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

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

Issue 1234553003: Supports the sound attribute to the Notification object Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: [WIP] Created 5 years, 5 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
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 void dispatchClickEvent() override; 83 void dispatchClickEvent() override;
84 void dispatchErrorEvent() override; 84 void dispatchErrorEvent() override;
85 void dispatchCloseEvent() override; 85 void dispatchCloseEvent() override;
86 86
87 String title() const { return m_title; } 87 String title() const { return m_title; }
88 String dir() const { return m_dir; } 88 String dir() const { return m_dir; }
89 String lang() const { return m_lang; } 89 String lang() const { return m_lang; }
90 String body() const { return m_body; } 90 String body() const { return m_body; }
91 String tag() const { return m_tag; } 91 String tag() const { return m_tag; }
92 String icon() const { return m_iconUrl; } 92 String icon() const { return m_iconUrl; }
93 String sound() const { return m_soundUrl; }
93 NavigatorVibration::VibrationPattern vibrate(bool& isNull) const; 94 NavigatorVibration::VibrationPattern vibrate(bool& isNull) const;
94 bool silent() const { return m_silent; } 95 bool silent() const { return m_silent; }
95 ScriptValue data(ScriptState*) const; 96 ScriptValue data(ScriptState*) const;
96 97
97 TextDirection direction() const; 98 TextDirection direction() const;
98 KURL iconURL() const { return m_iconUrl; } 99 KURL iconURL() const { return m_iconUrl; }
100 KURL soundURL() const { return m_soundUrl; }
99 SerializedScriptValue* serializedData() const { return m_serializedData.get( ); } 101 SerializedScriptValue* serializedData() const { return m_serializedData.get( ); }
100 102
101 static String permissionString(WebNotificationPermission); 103 static String permissionString(WebNotificationPermission);
102 static String permission(ExecutionContext*); 104 static String permission(ExecutionContext*);
103 static WebNotificationPermission checkPermission(ExecutionContext*); 105 static WebNotificationPermission checkPermission(ExecutionContext*);
104 static void requestPermission(ExecutionContext*, NotificationPermissionCallb ack* = nullptr); 106 static void requestPermission(ExecutionContext*, NotificationPermissionCallb ack* = nullptr);
105 107
106 // EventTarget interface. 108 // EventTarget interface.
107 virtual ExecutionContext* executionContext() const override final { return A ctiveDOMObject::executionContext(); } 109 virtual ExecutionContext* executionContext() const override final { return A ctiveDOMObject::executionContext(); }
108 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) override final; 110 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) override final;
(...skipping 14 matching lines...) Expand all
123 // a V8 wrapper, hasPendingActivity() prevents the wrapper from being 125 // a V8 wrapper, hasPendingActivity() prevents the wrapper from being
124 // collected while m_state is Showing, and so this instance stays alive 126 // collected while m_state is Showing, and so this instance stays alive
125 // until the operation completes. Otherwise, you need to hold a ref on this 127 // until the operation completes. Otherwise, you need to hold a ref on this
126 // instance until the operation completes. 128 // instance until the operation completes.
127 void show(); 129 void show();
128 130
129 void setDir(const String& dir) { m_dir = dir; } 131 void setDir(const String& dir) { m_dir = dir; }
130 void setLang(const String& lang) { m_lang = lang; } 132 void setLang(const String& lang) { m_lang = lang; }
131 void setBody(const String& body) { m_body = body; } 133 void setBody(const String& body) { m_body = body; }
132 void setIconUrl(KURL iconUrl) { m_iconUrl = iconUrl; } 134 void setIconUrl(KURL iconUrl) { m_iconUrl = iconUrl; }
135 void setSoundUrl(KURL soundUrl) { m_soundUrl = soundUrl; }
133 void setTag(const String& tag) { m_tag = tag; } 136 void setTag(const String& tag) { m_tag = tag; }
134 void setVibrate(const NavigatorVibration::VibrationPattern& vibrate) { m_vib rate = vibrate; } 137 void setVibrate(const NavigatorVibration::VibrationPattern& vibrate) { m_vib rate = vibrate; }
135 void setSilent(bool silent) { m_silent = silent; } 138 void setSilent(bool silent) { m_silent = silent; }
136 void setSerializedData(PassRefPtr<SerializedScriptValue> data) { m_serialize dData = data; } 139 void setSerializedData(PassRefPtr<SerializedScriptValue> data) { m_serialize dData = data; }
137 140
138 void setPersistentId(int64_t persistentId) { m_persistentId = persistentId; } 141 void setPersistentId(int64_t persistentId) { m_persistentId = persistentId; }
139 142
140 private: 143 private:
141 String m_title; 144 String m_title;
142 String m_dir; 145 String m_dir;
143 String m_lang; 146 String m_lang;
144 String m_body; 147 String m_body;
145 String m_tag; 148 String m_tag;
146 NavigatorVibration::VibrationPattern m_vibrate; 149 NavigatorVibration::VibrationPattern m_vibrate;
147 bool m_silent; 150 bool m_silent;
148 RefPtr<SerializedScriptValue> m_serializedData; 151 RefPtr<SerializedScriptValue> m_serializedData;
149 152
150 KURL m_iconUrl; 153 KURL m_iconUrl;
154 KURL m_soundUrl;
151 155
152 // Notifications can either be bound to the page, which means they're identi fied by 156 // Notifications can either be bound to the page, which means they're identi fied by
153 // their delegate, or persistent, which means they're identified by a persis tent Id 157 // their delegate, or persistent, which means they're identified by a persis tent Id
154 // given to us by the embedder. This influences how we close the notificatio n. 158 // given to us by the embedder. This influences how we close the notificatio n.
155 int64_t m_persistentId; 159 int64_t m_persistentId;
156 160
157 enum NotificationState { 161 enum NotificationState {
158 NotificationStateIdle, 162 NotificationStateIdle,
159 NotificationStateShowing, 163 NotificationStateShowing,
160 NotificationStateClosing, 164 NotificationStateClosing,
161 NotificationStateClosed 165 NotificationStateClosed
162 }; 166 };
163 167
164 // Only to be used by the Notification::create() method when notifications w ere created 168 // Only to be used by the Notification::create() method when notifications w ere created
165 // by the embedder rather than by Blink. 169 // by the embedder rather than by Blink.
166 void setState(NotificationState state) { m_state = state; } 170 void setState(NotificationState state) { m_state = state; }
167 171
168 NotificationState m_state; 172 NotificationState m_state;
169 173
170 AsyncMethodRunner<Notification> m_asyncRunner; 174 AsyncMethodRunner<Notification> m_asyncRunner;
171 }; 175 };
172 176
173 } // namespace blink 177 } // namespace blink
174 178
175 #endif // Notification_h 179 #endif // Notification_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698