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

Unified Diff: chrome/browser/notifications/notification_platform_bridge_linux.cc

Issue 2875443002: Linux native notifications: Support list notifications (Closed)
Patch Set: Rebase Created 3 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
« no previous file with comments | « no previous file | chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/notifications/notification_platform_bridge_linux.cc
diff --git a/chrome/browser/notifications/notification_platform_bridge_linux.cc b/chrome/browser/notifications/notification_platform_bridge_linux.cc
index 602b7b3047963c747b8d7246f67cdb8750e763af..1a6f902197f5395ebab5cbf05037fdd130ee39f0 100644
--- a/chrome/browser/notifications/notification_platform_bridge_linux.cc
+++ b/chrome/browser/notifications/notification_platform_bridge_linux.cc
@@ -475,11 +475,27 @@ class NotificationPlatformBridgeLinuxImpl
std::string body;
if (base::ContainsKey(capabilities_, kCapabilityBody)) {
body = base::UTF16ToUTF8(notification->message());
- if (base::ContainsKey(capabilities_, kCapabilityBodyMarkup)) {
+ const bool body_markup =
+ base::ContainsKey(capabilities_, kCapabilityBodyMarkup);
+ if (body_markup) {
base::ReplaceSubstringsAfterOffset(&body, 0, "&", "&");
base::ReplaceSubstringsAfterOffset(&body, 0, "<", "&lt;");
base::ReplaceSubstringsAfterOffset(&body, 0, ">", "&gt;");
}
+ if (notification->type() == message_center::NOTIFICATION_TYPE_MULTIPLE) {
+ for (const auto& item : notification->items()) {
+ if (!body.empty())
+ body += "\n";
+ const std::string title = base::UTF16ToUTF8(item.title);
+ const std::string message = base::UTF16ToUTF8(item.message);
+ // TODO(peter): Figure out the right way to internationalize
+ // this for RTL languages.
+ if (body_markup)
+ body += "<b>" + title + "</b> " + message;
+ else
+ body += title + " - " + message;
+ }
+ }
}
writer.AppendString(body);
« no previous file with comments | « no previous file | chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698