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

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

Issue 1244703002: Remove 'blink::WebSerializedOrigin' (3/4) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: yay 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/WebSecurityOrigin.h"
23 #include "public/platform/modules/notifications/WebNotificationData.h" 24 #include "public/platform/modules/notifications/WebNotificationData.h"
24 #include "public/platform/modules/notifications/WebNotificationManager.h" 25 #include "public/platform/modules/notifications/WebNotificationManager.h"
25 #include "wtf/PassOwnPtr.h" 26 #include "wtf/PassOwnPtr.h"
26 27
27 namespace blink { 28 namespace blink {
28 namespace { 29 namespace {
29 30
30 // Allows using a CallbackPromiseAdapter with a WebVector to resolve the 31 // Allows using a CallbackPromiseAdapter with a WebVector to resolve the
31 // getNotifications() promise with a HeapVector owning Notifications. 32 // getNotifications() promise with a HeapVector owning Notifications.
32 class NotificationArray { 33 class NotificationArray {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 NavigatorVibration::VibrationPattern vibrate = NavigatorVibration::sanitizeV ibrationPattern(options.vibrate()); 89 NavigatorVibration::VibrationPattern vibrate = NavigatorVibration::sanitizeV ibrationPattern(options.vibrate());
89 WebNotificationData notification(title, dir, options.lang(), options.body(), options.tag(), iconUrl, vibrate, options.silent(), dataAsWireBytes); 90 WebNotificationData notification(title, dir, options.lang(), options.body(), options.tag(), iconUrl, vibrate, options.silent(), dataAsWireBytes);
90 WebNotificationShowCallbacks* callbacks = new CallbackPromiseAdapter<void, v oid>(resolver); 91 WebNotificationShowCallbacks* callbacks = new CallbackPromiseAdapter<void, v oid>(resolver);
91 92
92 SecurityOrigin* origin = executionContext->securityOrigin(); 93 SecurityOrigin* origin = executionContext->securityOrigin();
93 ASSERT(origin); 94 ASSERT(origin);
94 95
95 WebNotificationManager* notificationManager = Platform::current()->notificat ionManager(); 96 WebNotificationManager* notificationManager = Platform::current()->notificat ionManager();
96 ASSERT(notificationManager); 97 ASSERT(notificationManager);
97 98
98 notificationManager->showPersistent(*origin, notification, serviceWorkerRegi stration.webRegistration(), callbacks); 99 notificationManager->showPersistent(WebSecurityOrigin(origin), notification, serviceWorkerRegistration.webRegistration(), callbacks);
99 return promise; 100 return promise;
100 } 101 }
101 102
102 ScriptPromise ServiceWorkerRegistrationNotifications::getNotifications(ScriptSta te* scriptState, ServiceWorkerRegistration& serviceWorkerRegistration, const Get NotificationOptions& options) 103 ScriptPromise ServiceWorkerRegistrationNotifications::getNotifications(ScriptSta te* scriptState, ServiceWorkerRegistration& serviceWorkerRegistration, const Get NotificationOptions& options)
103 { 104 {
104 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); 105 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState);
105 ScriptPromise promise = resolver->promise(); 106 ScriptPromise promise = resolver->promise();
106 107
107 WebNotificationGetCallbacks* callbacks = new CallbackPromiseAdapter<Notifica tionArray, void>(resolver); 108 WebNotificationGetCallbacks* callbacks = new CallbackPromiseAdapter<Notifica tionArray, void>(resolver);
108 109
109 WebNotificationManager* notificationManager = Platform::current()->notificat ionManager(); 110 WebNotificationManager* notificationManager = Platform::current()->notificat ionManager();
110 ASSERT(notificationManager); 111 ASSERT(notificationManager);
111 112
112 notificationManager->getNotifications(options.tag(), serviceWorkerRegistrati on.webRegistration(), callbacks); 113 notificationManager->getNotifications(options.tag(), serviceWorkerRegistrati on.webRegistration(), callbacks);
113 return promise; 114 return promise;
114 } 115 }
115 116
116 } // namespace blink 117 } // 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