OLD | NEW |
---|---|
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 Loading... | |
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, "&", "&"); | 444 base::ReplaceSubstringsAfterOffset(&body, 0, "&", "&"); |
442 base::ReplaceSubstringsAfterOffset(&body, 0, "<", "<"); | 445 base::ReplaceSubstringsAfterOffset(&body, 0, "<", "<"); |
443 base::ReplaceSubstringsAfterOffset(&body, 0, ">", ">"); | 446 base::ReplaceSubstringsAfterOffset(&body, 0, ">", ">"); |
444 } | 447 } |
445 } | 448 } |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 } |
OLD | NEW |