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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 30 matching lines...) Expand all Loading... |
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, | 51 class Notification: public JsValue |
52 public std::enable_shared_from_this<Notification> | |
53 { | 52 { |
54 friend class FilterEngine; | 53 friend class FilterEngine; |
55 protected: | 54 protected: |
56 /** | 55 /** |
57 * Constructor. | 56 * Constructor. |
58 * @param jsValue `JsValue&&` notification JavaScript object. | 57 * @param jsValue `JsValue&&` notification JavaScript object. |
59 */ | 58 */ |
60 explicit Notification(JsValue&& jsValue); | 59 explicit Notification(JsValue&& jsValue); |
61 public: | 60 public: |
62 /** | 61 /** |
| 62 * Copy constructor |
| 63 */ |
| 64 Notification(const Notification& src); |
| 65 |
| 66 /** |
| 67 * Move constructor |
| 68 */ |
| 69 Notification(Notification&& src); |
| 70 |
| 71 /** |
| 72 * Assignment operator |
| 73 */ |
| 74 Notification& operator=(const Notification& src); |
| 75 |
| 76 /** |
| 77 * Move assignment operator |
| 78 */ |
| 79 Notification& operator=(Notification&& src); |
| 80 |
| 81 /** |
63 * Retrieves the type of this notification. | 82 * Retrieves the type of this notification. |
64 * @return Type of this notification. | 83 * @return Type of this notification. |
65 */ | 84 */ |
66 NotificationType GetType() const; | 85 NotificationType GetType() const; |
67 | 86 |
68 /** | 87 /** |
69 * Retrieves the title and message of this notification. | 88 * Retrieves the title and message of this notification. |
70 * @return Translated texts. | 89 * @return Translated texts. |
71 */ | 90 */ |
72 NotificationTexts GetTexts() const; | 91 NotificationTexts GetTexts() const; |
73 | 92 |
74 /** | 93 /** |
75 * Retrieves the URLs which should be mapped to the links in the message. | 94 * Retrieves the URLs which should be mapped to the links in the message. |
76 * @return List of links. | 95 * @return List of links. |
77 */ | 96 */ |
78 std::vector<std::string> GetLinks() const; | 97 std::vector<std::string> GetLinks() const; |
79 | 98 |
80 /** | 99 /** |
81 * Marks this notification as shown. It is only relevant for question | 100 * Marks this notification as shown. It is only relevant for question |
82 * notifications. Other notifications are marked automatically. | 101 * notifications. Other notifications are marked automatically. |
83 */ | 102 */ |
84 void MarkAsShown(); | 103 void MarkAsShown(); |
85 private: | 104 private: |
86 }; | 105 }; |
87 typedef std::shared_ptr<Notification> NotificationPtr; | |
88 } | 106 } |
89 | 107 |
90 #endif | 108 #endif |
OLD | NEW |