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

Unified Diff: Source/modules/notifications/Notification.h

Issue 789643003: The Service Worker notificationclick event should carry a notification. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add missing file Created 6 years 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 side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698