| 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 13 matching lines...) Expand all Loading... |
| 24 // Allows using a CallbackPromiseAdapter with a WebVector to resolve the | 24 // Allows using a CallbackPromiseAdapter with a WebVector to resolve the |
| 25 // getNotifications() promise with a HeapVector owning Notifications. | 25 // getNotifications() promise with a HeapVector owning Notifications. |
| 26 class NotificationArray { | 26 class NotificationArray { |
| 27 public: | 27 public: |
| 28 using WebType = const WebVector<WebPersistentNotificationInfo>&; | 28 using WebType = const WebVector<WebPersistentNotificationInfo>&; |
| 29 | 29 |
| 30 static HeapVector<Member<Notification>> take(ScriptPromiseResolver* resolver
, const WebVector<WebPersistentNotificationInfo>& notificationInfos) | 30 static HeapVector<Member<Notification>> take(ScriptPromiseResolver* resolver
, const WebVector<WebPersistentNotificationInfo>& notificationInfos) |
| 31 { | 31 { |
| 32 HeapVector<Member<Notification>> notifications; | 32 HeapVector<Member<Notification>> notifications; |
| 33 for (const WebPersistentNotificationInfo& notificationInfo : notificatio
nInfos) | 33 for (const WebPersistentNotificationInfo& notificationInfo : notificatio
nInfos) |
| 34 notifications.append(Notification::create(resolver->executionContext
(), notificationInfo.persistentId, notificationInfo.data)); | 34 notifications.append(Notification::create(resolver->executionContext
(), notificationInfo.persistentId, notificationInfo.data, true /* showing */)); |
| 35 | 35 |
| 36 return notifications; | 36 return notifications; |
| 37 } | 37 } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 NotificationArray() = delete; | 40 NotificationArray() = delete; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 } // namespace | 43 } // namespace |
| 44 | 44 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 WebNotificationGetCallbacks* callbacks = new CallbackPromiseAdapter<Notifica
tionArray, void>(resolver); | 83 WebNotificationGetCallbacks* callbacks = new CallbackPromiseAdapter<Notifica
tionArray, void>(resolver); |
| 84 | 84 |
| 85 WebNotificationManager* notificationManager = Platform::current()->notificat
ionManager(); | 85 WebNotificationManager* notificationManager = Platform::current()->notificat
ionManager(); |
| 86 ASSERT(notificationManager); | 86 ASSERT(notificationManager); |
| 87 | 87 |
| 88 notificationManager->getNotifications(options.tag(), serviceWorkerRegistrati
on.webRegistration(), callbacks); | 88 notificationManager->getNotifications(options.tag(), serviceWorkerRegistrati
on.webRegistration(), callbacks); |
| 89 return promise; | 89 return promise; |
| 90 } | 90 } |
| 91 | 91 |
| 92 } // namespace blink | 92 } // namespace blink |
| OLD | NEW |