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 | |
40 void AddObserver(Observer* observer); | |
41 void RemoveObserver(Observer* observer); | |
42 | |
43 // Increment |window_ref_count_| and a CreateNotificationWindow request | |
44 // is sent when |window_ref_count_| goes from zero to one. | |
45 void IncrementWindowRefCount(); | |
46 | |
47 // Decrement |window_ref_count_| and a CloseNotificationWindow request | |
48 // is sent when |window_ref_count_| goes from one to zero. | |
49 void DecrementWindowRefCount(); | |
50 | |
51 bool pinned() const { return pinned_; } | |
52 const gfx::ImageSkia& snapshot() const { return snapshot_; } | |
53 mojom::ArcNotificationExpandState expand_state() const { | |
54 return expand_state_; | |
55 } | |
56 mojom::ArcNotificationShownContents shown_contents() const { | |
57 return shown_contents_; | |
58 } | |
59 | |
60 private: | |
61 bool pinned_ = false; | |
62 mojom::ArcNotificationExpandState expand_state_ = | |
63 mojom::ArcNotificationExpandState::FIXED_SIZE; | |
64 mojom::ArcNotificationShownContents shown_contents_ = | |
65 mojom::ArcNotificationShownContents::CONTENTS_SHOWN; | |
66 gfx::ImageSkia snapshot_; | |
67 int window_ref_count_ = 0; | |
68 | |
69 base::ObserverList<Observer> observers_; | |
70 | |
71 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationItem); | |
72 }; | |
73 | |
74 } // namespace arc | |
75 | |
76 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_ITEM_H_ | |
OLD | NEW |