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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 const std::string& Notification::GetTitle() const | 70 const std::string& Notification::GetTitle() const |
71 { | 71 { |
72 return title; | 72 return title; |
73 } | 73 } |
74 | 74 |
75 const std::string& Notification::GetMessageString() const | 75 const std::string& Notification::GetMessageString() const |
76 { | 76 { |
77 return message; | 77 return message; |
78 } | 78 } |
79 | 79 |
80 std::vector<std::string> Notification::GetLinks() const | |
81 { | |
82 std::vector<std::string> retValue; | |
83 JsValuePtr jsLinks = GetProperty("links"); | |
84 if (!jsLinks->IsArray()) | |
85 { | |
86 return retValue; | |
87 } | |
88 JsValueList urlLinksList = jsLinks->AsList(); | |
89 for (JsValueList::const_iterator linkIterator = urlLinksList.begin(); | |
90 linkIterator != urlLinksList.end(); ++linkIterator) | |
91 { | |
92 retValue.emplace_back((*linkIterator)->AsString()); | |
Felix Dahlke
2015/02/02 14:40:48
C++11 again! :)
sergei
2015/02/02 14:51:28
Sorry, fixed.
| |
93 } | |
94 return retValue; | |
95 } | |
96 | |
80 void Notification::MarkAsShown() | 97 void Notification::MarkAsShown() |
81 { | 98 { |
82 JsValueList params; | 99 JsValueList params; |
83 params.push_back(GetProperty("id")); | 100 params.push_back(GetProperty("id")); |
84 jsEngine->Evaluate("API.markNotificationAsShown")->Call(params); | 101 jsEngine->Evaluate("API.markNotificationAsShown")->Call(params); |
85 } | 102 } |
86 | 103 |
87 NotificationPtr Notification::JsValueToNotification(const JsValuePtr& jsValue) | 104 NotificationPtr Notification::JsValueToNotification(const JsValuePtr& jsValue) |
88 { | 105 { |
89 if (!jsValue || !jsValue->IsObject()) | 106 if (!jsValue || !jsValue->IsObject()) |
(...skipping 14 matching lines...) Expand all Loading... | |
104 { | 121 { |
105 notification->title = jsTitle->AsString(); | 122 notification->title = jsTitle->AsString(); |
106 } | 123 } |
107 JsValuePtr jsMessage = jsTexts->GetProperty("message"); | 124 JsValuePtr jsMessage = jsTexts->GetProperty("message"); |
108 if (jsMessage->IsString()) | 125 if (jsMessage->IsString()) |
109 { | 126 { |
110 notification->message = jsMessage->AsString(); | 127 notification->message = jsMessage->AsString(); |
111 } | 128 } |
112 return notification; | 129 return notification; |
113 } | 130 } |
OLD | NEW |