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

Unified Diff: content/browser/notifications/notification_database_data_conversions.cc

Issue 1054573002: Implement support for notification.vibrate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/notifications/notification_database_data_conversions.cc
diff --git a/content/browser/notifications/notification_database_data_conversions.cc b/content/browser/notifications/notification_database_data_conversions.cc
index d656f7dec6b5c9f6cacb22d13206a0acd09faa07..371693009782251340f4212af0bd67fcfe916a03 100644
--- a/content/browser/notifications/notification_database_data_conversions.cc
+++ b/content/browser/notifications/notification_database_data_conversions.cc
@@ -38,6 +38,13 @@ bool DeserializeNotificationDatabaseData(const std::string& input,
notification_data->body = base::UTF8ToUTF16(payload.body());
notification_data->tag = payload.tag();
notification_data->icon = GURL(payload.icon());
+
+ if (payload.vibration_pattern().size()) {
dcheng 2015/05/06 18:43:27 empty() instead of size() makes this clearer Othe
Sanghyun Park 2015/05/07 12:08:32 google::protobuf::RepeatedField does not have "emp
+ notification_data->vibration_pattern.assign(
+ payload.vibration_pattern().begin(),
+ payload.vibration_pattern().end());
+ }
+
notification_data->silent = payload.silent();
if (payload.data().length()) {
@@ -67,6 +74,10 @@ bool SerializeNotificationDatabaseData(const NotificationDatabaseData& input,
payload->set_body(base::UTF16ToUTF8(notification_data.body));
payload->set_tag(notification_data.tag);
payload->set_icon(notification_data.icon.spec());
+
+ for (size_t i = 0; i < notification_data.vibration_pattern.size(); ++i)
+ payload->add_vibration_pattern(notification_data.vibration_pattern[i]);
+
payload->set_silent(notification_data.silent);
if (notification_data.data.size()) {

Powered by Google App Engine
This is Rietveld 408576698