OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_ARC_NOTIFICATION_ARC_NOTIFICATION_ITEM_H_ |
| 6 #define UI_ARC_NOTIFICATION_ARC_NOTIFICATION_ITEM_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/threading/thread_checker.h" |
| 13 #include "components/signin/core/account_id/account_id.h" |
| 14 #include "third_party/skia/include/core/SkBitmap.h" |
| 15 #include "ui/arc/notification/arc_notification_manager.h" |
| 16 #include "ui/message_center/message_center.h" |
| 17 |
| 18 namespace arc { |
| 19 |
| 20 class ArcNotificationItem { |
| 21 public: |
| 22 ArcNotificationItem(ArcNotificationManager* manager, |
| 23 message_center::MessageCenter* message_center, |
| 24 const ArcNotificationData& data, |
| 25 const AccountId& profile_id); |
| 26 ~ArcNotificationItem(); |
| 27 |
| 28 void UpdateWithArcNotificationData(const ArcNotificationData& data); |
| 29 |
| 30 // Methods called from ArcNotificationManager: |
| 31 void OnClosedFromAndroid(); |
| 32 |
| 33 // Methods called from ArcNotificationItemDelegate: |
| 34 void Close(bool by_user); |
| 35 void Click(); |
| 36 |
| 37 private: |
| 38 void OnImageDecoded(const SkBitmap& bitmap); |
| 39 |
| 40 ArcNotificationManager* const manager_; |
| 41 message_center::MessageCenter* const message_center_; |
| 42 const AccountId profile_id_; |
| 43 |
| 44 const std::string notification_key_; |
| 45 const std::string notification_id_; |
| 46 |
| 47 // Stores on-going notification data during the image decoding. |
| 48 // This field will be removed after removing async task of image decoding. |
| 49 scoped_ptr<message_center::Notification> notification_; |
| 50 |
| 51 // The flag to indicate that the removing is initiated by the manager and we |
| 52 // don't need to notify a remove event to the manager. |
| 53 // This is true only when: |
| 54 // (1) the notification is being removed |
| 55 // (2) the removing is initiated by manager |
| 56 bool being_removed_by_manager_ = false; |
| 57 |
| 58 // Stores the latest notification data which is newer than the on-going data. |
| 59 // If the on-going data is either none or the latest, this is null. |
| 60 // This field will be removed after removing async task of image decoding. |
| 61 ArcNotificationDataPtr newer_data_; |
| 62 |
| 63 base::ThreadChecker thread_checker_; |
| 64 base::WeakPtrFactory<ArcNotificationItem> weak_ptr_factory_; |
| 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(ArcNotificationItem); |
| 67 }; |
| 68 |
| 69 } // namespace arc |
| 70 |
| 71 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_ITEM_H_ |
OLD | NEW |