| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef UI_ARC_NOTIFICATION_ARC_NOTIFICATION_ITEM_H_ | 5 #ifndef UI_ARC_NOTIFICATION_ARC_NOTIFICATION_ITEM_H_ |
| 6 #define UI_ARC_NOTIFICATION_ARC_NOTIFICATION_ITEM_H_ | 6 #define UI_ARC_NOTIFICATION_ARC_NOTIFICATION_ITEM_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 const mojom::ArcNotificationData& data); | 32 const mojom::ArcNotificationData& data); |
| 33 | 33 |
| 34 // Methods called from ArcNotificationManager: | 34 // Methods called from ArcNotificationManager: |
| 35 void OnClosedFromAndroid(bool by_user); | 35 void OnClosedFromAndroid(bool by_user); |
| 36 | 36 |
| 37 // Methods called from ArcNotificationItemDelegate: | 37 // Methods called from ArcNotificationItemDelegate: |
| 38 void Close(bool by_user); | 38 void Close(bool by_user); |
| 39 void Click(); | 39 void Click(); |
| 40 void ButtonClick(int button_index); | 40 void ButtonClick(int button_index); |
| 41 | 41 |
| 42 const std::string& notification_key() const { return notification_key_; } |
| 43 |
| 42 protected: | 44 protected: |
| 43 static int ConvertAndroidPriority(int android_priority); | 45 static int ConvertAndroidPriority(int android_priority); |
| 44 static gfx::Image ConvertAndroidSmallIcon( | 46 static gfx::Image ConvertAndroidSmallIcon( |
| 45 const mojom::ArcBitmapPtr& arc_bitmap); | 47 const mojom::ArcBitmapPtr& arc_bitmap); |
| 46 | 48 |
| 47 // Checks whether there is on-going |notification_|. If so, cache the |data| | 49 // Checks whether there is on-going |notification_|. If so, cache the |data| |
| 48 // in |newer_data_| and returns true. Otherwise, returns false. | 50 // in |newer_data_| and returns true. Otherwise, returns false. |
| 49 bool CacheArcNotificationData(const mojom::ArcNotificationData& data); | 51 bool CacheArcNotificationData(const mojom::ArcNotificationData& data); |
| 50 | 52 |
| 51 // Sets the pending |notification_|. | 53 // Sets the pending |notification_|. |
| 52 void SetNotification( | 54 void SetNotification( |
| 53 std::unique_ptr<message_center::Notification> notification); | 55 std::unique_ptr<message_center::Notification> notification); |
| 54 | 56 |
| 55 // Add |notification_| to message center and update again if there is | 57 // Add |notification_| to message center and update again if there is |
| 56 // |newer_data_|. | 58 // |newer_data_|. |
| 57 void AddToMessageCenter(); | 59 void AddToMessageCenter(); |
| 58 | 60 |
| 59 bool CalledOnValidThread() const; | 61 bool CalledOnValidThread() const; |
| 60 | 62 |
| 61 const AccountId& profile_id() const { return profile_id_; } | 63 const AccountId& profile_id() const { return profile_id_; } |
| 62 const std::string& notification_key() const { return notification_key_; } | |
| 63 const std::string& notification_id() const { return notification_id_; } | 64 const std::string& notification_id() const { return notification_id_; } |
| 64 message_center::MessageCenter* message_center() { return message_center_; } | 65 message_center::MessageCenter* message_center() { return message_center_; } |
| 66 ArcNotificationManager* manager() { return manager_; } |
| 65 | 67 |
| 66 message_center::Notification* pending_notification() { | 68 message_center::Notification* pending_notification() { |
| 67 return notification_.get(); | 69 return notification_.get(); |
| 68 } | 70 } |
| 69 | 71 |
| 70 private: | 72 private: |
| 71 void OnImageDecoded(const SkBitmap& bitmap); | 73 void OnImageDecoded(const SkBitmap& bitmap); |
| 72 | 74 |
| 73 ArcNotificationManager* const manager_; | 75 ArcNotificationManager* const manager_; |
| 74 message_center::MessageCenter* const message_center_; | 76 message_center::MessageCenter* const message_center_; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 95 | 97 |
| 96 base::ThreadChecker thread_checker_; | 98 base::ThreadChecker thread_checker_; |
| 97 base::WeakPtrFactory<ArcNotificationItem> weak_ptr_factory_; | 99 base::WeakPtrFactory<ArcNotificationItem> weak_ptr_factory_; |
| 98 | 100 |
| 99 DISALLOW_COPY_AND_ASSIGN(ArcNotificationItem); | 101 DISALLOW_COPY_AND_ASSIGN(ArcNotificationItem); |
| 100 }; | 102 }; |
| 101 | 103 |
| 102 } // namespace arc | 104 } // namespace arc |
| 103 | 105 |
| 104 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_ITEM_H_ | 106 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_ITEM_H_ |
| OLD | NEW |