| OLD | NEW |
| 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 "modules/notifications/ServiceWorkerRegistrationNotifications.h" | 5 #include "modules/notifications/ServiceWorkerRegistrationNotifications.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "core/dom/ExecutionContext.h" | 10 #include "core/dom/ExecutionContext.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 if (!supplement) { | 123 if (!supplement) { |
| 124 supplement = new ServiceWorkerRegistrationNotifications(executionContext
, ®istration); | 124 supplement = new ServiceWorkerRegistrationNotifications(executionContext
, ®istration); |
| 125 provideTo(registration, supplementName(), supplement); | 125 provideTo(registration, supplementName(), supplement); |
| 126 } | 126 } |
| 127 return *supplement; | 127 return *supplement; |
| 128 } | 128 } |
| 129 | 129 |
| 130 void ServiceWorkerRegistrationNotifications::prepareShow(const WebNotificationDa
ta& data, std::unique_ptr<WebNotificationShowCallbacks> callbacks) | 130 void ServiceWorkerRegistrationNotifications::prepareShow(const WebNotificationDa
ta& data, std::unique_ptr<WebNotificationShowCallbacks> callbacks) |
| 131 { | 131 { |
| 132 RefPtr<SecurityOrigin> origin = getExecutionContext()->getSecurityOrigin(); | 132 RefPtr<SecurityOrigin> origin = getExecutionContext()->getSecurityOrigin(); |
| 133 NotificationResourcesLoader* loader = new NotificationResourcesLoader(WTF::b
ind(&ServiceWorkerRegistrationNotifications::didLoadResources, WeakPersistentThi
sPointer<ServiceWorkerRegistrationNotifications>(this), origin.release(), data,
passed(std::move(callbacks)))); | 133 NotificationResourcesLoader* loader = new NotificationResourcesLoader(WTF::b
ind(&ServiceWorkerRegistrationNotifications::didLoadResources, wrapWeakPersisten
t(this), origin.release(), data, passed(std::move(callbacks)))); |
| 134 m_loaders.add(loader); | 134 m_loaders.add(loader); |
| 135 loader->start(getExecutionContext(), data); | 135 loader->start(getExecutionContext(), data); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void ServiceWorkerRegistrationNotifications::didLoadResources(PassRefPtr<Securit
yOrigin> origin, const WebNotificationData& data, std::unique_ptr<WebNotificatio
nShowCallbacks> callbacks, NotificationResourcesLoader* loader) | 138 void ServiceWorkerRegistrationNotifications::didLoadResources(PassRefPtr<Securit
yOrigin> origin, const WebNotificationData& data, std::unique_ptr<WebNotificatio
nShowCallbacks> callbacks, NotificationResourcesLoader* loader) |
| 139 { | 139 { |
| 140 DCHECK(m_loaders.contains(loader)); | 140 DCHECK(m_loaders.contains(loader)); |
| 141 | 141 |
| 142 WebNotificationManager* notificationManager = Platform::current()->notificat
ionManager(); | 142 WebNotificationManager* notificationManager = Platform::current()->notificat
ionManager(); |
| 143 DCHECK(notificationManager); | 143 DCHECK(notificationManager); |
| 144 | 144 |
| 145 notificationManager->showPersistent(WebSecurityOrigin(origin.get()), data, l
oader->getResources(), m_registration->webRegistration(), callbacks.release()); | 145 notificationManager->showPersistent(WebSecurityOrigin(origin.get()), data, l
oader->getResources(), m_registration->webRegistration(), callbacks.release()); |
| 146 m_loaders.remove(loader); | 146 m_loaders.remove(loader); |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace blink | 149 } // namespace blink |
| OLD | NEW |