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

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

Issue 2522553003: Mojo C++ bindings: switch WebKit mojom targets to use STL/WTF types. (Closed)
Patch Set: . Created 4 years, 1 month 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/type_converters.cc
diff --git a/content/browser/notifications/type_converters.cc b/content/browser/notifications/type_converters.cc
index 823eaa16d6fa09fe584bead2a2f1a95c9920448d..7153615c0caa4585e8c2519258592c349ade2095 100644
--- a/content/browser/notifications/type_converters.cc
+++ b/content/browser/notifications/type_converters.cc
@@ -17,7 +17,7 @@ TypeConverter<PlatformNotificationData, blink::mojom::NotificationPtr>::Convert(
const blink::mojom::NotificationPtr& notification) {
PlatformNotificationData notification_data;
- notification_data.title = base::UTF8ToUTF16(notification->title.get());
+ notification_data.title = base::UTF8ToUTF16(notification->title);
switch (notification->direction) {
case NotificationDirection::LEFT_TO_RIGHT:
@@ -33,11 +33,11 @@ TypeConverter<PlatformNotificationData, blink::mojom::NotificationPtr>::Convert(
break;
}
- notification_data.lang = notification->lang;
- notification_data.body = base::UTF8ToUTF16(notification->body.get());
+ notification_data.lang = notification->lang.value_or(std::string());
+ notification_data.body = base::UTF8ToUTF16(notification->body);
notification_data.tag = notification->tag;
- notification_data.icon = GURL(notification->icon.get());
- notification_data.badge = GURL(notification->badge.get());
+ notification_data.icon = GURL(notification->icon);
+ notification_data.badge = GURL(notification->badge);
for (uint32_t vibration : notification->vibration_pattern)
notification_data.vibration_pattern.push_back(static_cast<int>(vibration));
@@ -62,11 +62,11 @@ TypeConverter<PlatformNotificationData, blink::mojom::NotificationPtr>::Convert(
}
data_action.action = action->action;
- data_action.title = base::UTF8ToUTF16(action->title.get());
- data_action.icon = GURL(action->icon.get());
- if (!action->placeholder.is_null()) {
+ data_action.title = base::UTF8ToUTF16(action->title);
+ data_action.icon = GURL(action->icon);
+ if (action->placeholder.has_value()) {
data_action.placeholder = base::NullableString16(
- base::UTF8ToUTF16(action->placeholder.get()), false /* is_null */);
+ base::UTF8ToUTF16(action->placeholder.value()), false /* is_null */);
}
notification_data.actions.push_back(data_action);
@@ -95,7 +95,7 @@ TypeConverter<blink::mojom::NotificationPtr, PlatformNotificationData>::Convert(
break;
}
- notification->lang = notification_data.lang;
+ notification->lang.emplace(notification_data.lang);
notification->body = base::UTF16ToUTF8(notification_data.body);
notification->tag = notification_data.tag;
notification->icon = notification_data.icon.spec();
@@ -128,7 +128,8 @@ TypeConverter<blink::mojom::NotificationPtr, PlatformNotificationData>::Convert(
action->title = base::UTF16ToUTF8(data_action.title);
action->icon = data_action.icon.spec();
if (!data_action.placeholder.is_null())
- action->placeholder = base::UTF16ToUTF8(data_action.placeholder.string());
+ action->placeholder.emplace(
+ base::UTF16ToUTF8(data_action.placeholder.string()));
notification->actions.push_back(std::move(action));
}

Powered by Google App Engine
This is Rietveld 408576698