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

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

Issue 1262023003: Serialize Notification.direction == "auto" in the database (2/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 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 349b9c834b49c127d5be69eea6c9aeb869e65f05..6b4c600ce692eaf76472fd07ca63101ea4600fcb 100644
--- a/content/browser/notifications/notification_database_data_conversions.cc
+++ b/content/browser/notifications/notification_database_data_conversions.cc
@@ -29,11 +29,21 @@ bool DeserializeNotificationDatabaseData(const std::string& input,
message.notification_data();
notification_data->title = base::UTF8ToUTF16(payload.title());
- notification_data->direction =
- payload.direction() ==
- NotificationDatabaseDataProto::NotificationData::RIGHT_TO_LEFT ?
- PlatformNotificationData::NotificationDirectionRightToLeft :
- PlatformNotificationData::NotificationDirectionLeftToRight;
+
+ switch (payload.direction()) {
+ case NotificationDatabaseDataProto::NotificationData::LEFT_TO_RIGHT:
+ notification_data->direction =
+ PlatformNotificationData::DIRECTION_LEFT_TO_RIGHT;
+ break;
+ case NotificationDatabaseDataProto::NotificationData::RIGHT_TO_LEFT:
+ notification_data->direction =
+ PlatformNotificationData::DIRECTION_RIGHT_TO_LEFT;
+ break;
+ case NotificationDatabaseDataProto::NotificationData::AUTO:
+ notification_data->direction = PlatformNotificationData::DIRECTION_AUTO;
+ break;
+ }
+
notification_data->lang = payload.lang();
notification_data->body = base::UTF8ToUTF16(payload.body());
notification_data->tag = payload.tag();
@@ -65,11 +75,22 @@ bool SerializeNotificationDatabaseData(const NotificationDatabaseData& input,
const PlatformNotificationData& notification_data = input.notification_data;
payload->set_title(base::UTF16ToUTF8(notification_data.title));
- payload->set_direction(
- notification_data.direction ==
- PlatformNotificationData::NotificationDirectionRightToLeft ?
- NotificationDatabaseDataProto::NotificationData::RIGHT_TO_LEFT :
- NotificationDatabaseDataProto::NotificationData::LEFT_TO_RIGHT);
+
+ switch (notification_data.direction) {
+ case PlatformNotificationData::DIRECTION_LEFT_TO_RIGHT:
+ payload->set_direction(
+ NotificationDatabaseDataProto::NotificationData::LEFT_TO_RIGHT);
+ break;
+ case PlatformNotificationData::DIRECTION_RIGHT_TO_LEFT:
+ payload->set_direction(
+ NotificationDatabaseDataProto::NotificationData::RIGHT_TO_LEFT);
+ break;
+ case PlatformNotificationData::DIRECTION_AUTO:
+ payload->set_direction(
+ NotificationDatabaseDataProto::NotificationData::AUTO);
+ break;
+ }
+
payload->set_lang(notification_data.lang);
payload->set_body(base::UTF16ToUTF8(notification_data.body));
payload->set_tag(notification_data.tag);

Powered by Google App Engine
This is Rietveld 408576698