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

Unified Diff: src/Notification.cpp

Issue 29416579: Issue 5034 - Part 1: Pass a JsValue directly to SetProperty() and return from GetProperty() (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Remove JsValue test Created April 19, 2017, 2:46 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/JsValue.cpp ('k') | src/WebRequestJsObject.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/Notification.cpp
===================================================================
--- a/src/Notification.cpp
+++ b/src/Notification.cpp
@@ -59,48 +59,48 @@
Notification::Notification(JsValue&& jsValue)
: JsValue(std::move(jsValue))
{
}
NotificationType Notification::GetType() const
{
- return StringToNotificationType(GetProperty("type")->AsString());
+ return StringToNotificationType(GetProperty("type").AsString());
}
NotificationTexts Notification::GetTexts() const
{
JsValue jsTexts = jsEngine->Evaluate("API.getNotificationTexts")->Call(*this);
NotificationTexts notificationTexts;
- JsValuePtr jsTitle = jsTexts.GetProperty("title");
- if (jsTitle->IsString())
+ JsValue jsTitle = jsTexts.GetProperty("title");
+ if (jsTitle.IsString())
{
- notificationTexts.title = jsTitle->AsString();
+ notificationTexts.title = jsTitle.AsString();
}
- JsValuePtr jsMessage = jsTexts.GetProperty("message");
- if (jsMessage->IsString())
+ JsValue jsMessage = jsTexts.GetProperty("message");
+ if (jsMessage.IsString())
{
- notificationTexts.message = jsMessage->AsString();
+ notificationTexts.message = jsMessage.AsString();
}
return notificationTexts;
}
std::vector<std::string> Notification::GetLinks() const
{
std::vector<std::string> retValue;
- JsValuePtr jsLinks = GetProperty("links");
- if (!jsLinks->IsArray())
+ JsValue jsLinks = GetProperty("links");
+ if (!jsLinks.IsArray())
{
return retValue;
}
- JsValueList urlLinksList = jsLinks->AsList();
+ JsValueList urlLinksList = jsLinks.AsList();
for (const auto& link : urlLinksList)
{
retValue.push_back(link->AsString());
}
return retValue;
}
void Notification::MarkAsShown()
{
- jsEngine->Evaluate("API.markNotificationAsShown")->Call(*GetProperty("id"));
+ jsEngine->Evaluate("API.markNotificationAsShown")->Call(GetProperty("id"));
}
« no previous file with comments | « src/JsValue.cpp ('k') | src/WebRequestJsObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld