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

Unified Diff: content/child/notifications/notification_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/child/notifications/notification_data_conversions.cc
diff --git a/content/child/notifications/notification_data_conversions.cc b/content/child/notifications/notification_data_conversions.cc
index c1eaec04c634af648a0643ea7670118a8ca17392..06e6448702cdaaad8229a319b717008ad9b1d03c 100644
--- a/content/child/notifications/notification_data_conversions.cc
+++ b/content/child/notifications/notification_data_conversions.cc
@@ -16,10 +16,22 @@ PlatformNotificationData ToPlatformNotificationData(
const WebNotificationData& web_data) {
PlatformNotificationData platform_data;
platform_data.title = web_data.title;
- platform_data.direction =
- web_data.direction == WebNotificationData::DirectionLeftToRight
- ? PlatformNotificationData::NotificationDirectionLeftToRight
- : PlatformNotificationData::NotificationDirectionRightToLeft;
+
+ switch (web_data.direction) {
+ case WebNotificationData::DirectionLeftToRight:
+ platform_data.direction =
+ PlatformNotificationData::DIRECTION_LEFT_TO_RIGHT;
+ break;
+ case WebNotificationData::DirectionRightToLeft:
+ platform_data.direction =
+ PlatformNotificationData::DIRECTION_RIGHT_TO_LEFT;
+ break;
+ case WebNotificationData::DirectionAuto:
+ platform_data.direction =
+ PlatformNotificationData::DIRECTION_AUTO;
+ break;
+ }
+
platform_data.lang = base::UTF16ToUTF8(base::StringPiece16(web_data.lang));
platform_data.body = web_data.body;
platform_data.tag = base::UTF16ToUTF8(base::StringPiece16(web_data.tag));
@@ -36,11 +48,19 @@ WebNotificationData ToWebNotificationData(
const PlatformNotificationData& platform_data) {
WebNotificationData web_data;
web_data.title = platform_data.title;
- web_data.direction =
- platform_data.direction ==
- PlatformNotificationData::NotificationDirectionLeftToRight
- ? WebNotificationData::DirectionLeftToRight
- : WebNotificationData::DirectionRightToLeft;
+
+ switch (platform_data.direction) {
+ case PlatformNotificationData::DIRECTION_LEFT_TO_RIGHT:
+ web_data.direction = WebNotificationData::DirectionLeftToRight;
+ break;
+ case PlatformNotificationData::DIRECTION_RIGHT_TO_LEFT:
+ web_data.direction = WebNotificationData::DirectionRightToLeft;
+ break;
+ case PlatformNotificationData::DIRECTION_AUTO:
+ web_data.direction = WebNotificationData::DirectionAuto;
+ break;
+ }
+
web_data.lang = blink::WebString::fromUTF8(platform_data.lang);
web_data.body = platform_data.body;
web_data.tag = blink::WebString::fromUTF8(platform_data.tag);

Powered by Google App Engine
This is Rietveld 408576698