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

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

Issue 1263043003: Add NotificationAction.action member (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@actions
Patch Set: Created 5 years, 4 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 void show(); 141 void show();
142 142
143 void setDir(const String& dir) { m_dir = dir; } 143 void setDir(const String& dir) { m_dir = dir; }
144 void setLang(const String& lang) { m_lang = lang; } 144 void setLang(const String& lang) { m_lang = lang; }
145 void setBody(const String& body) { m_body = body; } 145 void setBody(const String& body) { m_body = body; }
146 void setIconUrl(KURL iconUrl) { m_iconUrl = iconUrl; } 146 void setIconUrl(KURL iconUrl) { m_iconUrl = iconUrl; }
147 void setTag(const String& tag) { m_tag = tag; } 147 void setTag(const String& tag) { m_tag = tag; }
148 void setVibrate(const NavigatorVibration::VibrationPattern& vibrate) { m_vib rate = vibrate; } 148 void setVibrate(const NavigatorVibration::VibrationPattern& vibrate) { m_vib rate = vibrate; }
149 void setSilent(bool silent) { m_silent = silent; } 149 void setSilent(bool silent) { m_silent = silent; }
150 void setSerializedData(PassRefPtr<SerializedScriptValue> data) { m_serialize dData = data; } 150 void setSerializedData(PassRefPtr<SerializedScriptValue> data) { m_serialize dData = data; }
151 void setActions(const Vector<NotificationAction>& actions) { m_actions = act ions; }
152 151
153 void setPersistentId(int64_t persistentId) { m_persistentId = persistentId; } 152 void setPersistentId(int64_t persistentId) { m_persistentId = persistentId; }
154 153
155 String m_title; 154 String m_title;
156 String m_dir; 155 String m_dir;
157 String m_lang; 156 String m_lang;
158 String m_body; 157 String m_body;
159 String m_tag; 158 String m_tag;
160 NavigatorVibration::VibrationPattern m_vibrate; 159 NavigatorVibration::VibrationPattern m_vibrate;
161 bool m_silent; 160 bool m_silent;
(...skipping 23 matching lines...) Expand all
185 AsyncMethodRunner<Notification> m_asyncRunner; 184 AsyncMethodRunner<Notification> m_asyncRunner;
186 }; 185 };
187 186
188 template<size_t C, typename A> 187 template<size_t C, typename A>
189 void Notification::actionsToWebActions(const Vector<NotificationAction, C, A>& a ctions, WebVector<WebNotificationAction>& webActions) 188 void Notification::actionsToWebActions(const Vector<NotificationAction, C, A>& a ctions, WebVector<WebNotificationAction>& webActions)
190 { 189 {
191 size_t count = std::min(+maxActions, actions.size()); 190 size_t count = std::min(+maxActions, actions.size());
192 WebVector<WebNotificationAction> clearedAndResized(count); 191 WebVector<WebNotificationAction> clearedAndResized(count);
193 webActions.swap(clearedAndResized); 192 webActions.swap(clearedAndResized);
194 for (size_t i = 0; i < count; ++i) { 193 for (size_t i = 0; i < count; ++i) {
194 webActions[i].action = actions[i].action();
195 webActions[i].title = actions[i].title(); 195 webActions[i].title = actions[i].title();
196 } 196 }
197 } 197 }
198 198
199 } // namespace blink 199 } // namespace blink
200 200
201 #endif // Notification_h 201 #endif // Notification_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698