| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_EXTENSIONS_API_WEBRTC_AUDIO_PRIVATE_WEBRTC_AUDIO_PRIVATE_
API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEBRTC_AUDIO_PRIVATE_WEBRTC_AUDIO_PRIVATE_
API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_WEBRTC_AUDIO_PRIVATE_WEBRTC_AUDIO_PRIVATE_
API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_WEBRTC_AUDIO_PRIVATE_WEBRTC_AUDIO_PRIVATE_
API_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 WebrtcAudioPrivateFunction(); | 52 WebrtcAudioPrivateFunction(); |
| 53 ~WebrtcAudioPrivateFunction() override; | 53 ~WebrtcAudioPrivateFunction() override; |
| 54 | 54 |
| 55 protected: | 55 protected: |
| 56 // Retrieves the list of output device names on the appropriate | 56 // Retrieves the list of output device names on the appropriate |
| 57 // thread. Call from UI thread, callback will occur on IO thread. | 57 // thread. Call from UI thread, callback will occur on IO thread. |
| 58 void GetOutputDeviceNames(); | 58 void GetOutputDeviceNames(); |
| 59 | 59 |
| 60 // Must override this if you call GetOutputDeviceNames. Called on IO thread. | 60 // Must override this if you call GetOutputDeviceNames. Called on IO thread. |
| 61 virtual void OnOutputDeviceNames( | 61 virtual void OnOutputDeviceNames( |
| 62 scoped_ptr<media::AudioDeviceNames> device_names); | 62 std::unique_ptr<media::AudioDeviceNames> device_names); |
| 63 | 63 |
| 64 // Retrieve the list of AudioOutputController objects. Calls back | 64 // Retrieve the list of AudioOutputController objects. Calls back |
| 65 // via OnControllerList. | 65 // via OnControllerList. |
| 66 // | 66 // |
| 67 // Returns false on error, in which case it has set |error_| and the | 67 // Returns false on error, in which case it has set |error_| and the |
| 68 // entire function should fail. | 68 // entire function should fail. |
| 69 // | 69 // |
| 70 // Call from any thread. Callback will occur on originating thread. | 70 // Call from any thread. Callback will occur on originating thread. |
| 71 bool GetControllerList(const api::webrtc_audio_private::RequestInfo& request); | 71 bool GetControllerList(const api::webrtc_audio_private::RequestInfo& request); |
| 72 | 72 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 private: | 112 private: |
| 113 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.getSinks", | 113 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.getSinks", |
| 114 WEBRTC_AUDIO_PRIVATE_GET_SINKS); | 114 WEBRTC_AUDIO_PRIVATE_GET_SINKS); |
| 115 | 115 |
| 116 // Sequence of events is that we query the list of sinks on the | 116 // Sequence of events is that we query the list of sinks on the |
| 117 // AudioManager's thread, then calculate HMACs on the IO thread, | 117 // AudioManager's thread, then calculate HMACs on the IO thread, |
| 118 // then finish on the UI thread. | 118 // then finish on the UI thread. |
| 119 bool RunAsync() override; | 119 bool RunAsync() override; |
| 120 void DoQuery(); | 120 void DoQuery(); |
| 121 void OnOutputDeviceNames( | 121 void OnOutputDeviceNames( |
| 122 scoped_ptr<media::AudioDeviceNames> raw_ids) override; | 122 std::unique_ptr<media::AudioDeviceNames> raw_ids) override; |
| 123 void DoneOnUIThread(); | 123 void DoneOnUIThread(); |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 class WebrtcAudioPrivateGetActiveSinkFunction | 126 class WebrtcAudioPrivateGetActiveSinkFunction |
| 127 : public WebrtcAudioPrivateFunction { | 127 : public WebrtcAudioPrivateFunction { |
| 128 protected: | 128 protected: |
| 129 ~WebrtcAudioPrivateGetActiveSinkFunction() override {} | 129 ~WebrtcAudioPrivateGetActiveSinkFunction() override {} |
| 130 | 130 |
| 131 private: | 131 private: |
| 132 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.getActiveSink", | 132 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.getActiveSink", |
| (...skipping 16 matching lines...) Expand all Loading... |
| 149 | 149 |
| 150 private: | 150 private: |
| 151 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.setActiveSink", | 151 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.setActiveSink", |
| 152 WEBRTC_AUDIO_PRIVATE_SET_ACTIVE_SINK); | 152 WEBRTC_AUDIO_PRIVATE_SET_ACTIVE_SINK); |
| 153 | 153 |
| 154 bool RunAsync() override; | 154 bool RunAsync() override; |
| 155 void OnControllerList( | 155 void OnControllerList( |
| 156 const content::RenderProcessHost::AudioOutputControllerList& controllers) | 156 const content::RenderProcessHost::AudioOutputControllerList& controllers) |
| 157 override; | 157 override; |
| 158 void OnOutputDeviceNames( | 158 void OnOutputDeviceNames( |
| 159 scoped_ptr<media::AudioDeviceNames> device_names) override; | 159 std::unique_ptr<media::AudioDeviceNames> device_names) override; |
| 160 void SwitchDone(); | 160 void SwitchDone(); |
| 161 void DoneOnUIThread(); | 161 void DoneOnUIThread(); |
| 162 | 162 |
| 163 api::webrtc_audio_private::RequestInfo request_info_; | 163 api::webrtc_audio_private::RequestInfo request_info_; |
| 164 std::string sink_id_; | 164 std::string sink_id_; |
| 165 | 165 |
| 166 // Filled in by OnControllerList. | 166 // Filled in by OnControllerList. |
| 167 content::RenderProcessHost::AudioOutputControllerList controllers_; | 167 content::RenderProcessHost::AudioOutputControllerList controllers_; |
| 168 | 168 |
| 169 // Number of sink IDs we are still waiting for. Can become greater | 169 // Number of sink IDs we are still waiting for. Can become greater |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 void GetRawSourceIDOnIOThread(); | 211 void GetRawSourceIDOnIOThread(); |
| 212 | 212 |
| 213 // Gets the raw sink ID for a raw source ID. Sends it to |CalculateHMAC|. | 213 // Gets the raw sink ID for a raw source ID. Sends it to |CalculateHMAC|. |
| 214 void GetAssociatedSinkOnDeviceThread(const std::string& raw_source_id); | 214 void GetAssociatedSinkOnDeviceThread(const std::string& raw_source_id); |
| 215 | 215 |
| 216 // Receives the associated sink ID after its HMAC is calculated. | 216 // Receives the associated sink ID after its HMAC is calculated. |
| 217 void OnHMACCalculated(const std::string& hmac) override; | 217 void OnHMACCalculated(const std::string& hmac) override; |
| 218 | 218 |
| 219 // Accessed from UI thread and device thread, but only on one at a | 219 // Accessed from UI thread and device thread, but only on one at a |
| 220 // time, no locking needed. | 220 // time, no locking needed. |
| 221 scoped_ptr<api::webrtc_audio_private::GetAssociatedSink::Params> params_; | 221 std::unique_ptr<api::webrtc_audio_private::GetAssociatedSink::Params> params_; |
| 222 | 222 |
| 223 // Audio sources (input devices). Filled in by DoWorkOnDeviceThread. | 223 // Audio sources (input devices). Filled in by DoWorkOnDeviceThread. |
| 224 media::AudioDeviceNames source_devices_; | 224 media::AudioDeviceNames source_devices_; |
| 225 }; | 225 }; |
| 226 | 226 |
| 227 } // namespace extensions | 227 } // namespace extensions |
| 228 | 228 |
| 229 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBRTC_AUDIO_PRIVATE_WEBRTC_AUDIO_PRIVA
TE_API_H_ | 229 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBRTC_AUDIO_PRIVATE_WEBRTC_AUDIO_PRIVA
TE_API_H_ |
| OLD | NEW |