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

Unified Diff: ui/arc/notification/arc_notification_item.cc

Issue 1924213002: ARC: Support Android Notification Priority (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/arc/notification/arc_notification_item.cc
diff --git a/ui/arc/notification/arc_notification_item.cc b/ui/arc/notification/arc_notification_item.cc
index dc7288546f67f9027a7a9f57c14738782afb4e74..e25c951a2b2df5c9d50089cfbdd69d6f5fb19c65 100644
--- a/ui/arc/notification/arc_notification_item.cc
+++ b/ui/arc/notification/arc_notification_item.cc
@@ -39,6 +39,25 @@ SkBitmap DecodeImage(const std::vector<uint8_t>& data) {
return bitmap;
}
+// Convert from Android notification priority to Chrome notification priority.
hidehiko 2016/05/01 17:13:36 nit: s/Convert/Converts/
yoshiki 2016/05/02 06:52:47 Done.
+int convertAndroidPriority(const int androidPriority) {
hidehiko 2016/05/01 17:13:35 nit: s/androidPriority/android_priority/ for chrom
yoshiki 2016/05/02 06:52:47 Thanks, I confused. Fixed.
+ switch (androidPriority) {
+ case -2: // PRIORITY_MIN
+ case -1: // PRIORITY_LOW
+ return -2;
+ case 0: // PRIORITY_DEFAULT
+ // Mapped to Chrome's -1, not to pop up the notification.
hidehiko 2016/05/01 17:13:36 How about; On Android, PRIORITY_DEFAULT does not
yoshiki 2016/05/02 06:52:47 Thank you for suggestion. Done.
+ return -1;
+ case 1: // PRIORITY_HIGH
+ return 0;
+ case 2: // PRIORITY_MAX
+ return 2;
+ default:
+ NOTREACHED() << "Invalid Priority";
hidehiko 2016/05/01 17:13:35 nit: NOTREACHED() << "Invalid Priority: " << andr
yoshiki 2016/05/02 06:52:47 It should be useful. Done.
+ return 0;
+ }
+}
+
class ArcNotificationDelegate : public message_center::NotificationDelegate {
public:
explicit ArcNotificationDelegate(base::WeakPtr<ArcNotificationItem> item)
@@ -139,6 +158,8 @@ void ArcNotificationItem::UpdateWithArcNotificationData(
// are false.
rich_data.pinned = (data.no_clear || data.ongoing_event);
+ rich_data.priority = convertAndroidPriority(data.priority);
+
// The identifier of the notifier, which is used to distinguish the notifiers
// in the message center.
message_center::NotifierId notifier_id(
« 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