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

Side by Side Diff: Source/modules/notifications/Notification.h

Issue 1078783002: Update the Notification Blink API to use integral persistent ids. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/modules/notifications/Notification.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 class Notification final : public RefCountedGarbageCollectedEventTargetWithInlin eData<Notification>, public ActiveDOMObject, public WebNotificationDelegate { 57 class Notification final : public RefCountedGarbageCollectedEventTargetWithInlin eData<Notification>, public ActiveDOMObject, public WebNotificationDelegate {
58 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<N otification>); 58 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<N otification>);
59 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Notification); 59 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Notification);
60 DEFINE_WRAPPERTYPEINFO(); 60 DEFINE_WRAPPERTYPEINFO();
61 public: 61 public:
62 // Used for JavaScript instantiations of the Notification object. Will autom atically schedule for 62 // Used for JavaScript instantiations of the Notification object. Will autom atically schedule for
63 // the notification to be displayed to the user. 63 // the notification to be displayed to the user.
64 static Notification* create(ExecutionContext*, const String& title, const No tificationOptions&, ExceptionState&); 64 static Notification* create(ExecutionContext*, const String& title, const No tificationOptions&, ExceptionState&);
65 65
66 // Used for embedder-created Notification objects. Will initialize the Notif ication's state as showing. 66 // Used for embedder-created Notification objects. Will initialize the Notif ication's state as showing.
67 static Notification* create(ExecutionContext*, int64_t persistentId, const W ebNotificationData&);
68 // TODO(peter): Remove this method when the embedder only passes us int64_t persistent notification ids.
67 static Notification* create(ExecutionContext*, const String& persistentId, c onst WebNotificationData&); 69 static Notification* create(ExecutionContext*, const String& persistentId, c onst WebNotificationData&);
68 70
69 virtual ~Notification(); 71 virtual ~Notification();
70 72
71 void close(); 73 void close();
72 74
73 DEFINE_ATTRIBUTE_EVENT_LISTENER(click); 75 DEFINE_ATTRIBUTE_EVENT_LISTENER(click);
74 DEFINE_ATTRIBUTE_EVENT_LISTENER(show); 76 DEFINE_ATTRIBUTE_EVENT_LISTENER(show);
75 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); 77 DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
76 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); 78 DEFINE_ATTRIBUTE_EVENT_LISTENER(close);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 void show(); 125 void show();
124 126
125 void setDir(const String& dir) { m_dir = dir; } 127 void setDir(const String& dir) { m_dir = dir; }
126 void setLang(const String& lang) { m_lang = lang; } 128 void setLang(const String& lang) { m_lang = lang; }
127 void setBody(const String& body) { m_body = body; } 129 void setBody(const String& body) { m_body = body; }
128 void setIconUrl(KURL iconUrl) { m_iconUrl = iconUrl; } 130 void setIconUrl(KURL iconUrl) { m_iconUrl = iconUrl; }
129 void setTag(const String& tag) { m_tag = tag; } 131 void setTag(const String& tag) { m_tag = tag; }
130 void setSilent(bool silent) { m_silent = silent; } 132 void setSilent(bool silent) { m_silent = silent; }
131 void setSerializedData(PassRefPtr<SerializedScriptValue> data) { m_serialize dData = data; } 133 void setSerializedData(PassRefPtr<SerializedScriptValue> data) { m_serialize dData = data; }
132 134
133 void setPersistentId(const String& persistentId) { m_persistentId = persiste ntId; } 135 void setPersistentId(int64_t persistentId) { m_persistentId = persistentId; }
136 void setPersistentIdString(const String& persistentId) { m_persistentIdStrin g = persistentId; }
134 137
135 private: 138 private:
136 String m_title; 139 String m_title;
137 String m_dir; 140 String m_dir;
138 String m_lang; 141 String m_lang;
139 String m_body; 142 String m_body;
140 String m_tag; 143 String m_tag;
141 bool m_silent; 144 bool m_silent;
142 RefPtr<SerializedScriptValue> m_serializedData; 145 RefPtr<SerializedScriptValue> m_serializedData;
143 146
144 KURL m_iconUrl; 147 KURL m_iconUrl;
145 148
146 // Notifications can either be bound to the page, which means they're identi fied by 149 // Notifications can either be bound to the page, which means they're identi fied by
147 // their delegate, or persistent, which means they're identified by a persis tent Id 150 // their delegate, or persistent, which means they're identified by a persis tent Id
148 // given to us by the embedder. This influences how we close the notificatio n. 151 // given to us by the embedder. This influences how we close the notificatio n.
149 String m_persistentId; 152 int64_t m_persistentId;
153 String m_persistentIdString;
150 154
151 enum NotificationState { 155 enum NotificationState {
152 NotificationStateIdle, 156 NotificationStateIdle,
153 NotificationStateShowing, 157 NotificationStateShowing,
154 NotificationStateClosing, 158 NotificationStateClosing,
155 NotificationStateClosed 159 NotificationStateClosed
156 }; 160 };
157 161
158 // Only to be used by the Notification::create() method when notifications w ere created 162 // Only to be used by the Notification::create() method when notifications w ere created
159 // by the embedder rather than by Blink. 163 // by the embedder rather than by Blink.
160 void setState(NotificationState state) { m_state = state; } 164 void setState(NotificationState state) { m_state = state; }
161 165
162 NotificationState m_state; 166 NotificationState m_state;
163 167
164 AsyncMethodRunner<Notification> m_asyncRunner; 168 AsyncMethodRunner<Notification> m_asyncRunner;
165 }; 169 };
166 170
167 } // namespace blink 171 } // namespace blink
168 172
169 #endif // Notification_h 173 #endif // Notification_h
OLDNEW
« no previous file with comments | « no previous file | Source/modules/notifications/Notification.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698