Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: include/AdblockPlus/Notification.h

Issue 4904655779790848: Issue 1107.update1 - read Notification properties (title, message and type) on the fly (Closed)
Patch Set: rebase Created Nov. 4, 2015, 9:22 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/FilterEngine.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 18 matching lines...) Expand all
29 * Possible notification types. 29 * Possible notification types.
30 */ 30 */
31 enum NotificationType 31 enum NotificationType
32 { 32 {
33 NOTIFICATION_TYPE_INFORMATION, 33 NOTIFICATION_TYPE_INFORMATION,
34 NOTIFICATION_TYPE_QUESTION, 34 NOTIFICATION_TYPE_QUESTION,
35 NOTIFICATION_TYPE_CRITICAL 35 NOTIFICATION_TYPE_CRITICAL
36 }; 36 };
37 37
38 /** 38 /**
39 * Contains notification title and message. It's returned by
40 * `Notification::GetTexts`.
41 */
42 struct NotificationTexts
43 {
44 std::string title;
45 std::string message;
46 };
47
48 /**
39 * Wrapper for an Adblock Plus notification object. 49 * Wrapper for an Adblock Plus notification object.
40 */ 50 */
41 class Notification: public JsValue 51 class Notification: public JsValue,
52 public std::tr1::enable_shared_from_this<Notification>
42 { 53 {
43 friend class FilterEngine; 54 friend class FilterEngine;
44 protected: 55 protected:
45 static std::shared_ptr<Notification> JsValueToNotification(const JsValuePtr& jsValue);
46 /** 56 /**
47 * Constructor. 57 * Constructor.
48 * @param jsValue `JsValuePtr` notification JavaScript object. 58 * @param jsValue `JsValuePtr` notification JavaScript object.
49 */ 59 */
50 explicit Notification(const JsValuePtr& jsValue); 60 explicit Notification(const JsValuePtr& jsValue);
51 public: 61 public:
52 /** 62 /**
53 * Retrieves the type of this notification. 63 * Retrieves the type of this notification.
54 * @return Type of this notification. 64 * @return Type of this notification.
55 */ 65 */
56 NotificationType GetType() const; 66 NotificationType GetType() const;
57 67
58 /** 68 /**
59 * Retrieves the title of this notification. 69 * Retrieves the title and message of this notification.
60 * @return Title of this notification. 70 * @return Translated texts.
61 */ 71 */
62 const std::string& GetTitle() const; 72 NotificationTexts GetTexts();
63
64 /**
65 * Retrieves the message of this notification.
66 * @return Message of this notification.
67 */
68 const std::string& GetMessageString() const;
69 73
70 /** 74 /**
71 * Retrieves the URLs which should be mapped to the links in the message. 75 * Retrieves the URLs which should be mapped to the links in the message.
72 * @return List of links. 76 * @return List of links.
73 */ 77 */
74 std::vector<std::string> GetLinks() const; 78 std::vector<std::string> GetLinks() const;
75 79
76 /** 80 /**
77 * Marks this notification as shown. It is only relevant for question 81 * Marks this notification as shown. It is only relevant for question
78 * notifications. Other notifications are marked automatically. 82 * notifications. Other notifications are marked automatically.
79 */ 83 */
80 void MarkAsShown(); 84 void MarkAsShown();
81 private: 85 private:
82 std::string title;
83 std::string message;
84 NotificationType type;
85 }; 86 };
86 typedef std::shared_ptr<Notification> NotificationPtr; 87 typedef std::shared_ptr<Notification> NotificationPtr;
87 } 88 }
88 89
89 #endif 90 #endif
OLDNEW
« no previous file with comments | « no previous file | src/FilterEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld