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