Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1070)

Side by Side Diff: third_party/WebKit/Source/modules/notifications/NotificationData.cpp

Issue 2017893002: [Binding] [Refactoring] Use SerializedScriptValue class as external interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build error Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/notifications/NotificationData.h" 5 #include "modules/notifications/NotificationData.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/SerializedScriptValue.h" 8 #include "bindings/core/v8/SerializedScriptValue.h"
9 #include "bindings/core/v8/SerializedScriptValueFactory.h" 9 #include "bindings/core/v8/SerializedScriptValueFactory.h"
10 #include "core/dom/ExecutionContext.h" 10 #include "core/dom/ExecutionContext.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 webData.vibrate = VibrationController::sanitizeVibrationPattern(options.vibr ate()); 68 webData.vibrate = VibrationController::sanitizeVibrationPattern(options.vibr ate());
69 webData.timestamp = options.hasTimestamp() ? static_cast<double>(options.tim estamp()) : WTF::currentTimeMS(); 69 webData.timestamp = options.hasTimestamp() ? static_cast<double>(options.tim estamp()) : WTF::currentTimeMS();
70 webData.renotify = options.renotify(); 70 webData.renotify = options.renotify();
71 webData.silent = options.silent(); 71 webData.silent = options.silent();
72 webData.requireInteraction = options.requireInteraction(); 72 webData.requireInteraction = options.requireInteraction();
73 73
74 if (options.hasData()) { 74 if (options.hasData()) {
75 const ScriptValue& data = options.data(); 75 const ScriptValue& data = options.data();
76 v8::Isolate* isolate = data.isolate(); 76 v8::Isolate* isolate = data.isolate();
77 DCHECK(isolate->InContext()); 77 DCHECK(isolate->InContext());
78 RefPtr<SerializedScriptValue> serializedScriptValue = SerializedScriptVa lueFactory::instance().create(isolate, data.v8Value(), nullptr, nullptr, excepti onState); 78 RefPtr<SerializedScriptValue> serializedScriptValue = SerializedScriptVa lue::serialize(isolate, data.v8Value(), nullptr, nullptr, exceptionState);
79 if (exceptionState.hadException()) 79 if (exceptionState.hadException())
80 return WebNotificationData(); 80 return WebNotificationData();
81 81
82 Vector<char> serializedData; 82 Vector<char> serializedData;
83 serializedScriptValue->toWireBytes(serializedData); 83 serializedScriptValue->toWireBytes(serializedData);
84 84
85 webData.data = serializedData; 85 webData.data = serializedData;
86 } 86 }
87 87
88 Vector<WebNotificationAction> actions; 88 Vector<WebNotificationAction> actions;
(...skipping 26 matching lines...) Expand all
115 115
116 actions.append(webAction); 116 actions.append(webAction);
117 } 117 }
118 118
119 webData.actions = actions; 119 webData.actions = actions;
120 120
121 return webData; 121 return webData;
122 } 122 }
123 123
124 } // namespace blink 124 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698