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