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

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

Issue 1817093003: Host-side implementation of ARC audio bridge. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated commit message Created 4 years, 9 months 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_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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // Called whenever the state of the bridge has changed. 70 // Called whenever the state of the bridge has changed.
71 virtual void OnStateChanged(State state) {} 71 virtual void OnStateChanged(State state) {}
72 72
73 // Called whenever ARC's availability has changed for this system. 73 // Called whenever ARC's availability has changed for this system.
74 virtual void OnAvailableChanged(bool available) {} 74 virtual void OnAvailableChanged(bool available) {}
75 75
76 // Called whenever the ARC app interface state changes. 76 // Called whenever the ARC app interface state changes.
77 virtual void OnAppInstanceReady() {} 77 virtual void OnAppInstanceReady() {}
78 virtual void OnAppInstanceClosed() {} 78 virtual void OnAppInstanceClosed() {}
79 79
80 // Called whenever the ARC audio interface state changes.
81 virtual void OnAudioInstanceReady() {}
82 virtual void OnAudioInstanceClosed() {}
83
80 // Called whenever the ARC auth interface state changes. 84 // Called whenever the ARC auth interface state changes.
81 virtual void OnAuthInstanceReady() {} 85 virtual void OnAuthInstanceReady() {}
82 virtual void OnAuthInstanceClosed() {} 86 virtual void OnAuthInstanceClosed() {}
83 87
84 // Called whenever the ARC clipboard interface state changes. 88 // Called whenever the ARC clipboard interface state changes.
85 virtual void OnClipboardInstanceReady() {} 89 virtual void OnClipboardInstanceReady() {}
86 virtual void OnClipboardInstanceClosed() {} 90 virtual void OnClipboardInstanceClosed() {}
87 91
88 // Called whenever the ARC IME interface state changes. 92 // Called whenever the ARC IME interface state changes.
89 virtual void OnImeInstanceReady() {} 93 virtual void OnImeInstanceReady() {}
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // Adds or removes observers. This can only be called on the thread that this 152 // Adds or removes observers. This can only be called on the thread that this
149 // class was created on. 153 // class was created on.
150 void AddObserver(Observer* observer); 154 void AddObserver(Observer* observer);
151 void RemoveObserver(Observer* observer); 155 void RemoveObserver(Observer* observer);
152 156
153 // Gets the Mojo interface for all the instance services. This will return 157 // Gets the Mojo interface for all the instance services. This will return
154 // nullptr if that particular service is not ready yet. Use an Observer if 158 // nullptr if that particular service is not ready yet. Use an Observer if
155 // you want to be notified when this is ready. This can only be called on the 159 // you want to be notified when this is ready. This can only be called on the
156 // thread that this class was created on. 160 // thread that this class was created on.
157 AppInstance* app_instance() { return app_ptr_.get(); } 161 AppInstance* app_instance() { return app_ptr_.get(); }
162 AudioInstance* audio_instance() { return audio_ptr_.get(); }
158 AuthInstance* auth_instance() { return auth_ptr_.get(); } 163 AuthInstance* auth_instance() { return auth_ptr_.get(); }
159 ClipboardInstance* clipboard_instance() { return clipboard_ptr_.get(); } 164 ClipboardInstance* clipboard_instance() { return clipboard_ptr_.get(); }
160 ImeInstance* ime_instance() { return ime_ptr_.get(); } 165 ImeInstance* ime_instance() { return ime_ptr_.get(); }
161 InputInstance* input_instance() { return input_ptr_.get(); } 166 InputInstance* input_instance() { return input_ptr_.get(); }
162 IntentHelperInstance* intent_helper_instance() { 167 IntentHelperInstance* intent_helper_instance() {
163 return intent_helper_ptr_.get(); 168 return intent_helper_ptr_.get();
164 } 169 }
165 NetInstance* net_instance() { return net_ptr_.get(); } 170 NetInstance* net_instance() { return net_ptr_.get(); }
166 NotificationsInstance* notifications_instance() { 171 NotificationsInstance* notifications_instance() {
167 return notifications_ptr_.get(); 172 return notifications_ptr_.get();
168 } 173 }
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(); }
179 int32_t audio_version() const { return audio_ptr_.version(); }
174 int32_t auth_version() const { return auth_ptr_.version(); } 180 int32_t auth_version() const { return auth_ptr_.version(); }
175 int32_t clipboard_version() const { return clipboard_ptr_.version(); } 181 int32_t clipboard_version() const { return clipboard_ptr_.version(); }
176 int32_t ime_version() const { return ime_ptr_.version(); } 182 int32_t ime_version() const { return ime_ptr_.version(); }
177 int32_t input_version() const { return input_ptr_.version(); } 183 int32_t input_version() const { return input_ptr_.version(); }
178 int32_t intent_helper_version() const { return intent_helper_ptr_.version(); } 184 int32_t intent_helper_version() const { return intent_helper_ptr_.version(); }
179 int32_t net_version() const { return net_ptr_.version(); } 185 int32_t net_version() const { return net_ptr_.version(); }
180 int32_t notifications_version() const { return notifications_ptr_.version(); } 186 int32_t notifications_version() const { return notifications_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;
193 void OnAudioInstanceReady(AudioInstancePtr audio_ptr) override;
187 void OnAuthInstanceReady(AuthInstancePtr auth_ptr) override; 194 void OnAuthInstanceReady(AuthInstancePtr auth_ptr) override;
188 void OnClipboardInstanceReady(ClipboardInstancePtr clipboard_ptr) override; 195 void OnClipboardInstanceReady(ClipboardInstancePtr clipboard_ptr) override;
189 void OnImeInstanceReady(ImeInstancePtr ime_ptr) override; 196 void OnImeInstanceReady(ImeInstancePtr ime_ptr) override;
190 void OnInputInstanceReady(InputInstancePtr input_ptr) override; 197 void OnInputInstanceReady(InputInstancePtr input_ptr) override;
191 void OnIntentHelperInstanceReady( 198 void OnIntentHelperInstanceReady(
192 IntentHelperInstancePtr intent_helper_ptr) override; 199 IntentHelperInstancePtr intent_helper_ptr) override;
193 void OnNetInstanceReady(NetInstancePtr net_ptr) override; 200 void OnNetInstanceReady(NetInstancePtr net_ptr) override;
194 void OnNotificationsInstanceReady( 201 void OnNotificationsInstanceReady(
195 NotificationsInstancePtr notifications_ptr) override; 202 NotificationsInstancePtr notifications_ptr) override;
196 void OnPowerInstanceReady(PowerInstancePtr power_ptr) override; 203 void OnPowerInstanceReady(PowerInstancePtr power_ptr) override;
(...skipping 25 matching lines...) Expand all
222 229
223 private: 230 private:
224 friend class ArcBridgeTest; 231 friend class ArcBridgeTest;
225 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic); 232 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic);
226 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Prerequisites); 233 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Prerequisites);
227 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup); 234 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup);
228 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart); 235 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart);
229 236
230 // Called when one of the individual channels is closed. 237 // Called when one of the individual channels is closed.
231 void CloseAppChannel(); 238 void CloseAppChannel();
239 void CloseAudioChannel();
232 void CloseAuthChannel(); 240 void CloseAuthChannel();
233 void CloseClipboardChannel(); 241 void CloseClipboardChannel();
234 void CloseImeChannel(); 242 void CloseImeChannel();
235 void CloseInputChannel(); 243 void CloseInputChannel();
236 void CloseIntentHelperChannel(); 244 void CloseIntentHelperChannel();
237 void CloseNetChannel(); 245 void CloseNetChannel();
238 void CloseNotificationsChannel(); 246 void CloseNotificationsChannel();
239 void ClosePowerChannel(); 247 void ClosePowerChannel();
240 void CloseProcessChannel(); 248 void CloseProcessChannel();
241 void CloseVideoChannel(); 249 void CloseVideoChannel();
242 250
243 // Callbacks for QueryVersion. 251 // Callbacks for QueryVersion.
244 void OnAppVersionReady(int32_t version); 252 void OnAppVersionReady(int32_t version);
253 void OnAudioVersionReady(int32_t version);
245 void OnAuthVersionReady(int32_t version); 254 void OnAuthVersionReady(int32_t version);
246 void OnClipboardVersionReady(int32_t version); 255 void OnClipboardVersionReady(int32_t version);
247 void OnImeVersionReady(int32_t version); 256 void OnImeVersionReady(int32_t version);
248 void OnInputVersionReady(int32_t version); 257 void OnInputVersionReady(int32_t version);
249 void OnIntentHelperVersionReady(int32_t version); 258 void OnIntentHelperVersionReady(int32_t version);
250 void OnNetVersionReady(int32_t version); 259 void OnNetVersionReady(int32_t version);
251 void OnNotificationsVersionReady(int32_t version); 260 void OnNotificationsVersionReady(int32_t version);
252 void OnPowerVersionReady(int32_t version); 261 void OnPowerVersionReady(int32_t version);
253 void OnProcessVersionReady(int32_t version); 262 void OnProcessVersionReady(int32_t version);
254 void OnVideoVersionReady(int32_t version); 263 void OnVideoVersionReady(int32_t version);
255 264
256 // Mojo interfaces. 265 // Mojo interfaces.
257 AppInstancePtr app_ptr_; 266 AppInstancePtr app_ptr_;
267 AudioInstancePtr audio_ptr_;
258 AuthInstancePtr auth_ptr_; 268 AuthInstancePtr auth_ptr_;
259 ClipboardInstancePtr clipboard_ptr_; 269 ClipboardInstancePtr clipboard_ptr_;
260 ImeInstancePtr ime_ptr_; 270 ImeInstancePtr ime_ptr_;
261 InputInstancePtr input_ptr_; 271 InputInstancePtr input_ptr_;
262 IntentHelperInstancePtr intent_helper_ptr_; 272 IntentHelperInstancePtr intent_helper_ptr_;
263 NetInstancePtr net_ptr_; 273 NetInstancePtr net_ptr_;
264 NotificationsInstancePtr notifications_ptr_; 274 NotificationsInstancePtr notifications_ptr_;
265 PowerInstancePtr power_ptr_; 275 PowerInstancePtr power_ptr_;
266 ProcessInstancePtr process_ptr_; 276 ProcessInstancePtr process_ptr_;
267 VideoInstancePtr video_ptr_; 277 VideoInstancePtr video_ptr_;
268 278
269 // Temporary Mojo interfaces. After a Mojo interface pointer has been 279 // Temporary Mojo interfaces. After a Mojo interface pointer has been
270 // received from the other endpoint, we still need to asynchronously query 280 // received from the other endpoint, we still need to asynchronously query
271 // its version. While that is going on, we should still return nullptr on 281 // its version. While that is going on, we should still return nullptr on
272 // the xxx_instance() functions. 282 // the xxx_instance() functions.
273 // To keep the xxx_instance() functions being trivial, store the instance 283 // To keep the xxx_instance() functions being trivial, store the instance
274 // pointer in a temporary variable to avoid losing its reference. 284 // pointer in a temporary variable to avoid losing its reference.
275 AppInstancePtr temporary_app_ptr_; 285 AppInstancePtr temporary_app_ptr_;
286 AudioInstancePtr temporary_audio_ptr_;
276 AuthInstancePtr temporary_auth_ptr_; 287 AuthInstancePtr temporary_auth_ptr_;
277 ClipboardInstancePtr temporary_clipboard_ptr_; 288 ClipboardInstancePtr temporary_clipboard_ptr_;
278 ImeInstancePtr temporary_ime_ptr_; 289 ImeInstancePtr temporary_ime_ptr_;
279 InputInstancePtr temporary_input_ptr_; 290 InputInstancePtr temporary_input_ptr_;
280 IntentHelperInstancePtr temporary_intent_helper_ptr_; 291 IntentHelperInstancePtr temporary_intent_helper_ptr_;
281 NetInstancePtr temporary_net_ptr_; 292 NetInstancePtr temporary_net_ptr_;
282 NotificationsInstancePtr temporary_notifications_ptr_; 293 NotificationsInstancePtr temporary_notifications_ptr_;
283 PowerInstancePtr temporary_power_ptr_; 294 PowerInstancePtr temporary_power_ptr_;
284 ProcessInstancePtr temporary_process_ptr_; 295 ProcessInstancePtr temporary_process_ptr_;
285 VideoInstancePtr temporary_video_ptr_; 296 VideoInstancePtr temporary_video_ptr_;
(...skipping 10 matching lines...) Expand all
296 307
297 // WeakPtrFactory to use callbacks. 308 // WeakPtrFactory to use callbacks.
298 base::WeakPtrFactory<ArcBridgeService> weak_factory_; 309 base::WeakPtrFactory<ArcBridgeService> weak_factory_;
299 310
300 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); 311 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService);
301 }; 312 };
302 313
303 } // namespace arc 314 } // namespace arc
304 315
305 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ 316 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698