Chromium Code Reviews| Index: third_party/WebKit/Source/modules/notifications/NotificationManager.h |
| diff --git a/third_party/WebKit/Source/modules/notifications/NotificationManager.h b/third_party/WebKit/Source/modules/notifications/NotificationManager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..47ff2605a86a53a9884a41417b7994c057e6f9ac |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/notifications/NotificationManager.h |
| @@ -0,0 +1,57 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef NotificationManager_h |
| +#define NotificationManager_h |
| + |
| +#include "core/dom/ContextLifecycleObserver.h" |
| +#include "core/dom/ExecutionContext.h" |
| +#include "public/platform/modules/notifications/notification_service.mojom-blink.h" |
| +#include "wtf/Noncopyable.h" |
| +#include "wtf/text/WTFString.h" |
| + |
| +namespace blink { |
| + |
| +namespace mojom { |
| +enum class PermissionStatus; |
| +} |
| + |
| +// The notification manager, unique to the execution context, is responsible for |
| +// connecting and communicating with the Mojo notification service. |
| +// |
| +// TODO(peter): Make the NotificationManager responsible for resource loading. |
| +class NotificationManager final |
| + : public GarbageCollectedFinalized<NotificationManager> |
| + , public ContextLifecycleObserver |
| + , public Supplement<ExecutionContext> { |
| + USING_GARBAGE_COLLECTED_MIXIN(NotificationManager); |
| + WTF_MAKE_NONCOPYABLE(NotificationManager); |
| +public: |
| + static NotificationManager* from(ExecutionContext*); |
| + static const char* supplementName(); |
| + |
| + ~NotificationManager(); |
| + |
| + // Returns the notification permission status of the current origin. This |
| + // method is synchronous to support the Notification.permission getter. |
| + mojom::PermissionStatus permissionStatus() const; |
| + |
| + // ContextLifecycleObserver implementation. |
| + void contextDestroyed() override; |
| + |
| + DECLARE_VIRTUAL_TRACE(); |
| + |
| +private: |
| + NotificationManager(ExecutionContext*); |
|
Michael van Ouwerkerk
2016/05/06 11:45:20
explicit
Peter Beverloo
2016/05/06 14:51:33
Done.
|
| + |
| + // Returns a string containing the security origin of the execution |
| + // context this NotificationManager has been associated with. |
| + String getOriginString() const; |
| + |
| + mojom::blink::NotificationServicePtr m_service; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // NotificationManager_h |