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

Side by Side Diff: Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp

Issue 1232563003: Remove 'blink::WebSerializedOrigin' (1/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix. Created 5 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "modules/notifications/ServiceWorkerRegistrationNotifications.h" 6 #include "modules/notifications/ServiceWorkerRegistrationNotifications.h"
7 7
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" 8 #include "bindings/core/v8/CallbackPromiseAdapter.h"
9 #include "bindings/core/v8/ExceptionState.h" 9 #include "bindings/core/v8/ExceptionState.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
11 #include "bindings/core/v8/SerializedScriptValue.h" 11 #include "bindings/core/v8/SerializedScriptValue.h"
12 #include "bindings/core/v8/SerializedScriptValueFactory.h" 12 #include "bindings/core/v8/SerializedScriptValueFactory.h"
13 #include "bindings/core/v8/V8ThrowException.h" 13 #include "bindings/core/v8/V8ThrowException.h"
14 #include "core/dom/DOMException.h" 14 #include "core/dom/DOMException.h"
15 #include "core/dom/ExceptionCode.h" 15 #include "core/dom/ExceptionCode.h"
16 #include "core/dom/ExecutionContext.h" 16 #include "core/dom/ExecutionContext.h"
17 #include "modules/notifications/GetNotificationOptions.h" 17 #include "modules/notifications/GetNotificationOptions.h"
18 #include "modules/notifications/Notification.h" 18 #include "modules/notifications/Notification.h"
19 #include "modules/notifications/NotificationOptions.h" 19 #include "modules/notifications/NotificationOptions.h"
20 #include "modules/vibration/NavigatorVibration.h" 20 #include "modules/vibration/NavigatorVibration.h"
21 #include "platform/weborigin/KURL.h" 21 #include "platform/weborigin/KURL.h"
22 #include "public/platform/Platform.h" 22 #include "public/platform/Platform.h"
23 #include "public/platform/WebSerializedOrigin.h"
24 #include "public/platform/modules/notifications/WebNotificationData.h" 23 #include "public/platform/modules/notifications/WebNotificationData.h"
25 #include "public/platform/modules/notifications/WebNotificationManager.h" 24 #include "public/platform/modules/notifications/WebNotificationManager.h"
26 #include "wtf/PassOwnPtr.h" 25 #include "wtf/PassOwnPtr.h"
27 26
28 namespace blink { 27 namespace blink {
29 namespace { 28 namespace {
30 29
31 // Allows using a CallbackPromiseAdapter with a WebVector to resolve the 30 // Allows using a CallbackPromiseAdapter with a WebVector to resolve the
32 // getNotifications() promise with a HeapVector owning Notifications. 31 // getNotifications() promise with a HeapVector owning Notifications.
33 class NotificationArray { 32 class NotificationArray {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 NavigatorVibration::VibrationPattern vibrate = NavigatorVibration::sanitizeV ibrationPattern(options.vibrate()); 88 NavigatorVibration::VibrationPattern vibrate = NavigatorVibration::sanitizeV ibrationPattern(options.vibrate());
90 WebNotificationData notification(title, dir, options.lang(), options.body(), options.tag(), iconUrl, vibrate, options.silent(), dataAsWireBytes); 89 WebNotificationData notification(title, dir, options.lang(), options.body(), options.tag(), iconUrl, vibrate, options.silent(), dataAsWireBytes);
91 WebNotificationShowCallbacks* callbacks = new CallbackPromiseAdapter<void, v oid>(resolver); 90 WebNotificationShowCallbacks* callbacks = new CallbackPromiseAdapter<void, v oid>(resolver);
92 91
93 SecurityOrigin* origin = executionContext->securityOrigin(); 92 SecurityOrigin* origin = executionContext->securityOrigin();
94 ASSERT(origin); 93 ASSERT(origin);
95 94
96 WebNotificationManager* notificationManager = Platform::current()->notificat ionManager(); 95 WebNotificationManager* notificationManager = Platform::current()->notificat ionManager();
97 ASSERT(notificationManager); 96 ASSERT(notificationManager);
98 97
99 notificationManager->showPersistent(WebSerializedOrigin(*origin), notificati on, serviceWorkerRegistration.webRegistration(), callbacks); 98 notificationManager->showPersistent(*origin, notification, serviceWorkerRegi stration.webRegistration(), callbacks);
100 return promise; 99 return promise;
101 } 100 }
102 101
103 ScriptPromise ServiceWorkerRegistrationNotifications::getNotifications(ScriptSta te* scriptState, ServiceWorkerRegistration& serviceWorkerRegistration, const Get NotificationOptions& options) 102 ScriptPromise ServiceWorkerRegistrationNotifications::getNotifications(ScriptSta te* scriptState, ServiceWorkerRegistration& serviceWorkerRegistration, const Get NotificationOptions& options)
104 { 103 {
105 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); 104 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState);
106 ScriptPromise promise = resolver->promise(); 105 ScriptPromise promise = resolver->promise();
107 106
108 WebNotificationGetCallbacks* callbacks = new CallbackPromiseAdapter<Notifica tionArray, void>(resolver); 107 WebNotificationGetCallbacks* callbacks = new CallbackPromiseAdapter<Notifica tionArray, void>(resolver);
109 108
110 WebNotificationManager* notificationManager = Platform::current()->notificat ionManager(); 109 WebNotificationManager* notificationManager = Platform::current()->notificat ionManager();
111 ASSERT(notificationManager); 110 ASSERT(notificationManager);
112 111
113 notificationManager->getNotifications(options.tag(), serviceWorkerRegistrati on.webRegistration(), callbacks); 112 notificationManager->getNotifications(options.tag(), serviceWorkerRegistrati on.webRegistration(), callbacks);
114 return promise; 113 return promise;
115 } 114 }
116 115
117 } // namespace blink 116 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/notifications/Notification.cpp ('k') | Source/modules/websockets/DocumentWebSocketChannel.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698