Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: ui/arc/notification/arc_notification_manager.h

Issue 2133503002: arc: Revamp the ArcBridgeService interface (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: More rebasing Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/arc/BUILD.gn ('k') | ui/arc/notification/arc_notification_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/arc/instance_holder.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;
21 22
22 class ArcNotificationManager : public ArcService, 23 class ArcNotificationManager
23 public ArcBridgeService::Observer, 24 : public ArcService,
24 public mojom::NotificationsHost { 25 public InstanceHolder<mojom::NotificationsInstance>::Observer,
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,
31 message_center::MessageCenter* message_center); 33 message_center::MessageCenter* message_center);
32 34
33 ~ArcNotificationManager() override; 35 ~ArcNotificationManager() override;
34 36
35 // ArcBridgeService::Observer implementation: 37 // InstanceHolder<mojom::NotificationsInstance>::Observer implementation:
36 void OnNotificationsInstanceReady() override; 38 void OnInstanceReady() override;
37 void OnNotificationsInstanceClosed() override; 39 void OnInstanceClosed() override;
38 40
39 // mojom::NotificationsHost implementation: 41 // mojom::NotificationsHost implementation:
40 void OnNotificationPosted(mojom::ArcNotificationDataPtr data) override; 42 void OnNotificationPosted(mojom::ArcNotificationDataPtr data) override;
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(const std::string& key,
49 const std::string& key, int button_index); 51 int button_index);
50 52
51 private: 53 private:
52 const AccountId main_profile_id_; 54 const AccountId main_profile_id_;
53 message_center::MessageCenter* const message_center_; 55 message_center::MessageCenter* const message_center_;
54 56
55 using ItemMap = 57 using ItemMap =
56 std::unordered_map<std::string, std::unique_ptr<ArcNotificationItem>>; 58 std::unordered_map<std::string, std::unique_ptr<ArcNotificationItem>>;
57 ItemMap items_; 59 ItemMap items_;
58 60
59 bool ready_ = false; 61 bool ready_ = false;
60 62
61 mojo::Binding<arc::mojom::NotificationsHost> binding_; 63 mojo::Binding<arc::mojom::NotificationsHost> binding_;
62 64
63 DISALLOW_COPY_AND_ASSIGN(ArcNotificationManager); 65 DISALLOW_COPY_AND_ASSIGN(ArcNotificationManager);
64 }; 66 };
65 67
66 } // namespace arc 68 } // namespace arc
67 69
68 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_MANAGER_H_ 70 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_MANAGER_H_
OLDNEW
« no previous file with comments | « ui/arc/BUILD.gn ('k') | ui/arc/notification/arc_notification_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698