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