OLD | NEW |
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_H_ | 5 #ifndef COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ |
6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ | 6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 virtual void OnImeInstanceClosed() {} | 90 virtual void OnImeInstanceClosed() {} |
91 | 91 |
92 // Called whenever the ARC input interface state changes. | 92 // Called whenever the ARC input interface state changes. |
93 virtual void OnInputInstanceReady() {} | 93 virtual void OnInputInstanceReady() {} |
94 virtual void OnInputInstanceClosed() {} | 94 virtual void OnInputInstanceClosed() {} |
95 | 95 |
96 // Called whenever the ARC notification interface state changes. | 96 // Called whenever the ARC notification interface state changes. |
97 virtual void OnNotificationsInstanceReady() {} | 97 virtual void OnNotificationsInstanceReady() {} |
98 virtual void OnNotificationsInstanceClosed() {} | 98 virtual void OnNotificationsInstanceClosed() {} |
99 | 99 |
| 100 // Called whenever the ARC net interface state changes. |
| 101 virtual void OnNetInstanceReady() {} |
| 102 virtual void OnNetInstanceClosed() {} |
| 103 |
100 // Called whenever the ARC power interface state changes. | 104 // Called whenever the ARC power interface state changes. |
101 virtual void OnPowerInstanceReady() {} | 105 virtual void OnPowerInstanceReady() {} |
102 virtual void OnPowerInstanceClosed() {} | 106 virtual void OnPowerInstanceClosed() {} |
103 | 107 |
104 // Called whenever the ARC process interface state changes. | 108 // Called whenever the ARC process interface state changes. |
105 virtual void OnProcessInstanceReady() {} | 109 virtual void OnProcessInstanceReady() {} |
106 virtual void OnProcessInstanceClosed() {} | 110 virtual void OnProcessInstanceClosed() {} |
107 | 111 |
108 // Called whenever the ARC settings interface state changes. | 112 // Called whenever the ARC settings interface state changes. |
109 virtual void OnSettingsInstanceReady() {} | 113 virtual void OnSettingsInstanceReady() {} |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 152 |
149 // Gets the Mojo interface for all the instance services. This will return | 153 // Gets the Mojo interface for all the instance services. This will return |
150 // nullptr if that particular service is not ready yet. Use an Observer if | 154 // nullptr if that particular service is not ready yet. Use an Observer if |
151 // you want to be notified when this is ready. This can only be called on the | 155 // you want to be notified when this is ready. This can only be called on the |
152 // thread that this class was created on. | 156 // thread that this class was created on. |
153 AppInstance* app_instance() { return app_ptr_.get(); } | 157 AppInstance* app_instance() { return app_ptr_.get(); } |
154 AuthInstance* auth_instance() { return auth_ptr_.get(); } | 158 AuthInstance* auth_instance() { return auth_ptr_.get(); } |
155 ClipboardInstance* clipboard_instance() { return clipboard_ptr_.get(); } | 159 ClipboardInstance* clipboard_instance() { return clipboard_ptr_.get(); } |
156 ImeInstance* ime_instance() { return ime_ptr_.get(); } | 160 ImeInstance* ime_instance() { return ime_ptr_.get(); } |
157 InputInstance* input_instance() { return input_ptr_.get(); } | 161 InputInstance* input_instance() { return input_ptr_.get(); } |
| 162 NetInstance* net_instance() { return net_ptr_.get(); } |
158 NotificationsInstance* notifications_instance() { | 163 NotificationsInstance* notifications_instance() { |
159 return notifications_ptr_.get(); | 164 return notifications_ptr_.get(); |
160 } | 165 } |
161 PowerInstance* power_instance() { return power_ptr_.get(); } | 166 PowerInstance* power_instance() { return power_ptr_.get(); } |
162 ProcessInstance* process_instance() { return process_ptr_.get(); } | 167 ProcessInstance* process_instance() { return process_ptr_.get(); } |
163 SettingsInstance* settings_instance() { return settings_ptr_.get(); } | 168 SettingsInstance* settings_instance() { return settings_ptr_.get(); } |
164 VideoInstance* video_instance() { return video_ptr_.get(); } | 169 VideoInstance* video_instance() { return video_ptr_.get(); } |
165 | 170 |
166 int32_t app_version() const { return app_ptr_.version(); } | 171 int32_t app_version() const { return app_ptr_.version(); } |
167 int32_t auth_version() const { return auth_ptr_.version(); } | 172 int32_t auth_version() const { return auth_ptr_.version(); } |
168 int32_t clipboard_version() const { return clipboard_ptr_.version(); } | 173 int32_t clipboard_version() const { return clipboard_ptr_.version(); } |
169 int32_t ime_version() const { return ime_ptr_.version(); } | 174 int32_t ime_version() const { return ime_ptr_.version(); } |
170 int32_t input_version() const { return input_ptr_.version(); } | 175 int32_t input_version() const { return input_ptr_.version(); } |
171 int32_t notifications_version() const { return notifications_ptr_.version(); } | 176 int32_t notifications_version() const { return notifications_ptr_.version(); } |
172 int32_t power_version() const { return power_ptr_.version(); } | 177 int32_t power_version() const { return power_ptr_.version(); } |
173 int32_t process_version() const { return process_ptr_.version(); } | 178 int32_t process_version() const { return process_ptr_.version(); } |
174 int32_t settings_version() const { return settings_ptr_.version(); } | 179 int32_t settings_version() const { return settings_ptr_.version(); } |
175 int32_t video_version() const { return video_ptr_.version(); } | 180 int32_t video_version() const { return video_ptr_.version(); } |
176 | 181 |
177 // ArcHost: | 182 // ArcHost: |
178 void OnAppInstanceReady(AppInstancePtr app_ptr) override; | 183 void OnAppInstanceReady(AppInstancePtr app_ptr) override; |
179 void OnAuthInstanceReady(AuthInstancePtr auth_ptr) override; | 184 void OnAuthInstanceReady(AuthInstancePtr auth_ptr) override; |
180 void OnClipboardInstanceReady(ClipboardInstancePtr clipboard_ptr) override; | 185 void OnClipboardInstanceReady(ClipboardInstancePtr clipboard_ptr) override; |
181 void OnImeInstanceReady(ImeInstancePtr ime_ptr) override; | 186 void OnImeInstanceReady(ImeInstancePtr ime_ptr) override; |
182 void OnInputInstanceReady(InputInstancePtr input_ptr) override; | 187 void OnInputInstanceReady(InputInstancePtr input_ptr) override; |
| 188 void OnNetInstanceReady(NetInstancePtr net_ptr) override; |
183 void OnNotificationsInstanceReady( | 189 void OnNotificationsInstanceReady( |
184 NotificationsInstancePtr notifications_ptr) override; | 190 NotificationsInstancePtr notifications_ptr) override; |
185 void OnPowerInstanceReady(PowerInstancePtr power_ptr) override; | 191 void OnPowerInstanceReady(PowerInstancePtr power_ptr) override; |
186 void OnProcessInstanceReady(ProcessInstancePtr process_ptr) override; | 192 void OnProcessInstanceReady(ProcessInstancePtr process_ptr) override; |
187 void OnSettingsInstanceReady(SettingsInstancePtr process_ptr) override; | 193 void OnSettingsInstanceReady(SettingsInstancePtr process_ptr) override; |
188 void OnVideoInstanceReady(VideoInstancePtr video_ptr) override; | 194 void OnVideoInstanceReady(VideoInstancePtr video_ptr) override; |
189 | 195 |
190 // Gets the current state of the bridge service. | 196 // Gets the current state of the bridge service. |
191 State state() const { return state_; } | 197 State state() const { return state_; } |
192 | 198 |
(...skipping 22 matching lines...) Expand all Loading... |
215 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Prerequisites); | 221 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Prerequisites); |
216 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup); | 222 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup); |
217 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart); | 223 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart); |
218 | 224 |
219 // Called when one of the individual channels is closed. | 225 // Called when one of the individual channels is closed. |
220 void CloseAppChannel(); | 226 void CloseAppChannel(); |
221 void CloseAuthChannel(); | 227 void CloseAuthChannel(); |
222 void CloseClipboardChannel(); | 228 void CloseClipboardChannel(); |
223 void CloseImeChannel(); | 229 void CloseImeChannel(); |
224 void CloseInputChannel(); | 230 void CloseInputChannel(); |
| 231 void CloseNetChannel(); |
225 void CloseNotificationsChannel(); | 232 void CloseNotificationsChannel(); |
226 void ClosePowerChannel(); | 233 void ClosePowerChannel(); |
227 void CloseProcessChannel(); | 234 void CloseProcessChannel(); |
228 void CloseSettingsChannel(); | 235 void CloseSettingsChannel(); |
229 void CloseVideoChannel(); | 236 void CloseVideoChannel(); |
230 | 237 |
231 // Callbacks for QueryVersion. | 238 // Callbacks for QueryVersion. |
232 void OnAppVersionReady(int32_t version); | 239 void OnAppVersionReady(int32_t version); |
233 void OnAuthVersionReady(int32_t version); | 240 void OnAuthVersionReady(int32_t version); |
234 void OnClipboardVersionReady(int32_t version); | 241 void OnClipboardVersionReady(int32_t version); |
235 void OnImeVersionReady(int32_t version); | 242 void OnImeVersionReady(int32_t version); |
236 void OnInputVersionReady(int32_t version); | 243 void OnInputVersionReady(int32_t version); |
| 244 void OnNetVersionReady(int32_t version); |
237 void OnNotificationsVersionReady(int32_t version); | 245 void OnNotificationsVersionReady(int32_t version); |
238 void OnPowerVersionReady(int32_t version); | 246 void OnPowerVersionReady(int32_t version); |
239 void OnProcessVersionReady(int32_t version); | 247 void OnProcessVersionReady(int32_t version); |
240 void OnSettingsVersionReady(int32_t version); | 248 void OnSettingsVersionReady(int32_t version); |
241 void OnVideoVersionReady(int32_t version); | 249 void OnVideoVersionReady(int32_t version); |
242 | 250 |
243 // Mojo interfaces. | 251 // Mojo interfaces. |
244 AppInstancePtr app_ptr_; | 252 AppInstancePtr app_ptr_; |
245 AuthInstancePtr auth_ptr_; | 253 AuthInstancePtr auth_ptr_; |
246 ClipboardInstancePtr clipboard_ptr_; | 254 ClipboardInstancePtr clipboard_ptr_; |
247 ImeInstancePtr ime_ptr_; | 255 ImeInstancePtr ime_ptr_; |
248 InputInstancePtr input_ptr_; | 256 InputInstancePtr input_ptr_; |
| 257 NetInstancePtr net_ptr_; |
249 NotificationsInstancePtr notifications_ptr_; | 258 NotificationsInstancePtr notifications_ptr_; |
250 PowerInstancePtr power_ptr_; | 259 PowerInstancePtr power_ptr_; |
251 ProcessInstancePtr process_ptr_; | 260 ProcessInstancePtr process_ptr_; |
252 SettingsInstancePtr settings_ptr_; | 261 SettingsInstancePtr settings_ptr_; |
253 VideoInstancePtr video_ptr_; | 262 VideoInstancePtr video_ptr_; |
254 | 263 |
255 // Temporary Mojo interfaces. After a Mojo interface pointer has been | 264 // Temporary Mojo interfaces. After a Mojo interface pointer has been |
256 // received from the other endpoint, we still need to asynchronously query | 265 // received from the other endpoint, we still need to asynchronously query |
257 // its version. While that is going on, we should still return nullptr on | 266 // its version. While that is going on, we should still return nullptr on |
258 // the xxx_instance() functions. | 267 // the xxx_instance() functions. |
259 // To keep the xxx_instance() functions being trivial, store the instance | 268 // To keep the xxx_instance() functions being trivial, store the instance |
260 // pointer in a temporary variable to avoid losing its reference. | 269 // pointer in a temporary variable to avoid losing its reference. |
261 AppInstancePtr temporary_app_ptr_; | 270 AppInstancePtr temporary_app_ptr_; |
262 AuthInstancePtr temporary_auth_ptr_; | 271 AuthInstancePtr temporary_auth_ptr_; |
263 ClipboardInstancePtr temporary_clipboard_ptr_; | 272 ClipboardInstancePtr temporary_clipboard_ptr_; |
264 ImeInstancePtr temporary_ime_ptr_; | 273 ImeInstancePtr temporary_ime_ptr_; |
265 InputInstancePtr temporary_input_ptr_; | 274 InputInstancePtr temporary_input_ptr_; |
| 275 NetInstancePtr temporary_net_ptr_; |
266 NotificationsInstancePtr temporary_notifications_ptr_; | 276 NotificationsInstancePtr temporary_notifications_ptr_; |
267 PowerInstancePtr temporary_power_ptr_; | 277 PowerInstancePtr temporary_power_ptr_; |
268 ProcessInstancePtr temporary_process_ptr_; | 278 ProcessInstancePtr temporary_process_ptr_; |
269 SettingsInstancePtr temporary_settings_ptr_; | 279 SettingsInstancePtr temporary_settings_ptr_; |
270 VideoInstancePtr temporary_video_ptr_; | 280 VideoInstancePtr temporary_video_ptr_; |
271 | 281 |
272 base::ObserverList<Observer> observer_list_; | 282 base::ObserverList<Observer> observer_list_; |
273 | 283 |
274 base::ThreadChecker thread_checker_; | 284 base::ThreadChecker thread_checker_; |
275 | 285 |
276 // If the ARC instance service is available. | 286 // If the ARC instance service is available. |
277 bool available_; | 287 bool available_; |
278 | 288 |
279 // The current state of the bridge. | 289 // The current state of the bridge. |
280 ArcBridgeService::State state_; | 290 ArcBridgeService::State state_; |
281 | 291 |
282 // WeakPtrFactory to use callbacks. | 292 // WeakPtrFactory to use callbacks. |
283 base::WeakPtrFactory<ArcBridgeService> weak_factory_; | 293 base::WeakPtrFactory<ArcBridgeService> weak_factory_; |
284 | 294 |
285 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); | 295 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); |
286 }; | 296 }; |
287 | 297 |
288 } // namespace arc | 298 } // namespace arc |
289 | 299 |
290 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ | 300 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ |
OLD | NEW |