| 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 <string> | 8 #include <string> |
| 9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 | 10 |
| 11 #include "components/arc/arc_bridge_service.h" | 11 #include "components/arc/arc_bridge_service.h" |
| 12 #include "components/arc/arc_service.h" | 12 #include "components/arc/arc_service.h" |
| 13 #include "components/arc/common/notifications.mojom.h" | 13 #include "components/arc/common/notifications.mojom.h" |
| 14 #include "components/signin/core/account_id/account_id.h" | 14 #include "components/signin/core/account_id/account_id.h" |
| 15 #include "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
| 16 #include "ui/message_center/message_center.h" | 16 #include "ui/message_center/message_center.h" |
| 17 | 17 |
| 18 namespace arc { | 18 namespace arc { |
| 19 | 19 |
| 20 class ArcNotificationItem; | 20 class ArcNotificationItem; |
| 21 | 21 |
| 22 class ArcNotificationManager : public ArcService, | 22 class ArcNotificationManager : public ArcService, |
| 23 public ArcBridgeService::Observer, | 23 public ArcBridgeService::Observer, |
| 24 public NotificationsHost { | 24 public mojom::NotificationsHost { |
| 25 public: | 25 public: |
| 26 ArcNotificationManager(ArcBridgeService* bridge_service, | 26 ArcNotificationManager(ArcBridgeService* bridge_service, |
| 27 const AccountId& main_profile_id); | 27 const AccountId& main_profile_id); |
| 28 | 28 |
| 29 ArcNotificationManager(ArcBridgeService* bridge_service, | 29 ArcNotificationManager(ArcBridgeService* bridge_service, |
| 30 const AccountId& main_profile_id, | 30 const AccountId& main_profile_id, |
| 31 message_center::MessageCenter* message_center); | 31 message_center::MessageCenter* message_center); |
| 32 | 32 |
| 33 ~ArcNotificationManager() override; | 33 ~ArcNotificationManager() override; |
| 34 | 34 |
| 35 // ArcBridgeService::Observer implementation: | 35 // ArcBridgeService::Observer implementation: |
| 36 void OnNotificationsInstanceReady() override; | 36 void OnNotificationsInstanceReady() override; |
| 37 void OnNotificationsInstanceClosed() override; | 37 void OnNotificationsInstanceClosed() override; |
| 38 | 38 |
| 39 // NotificationsHost implementation: | 39 // mojom::NotificationsHost implementation: |
| 40 void OnNotificationPosted(ArcNotificationDataPtr data) override; | 40 void OnNotificationPosted(mojom::ArcNotificationDataPtr data) override; |
| 41 void OnNotificationRemoved(const mojo::String& key) override; | 41 void OnNotificationRemoved(const mojo::String& key) override; |
| 42 void OnToastPosted(ArcToastDataPtr data) override; | 42 void OnToastPosted(mojom::ArcToastDataPtr data) override; |
| 43 void OnToastCancelled(ArcToastDataPtr data) override; | 43 void OnToastCancelled(mojom::ArcToastDataPtr data) override; |
| 44 | 44 |
| 45 // Methods called from ArcNotificationItem: | 45 // Methods called from ArcNotificationItem: |
| 46 void SendNotificationRemovedFromChrome(const std::string& key); | 46 void SendNotificationRemovedFromChrome(const std::string& key); |
| 47 void SendNotificationClickedOnChrome(const std::string& key); | 47 void SendNotificationClickedOnChrome(const std::string& key); |
| 48 void SendNotificationButtonClickedOnChrome( | 48 void SendNotificationButtonClickedOnChrome( |
| 49 const std::string& key, int button_index); | 49 const std::string& key, int button_index); |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 const AccountId main_profile_id_; | 52 const AccountId main_profile_id_; |
| 53 message_center::MessageCenter* const message_center_; | 53 message_center::MessageCenter* const message_center_; |
| 54 | 54 |
| 55 using ItemMap = | 55 using ItemMap = |
| 56 std::unordered_map<std::string, std::unique_ptr<ArcNotificationItem>>; | 56 std::unordered_map<std::string, std::unique_ptr<ArcNotificationItem>>; |
| 57 ItemMap items_; | 57 ItemMap items_; |
| 58 | 58 |
| 59 bool ready_ = false; | 59 bool ready_ = false; |
| 60 | 60 |
| 61 mojo::Binding<arc::NotificationsHost> binding_; | 61 mojo::Binding<arc::mojom::NotificationsHost> binding_; |
| 62 | 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(ArcNotificationManager); | 63 DISALLOW_COPY_AND_ASSIGN(ArcNotificationManager); |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 } // namespace arc | 66 } // namespace arc |
| 67 | 67 |
| 68 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_MANAGER_H_ | 68 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_MANAGER_H_ |
| OLD | NEW |