| Index: third_party/WebKit/Source/modules/notifications/Notification.h
|
| diff --git a/third_party/WebKit/Source/modules/notifications/Notification.h b/third_party/WebKit/Source/modules/notifications/Notification.h
|
| index cf5c627b6ea058e3acdae6211829e286875ba0bf..44c93dc9b5b3d4d7559ba6e66fd2b29b58fae5da 100644
|
| --- a/third_party/WebKit/Source/modules/notifications/Notification.h
|
| +++ b/third_party/WebKit/Source/modules/notifications/Notification.h
|
| @@ -40,24 +40,26 @@
|
| #include "modules/EventTargetModules.h"
|
| #include "modules/ModulesExport.h"
|
| #include "modules/vibration/NavigatorVibration.h"
|
| +#include "mojo/public/cpp/bindings/binding.h"
|
| #include "platform/AsyncMethodRunner.h"
|
| #include "platform/heap/Handle.h"
|
| #include "platform/weborigin/KURL.h"
|
| #include "public/platform/WebVector.h"
|
| -#include "public/platform/modules/notifications/WebNotificationData.h"
|
| -#include "public/platform/modules/notifications/WebNotificationDelegate.h"
|
| +#include "public/platform/modules/notifications/notification.mojom-blink.h"
|
| +#include "public/platform/modules/notifications/notification_service.mojom-blink.h"
|
| #include "public/platform/modules/permissions/permission_status.mojom.h"
|
|
|
| namespace blink {
|
|
|
| class ExecutionContext;
|
| class NotificationAction;
|
| +class NotificationManager;
|
| class NotificationOptions;
|
| class NotificationPermissionCallback;
|
| class NotificationResourcesLoader;
|
| class ScriptState;
|
|
|
| -class MODULES_EXPORT Notification final : public EventTargetWithInlineData, public ActiveScriptWrappable, public ActiveDOMObject, public WebNotificationDelegate {
|
| +class MODULES_EXPORT Notification final : public EventTargetWithInlineData, public ActiveScriptWrappable, public ActiveDOMObject, public mojom::blink::NotificationClient {
|
| USING_GARBAGE_COLLECTED_MIXIN(Notification);
|
| DEFINE_WRAPPERTYPEINFO();
|
| public:
|
| @@ -67,7 +69,7 @@ public:
|
|
|
| // Used for embedder-created Notification objects. If |showing| is true, will initialize the
|
| // Notification's state as showing, or as closed otherwise.
|
| - static Notification* create(ExecutionContext*, int64_t persistentId, const WebNotificationData&, bool showing);
|
| + static Notification* create(ExecutionContext*, mojom::blink::NotificationPtr, bool showing);
|
|
|
| ~Notification() override;
|
|
|
| @@ -78,11 +80,9 @@ public:
|
| DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
|
| DEFINE_ATTRIBUTE_EVENT_LISTENER(close);
|
|
|
| - // WebNotificationDelegate implementation.
|
| - void dispatchShowEvent() override;
|
| - void dispatchClickEvent() override;
|
| - void dispatchErrorEvent() override;
|
| - void dispatchCloseEvent() override;
|
| + // mojom::blink::NotificationClient implementation.
|
| + void OnClick() override;
|
| + void OnClose(mojom::blink::NotificationCloseResult result) override;
|
|
|
| String title() const;
|
| String dir() const;
|
| @@ -101,7 +101,6 @@ public:
|
|
|
| static String permissionString(mojom::PermissionStatus);
|
| static String permission(ExecutionContext*);
|
| - static mojom::PermissionStatus checkPermission(ExecutionContext*);
|
| static ScriptPromise requestPermission(ScriptState*, NotificationPermissionCallback*);
|
|
|
| static size_t maxActions();
|
| @@ -123,7 +122,10 @@ protected:
|
| DispatchEventResult dispatchEventInternal(Event*) final;
|
|
|
| private:
|
| - Notification(ExecutionContext*, const WebNotificationData&);
|
| + Notification(ExecutionContext*, mojom::blink::NotificationPtr);
|
| +
|
| + // Returns the notification manager responsible for this notification.
|
| + NotificationManager* manager() const;
|
|
|
| // Schedules an asynchronous call to |prepareShow|, allowing the constructor
|
| // to return so that events can be fired on the notification object.
|
| @@ -133,24 +135,21 @@ private:
|
| // before showing the notification.
|
| void prepareShow();
|
|
|
| - // Shows the notification, using the resources loaded by the
|
| - // NotificationResourcesLoader.
|
| - void didLoadResources(NotificationResourcesLoader*);
|
| + // Shows the |notification|, using the resources loaded by the given loader.
|
| + void didLoadResources(NotificationResourcesLoader*, mojom::blink::NotificationPtr notification);
|
|
|
| - void setPersistentId(int64_t persistentId) { m_persistentId = persistentId; }
|
| + // Fires the "show" event on the notification's object, stores the id given
|
| + // by the embedder in the local notification data.
|
| + void didShowNotification(mojom::blink::NotificationDisplayResult result, const String& id);
|
|
|
| - WebNotificationData m_data;
|
| + mojom::blink::NotificationPtr m_data;
|
|
|
| // ScriptValue representations of the developer-associated data. Initialized lazily on first access.
|
| ScriptValue m_developerData;
|
|
|
| - // Notifications can either be bound to the page, which means they're identified by
|
| - // their delegate, or persistent, which means they're identified by a persistent Id
|
| - // given to us by the embedder. This influences how we close the notification.
|
| - int64_t m_persistentId;
|
| -
|
| enum NotificationState {
|
| NotificationStateIdle,
|
| + NotificationStateLoading,
|
| NotificationStateShowing,
|
| NotificationStateClosing,
|
| NotificationStateClosed
|
| @@ -165,6 +164,8 @@ private:
|
| Member<AsyncMethodRunner<Notification>> m_prepareShowMethodRunner;
|
|
|
| Member<NotificationResourcesLoader> m_loader;
|
| +
|
| + mojo::Binding<mojom::blink::NotificationClient> m_binding;
|
| };
|
|
|
| } // namespace blink
|
|
|