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

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

Issue 1948223004: Introduce the Blink NotificationService, move permission checks there (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: OWNERS + thread jump when connecting Created 4 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NotificationManager_h
6 #define NotificationManager_h
7
8 #include "core/dom/ContextLifecycleObserver.h"
9 #include "core/dom/ExecutionContext.h"
10 #include "public/platform/modules/notifications/notification_service.mojom-blink .h"
11 #include "wtf/Noncopyable.h"
12 #include "wtf/text/WTFString.h"
13
14 namespace blink {
15
16 namespace mojom {
17 enum class PermissionStatus;
18 }
19
20 // The notification manager, unique to the execution context, is responsible for
21 // connecting and communicating with the Mojo notification service.
22 //
23 // TODO(peter): Make the NotificationManager responsible for resource loading.
24 class NotificationManager final
25 : public GarbageCollectedFinalized<NotificationManager>
26 , public ContextLifecycleObserver
27 , public Supplement<ExecutionContext> {
28 USING_GARBAGE_COLLECTED_MIXIN(NotificationManager);
29 WTF_MAKE_NONCOPYABLE(NotificationManager);
30 public:
31 static NotificationManager* from(ExecutionContext*);
32 static const char* supplementName();
33
34 ~NotificationManager();
35
36 // Returns the notification permission status of the current origin. This
37 // method is synchronous to support the Notification.permission getter.
38 mojom::PermissionStatus permissionStatus() const;
39
40 // ContextLifecycleObserver implementation.
41 void contextDestroyed() override;
42
43 DECLARE_VIRTUAL_TRACE();
44
45 private:
46 NotificationManager(ExecutionContext*);
Michael van Ouwerkerk 2016/05/06 11:45:20 explicit
Peter Beverloo 2016/05/06 14:51:33 Done.
47
48 // Returns a string containing the security origin of the execution
49 // context this NotificationManager has been associated with.
50 String getOriginString() const;
51
52 mojom::blink::NotificationServicePtr m_service;
53 };
54
55 } // namespace blink
56
57 #endif // NotificationManager_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698