Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 13 matching lines...) Expand all Loading... | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef Notification_h | 31 #ifndef Notification_h |
| 32 #define Notification_h | 32 #define Notification_h |
| 33 | 33 |
| 34 #include "bindings/core/v8/SerializedScriptValue.h" | |
| 34 #include "core/dom/ActiveDOMObject.h" | 35 #include "core/dom/ActiveDOMObject.h" |
| 35 #include "modules/EventTargetModules.h" | 36 #include "modules/EventTargetModules.h" |
| 36 #include "platform/AsyncMethodRunner.h" | 37 #include "platform/AsyncMethodRunner.h" |
| 37 #include "platform/heap/Handle.h" | 38 #include "platform/heap/Handle.h" |
| 38 #include "platform/text/TextDirection.h" | 39 #include "platform/text/TextDirection.h" |
| 39 #include "platform/weborigin/KURL.h" | 40 #include "platform/weborigin/KURL.h" |
| 40 #include "public/platform/modules/notifications/WebNotificationDelegate.h" | 41 #include "public/platform/modules/notifications/WebNotificationDelegate.h" |
| 41 #include "public/platform/modules/notifications/WebNotificationPermission.h" | 42 #include "public/platform/modules/notifications/WebNotificationPermission.h" |
| 42 #include "wtf/PassOwnPtr.h" | 43 #include "wtf/PassOwnPtr.h" |
| 43 #include "wtf/RefCounted.h" | 44 #include "wtf/RefCounted.h" |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 69 DEFINE_ATTRIBUTE_EVENT_LISTENER(show); | 70 DEFINE_ATTRIBUTE_EVENT_LISTENER(show); |
| 70 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 71 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
| 71 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); | 72 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); |
| 72 | 73 |
| 73 // WebNotificationDelegate implementation. | 74 // WebNotificationDelegate implementation. |
| 74 void dispatchShowEvent() override; | 75 void dispatchShowEvent() override; |
| 75 void dispatchClickEvent() override; | 76 void dispatchClickEvent() override; |
| 76 void dispatchErrorEvent() override; | 77 void dispatchErrorEvent() override; |
| 77 void dispatchCloseEvent() override; | 78 void dispatchCloseEvent() override; |
| 78 | 79 |
| 80 SerializedScriptValue* data() const { return m_data.get(); } | |
| 79 String title() const { return m_title; } | 81 String title() const { return m_title; } |
| 80 String dir() const { return m_dir; } | 82 String dir() const { return m_dir; } |
| 81 String lang() const { return m_lang; } | 83 String lang() const { return m_lang; } |
| 82 String body() const { return m_body; } | 84 String body() const { return m_body; } |
| 83 String tag() const { return m_tag; } | 85 String tag() const { return m_tag; } |
| 84 String icon() const { return m_iconUrl; } | 86 String icon() const { return m_iconUrl; } |
| 85 bool silent() const { return m_silent; } | 87 bool silent() const { return m_silent; } |
| 86 | 88 |
| 87 TextDirection direction() const; | 89 TextDirection direction() const; |
| 88 KURL iconURL() const { return m_iconUrl; } | 90 KURL iconURL() const { return m_iconUrl; } |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 108 | 110 |
| 109 void scheduleShow(); | 111 void scheduleShow(); |
| 110 | 112 |
| 111 // Calling show() may start asynchronous operation. If this object has | 113 // Calling show() may start asynchronous operation. If this object has |
| 112 // a V8 wrapper, hasPendingActivity() prevents the wrapper from being | 114 // a V8 wrapper, hasPendingActivity() prevents the wrapper from being |
| 113 // collected while m_state is Showing, and so this instance stays alive | 115 // collected while m_state is Showing, and so this instance stays alive |
| 114 // until the operation completes. Otherwise, you need to hold a ref on this | 116 // until the operation completes. Otherwise, you need to hold a ref on this |
| 115 // instance until the operation completes. | 117 // instance until the operation completes. |
| 116 void show(); | 118 void show(); |
| 117 | 119 |
| 120 void setData(PassRefPtr<SerializedScriptValue> data) { m_data = data; } | |
|
Peter Beverloo
2015/03/12 01:16:26
nit: please place this under setSilent(). Generall
Sanghyun Park
2015/03/12 02:58:47
I see. I'll move this under setSlient().
| |
| 118 void setDir(const String& dir) { m_dir = dir; } | 121 void setDir(const String& dir) { m_dir = dir; } |
| 119 void setLang(const String& lang) { m_lang = lang; } | 122 void setLang(const String& lang) { m_lang = lang; } |
| 120 void setBody(const String& body) { m_body = body; } | 123 void setBody(const String& body) { m_body = body; } |
| 121 void setIconUrl(KURL iconUrl) { m_iconUrl = iconUrl; } | 124 void setIconUrl(KURL iconUrl) { m_iconUrl = iconUrl; } |
| 122 void setTag(const String& tag) { m_tag = tag; } | 125 void setTag(const String& tag) { m_tag = tag; } |
| 123 void setSilent(bool silent) { m_silent = silent; } | 126 void setSilent(bool silent) { m_silent = silent; } |
| 124 | 127 |
| 125 void setPersistentId(const String& persistentId) { m_persistentId = persiste ntId; } | 128 void setPersistentId(const String& persistentId) { m_persistentId = persiste ntId; } |
| 126 | 129 |
| 127 private: | 130 private: |
| 131 RefPtr<SerializedScriptValue> m_data; | |
| 128 String m_title; | 132 String m_title; |
| 129 String m_dir; | 133 String m_dir; |
| 130 String m_lang; | 134 String m_lang; |
| 131 String m_body; | 135 String m_body; |
| 132 String m_tag; | 136 String m_tag; |
| 133 bool m_silent; | 137 bool m_silent; |
| 134 | 138 |
| 135 KURL m_iconUrl; | 139 KURL m_iconUrl; |
| 136 | 140 |
| 137 // Notifications can either be bound to the page, which means they're identi fied by | 141 // Notifications can either be bound to the page, which means they're identi fied by |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 151 void setState(NotificationState state) { m_state = state; } | 155 void setState(NotificationState state) { m_state = state; } |
| 152 | 156 |
| 153 NotificationState m_state; | 157 NotificationState m_state; |
| 154 | 158 |
| 155 AsyncMethodRunner<Notification> m_asyncRunner; | 159 AsyncMethodRunner<Notification> m_asyncRunner; |
| 156 }; | 160 }; |
| 157 | 161 |
| 158 } // namespace blink | 162 } // namespace blink |
| 159 | 163 |
| 160 #endif // Notification_h | 164 #endif // Notification_h |
| OLD | NEW |