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

Unified Diff: content/child/notifications/notification_manager.cc

Issue 2613003002: Use explicit WebString <-> string conversion methods for notifications (Closed)
Patch Set: build fix Created 3 years, 11 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
« no previous file with comments | « content/child/notifications/notification_data_conversions.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/notifications/notification_manager.cc
diff --git a/content/child/notifications/notification_manager.cc b/content/child/notifications/notification_manager.cc
index cc6ee3e7c33d13d3006885b0e4421862335e742d..d1598f40c60b682e9a508c0c8a070d2c0d3cce4a 100644
--- a/content/child/notifications/notification_manager.cc
+++ b/content/child/notifications/notification_manager.cc
@@ -21,6 +21,8 @@
#include "third_party/WebKit/public/platform/modules/notifications/WebNotificationDelegate.h"
#include "url/origin.h"
+using blink::WebString;
+
namespace content {
namespace {
@@ -96,7 +98,8 @@ void NotificationManager::show(
active_page_notifications_[notification_id] = ActiveNotificationData(
delegate, origin_gurl,
- base::UTF16ToUTF8(base::StringPiece16(notification_data.tag)));
+ notification_data.tag.utf8(
+ WebString::UTF8ConversionMode::kStrictReplacingErrorsWithFFFD));
// TODO(mkwst): This is potentially doing the wrong thing with unique
// origins. Perhaps also 'file:', 'blob:' and 'filesystem:'. See
@@ -181,7 +184,8 @@ void NotificationManager::getNotifications(
thread_safe_sender_->Send(new PlatformNotificationHostMsg_GetNotifications(
request_id, service_worker_registration_id, origin,
- base::UTF16ToUTF8(base::StringPiece16(filter_tag))));
+ filter_tag.utf8(
+ WebString::UTF8ConversionMode::kStrictReplacingErrorsWithFFFD)));
}
void NotificationManager::close(blink::WebNotificationDelegate* delegate) {
@@ -208,8 +212,10 @@ void NotificationManager::closePersistent(
// TODO(mkwst): This is potentially doing the wrong thing with unique
// origins. Perhaps also 'file:', 'blob:' and 'filesystem:'. See
// https://crbug.com/490074 for detail.
- url::Origin(origin).GetURL(), base::UTF16ToUTF8(base::StringPiece16(tag)),
- base::UTF16ToUTF8(base::StringPiece16(notification_id))));
+ url::Origin(origin).GetURL(),
+ tag.utf8(WebString::UTF8ConversionMode::kStrictReplacingErrorsWithFFFD),
+ notification_id.utf8(
+ WebString::UTF8ConversionMode::kStrictReplacingErrorsWithFFFD)));
}
void NotificationManager::notifyDelegateDestroyed(
« no previous file with comments | « content/child/notifications/notification_data_conversions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698