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

Side by Side Diff: chrome/browser/notifications/notification_platform_bridge_linux.cc

Issue 2866333002: Linux native notifications: Add percentage to title for progress notifications (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/notifications/notification_platform_bridge_linux.h" 5 #include "chrome/browser/notifications/notification_platform_bridge_linux.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <unordered_map> 10 #include <unordered_map>
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 dbus::MessageWriter writer(&method_call); 425 dbus::MessageWriter writer(&method_call);
426 426
427 // app_name passed implicitly via desktop-entry. 427 // app_name passed implicitly via desktop-entry.
428 writer.AppendString(""); 428 writer.AppendString("");
429 429
430 writer.AppendUint32(data->dbus_id); 430 writer.AppendUint32(data->dbus_id);
431 431
432 // app_icon passed implicitly via desktop-entry. 432 // app_icon passed implicitly via desktop-entry.
433 writer.AppendString(""); 433 writer.AppendString("");
434 434
435 writer.AppendString(base::UTF16ToUTF8(notification->title())); 435 std::string summary = base::UTF16ToUTF8(notification->title());
436 if (notification->type() == message_center::NOTIFICATION_TYPE_PROGRESS)
437 summary = base::IntToString(notification->progress()) + "% - " + summary;
Peter Beverloo 2017/05/09 22:51:54 nit: prefer base::FormatPercent() You should prob
Tom (Use chromium acct) 2017/05/10 20:10:20 Done.
438 writer.AppendString(summary);
436 439
437 std::string body; 440 std::string body;
438 if (base::ContainsKey(capabilities_, "body")) { 441 if (base::ContainsKey(capabilities_, "body")) {
439 body = base::UTF16ToUTF8(notification->message()); 442 body = base::UTF16ToUTF8(notification->message());
440 if (base::ContainsKey(capabilities_, "body-markup")) { 443 if (base::ContainsKey(capabilities_, "body-markup")) {
441 base::ReplaceSubstringsAfterOffset(&body, 0, "&", "&amp;"); 444 base::ReplaceSubstringsAfterOffset(&body, 0, "&", "&amp;");
442 base::ReplaceSubstringsAfterOffset(&body, 0, "<", "&lt;"); 445 base::ReplaceSubstringsAfterOffset(&body, 0, "<", "&lt;");
443 base::ReplaceSubstringsAfterOffset(&body, 0, ">", "&gt;"); 446 base::ReplaceSubstringsAfterOffset(&body, 0, ">", "&gt;");
444 } 447 }
445 } 448 }
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 } 791 }
789 792
790 void NotificationPlatformBridgeLinux::SetReadyCallback( 793 void NotificationPlatformBridgeLinux::SetReadyCallback(
791 NotificationBridgeReadyCallback callback) { 794 NotificationBridgeReadyCallback callback) {
792 impl_->SetReadyCallback(std::move(callback)); 795 impl_->SetReadyCallback(std::move(callback));
793 } 796 }
794 797
795 void NotificationPlatformBridgeLinux::CleanUp() { 798 void NotificationPlatformBridgeLinux::CleanUp() {
796 impl_->CleanUp(); 799 impl_->CleanUp();
797 } 800 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698