Chromium Code Reviews| Index: Source/modules/notifications/Notification.h |
| diff --git a/Source/modules/notifications/Notification.h b/Source/modules/notifications/Notification.h |
| index 54b0ae4f9e75c543bfc57d819f2884f7f60208fa..0e716c8a78b9946d73d9d546201e391fad964186 100644 |
| --- a/Source/modules/notifications/Notification.h |
| +++ b/Source/modules/notifications/Notification.h |
| @@ -47,6 +47,7 @@ namespace blink { |
| class ExecutionContext; |
| class NotificationOptions; |
| class NotificationPermissionCallback; |
| +struct WebNotificationData; |
| class Notification : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<Notification>, public ActiveDOMObject, public EventTargetWithInlineData, public WebNotificationDelegate { |
| DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<Notification>); |
| @@ -54,6 +55,7 @@ class Notification : public RefCountedGarbageCollectedWillBeGarbageCollectedFina |
| WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Notification); |
| public: |
| static Notification* create(ExecutionContext*, const String& title, const NotificationOptions&); |
| + static Notification* create(ExecutionContext*, const String& persistentId, const WebNotificationData&); |
|
Michael van Ouwerkerk
2014/12/09 19:49:21
It would be nice to document the different types b
Peter Beverloo
2014/12/10 14:11:09
Done.
|
| virtual ~Notification(); |
| @@ -97,6 +99,8 @@ public: |
| private: |
| Notification(const String& title, ExecutionContext*); |
| + void scheduleShow(); |
| + |
| // Calling show() may start asynchronous operation. If this object has |
| // a V8 wrapper, hasPendingActivity() prevents the wrapper from being |
| // collected while m_state is Showing, and so this instance stays alive |
| @@ -110,6 +114,8 @@ private: |
| void setIconUrl(KURL iconUrl) { m_iconUrl = iconUrl; } |
| void setTag(const String& tag) { m_tag = tag; } |
| + void setPersistentId(const String& persistentId) { m_persistentId = persistentId; } |
| + |
| private: |
| String m_title; |
| String m_dir; |
| @@ -119,12 +125,21 @@ private: |
| KURL m_iconUrl; |
| + // 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. |
| + String m_persistentId; |
| + |
| enum NotificationState { |
| NotificationStateIdle, |
| NotificationStateShowing, |
| NotificationStateClosed |
| }; |
| + // Only to be used by the Notification::create() method when notifications were created |
| + // by the embedder rather than by Blink. |
| + void setState(NotificationState state) { m_state = state; } |
| + |
| NotificationState m_state; |
| AsyncMethodRunner<Notification> m_asyncRunner; |