Left: | ||
Right: |
OLD | NEW |
---|---|
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 Loading... | |
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, public std::tr1::enable_shared_from_this<N otification> |
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
| |
42 { | 52 { |
43 friend class FilterEngine; | 53 friend class FilterEngine; |
44 protected: | 54 protected: |
45 static std::tr1::shared_ptr<Notification> JsValueToNotification(const JsValu ePtr& jsValue); | |
46 /** | 55 /** |
47 * Constructor. | 56 * Constructor. |
48 * @param jsValue `JsValuePtr` notification JavaScript object. | 57 * @param jsValue `JsValuePtr` notification JavaScript object. |
49 */ | 58 */ |
50 explicit Notification(const JsValuePtr& jsValue); | 59 explicit Notification(const JsValuePtr& jsValue); |
51 public: | 60 public: |
52 /** | 61 /** |
53 * Retrieves the type of this notification. | 62 * Retrieves the type of this notification. |
54 * @return Type of this notification. | 63 * @return Type of this notification. |
55 */ | 64 */ |
56 NotificationType GetType() const; | 65 NotificationType GetType() const; |
57 | 66 |
58 /** | 67 /** |
59 * Retrieves the title of this notification. | 68 * Retrieves the title and message of this notification. |
60 * @return Title of this notification. | 69 * @return Translated texts. |
61 */ | 70 */ |
62 const std::string& GetTitle() const; | 71 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 | 72 |
70 /** | 73 /** |
71 * Marks this notification as shown. It is only relevant for question | 74 * Marks this notification as shown. It is only relevant for question |
72 * notifications. Other notifications are marked automatically. | 75 * notifications. Other notifications are marked automatically. |
73 */ | 76 */ |
74 void MarkAsShown(); | 77 void MarkAsShown(); |
75 private: | 78 private: |
76 std::string title; | |
77 std::string message; | |
78 NotificationType type; | |
79 }; | 79 }; |
80 typedef std::tr1::shared_ptr<Notification> NotificationPtr; | 80 typedef std::tr1::shared_ptr<Notification> NotificationPtr; |
81 } | 81 } |
82 | 82 |
83 #endif | 83 #endif |
OLD | NEW |