| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
| 13 #include "components/signin/core/account_id/account_id.h" | 13 #include "components/signin/core/account_id/account_id.h" |
| 14 #include "third_party/skia/include/core/SkBitmap.h" | 14 #include "third_party/skia/include/core/SkBitmap.h" |
| 15 #include "ui/arc/notification/arc_notification_manager.h" | 15 #include "ui/arc/notification/arc_notification_manager.h" |
| 16 #include "ui/message_center/message_center.h" | 16 #include "ui/message_center/message_center.h" |
| 17 | 17 |
| 18 namespace arc { | 18 namespace arc { |
| 19 | 19 |
| 20 // The class represents each ARC notification. One instance of this class | 20 // The class represents each ARC notification. One instance of this class |
| 21 // corresponds to one ARC notification. | 21 // corresponds to one ARC notification. |
| 22 class ArcNotificationItem { | 22 class ArcNotificationItem { |
| 23 public: | 23 public: |
| 24 ArcNotificationItem(ArcNotificationManager* manager, | 24 ArcNotificationItem(ArcNotificationManager* manager, |
| 25 message_center::MessageCenter* message_center, | 25 message_center::MessageCenter* message_center, |
| 26 const std::string& notification_key, | 26 const std::string& notification_key, |
| 27 const AccountId& profile_id); | 27 const AccountId& profile_id); |
| 28 ~ArcNotificationItem(); | 28 ~ArcNotificationItem(); |
| 29 | 29 |
| 30 void UpdateWithArcNotificationData(const ArcNotificationData& data); | 30 void UpdateWithArcNotificationData(const mojom::ArcNotificationData& data); |
| 31 | 31 |
| 32 // Methods called from ArcNotificationManager: | 32 // Methods called from ArcNotificationManager: |
| 33 void OnClosedFromAndroid(bool by_user); | 33 void OnClosedFromAndroid(bool by_user); |
| 34 | 34 |
| 35 // Methods called from ArcNotificationItemDelegate: | 35 // Methods called from ArcNotificationItemDelegate: |
| 36 void Close(bool by_user); | 36 void Close(bool by_user); |
| 37 void Click(); | 37 void Click(); |
| 38 void ButtonClick(int button_index); | 38 void ButtonClick(int button_index); |
| 39 | 39 |
| 40 private: | 40 private: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 54 // The flag to indicate that the removing is initiated by the manager and we | 54 // The flag to indicate that the removing is initiated by the manager and we |
| 55 // don't need to notify a remove event to the manager. | 55 // don't need to notify a remove event to the manager. |
| 56 // This is true only when: | 56 // This is true only when: |
| 57 // (1) the notification is being removed | 57 // (1) the notification is being removed |
| 58 // (2) the removing is initiated by manager | 58 // (2) the removing is initiated by manager |
| 59 bool being_removed_by_manager_ = false; | 59 bool being_removed_by_manager_ = false; |
| 60 | 60 |
| 61 // Stores the latest notification data which is newer than the on-going data. | 61 // Stores the latest notification data which is newer than the on-going data. |
| 62 // If the on-going data is either none or the latest, this is null. | 62 // If the on-going data is either none or the latest, this is null. |
| 63 // This field will be removed after removing async task of image decoding. | 63 // This field will be removed after removing async task of image decoding. |
| 64 ArcNotificationDataPtr newer_data_; | 64 mojom::ArcNotificationDataPtr newer_data_; |
| 65 | 65 |
| 66 base::ThreadChecker thread_checker_; | 66 base::ThreadChecker thread_checker_; |
| 67 base::WeakPtrFactory<ArcNotificationItem> weak_ptr_factory_; | 67 base::WeakPtrFactory<ArcNotificationItem> weak_ptr_factory_; |
| 68 | 68 |
| 69 DISALLOW_COPY_AND_ASSIGN(ArcNotificationItem); | 69 DISALLOW_COPY_AND_ASSIGN(ArcNotificationItem); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 } // namespace arc | 72 } // namespace arc |
| 73 | 73 |
| 74 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_ITEM_H_ | 74 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_ITEM_H_ |
| OLD | NEW |