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_MANAGER_H_ | 5 #ifndef UI_ARC_NOTIFICATION_ARC_NOTIFICATION_MANAGER_H_ |
6 #define UI_ARC_NOTIFICATION_ARC_NOTIFICATION_MANAGER_H_ | 6 #define UI_ARC_NOTIFICATION_ARC_NOTIFICATION_MANAGER_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 #include <unordered_map> | 10 #include <unordered_map> |
10 | 11 |
11 #include "components/arc/arc_bridge_service.h" | 12 #include "components/arc/arc_bridge_service.h" |
12 #include "components/arc/arc_service.h" | 13 #include "components/arc/arc_service.h" |
13 #include "components/arc/common/notifications.mojom.h" | 14 #include "components/arc/common/notifications.mojom.h" |
14 #include "components/signin/core/account_id/account_id.h" | 15 #include "components/signin/core/account_id/account_id.h" |
15 #include "mojo/public/cpp/bindings/binding.h" | 16 #include "mojo/public/cpp/bindings/binding.h" |
16 #include "ui/message_center/message_center.h" | 17 #include "ui/message_center/message_center.h" |
17 | 18 |
18 namespace arc { | 19 namespace arc { |
19 | 20 |
20 class ArcNotificationItem; | 21 class ArcNotificationItem; |
| 22 class ArcNotificationSurfaceCollection; |
21 | 23 |
22 class ArcNotificationManager : public ArcService, | 24 class ArcNotificationManager : public ArcService, |
23 public ArcBridgeService::Observer, | 25 public ArcBridgeService::Observer, |
24 public mojom::NotificationsHost { | 26 public mojom::NotificationsHost { |
25 public: | 27 public: |
26 ArcNotificationManager(ArcBridgeService* bridge_service, | 28 ArcNotificationManager(ArcBridgeService* bridge_service, |
27 const AccountId& main_profile_id); | 29 const AccountId& main_profile_id); |
28 | 30 |
29 ArcNotificationManager(ArcBridgeService* bridge_service, | 31 ArcNotificationManager(ArcBridgeService* bridge_service, |
30 const AccountId& main_profile_id, | 32 const AccountId& main_profile_id, |
(...skipping 10 matching lines...) Expand all Loading... |
41 void OnNotificationRemoved(const mojo::String& key) override; | 43 void OnNotificationRemoved(const mojo::String& key) override; |
42 void OnToastPosted(mojom::ArcToastDataPtr data) override; | 44 void OnToastPosted(mojom::ArcToastDataPtr data) override; |
43 void OnToastCancelled(mojom::ArcToastDataPtr data) override; | 45 void OnToastCancelled(mojom::ArcToastDataPtr data) override; |
44 | 46 |
45 // Methods called from ArcNotificationItem: | 47 // Methods called from ArcNotificationItem: |
46 void SendNotificationRemovedFromChrome(const std::string& key); | 48 void SendNotificationRemovedFromChrome(const std::string& key); |
47 void SendNotificationClickedOnChrome(const std::string& key); | 49 void SendNotificationClickedOnChrome(const std::string& key); |
48 void SendNotificationButtonClickedOnChrome( | 50 void SendNotificationButtonClickedOnChrome( |
49 const std::string& key, int button_index); | 51 const std::string& key, int button_index); |
50 | 52 |
| 53 ArcNotificationSurfaceCollection* notification_surface_collection() { |
| 54 return notification_surface_collection_.get(); |
| 55 } |
| 56 |
51 private: | 57 private: |
52 const AccountId main_profile_id_; | 58 const AccountId main_profile_id_; |
53 message_center::MessageCenter* const message_center_; | 59 message_center::MessageCenter* const message_center_; |
54 | 60 |
55 using ItemMap = | 61 using ItemMap = |
56 std::unordered_map<std::string, std::unique_ptr<ArcNotificationItem>>; | 62 std::unordered_map<std::string, std::unique_ptr<ArcNotificationItem>>; |
57 ItemMap items_; | 63 ItemMap items_; |
58 | 64 |
59 bool ready_ = false; | 65 bool ready_ = false; |
60 | 66 |
| 67 std::unique_ptr<ArcNotificationSurfaceCollection> |
| 68 notification_surface_collection_; |
| 69 |
61 mojo::Binding<arc::mojom::NotificationsHost> binding_; | 70 mojo::Binding<arc::mojom::NotificationsHost> binding_; |
62 | 71 |
63 DISALLOW_COPY_AND_ASSIGN(ArcNotificationManager); | 72 DISALLOW_COPY_AND_ASSIGN(ArcNotificationManager); |
64 }; | 73 }; |
65 | 74 |
66 } // namespace arc | 75 } // namespace arc |
67 | 76 |
68 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_MANAGER_H_ | 77 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_MANAGER_H_ |
OLD | NEW |