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

Delta Between Two Patch Sets: include/AdblockPlus/Notification.h

Issue 4904655779790848: Issue 1107.update1 - read Notification properties (title, message and type) on the fly (Closed)
Left Patch Set: Created Jan. 27, 2015, 10:15 a.m.
Right 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/FilterEngine.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #ifndef ADBLOCK_PLUS_NOTIFICATION_H 18 #ifndef ADBLOCK_PLUS_NOTIFICATION_H
19 #define ADBLOCK_PLUS_NOTIFICATION_H 19 #define ADBLOCK_PLUS_NOTIFICATION_H
20 20
21 #include <string> 21 #include <string>
22 #include <vector> 22 #include <vector>
23 #include "tr1_memory.h" 23 #include <memory>
24 24
25 namespace AdblockPlus 25 namespace AdblockPlus
26 { 26 {
27 class FilterEngine; 27 class FilterEngine;
28 /** 28 /**
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 39 * Contains notification title and message. It's returned by
40 * `Notification::GetTexts`. 40 * `Notification::GetTexts`.
41 */ 41 */
42 struct NotificationTexts 42 struct NotificationTexts
43 { 43 {
44 std::string title; 44 std::string title;
45 std::string message; 45 std::string message;
46 }; 46 };
47 47
48 /** 48 /**
49 * Wrapper for an Adblock Plus notification object. 49 * Wrapper for an Adblock Plus notification object.
50 */ 50 */
51 class Notification: public JsValue, public std::tr1::enable_shared_from_this<N otification> 51 class Notification: public JsValue,
Felix Dahlke 2015/01/27 13:09:09 Missed it before, but we have one space before `:`
sergei 2015/01/27 13:20:12 fixed. I styled it as Filter and Subscription in F
52 public std::tr1::enable_shared_from_this<Notification>
52 { 53 {
53 friend class FilterEngine; 54 friend class FilterEngine;
54 protected: 55 protected:
55 /** 56 /**
56 * Constructor. 57 * Constructor.
57 * @param jsValue `JsValuePtr` notification JavaScript object. 58 * @param jsValue `JsValuePtr` notification JavaScript object.
58 */ 59 */
59 explicit Notification(const JsValuePtr& jsValue); 60 explicit Notification(const JsValuePtr& jsValue);
60 public: 61 public:
61 /** 62 /**
62 * Retrieves the type of this notification. 63 * Retrieves the type of this notification.
63 * @return Type of this notification. 64 * @return Type of this notification.
64 */ 65 */
65 NotificationType GetType() const; 66 NotificationType GetType() const;
66 67
67 /** 68 /**
68 * Retrieves the title and message of this notification. 69 * Retrieves the title and message of this notification.
69 * @return Translated texts. 70 * @return Translated texts.
70 */ 71 */
71 NotificationTexts GetTexts(); 72 NotificationTexts GetTexts();
72 73
73 /** 74 /**
75 * Retrieves the URLs which should be mapped to the links in the message.
76 * @return List of links.
77 */
78 std::vector<std::string> GetLinks() const;
79
80 /**
74 * Marks this notification as shown. It is only relevant for question 81 * Marks this notification as shown. It is only relevant for question
75 * notifications. Other notifications are marked automatically. 82 * notifications. Other notifications are marked automatically.
76 */ 83 */
77 void MarkAsShown(); 84 void MarkAsShown();
78 private: 85 private:
79 }; 86 };
80 typedef std::tr1::shared_ptr<Notification> NotificationPtr; 87 typedef std::shared_ptr<Notification> NotificationPtr;
81 } 88 }
82 89
83 #endif 90 #endif
LEFTRIGHT

Powered by Google App Engine
This is Rietveld