| 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_CUSTOM_NOTIFICATION_ITEM_H_ | |
| 6 #define UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_ITEM_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/observer_list.h" | |
| 10 #include "ui/arc/notification/arc_notification_item.h" | |
| 11 #include "ui/gfx/image/image_skia.h" | |
| 12 | |
| 13 namespace arc { | |
| 14 | |
| 15 class ArcCustomNotificationItem : public ArcNotificationItem { | |
| 16 public: | |
| 17 class Observer { | |
| 18 public: | |
| 19 // Invoked when the notification data for this item has changed. | |
| 20 virtual void OnItemDestroying() = 0; | |
| 21 | |
| 22 // Invoked when the notification data for the item is updated. | |
| 23 virtual void OnItemUpdated() = 0; | |
| 24 | |
| 25 protected: | |
| 26 virtual ~Observer() = default; | |
| 27 }; | |
| 28 | |
| 29 ArcCustomNotificationItem(ArcNotificationManager* manager, | |
| 30 message_center::MessageCenter* message_center, | |
| 31 const std::string& notification_key, | |
| 32 const AccountId& profile_id); | |
| 33 ~ArcCustomNotificationItem() override; | |
| 34 | |
| 35 void UpdateWithArcNotificationData( | |
| 36 mojom::ArcNotificationDataPtr data) override; | |
| 37 | |
| 38 void CloseFromCloseButton(); | |
| 39 void OpenSettingsFromSettingsButton(); | |
| 40 | |
| 41 void AddObserver(Observer* observer); | |
| 42 void RemoveObserver(Observer* observer); | |
| 43 | |
| 44 // Increment |window_ref_count_| and a CreateNotificationWindow request | |
| 45 // is sent when |window_ref_count_| goes from zero to one. | |
| 46 void IncrementWindowRefCount(); | |
| 47 | |
| 48 // Decrement |window_ref_count_| and a CloseNotificationWindow request | |
| 49 // is sent when |window_ref_count_| goes from one to zero. | |
| 50 void DecrementWindowRefCount(); | |
| 51 | |
| 52 bool pinned() const { return pinned_; } | |
| 53 const gfx::ImageSkia& snapshot() const { return snapshot_; } | |
| 54 | |
| 55 private: | |
| 56 bool pinned_ = false; | |
| 57 gfx::ImageSkia snapshot_; | |
| 58 int window_ref_count_ = 0; | |
| 59 | |
| 60 base::ObserverList<Observer> observers_; | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationItem); | |
| 63 }; | |
| 64 | |
| 65 } // namespace arc | |
| 66 | |
| 67 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_ITEM_H_ | |
| OLD | NEW |