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

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

Issue 1847863002: Move notification resource loading from content/child to blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Fix ASAN. Cleanups. Address peter's comments. Created 4 years, 8 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 #ifndef ServiceWorkerRegistrationNotifications_h 5 #ifndef ServiceWorkerRegistrationNotifications_h
6 #define ServiceWorkerRegistrationNotifications_h 6 #define ServiceWorkerRegistrationNotifications_h
7 7
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "core/dom/ContextLifecycleObserver.h"
10 #include "platform/Supplementable.h"
11 #include "platform/heap/GarbageCollected.h"
12 #include "platform/heap/Handle.h"
13 #include "platform/heap/HeapAllocator.h"
14 #include "platform/heap/Visitor.h"
15 #include "public/platform/modules/notifications/WebNotificationManager.h"
16 #include "wtf/Noncopyable.h"
17 #include "wtf/OwnPtr.h"
18 #include "wtf/PassOwnPtr.h"
19 #include "wtf/PassRefPtr.h"
9 20
10 namespace blink { 21 namespace blink {
11 22
23 class ExecutionContext;
12 class ExceptionState; 24 class ExceptionState;
13 class GetNotificationOptions; 25 class GetNotificationOptions;
14 class NotificationOptions; 26 class NotificationOptions;
27 class NotificationResourcesLoader;
15 class ScriptState; 28 class ScriptState;
29 class SecurityOrigin;
16 class ServiceWorkerRegistration; 30 class ServiceWorkerRegistration;
31 struct WebNotificationData;
17 32
18 class ServiceWorkerRegistrationNotifications { 33 class ServiceWorkerRegistrationNotifications final : public GarbageCollectedFina lized<ServiceWorkerRegistrationNotifications>, public Supplement<ServiceWorkerRe gistration>, public ContextLifecycleObserver {
19 STATIC_ONLY(ServiceWorkerRegistrationNotifications); 34 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerRegistrationNotifications);
35 WTF_MAKE_NONCOPYABLE(ServiceWorkerRegistrationNotifications);
20 public: 36 public:
37 virtual ~ServiceWorkerRegistrationNotifications();
Peter Beverloo 2016/04/18 15:22:37 nit: This doesn't have to be virtual given that th
Michael van Ouwerkerk 2016/04/18 17:03:15 Done.
21 static ScriptPromise showNotification(ScriptState*, ServiceWorkerRegistratio n&, const String& title, const NotificationOptions&, ExceptionState&); 38 static ScriptPromise showNotification(ScriptState*, ServiceWorkerRegistratio n&, const String& title, const NotificationOptions&, ExceptionState&);
22 static ScriptPromise getNotifications(ScriptState*, ServiceWorkerRegistratio n&, const GetNotificationOptions&); 39 static ScriptPromise getNotifications(ScriptState*, ServiceWorkerRegistratio n&, const GetNotificationOptions&);
40
41 // ContextLifecycleObserver interface.
42 void contextDestroyed() override;
43
44 DECLARE_VIRTUAL_TRACE();
45
46 private:
47 ServiceWorkerRegistrationNotifications(ExecutionContext*, ServiceWorkerRegis tration*);
48
49 static const char* supplementName();
50 static ServiceWorkerRegistrationNotifications& from(ExecutionContext*, Servi ceWorkerRegistration&);
51
52 void prepareShow(const WebNotificationData&, PassOwnPtr<WebNotificationShowC allbacks>);
53 void didLoadResources(PassRefPtr<SecurityOrigin>, const WebNotificationData& , PassOwnPtr<WebNotificationShowCallbacks>, NotificationResourcesLoader*);
54
55 Member<ServiceWorkerRegistration> m_registration;
56 HeapHashSet<Member<NotificationResourcesLoader>> m_loaders;
23 }; 57 };
24 58
25 } // namespace blink 59 } // namespace blink
26 60
27 #endif // ServiceWorkerRegistrationNotifications_h 61 #endif // ServiceWorkerRegistrationNotifications_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698