| 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 20 matching lines...) Expand all Loading... |
| 31 // Allows using a CallbackPromiseAdapter with a WebVector to resolve the | 31 // Allows using a CallbackPromiseAdapter with a WebVector to resolve the |
| 32 // getNotifications() promise with a HeapVector owning Notifications. | 32 // getNotifications() promise with a HeapVector owning Notifications. |
| 33 class NotificationArray { | 33 class NotificationArray { |
| 34 public: | 34 public: |
| 35 using WebType = const WebVector<WebPersistentNotificationInfo>&; | 35 using WebType = const WebVector<WebPersistentNotificationInfo>&; |
| 36 | 36 |
| 37 static HeapVector<Member<Notification>> take(ScriptPromiseResolver* resolver
, const WebVector<WebPersistentNotificationInfo>& notificationInfos) | 37 static HeapVector<Member<Notification>> take(ScriptPromiseResolver* resolver
, const WebVector<WebPersistentNotificationInfo>& notificationInfos) |
| 38 { | 38 { |
| 39 HeapVector<Member<Notification>> notifications; | 39 HeapVector<Member<Notification>> notifications; |
| 40 for (const WebPersistentNotificationInfo& notificationInfo : notificatio
nInfos) | 40 for (const WebPersistentNotificationInfo& notificationInfo : notificatio
nInfos) |
| 41 notifications.append(Notification::create(resolver->getExecutionCont
ext(), notificationInfo.persistentId, notificationInfo.data, true /* showing */)
); | 41 notifications.append(Notification::create(resolver->getExecutionCont
ext(), notificationInfo.notificationId, notificationInfo.data, true /* showing *
/)); |
| 42 | 42 |
| 43 return notifications; | 43 return notifications; |
| 44 } | 44 } |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 NotificationArray() = delete; | 47 NotificationArray() = delete; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 } // namespace | 50 } // namespace |
| 51 | 51 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |