Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | |
3 * Copyright (C) 2006-2015 Eyeo GmbH | |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * Adblock Plus is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
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/>. | |
16 */ | |
17 | |
18 #ifndef ADBLOCK_PLUS_NOTIFICATION_H | |
19 #define ADBLOCK_PLUS_NOTIFICATION_H | |
20 | |
21 #include <string> | |
22 #include <vector> | |
23 #include <memory> | |
24 | |
25 namespace AdblockPlus | |
26 { | |
27 class FilterEngine; | |
28 enum NotificationType | |
29 { | |
30 NOTIFICATION_TYPE_INFORMATION = 0, | |
Felix Dahlke
2015/01/22 10:25:25
Why explicitly assign the values here? We typicall
sergei
2015/01/22 14:08:15
fixed
| |
31 NOTIFICATION_TYPE_QUESTION = 1, | |
Felix Dahlke
2015/01/22 10:25:25
No column aligning please :D
| |
32 NOTIFICATION_TYPE_CRITICAL = 2 | |
33 }; | |
34 | |
35 struct NotificationTexts | |
Felix Dahlke
2015/01/22 10:25:25
It's a single one, so "NotificationText"?
sergei
2015/01/22 14:08:15
Actually there were two fields and the plural form
Felix Dahlke
2015/01/22 14:36:31
Argh you're right, of course it's two. Should real
| |
36 { | |
37 std::string title; | |
38 std::string message; | |
39 }; | |
40 | |
41 class Notification : public JsValue, public std::tr1::enable_shared_from_this< Notification> | |
42 { | |
43 friend class FilterEngine; | |
44 protected: | |
45 struct PrivateCtrArg{}; | |
Felix Dahlke
2015/01/22 10:25:25
I still find this pattern highly obscure. We've go
sergei
2015/01/22 14:08:15
JIC, if the constructor is not public then std::ma
| |
46 static std::tr1::shared_ptr<Notification> JsValueToNotification(const JsValu ePtr& jsValue); | |
47 /// @param jsText is javascript object returned by getLocalizedTexts. | |
48 static NotificationTexts JsTextsToNotificationTexts(const JsValue& jsText); | |
49 public: | |
50 Notification(NotificationType type, const std::string& id, const JsValuePtr& jsValue, PrivateCtrArg); | |
51 Notification(const JsValuePtr& value, PrivateCtrArg); | |
52 std::string GetId() const; | |
Wladimir Palant
2015/01/22 10:47:20
I think this method should be removed. The ID is a
sergei
2015/01/22 14:08:15
removed
| |
53 NotificationType GetType() const; | |
54 /** | |
55 * Localizes the texts of the supplied notification. | |
56 * @return the translated texts. | |
57 */ | |
58 NotificationTexts GetTexts(); | |
Wladimir Palant
2015/01/22 10:47:20
An explicit method here shouldn't be necessary. Th
sergei
2015/01/22 14:08:15
fixed
Felix Dahlke
2015/01/23 21:27:50
Missed this discussion before. I actually disagree
| |
59 void SetTitle(const std::string& value); | |
60 void SetMessage(const std::string& value); | |
61 std::vector<std::string> GetUrlFilters() const; | |
62 void AddUrlFilter(const std::string& value); | |
Wladimir Palant
2015/01/22 10:47:20
The four methods above should be removed - as disc
sergei
2015/01/22 14:08:15
fixed
| |
63 void MarkAsShown(); | |
64 }; | |
65 } | |
66 | |
67 #endif | |
OLD | NEW |