Index: Source/modules/notifications/Notification.h |
diff --git a/Source/modules/notifications/Notification.h b/Source/modules/notifications/Notification.h |
index 31735bfc09638301e01ed1731ef34223e6263b7f..d706a37e1c765c006eecc95b6e3e9fc3b7f113c2 100644 |
--- a/Source/modules/notifications/Notification.h |
+++ b/Source/modules/notifications/Notification.h |
@@ -36,14 +36,12 @@ |
#include "core/dom/ActiveDOMObject.h" |
#include "modules/EventTargetModules.h" |
#include "modules/ModulesExport.h" |
-#include "modules/notifications/NotificationAction.h" |
#include "modules/vibration/NavigatorVibration.h" |
#include "platform/AsyncMethodRunner.h" |
#include "platform/heap/Handle.h" |
-#include "platform/text/TextDirection.h" |
#include "platform/weborigin/KURL.h" |
#include "public/platform/WebVector.h" |
-#include "public/platform/modules/notifications/WebNotificationAction.h" |
+#include "public/platform/modules/notifications/WebNotificationData.h" |
#include "public/platform/modules/notifications/WebNotificationDelegate.h" |
#include "public/platform/modules/notifications/WebNotificationPermission.h" |
#include "wtf/PassOwnPtr.h" |
@@ -54,12 +52,12 @@ |
namespace blink { |
class ExecutionContext; |
+class NotificationAction; |
class NotificationOptions; |
class NotificationPermissionCallback; |
class ScriptState; |
class ScriptValue; |
class UnsignedLongOrUnsignedLongSequence; |
-struct WebNotificationData; |
class MODULES_EXPORT Notification final : public RefCountedGarbageCollectedEventTargetWithInlineData<Notification>, public ActiveDOMObject, public WebNotificationDelegate { |
REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(Notification); |
@@ -67,7 +65,7 @@ class MODULES_EXPORT Notification final : public RefCountedGarbageCollectedEvent |
DEFINE_WRAPPERTYPEINFO(); |
public: |
// Used for JavaScript instantiations of the Notification object. Will automatically schedule for |
- // the notification to be displayed to the user. |
+ // the notification to be displayed to the user when the developer-provided data is valid. |
static Notification* create(ExecutionContext*, const String& title, const NotificationOptions&, ExceptionState&); |
// Used for embedder-created Notification objects. Will initialize the Notification's state as showing. |
@@ -88,20 +86,16 @@ public: |
void dispatchErrorEvent() override; |
void dispatchCloseEvent() override; |
- String title() const { return m_title; } |
- String dir() const { return m_dir; } |
- String lang() const { return m_lang; } |
- String body() const { return m_body; } |
- String tag() const { return m_tag; } |
- String icon() const { return m_iconUrl; } |
- const NavigatorVibration::VibrationPattern& vibrate(bool& isNull) const; |
- bool silent() const { return m_silent; } |
- ScriptValue data(ScriptState*) const; |
- const HeapVector<NotificationAction>& actions() const { return m_actions; } |
- |
- TextDirection direction() const; |
- KURL iconURL() const { return m_iconUrl; } |
- SerializedScriptValue* serializedData() const { return m_serializedData.get(); } |
+ String title() const; |
+ String dir() const; |
+ String lang() const; |
+ String body() const; |
+ String tag() const; |
+ String icon() const; |
+ NavigatorVibration::VibrationPattern vibrate(bool& isNull) const; |
+ bool silent() const; |
+ ScriptValue data(ScriptState*); |
+ HeapVector<NotificationAction> actions() const; |
static String permissionString(WebNotificationPermission); |
static String permission(ExecutionContext*); |
@@ -110,8 +104,6 @@ public: |
static size_t maxActions(); |
- static void actionsToWebActions(const HeapVector<NotificationAction>& actions, WebVector<WebNotificationAction>* webActions); |
- |
// EventTarget interface. |
ExecutionContext* executionContext() const final { return ActiveDOMObject::executionContext(); } |
const AtomicString& interfaceName() const override; |
@@ -127,9 +119,7 @@ protected: |
bool dispatchEventInternal(PassRefPtrWillBeRawPtr<Event>) final; |
private: |
- static void webActionsToActions(const WebVector<WebNotificationAction>& webActions, HeapVector<NotificationAction>* actions); |
- |
- Notification(const String& title, ExecutionContext*); |
+ Notification(ExecutionContext*, const WebNotificationData&); |
void scheduleShow(); |
@@ -140,29 +130,12 @@ private: |
// instance until the operation completes. |
void show(); |
- void setDir(const String& dir) { m_dir = dir; } |
- void setLang(const String& lang) { m_lang = lang; } |
- void setBody(const String& body) { m_body = body; } |
- void setIconUrl(KURL iconUrl) { m_iconUrl = iconUrl; } |
- void setTag(const String& tag) { m_tag = tag; } |
- void setVibrate(const NavigatorVibration::VibrationPattern& vibrate) { m_vibrate = vibrate; } |
- void setSilent(bool silent) { m_silent = silent; } |
- void setSerializedData(PassRefPtr<SerializedScriptValue> data) { m_serializedData = data; } |
- void setActions(const HeapVector<NotificationAction>& actions) { m_actions = actions; } |
- |
void setPersistentId(int64_t persistentId) { m_persistentId = persistentId; } |
- String m_title; |
- String m_dir; |
- String m_lang; |
- String m_body; |
- String m_tag; |
- NavigatorVibration::VibrationPattern m_vibrate; |
- bool m_silent; |
- RefPtr<SerializedScriptValue> m_serializedData; |
- HeapVector<NotificationAction> m_actions; |
+private: |
+ WebNotificationData m_data; |
- KURL m_iconUrl; |
+ RefPtr<SerializedScriptValue> m_serializedData; |
// 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 |