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

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

Issue 2244913002: Remove content::NotificationPermissionDispatcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permissions_typemaps
Patch Set: Rebased. Created 4 years, 4 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 NotificationManager_h 5 #ifndef NotificationManager_h
6 #define NotificationManager_h 6 #define NotificationManager_h
7 7
8 #include "core/dom/ContextLifecycleObserver.h" 8 #include "core/dom/ContextLifecycleObserver.h"
9 #include "core/dom/ExecutionContext.h" 9 #include "core/dom/ExecutionContext.h"
10 #include "public/platform/modules/notifications/notification_service.mojom-blink .h" 10 #include "public/platform/modules/notifications/notification_service.mojom-blink .h"
11 #include "public/platform/modules/permissions/permission.mojom-blink.h"
11 #include "wtf/Noncopyable.h" 12 #include "wtf/Noncopyable.h"
12 #include "wtf/text/WTFString.h" 13 #include "wtf/text/WTFString.h"
13 14
14 namespace blink { 15 namespace blink {
15 16
16 namespace mojom { 17 namespace mojom {
17 namespace blink { 18 namespace blink {
18 enum class PermissionStatus; 19 enum class PermissionStatus;
19 } 20 }
20 } 21 }
21 22
23 class NotificationPermissionCallback;
24 class ScriptPromise;
25 class ScriptPromiseResolver;
26 class ScriptState;
27
22 // The notification manager, unique to the execution context, is responsible for 28 // The notification manager, unique to the execution context, is responsible for
23 // connecting and communicating with the Mojo notification service. 29 // connecting and communicating with the Mojo notification service.
24 // 30 //
25 // TODO(peter): Make the NotificationManager responsible for resource loading. 31 // TODO(peter): Make the NotificationManager responsible for resource loading.
26 class NotificationManager final 32 class NotificationManager final
27 : public GarbageCollectedFinalized<NotificationManager> 33 : public GarbageCollectedFinalized<NotificationManager>
28 , public ContextLifecycleObserver 34 , public ContextLifecycleObserver
29 , public Supplement<ExecutionContext> { 35 , public Supplement<ExecutionContext> {
30 USING_GARBAGE_COLLECTED_MIXIN(NotificationManager); 36 USING_GARBAGE_COLLECTED_MIXIN(NotificationManager);
31 WTF_MAKE_NONCOPYABLE(NotificationManager); 37 WTF_MAKE_NONCOPYABLE(NotificationManager);
32 public: 38 public:
33 static NotificationManager* from(ExecutionContext*); 39 static NotificationManager* from(ExecutionContext*);
34 static const char* supplementName(); 40 static const char* supplementName();
35 41
36 ~NotificationManager(); 42 ~NotificationManager();
37 43
38 // Returns the notification permission status of the current origin. This 44 // Returns the notification permission status of the current origin. This
39 // method is synchronous to support the Notification.permission getter. 45 // method is synchronous to support the Notification.permission getter.
40 mojom::blink::PermissionStatus permissionStatus() const; 46 mojom::blink::PermissionStatus permissionStatus();
47
48 ScriptPromise requestPermission(ScriptState*, NotificationPermissionCallback * deprecatedCallback);
41 49
42 // ContextLifecycleObserver implementation. 50 // ContextLifecycleObserver implementation.
43 void contextDestroyed() override; 51 void contextDestroyed() override;
44 52
45 DECLARE_VIRTUAL_TRACE(); 53 DECLARE_VIRTUAL_TRACE();
46 54
47 private: 55 private:
48 explicit NotificationManager(ExecutionContext*); 56 explicit NotificationManager(ExecutionContext*);
49 57
50 mojom::blink::NotificationServicePtr m_service; 58 void onPermissionRequestComplete(ScriptPromiseResolver*, NotificationPermiss ionCallback*, mojom::blink::PermissionStatus);
59
60 mojom::blink::NotificationServicePtr m_notificationService;
61 mojom::blink::PermissionServicePtr m_permissionService;
51 }; 62 };
52 63
53 } // namespace blink 64 } // namespace blink
54 65
55 #endif // NotificationManager_h 66 #endif // NotificationManager_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698