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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/containers/scoped_ptr_hash_map.h" | 11 #include "base/containers/scoped_ptr_hash_map.h" |
12 #include "components/arc/arc_bridge_service.h" | 12 #include "components/arc/arc_bridge_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 | 17 |
17 namespace arc { | 18 namespace arc { |
18 | 19 |
19 class ArcNotificationItem; | 20 class ArcNotificationItem; |
20 | 21 |
21 class ArcNotificationManager : public ArcBridgeService::Observer, | 22 class ArcNotificationManager : public ArcService, |
| 23 public ArcBridgeService::Observer, |
22 public NotificationsHost { | 24 public NotificationsHost { |
23 public: | 25 public: |
24 ArcNotificationManager(ArcBridgeService* bridge_service, | 26 ArcNotificationManager(ArcBridgeService* bridge_service, |
25 const AccountId& main_profile_id); | 27 const AccountId& main_profile_id); |
26 ~ArcNotificationManager() override; | 28 ~ArcNotificationManager() override; |
27 | 29 |
28 // ArcBridgeService::Observer implementation: | 30 // ArcBridgeService::Observer implementation: |
29 void OnNotificationsInstanceReady() override; | 31 void OnNotificationsInstanceReady() override; |
30 | 32 |
31 // NotificationsHost implementation: | 33 // NotificationsHost implementation: |
32 void OnNotificationPosted(ArcNotificationDataPtr data) override; | 34 void OnNotificationPosted(ArcNotificationDataPtr data) override; |
33 void OnNotificationRemoved(const mojo::String& key) override; | 35 void OnNotificationRemoved(const mojo::String& key) override; |
34 | 36 |
35 // Methods called from ArcNotificationItem: | 37 // Methods called from ArcNotificationItem: |
36 void SendNotificationRemovedFromChrome(const std::string& key); | 38 void SendNotificationRemovedFromChrome(const std::string& key); |
37 void SendNotificationClickedOnChrome(const std::string& key); | 39 void SendNotificationClickedOnChrome(const std::string& key); |
38 | 40 |
39 private: | 41 private: |
40 ArcBridgeService* const arc_bridge_; | |
41 const AccountId main_profile_id_; | 42 const AccountId main_profile_id_; |
42 | 43 |
43 using ItemMap = | 44 using ItemMap = |
44 base::ScopedPtrHashMap<std::string, scoped_ptr<ArcNotificationItem>>; | 45 base::ScopedPtrHashMap<std::string, scoped_ptr<ArcNotificationItem>>; |
45 ItemMap items_; | 46 ItemMap items_; |
46 | 47 |
47 mojo::Binding<arc::NotificationsHost> binding_; | 48 mojo::Binding<arc::NotificationsHost> binding_; |
48 | 49 |
49 DISALLOW_COPY_AND_ASSIGN(ArcNotificationManager); | 50 DISALLOW_COPY_AND_ASSIGN(ArcNotificationManager); |
50 }; | 51 }; |
51 | 52 |
52 } // namespace arc | 53 } // namespace arc |
53 | 54 |
54 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_MANAGER_H_ | 55 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_MANAGER_H_ |
OLD | NEW |