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