Chromium Code Reviews| Index: Source/modules/notifications/Notification.cpp |
| diff --git a/Source/modules/notifications/Notification.cpp b/Source/modules/notifications/Notification.cpp |
| index 89fe61c4ffa0bb89b62a3e2a24cea916ee94f0f0..6f59fbd158e5ac182a18b8b30d801ffe296357cf 100644 |
| --- a/Source/modules/notifications/Notification.cpp |
| +++ b/Source/modules/notifications/Notification.cpp |
| @@ -48,6 +48,7 @@ |
| #include "platform/UserGestureIndicator.h" |
| #include "public/platform/Platform.h" |
| #include "public/platform/WebSerializedOrigin.h" |
| +#include "public/platform/WebString.h" |
| #include "public/platform/modules/notifications/WebNotificationData.h" |
| #include "public/platform/modules/notifications/WebNotificationManager.h" |
| @@ -121,6 +122,11 @@ Notification* Notification::create(ExecutionContext* context, const String& pers |
| if (!data.icon.isEmpty()) |
| notification->setIconUrl(data.icon); |
| + if (!data.data.isEmpty()) { |
| + notification->setSerializedData(SerializedScriptValueFactory::instance().createFromWire(data.data)); |
| + notification->serializedData()->registerMemoryAllocatedWithCurrentScriptContext(); |
| + } |
| + |
| notification->setState(NotificationStateShowing); |
| notification->suspendIfNeeded(); |
| return notification; |
| @@ -162,7 +168,13 @@ void Notification::show() |
| // FIXME: Do CSP checks on the associated notification icon. |
| WebNotificationData::Direction dir = m_dir == "rtl" ? WebNotificationData::DirectionRightToLeft : WebNotificationData::DirectionLeftToRight; |
| - WebNotificationData notificationData(m_title, dir, m_lang, m_body, m_tag, m_iconUrl, m_silent); |
| + |
| + // No send data property in non-persistent notification. |
|
Peter Beverloo
2015/03/15 22:35:04
nit: drop line 172, it doesn't add anything. Lines
Sanghyun Park
2015/03/16 00:00:21
I'll fix this
|
| + // The lifetime and availability of non-persistent notifications |
| + // is tied to the page they were created by, and thus the data |
| + // doesn't have to be known to the embedder. |
| + String emptyDataAsWireString; |
| + WebNotificationData notificationData(m_title, dir, m_lang, m_body, m_tag, m_iconUrl, m_silent, emptyDataAsWireString); |
| notificationManager()->show(WebSerializedOrigin(*origin), notificationData, this); |
| m_state = NotificationStateShowing; |