| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 virtual void OnIntentHelperInstanceClosed() {} | 98 virtual void OnIntentHelperInstanceClosed() {} |
| 99 | 99 |
| 100 // Called whenever the ARC notification interface state changes. | 100 // Called whenever the ARC notification interface state changes. |
| 101 virtual void OnNotificationsInstanceReady() {} | 101 virtual void OnNotificationsInstanceReady() {} |
| 102 virtual void OnNotificationsInstanceClosed() {} | 102 virtual void OnNotificationsInstanceClosed() {} |
| 103 | 103 |
| 104 // Called whenever the ARC net interface state changes. | 104 // Called whenever the ARC net interface state changes. |
| 105 virtual void OnNetInstanceReady() {} | 105 virtual void OnNetInstanceReady() {} |
| 106 virtual void OnNetInstanceClosed() {} | 106 virtual void OnNetInstanceClosed() {} |
| 107 | 107 |
| 108 // Called whenever the ARC policy interface state changes. |
| 109 virtual void OnPolicyInstanceReady() {} |
| 110 virtual void OnPolicyInstanceClosed() {} |
| 111 |
| 108 // Called whenever the ARC power interface state changes. | 112 // Called whenever the ARC power interface state changes. |
| 109 virtual void OnPowerInstanceReady() {} | 113 virtual void OnPowerInstanceReady() {} |
| 110 virtual void OnPowerInstanceClosed() {} | 114 virtual void OnPowerInstanceClosed() {} |
| 111 | 115 |
| 112 // Called whenever the ARC process interface state changes. | 116 // Called whenever the ARC process interface state changes. |
| 113 virtual void OnProcessInstanceReady() {} | 117 virtual void OnProcessInstanceReady() {} |
| 114 virtual void OnProcessInstanceClosed() {} | 118 virtual void OnProcessInstanceClosed() {} |
| 115 | 119 |
| 116 // Called whenever the ARC video interface state changes. | 120 // Called whenever the ARC video interface state changes. |
| 117 virtual void OnVideoInstanceReady() {} | 121 virtual void OnVideoInstanceReady() {} |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 ClipboardInstance* clipboard_instance() { return clipboard_ptr_.get(); } | 163 ClipboardInstance* clipboard_instance() { return clipboard_ptr_.get(); } |
| 160 ImeInstance* ime_instance() { return ime_ptr_.get(); } | 164 ImeInstance* ime_instance() { return ime_ptr_.get(); } |
| 161 InputInstance* input_instance() { return input_ptr_.get(); } | 165 InputInstance* input_instance() { return input_ptr_.get(); } |
| 162 IntentHelperInstance* intent_helper_instance() { | 166 IntentHelperInstance* intent_helper_instance() { |
| 163 return intent_helper_ptr_.get(); | 167 return intent_helper_ptr_.get(); |
| 164 } | 168 } |
| 165 NetInstance* net_instance() { return net_ptr_.get(); } | 169 NetInstance* net_instance() { return net_ptr_.get(); } |
| 166 NotificationsInstance* notifications_instance() { | 170 NotificationsInstance* notifications_instance() { |
| 167 return notifications_ptr_.get(); | 171 return notifications_ptr_.get(); |
| 168 } | 172 } |
| 173 PolicyInstance* policy_instance() { return policy_ptr_.get(); } |
| 169 PowerInstance* power_instance() { return power_ptr_.get(); } | 174 PowerInstance* power_instance() { return power_ptr_.get(); } |
| 170 ProcessInstance* process_instance() { return process_ptr_.get(); } | 175 ProcessInstance* process_instance() { return process_ptr_.get(); } |
| 171 VideoInstance* video_instance() { return video_ptr_.get(); } | 176 VideoInstance* video_instance() { return video_ptr_.get(); } |
| 172 | 177 |
| 173 int32_t app_version() const { return app_ptr_.version(); } | 178 int32_t app_version() const { return app_ptr_.version(); } |
| 174 int32_t auth_version() const { return auth_ptr_.version(); } | 179 int32_t auth_version() const { return auth_ptr_.version(); } |
| 175 int32_t clipboard_version() const { return clipboard_ptr_.version(); } | 180 int32_t clipboard_version() const { return clipboard_ptr_.version(); } |
| 176 int32_t ime_version() const { return ime_ptr_.version(); } | 181 int32_t ime_version() const { return ime_ptr_.version(); } |
| 177 int32_t input_version() const { return input_ptr_.version(); } | 182 int32_t input_version() const { return input_ptr_.version(); } |
| 178 int32_t intent_helper_version() const { return intent_helper_ptr_.version(); } | 183 int32_t intent_helper_version() const { return intent_helper_ptr_.version(); } |
| 179 int32_t net_version() const { return net_ptr_.version(); } | 184 int32_t net_version() const { return net_ptr_.version(); } |
| 180 int32_t notifications_version() const { return notifications_ptr_.version(); } | 185 int32_t notifications_version() const { return notifications_ptr_.version(); } |
| 186 int32_t policy_version() const { return policy_ptr_.version(); } |
| 181 int32_t power_version() const { return power_ptr_.version(); } | 187 int32_t power_version() const { return power_ptr_.version(); } |
| 182 int32_t process_version() const { return process_ptr_.version(); } | 188 int32_t process_version() const { return process_ptr_.version(); } |
| 183 int32_t video_version() const { return video_ptr_.version(); } | 189 int32_t video_version() const { return video_ptr_.version(); } |
| 184 | 190 |
| 185 // ArcHost: | 191 // ArcHost: |
| 186 void OnAppInstanceReady(AppInstancePtr app_ptr) override; | 192 void OnAppInstanceReady(AppInstancePtr app_ptr) override; |
| 187 void OnAuthInstanceReady(AuthInstancePtr auth_ptr) override; | 193 void OnAuthInstanceReady(AuthInstancePtr auth_ptr) override; |
| 188 void OnClipboardInstanceReady(ClipboardInstancePtr clipboard_ptr) override; | 194 void OnClipboardInstanceReady(ClipboardInstancePtr clipboard_ptr) override; |
| 189 void OnImeInstanceReady(ImeInstancePtr ime_ptr) override; | 195 void OnImeInstanceReady(ImeInstancePtr ime_ptr) override; |
| 190 void OnInputInstanceReady(InputInstancePtr input_ptr) override; | 196 void OnInputInstanceReady(InputInstancePtr input_ptr) override; |
| 191 void OnIntentHelperInstanceReady( | 197 void OnIntentHelperInstanceReady( |
| 192 IntentHelperInstancePtr intent_helper_ptr) override; | 198 IntentHelperInstancePtr intent_helper_ptr) override; |
| 193 void OnNetInstanceReady(NetInstancePtr net_ptr) override; | 199 void OnNetInstanceReady(NetInstancePtr net_ptr) override; |
| 194 void OnNotificationsInstanceReady( | 200 void OnNotificationsInstanceReady( |
| 195 NotificationsInstancePtr notifications_ptr) override; | 201 NotificationsInstancePtr notifications_ptr) override; |
| 202 void OnPolicyInstanceReady(PolicyInstancePtr policy_ptr) override; |
| 196 void OnPowerInstanceReady(PowerInstancePtr power_ptr) override; | 203 void OnPowerInstanceReady(PowerInstancePtr power_ptr) override; |
| 197 void OnProcessInstanceReady(ProcessInstancePtr process_ptr) override; | 204 void OnProcessInstanceReady(ProcessInstancePtr process_ptr) override; |
| 198 void OnVideoInstanceReady(VideoInstancePtr video_ptr) override; | 205 void OnVideoInstanceReady(VideoInstancePtr video_ptr) override; |
| 199 | 206 |
| 200 // Gets the current state of the bridge service. | 207 // Gets the current state of the bridge service. |
| 201 State state() const { return state_; } | 208 State state() const { return state_; } |
| 202 | 209 |
| 203 // Gets if ARC is available in this system. | 210 // Gets if ARC is available in this system. |
| 204 bool available() const { return available_; } | 211 bool available() const { return available_; } |
| 205 | 212 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 228 | 235 |
| 229 // Called when one of the individual channels is closed. | 236 // Called when one of the individual channels is closed. |
| 230 void CloseAppChannel(); | 237 void CloseAppChannel(); |
| 231 void CloseAuthChannel(); | 238 void CloseAuthChannel(); |
| 232 void CloseClipboardChannel(); | 239 void CloseClipboardChannel(); |
| 233 void CloseImeChannel(); | 240 void CloseImeChannel(); |
| 234 void CloseInputChannel(); | 241 void CloseInputChannel(); |
| 235 void CloseIntentHelperChannel(); | 242 void CloseIntentHelperChannel(); |
| 236 void CloseNetChannel(); | 243 void CloseNetChannel(); |
| 237 void CloseNotificationsChannel(); | 244 void CloseNotificationsChannel(); |
| 245 void ClosePolicyChannel(); |
| 238 void ClosePowerChannel(); | 246 void ClosePowerChannel(); |
| 239 void CloseProcessChannel(); | 247 void CloseProcessChannel(); |
| 240 void CloseVideoChannel(); | 248 void CloseVideoChannel(); |
| 241 | 249 |
| 242 // Callbacks for QueryVersion. | 250 // Callbacks for QueryVersion. |
| 243 void OnAppVersionReady(int32_t version); | 251 void OnAppVersionReady(int32_t version); |
| 244 void OnAuthVersionReady(int32_t version); | 252 void OnAuthVersionReady(int32_t version); |
| 245 void OnClipboardVersionReady(int32_t version); | 253 void OnClipboardVersionReady(int32_t version); |
| 246 void OnImeVersionReady(int32_t version); | 254 void OnImeVersionReady(int32_t version); |
| 247 void OnInputVersionReady(int32_t version); | 255 void OnInputVersionReady(int32_t version); |
| 248 void OnIntentHelperVersionReady(int32_t version); | 256 void OnIntentHelperVersionReady(int32_t version); |
| 249 void OnNetVersionReady(int32_t version); | 257 void OnNetVersionReady(int32_t version); |
| 250 void OnNotificationsVersionReady(int32_t version); | 258 void OnNotificationsVersionReady(int32_t version); |
| 259 void OnPolicyVersionReady(int32_t version); |
| 251 void OnPowerVersionReady(int32_t version); | 260 void OnPowerVersionReady(int32_t version); |
| 252 void OnProcessVersionReady(int32_t version); | 261 void OnProcessVersionReady(int32_t version); |
| 253 void OnVideoVersionReady(int32_t version); | 262 void OnVideoVersionReady(int32_t version); |
| 254 | 263 |
| 255 // Mojo interfaces. | 264 // Mojo interfaces. |
| 256 AppInstancePtr app_ptr_; | 265 AppInstancePtr app_ptr_; |
| 257 AuthInstancePtr auth_ptr_; | 266 AuthInstancePtr auth_ptr_; |
| 258 ClipboardInstancePtr clipboard_ptr_; | 267 ClipboardInstancePtr clipboard_ptr_; |
| 259 ImeInstancePtr ime_ptr_; | 268 ImeInstancePtr ime_ptr_; |
| 260 InputInstancePtr input_ptr_; | 269 InputInstancePtr input_ptr_; |
| 261 IntentHelperInstancePtr intent_helper_ptr_; | 270 IntentHelperInstancePtr intent_helper_ptr_; |
| 262 NetInstancePtr net_ptr_; | 271 NetInstancePtr net_ptr_; |
| 263 NotificationsInstancePtr notifications_ptr_; | 272 NotificationsInstancePtr notifications_ptr_; |
| 273 PolicyInstancePtr policy_ptr_; |
| 264 PowerInstancePtr power_ptr_; | 274 PowerInstancePtr power_ptr_; |
| 265 ProcessInstancePtr process_ptr_; | 275 ProcessInstancePtr process_ptr_; |
| 266 VideoInstancePtr video_ptr_; | 276 VideoInstancePtr video_ptr_; |
| 267 | 277 |
| 268 // Temporary Mojo interfaces. After a Mojo interface pointer has been | 278 // Temporary Mojo interfaces. After a Mojo interface pointer has been |
| 269 // received from the other endpoint, we still need to asynchronously query | 279 // received from the other endpoint, we still need to asynchronously query |
| 270 // its version. While that is going on, we should still return nullptr on | 280 // its version. While that is going on, we should still return nullptr on |
| 271 // the xxx_instance() functions. | 281 // the xxx_instance() functions. |
| 272 // To keep the xxx_instance() functions being trivial, store the instance | 282 // To keep the xxx_instance() functions being trivial, store the instance |
| 273 // pointer in a temporary variable to avoid losing its reference. | 283 // pointer in a temporary variable to avoid losing its reference. |
| 274 AppInstancePtr temporary_app_ptr_; | 284 AppInstancePtr temporary_app_ptr_; |
| 275 AuthInstancePtr temporary_auth_ptr_; | 285 AuthInstancePtr temporary_auth_ptr_; |
| 276 ClipboardInstancePtr temporary_clipboard_ptr_; | 286 ClipboardInstancePtr temporary_clipboard_ptr_; |
| 277 ImeInstancePtr temporary_ime_ptr_; | 287 ImeInstancePtr temporary_ime_ptr_; |
| 278 InputInstancePtr temporary_input_ptr_; | 288 InputInstancePtr temporary_input_ptr_; |
| 279 IntentHelperInstancePtr temporary_intent_helper_ptr_; | 289 IntentHelperInstancePtr temporary_intent_helper_ptr_; |
| 280 NetInstancePtr temporary_net_ptr_; | 290 NetInstancePtr temporary_net_ptr_; |
| 281 NotificationsInstancePtr temporary_notifications_ptr_; | 291 NotificationsInstancePtr temporary_notifications_ptr_; |
| 292 PolicyInstancePtr temporary_policy_ptr_; |
| 282 PowerInstancePtr temporary_power_ptr_; | 293 PowerInstancePtr temporary_power_ptr_; |
| 283 ProcessInstancePtr temporary_process_ptr_; | 294 ProcessInstancePtr temporary_process_ptr_; |
| 284 VideoInstancePtr temporary_video_ptr_; | 295 VideoInstancePtr temporary_video_ptr_; |
| 285 | 296 |
| 286 base::ObserverList<Observer> observer_list_; | 297 base::ObserverList<Observer> observer_list_; |
| 287 | 298 |
| 288 base::ThreadChecker thread_checker_; | 299 base::ThreadChecker thread_checker_; |
| 289 | 300 |
| 290 // If the ARC instance service is available. | 301 // If the ARC instance service is available. |
| 291 bool available_; | 302 bool available_; |
| 292 | 303 |
| 293 // The current state of the bridge. | 304 // The current state of the bridge. |
| 294 ArcBridgeService::State state_; | 305 ArcBridgeService::State state_; |
| 295 | 306 |
| 296 // WeakPtrFactory to use callbacks. | 307 // WeakPtrFactory to use callbacks. |
| 297 base::WeakPtrFactory<ArcBridgeService> weak_factory_; | 308 base::WeakPtrFactory<ArcBridgeService> weak_factory_; |
| 298 | 309 |
| 299 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); | 310 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); |
| 300 }; | 311 }; |
| 301 | 312 |
| 302 } // namespace arc | 313 } // namespace arc |
| 303 | 314 |
| 304 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ | 315 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ |
| OLD | NEW |