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

Side by Side Diff: components/arc/arc_bridge_service_impl.h

Issue 1523643002: arc-bridge: Move most methods to Mojo interfaces (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Fixed GN build Created 5 years 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ 5 #ifndef COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_
6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ 6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 18 matching lines...) Expand all
29 public: 29 public:
30 explicit ArcBridgeServiceImpl(scoped_ptr<ArcBridgeBootstrap> bootstrap); 30 explicit ArcBridgeServiceImpl(scoped_ptr<ArcBridgeBootstrap> bootstrap);
31 ~ArcBridgeServiceImpl() override; 31 ~ArcBridgeServiceImpl() override;
32 32
33 void DetectAvailability() override; 33 void DetectAvailability() override;
34 34
35 void HandleStartup() override; 35 void HandleStartup() override;
36 36
37 void Shutdown() override; 37 void Shutdown() override;
38 38
39 bool RegisterInputDevice(const std::string& name,
40 const std::string& device_type,
41 base::ScopedFD fd) override;
42
43 bool SendNotificationEventToAndroid(const std::string& key,
44 ArcNotificationEvent event) override;
45
46 // Requests to refresh an app list.
47 bool RefreshAppList() override;
48
49 // Requests to launch an app.
50 bool LaunchApp(const std::string& package,
51 const std::string& activity) override;
52
53 // Requests to load an icon of specific scale_factor.
54 bool RequestAppIcon(const std::string& package,
55 const std::string& activity,
56 ScaleFactor scale_factor) override;
57
58 // Requests ARC process list.
59 bool RequestProcessList() override;
60
61 private: 39 private:
62 friend class ArcBridgeTest; 40 friend class ArcBridgeTest;
63 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic); 41 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic);
64 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Prerequisites); 42 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Prerequisites);
65 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup); 43 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup);
66 44
67 // If all pre-requisites are true (ARC is available, it has been enabled, and 45 // If all pre-requisites are true (ARC is available, it has been enabled, and
68 // the session has started), and ARC is stopped, start ARC. If ARC is running 46 // the session has started), and ARC is stopped, start ARC. If ARC is running
69 // and the pre-requisites stop being true, stop ARC. 47 // and the pre-requisites stop being true, stop ARC.
70 void PrerequisitesChanged(); 48 void PrerequisitesChanged();
71 49
72 // Stops the running instance. 50 // Stops the running instance.
73 void StopInstance(); 51 void StopInstance();
74 52
75 // Called when the instance has reached a boot phase 53 // ArcBridgeHost:
76 void OnInstanceBootPhase(InstanceBootPhase phase) override; 54 void OnAppInstanceReady(AppInstancePtr app_ptr) override;
77 // Handler for ArcInstanceHostMsg_NotificationPosted message. 55 void OnInputInstanceReady(InputInstancePtr input_ptr) override;
78 void OnNotificationPosted(ArcNotificationDataPtr data) override; 56 void OnNotificationsInstanceReady(
79 // Handler for ArcInstanceHostMsg_NotificationRemoved message. 57 NotificationsInstancePtr notifications_ptr) override;
80 void OnNotificationRemoved(const mojo::String& key) override; 58 void OnPowerInstanceReady(PowerInstancePtr power_ptr) override;
81 59 void OnProcessListInstanceReady(
82 // Called whenever ARC sends information about available apps. 60 ProcessListInstancePtr process_list_ptr) override;
83 void OnAppListRefreshed(mojo::Array<arc::AppInfoPtr> apps) override;
84
85 // Called whenever ARC sends app icon data for specific scale factor.
86 void OnAppIcon(const mojo::String& package,
87 const mojo::String& activity,
88 ScaleFactor scale_factor,
89 mojo::Array<uint8_t> icon_png_data) override;
90
91 // Called when the latest process list is reported from ARC.
92 void OnUpdateProcessList(
93 mojo::Array<RunningAppProcessInfoPtr> processes_ptr) override;
94
95 // Called when the instance requests wake lock services
96 void OnAcquireDisplayWakeLock(DisplayWakeLockType type) override;
97 void OnReleaseDisplayWakeLock(DisplayWakeLockType type) override;
98 61
99 // ArcBridgeBootstrap::Delegate: 62 // ArcBridgeBootstrap::Delegate:
100 void OnConnectionEstablished(ArcBridgeInstancePtr instance) override; 63 void OnConnectionEstablished(ArcBridgeInstancePtr instance) override;
101 void OnStopped() override; 64 void OnStopped() override;
102 65
103 // DBus callbacks. 66 // DBus callbacks.
104 void OnArcAvailable(bool available); 67 void OnArcAvailable(bool available);
105 68
106 scoped_ptr<ArcBridgeBootstrap> bootstrap_; 69 scoped_ptr<ArcBridgeBootstrap> bootstrap_;
107 70
108 // Mojo endpoints. 71 // Mojo endpoints.
109 mojo::Binding<ArcBridgeHost> binding_; 72 mojo::Binding<ArcBridgeHost> binding_;
110 ArcBridgeInstancePtr instance_ptr_; 73 ArcBridgeInstancePtr instance_ptr_;
111 74
112 // If the user's session has started. 75 // If the user's session has started.
113 bool session_started_; 76 bool session_started_;
114 77
115 // WeakPtrFactory to use callbacks. 78 // WeakPtrFactory to use callbacks.
116 base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_; 79 base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_;
117 80
118 DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl); 81 DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl);
119 }; 82 };
120 83
121 } // namespace arc 84 } // namespace arc
122 85
123 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ 86 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698