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

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

Issue 2010103002: [Binding] [Refactoring] Remove redundant overloaded methods (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 if (options.hasBadge() && !options.badge().isEmpty()) 65 if (options.hasBadge() && !options.badge().isEmpty())
66 webData.badge = completeURL(executionContext, options.badge()); 66 webData.badge = completeURL(executionContext, options.badge());
67 67
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 RefPtr<SerializedScriptValue> serializedScriptValue = SerializedScriptVa lueFactory::instance().create(options.data().isolate(), options.data(), nullptr, exceptionState); 75 const ScriptValue& data = options.data();
76 v8::Isolate* isolate = data.isolate();
77 DCHECK(isolate->InContext());
78 RefPtr<SerializedScriptValue> serializedScriptValue = SerializedScriptVa lueFactory::instance().create(isolate, data.v8Value(), nullptr, nullptr, excepti onState);
76 if (exceptionState.hadException()) 79 if (exceptionState.hadException())
77 return WebNotificationData(); 80 return WebNotificationData();
78 81
79 Vector<char> serializedData; 82 Vector<char> serializedData;
80 serializedScriptValue->toWireBytes(serializedData); 83 serializedScriptValue->toWireBytes(serializedData);
81 84
82 webData.data = serializedData; 85 webData.data = serializedData;
83 } 86 }
84 87
85 Vector<WebNotificationAction> actions; 88 Vector<WebNotificationAction> actions;
(...skipping 26 matching lines...) Expand all
112 115
113 actions.append(webAction); 116 actions.append(webAction);
114 } 117 }
115 118
116 webData.actions = actions; 119 webData.actions = actions;
117 120
118 return webData; 121 return webData;
119 } 122 }
120 123
121 } // namespace blink 124 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698