Chromium Code Reviews| Index: third_party/WebKit/Source/modules/notifications/Notification.cpp |
| diff --git a/third_party/WebKit/Source/modules/notifications/Notification.cpp b/third_party/WebKit/Source/modules/notifications/Notification.cpp |
| index a874cbe0ba0267b670cf4caeeafb4d89d670ea9b..094eef079dad8d214f7b551f8117c15187e8c5d5 100644 |
| --- a/third_party/WebKit/Source/modules/notifications/Notification.cpp |
| +++ b/third_party/WebKit/Source/modules/notifications/Notification.cpp |
| @@ -33,6 +33,7 @@ |
| #include "bindings/core/v8/ExceptionState.h" |
| #include "bindings/core/v8/ScriptState.h" |
| #include "bindings/core/v8/SerializedScriptValueFactory.h" |
| +#include "bindings/modules/v8/V8NotificationAction.h" |
| #include "core/dom/Document.h" |
| #include "core/dom/ExecutionContext.h" |
| #include "core/dom/ExecutionContextTask.h" |
| @@ -260,14 +261,11 @@ String Notification::badge() const |
| return m_data.badge.string(); |
| } |
| -NavigatorVibration::VibrationPattern Notification::vibrate(bool& isNull) const |
| +NavigatorVibration::VibrationPattern Notification::vibrate() const |
| { |
| NavigatorVibration::VibrationPattern pattern; |
| pattern.appendRange(m_data.vibrate.begin(), m_data.vibrate.end()); |
| - if (!pattern.size()) |
| - isNull = true; |
| - |
| return pattern; |
| } |
| @@ -302,32 +300,38 @@ ScriptValue Notification::data(ScriptState* scriptState) |
| else |
| serializedValue = SerializedScriptValueFactory::instance().create(); |
| - m_developerData = ScriptValue(scriptState, serializedValue->deserialize(scriptState->isolate())); |
| + m_developerData = ScriptValue::from(scriptState, serializedValue->deserialize(scriptState->isolate())); |
| } |
| return m_developerData; |
| } |
| -HeapVector<NotificationAction> Notification::actions() const |
| +Vector<v8::Local<v8::Value>> Notification::actions(ScriptState* scriptState) const |
| { |
| - HeapVector<NotificationAction> actions; |
| + Vector<v8::Local<v8::Value>> actions; |
| actions.grow(m_data.actions.size()); |
| for (size_t i = 0; i < m_data.actions.size(); ++i) { |
| + NotificationAction action; |
| + |
| switch (m_data.actions[i].type) { |
| case WebNotificationAction::Button: |
| - actions[i].setType("button"); |
| + action.setType("button"); |
| break; |
| case WebNotificationAction::Text: |
| - actions[i].setType("text"); |
| + action.setType("text"); |
| break; |
| default: |
| NOTREACHED() << "Unknown action type: " << m_data.actions[i].type; |
| } |
| - actions[i].setAction(m_data.actions[i].action); |
| - actions[i].setTitle(m_data.actions[i].title); |
| - actions[i].setIcon(m_data.actions[i].icon.string()); |
| - actions[i].setPlaceholder(m_data.actions[i].placeholder); |
| + action.setAction(m_data.actions[i].action); |
| + action.setTitle(m_data.actions[i].title); |
| + action.setIcon(m_data.actions[i].icon.string()); |
| + action.setPlaceholder(m_data.actions[i].placeholder); |
| + |
| + // Not just the sequence of actions itself, but also the actions contained within the |
| + // sequence should be frozen per the Web Notification specification. |
| + actions[i] = freezeV8Object(toV8(action, scriptState), scriptState->isolate()); |
|
bashi
2016/05/17 02:42:12
Not directly related to this CL but it seems that
|
| } |
| return actions; |