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

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

Issue 2300093002: Make //content responsible for generating notification Ids (Closed)
Patch Set: comments Created 4 years, 3 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 "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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698