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

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

Issue 2066853002: arc: Show custom notification via notification surface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notification-exo
Patch Set: add comment for use_custom_notification Created 4 years, 6 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
Index: ui/arc/notification/arc_notification_item.h
diff --git a/ui/arc/notification/arc_notification_item.h b/ui/arc/notification/arc_notification_item.h
index 3825de03e9e257350bca367568fc5d3085e4b104..bdaf1d51c2c8a6d86d0e0edd8acf2f895c145815 100644
--- a/ui/arc/notification/arc_notification_item.h
+++ b/ui/arc/notification/arc_notification_item.h
@@ -5,6 +5,7 @@
#ifndef UI_ARC_NOTIFICATION_ARC_NOTIFICATION_ITEM_H_
#define UI_ARC_NOTIFICATION_ARC_NOTIFICATION_ITEM_H_
+#include <memory>
#include <string>
#include "base/macros.h"
@@ -25,9 +26,10 @@ class ArcNotificationItem {
message_center::MessageCenter* message_center,
const std::string& notification_key,
const AccountId& profile_id);
- ~ArcNotificationItem();
+ virtual ~ArcNotificationItem();
- void UpdateWithArcNotificationData(const mojom::ArcNotificationData& data);
+ virtual void UpdateWithArcNotificationData(
+ const mojom::ArcNotificationData& data);
// Methods called from ArcNotificationManager:
void OnClosedFromAndroid(bool by_user);
@@ -37,6 +39,31 @@ class ArcNotificationItem {
void Click();
void ButtonClick(int button_index);
+ protected:
+ static int ConvertAndroidPriority(int android_priority);
+
+ // Checks whether there is on-going |notification_|. If so, cache the |data|
+ // in |newer_data_| and returns true. Otherwise, returns false.
+ bool CacheArcNotificationData(const mojom::ArcNotificationData& data);
+
+ // Sets the pending |notification_|.
+ void SetNotification(
+ std::unique_ptr<message_center::Notification> notification);
+
+ // Add |notification_| to message center and update again if there is
+ // |newer_data_|.
+ void AddToMessageCenter();
+
+ bool CalledOnValidThread() const;
+
+ const AccountId& profile_id() const { return profile_id_; }
+ const std::string& notification_key() const { return notification_key_; }
+ const std::string& notification_id() const { return notification_id_; }
+
+ message_center::Notification* pending_notification() {
+ return notification_.get();
+ }
+
private:
void OnImageDecoded(const SkBitmap& bitmap);

Powered by Google App Engine
This is Rietveld 408576698