| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 } | 169 } |
| 170 | 170 |
| 171 void ServiceWorkerRegistrationNotifications::prepareShow( | 171 void ServiceWorkerRegistrationNotifications::prepareShow( |
| 172 const WebNotificationData& data, | 172 const WebNotificationData& data, |
| 173 std::unique_ptr<WebNotificationShowCallbacks> callbacks) { | 173 std::unique_ptr<WebNotificationShowCallbacks> callbacks) { |
| 174 RefPtr<SecurityOrigin> origin = getExecutionContext()->getSecurityOrigin(); | 174 RefPtr<SecurityOrigin> origin = getExecutionContext()->getSecurityOrigin(); |
| 175 NotificationResourcesLoader* loader = new NotificationResourcesLoader( | 175 NotificationResourcesLoader* loader = new NotificationResourcesLoader( |
| 176 WTF::bind(&ServiceWorkerRegistrationNotifications::didLoadResources, | 176 WTF::bind(&ServiceWorkerRegistrationNotifications::didLoadResources, |
| 177 wrapWeakPersistent(this), origin.release(), data, | 177 wrapWeakPersistent(this), origin.release(), data, |
| 178 WTF::passed(std::move(callbacks)))); | 178 WTF::passed(std::move(callbacks)))); |
| 179 m_loaders.add(loader); | 179 m_loaders.insert(loader); |
| 180 loader->start(getExecutionContext(), data); | 180 loader->start(getExecutionContext(), data); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void ServiceWorkerRegistrationNotifications::didLoadResources( | 183 void ServiceWorkerRegistrationNotifications::didLoadResources( |
| 184 PassRefPtr<SecurityOrigin> origin, | 184 PassRefPtr<SecurityOrigin> origin, |
| 185 const WebNotificationData& data, | 185 const WebNotificationData& data, |
| 186 std::unique_ptr<WebNotificationShowCallbacks> callbacks, | 186 std::unique_ptr<WebNotificationShowCallbacks> callbacks, |
| 187 NotificationResourcesLoader* loader) { | 187 NotificationResourcesLoader* loader) { |
| 188 DCHECK(m_loaders.contains(loader)); | 188 DCHECK(m_loaders.contains(loader)); |
| 189 | 189 |
| 190 WebNotificationManager* notificationManager = | 190 WebNotificationManager* notificationManager = |
| 191 Platform::current()->notificationManager(); | 191 Platform::current()->notificationManager(); |
| 192 DCHECK(notificationManager); | 192 DCHECK(notificationManager); |
| 193 | 193 |
| 194 notificationManager->showPersistent( | 194 notificationManager->showPersistent( |
| 195 WebSecurityOrigin(origin.get()), data, loader->getResources(), | 195 WebSecurityOrigin(origin.get()), data, loader->getResources(), |
| 196 m_registration->webRegistration(), std::move(callbacks)); | 196 m_registration->webRegistration(), std::move(callbacks)); |
| 197 m_loaders.remove(loader); | 197 m_loaders.remove(loader); |
| 198 } | 198 } |
| 199 | 199 |
| 200 } // namespace blink | 200 } // namespace blink |
| OLD | NEW |