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

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

Issue 5797488346791936: Issue 1107 - Support notifications (Closed)
Left Patch Set: remove local Notifications Created Jan. 22, 2015, 2:01 p.m.
Right Patch Set: fix comment Created Jan. 23, 2015, 3:56 p.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 | « include/AdblockPlus/FilterEngine.h ('k') | lib/api.js » ('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 <memory> 23 #include "tr1_memory.h"
24 24
25 namespace AdblockPlus 25 namespace AdblockPlus
26 { 26 {
27 class FilterEngine; 27 class FilterEngine;
28 /**
29 * Possible notification types.
30 */
28 enum NotificationType 31 enum NotificationType
29 { 32 {
30 NOTIFICATION_TYPE_INFORMATION, NOTIFICATION_TYPE_QUESTION, NOTIFICATION_TYPE _CRITICAL 33 NOTIFICATION_TYPE_INFORMATION,
Wladimir Palant 2015/01/22 15:19:51 Nit: listing these one per line would be better, t
sergei 2015/01/22 16:15:11 fixed
34 NOTIFICATION_TYPE_QUESTION,
35 NOTIFICATION_TYPE_CRITICAL
31 }; 36 };
32 37
38 /**
39 * Wrapper for an Adblock Plus notification object.
40 */
33 class Notification: public JsValue 41 class Notification: public JsValue
34 { 42 {
35 friend class FilterEngine; 43 friend class FilterEngine;
36 protected: 44 protected:
37 struct PrivateCtrArg{};
38 static std::tr1::shared_ptr<Notification> JsValueToNotification(const JsValu ePtr& jsValue); 45 static std::tr1::shared_ptr<Notification> JsValueToNotification(const JsValu ePtr& jsValue);
46 /**
47 * Constructor.
48 * @param jsValue `JsValuePtr` notification JavaScript object.
49 */
50 explicit Notification(const JsValuePtr& jsValue);
39 public: 51 public:
40 explicit Notification(const JsValuePtr& jsValue, PrivateCtrArg); 52 /**
53 * Retrieves the type of this notification.
54 * @return Type of this notification.
55 */
41 NotificationType GetType() const; 56 NotificationType GetType() const;
57
42 /** 58 /**
43 * Localizes the texts of the supplied notification. 59 * Retrieves the title of this notification.
44 * @return the translated texts. 60 * @return Title of this notification.
45 */ 61 */
46 const std::string& GetTitle() const; 62 const std::string& GetTitle() const;
63
64 /**
65 * Retrieves the message of this notification.
66 * @return Message of this notification.
67 */
47 const std::string& GetMessageString() const; 68 const std::string& GetMessageString() const;
sergei 2015/01/22 14:08:15 It's not GetMessage because it's not possible to c
69
70 /**
71 * Marks this notification as shown. It is only relevant for question
72 * notifications. Other notifications are marked automatically.
73 */
48 void MarkAsShown(); 74 void MarkAsShown();
49 private: 75 private:
50 std::string title; 76 std::string title;
51 std::string message; 77 std::string message;
52 NotificationType type; 78 NotificationType type;
53 }; 79 };
54 typedef std::tr1::shared_ptr<Notification> NotificationPtr; 80 typedef std::tr1::shared_ptr<Notification> NotificationPtr;
55 } 81 }
56 82
57 #endif 83 #endif
LEFTRIGHT

Powered by Google App Engine
This is Rietveld