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 "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/system_monitor/system_monitor.h" | 9 #include "base/system_monitor/system_monitor.h" |
10 #include "chrome/browser/extensions/chrome_extension_function.h" | 10 #include "chrome/browser/extensions/chrome_extension_function.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 protected: | 110 protected: |
111 virtual ~WebrtcAudioPrivateGetSinksFunction() {} | 111 virtual ~WebrtcAudioPrivateGetSinksFunction() {} |
112 | 112 |
113 private: | 113 private: |
114 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.getSinks", | 114 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.getSinks", |
115 WEBRTC_AUDIO_PRIVATE_GET_SINKS); | 115 WEBRTC_AUDIO_PRIVATE_GET_SINKS); |
116 | 116 |
117 // Sequence of events is that we query the list of sinks on the | 117 // Sequence of events is that we query the list of sinks on the |
118 // AudioManager's thread, then calculate HMACs on the IO thread, | 118 // AudioManager's thread, then calculate HMACs on the IO thread, |
119 // then finish on the UI thread. | 119 // then finish on the UI thread. |
120 virtual bool RunImpl() OVERRIDE; | 120 virtual bool RunAsync() OVERRIDE; |
121 void DoQuery(); | 121 void DoQuery(); |
122 virtual void OnOutputDeviceNames( | 122 virtual void OnOutputDeviceNames( |
123 scoped_ptr<media::AudioDeviceNames> raw_ids) OVERRIDE; | 123 scoped_ptr<media::AudioDeviceNames> raw_ids) OVERRIDE; |
124 void DoneOnUIThread(); | 124 void DoneOnUIThread(); |
125 }; | 125 }; |
126 | 126 |
127 class WebrtcAudioPrivateGetActiveSinkFunction | 127 class WebrtcAudioPrivateGetActiveSinkFunction |
128 : public WebrtcAudioPrivateFunction { | 128 : public WebrtcAudioPrivateFunction { |
129 protected: | 129 protected: |
130 virtual ~WebrtcAudioPrivateGetActiveSinkFunction() {} | 130 virtual ~WebrtcAudioPrivateGetActiveSinkFunction() {} |
131 | 131 |
132 private: | 132 private: |
133 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.getActiveSink", | 133 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.getActiveSink", |
134 WEBRTC_AUDIO_PRIVATE_GET_ACTIVE_SINK); | 134 WEBRTC_AUDIO_PRIVATE_GET_ACTIVE_SINK); |
135 | 135 |
136 virtual bool RunImpl() OVERRIDE; | 136 virtual bool RunAsync() OVERRIDE; |
137 virtual void OnControllerList( | 137 virtual void OnControllerList( |
138 const content::RenderViewHost::AudioOutputControllerList& | 138 const content::RenderViewHost::AudioOutputControllerList& |
139 controllers) OVERRIDE; | 139 controllers) OVERRIDE; |
140 virtual void OnHMACCalculated(const std::string& hmac) OVERRIDE; | 140 virtual void OnHMACCalculated(const std::string& hmac) OVERRIDE; |
141 }; | 141 }; |
142 | 142 |
143 class WebrtcAudioPrivateSetActiveSinkFunction | 143 class WebrtcAudioPrivateSetActiveSinkFunction |
144 : public WebrtcAudioPrivateFunction { | 144 : public WebrtcAudioPrivateFunction { |
145 public: | 145 public: |
146 WebrtcAudioPrivateSetActiveSinkFunction(); | 146 WebrtcAudioPrivateSetActiveSinkFunction(); |
147 | 147 |
148 protected: | 148 protected: |
149 virtual ~WebrtcAudioPrivateSetActiveSinkFunction(); | 149 virtual ~WebrtcAudioPrivateSetActiveSinkFunction(); |
150 | 150 |
151 private: | 151 private: |
152 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.setActiveSink", | 152 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.setActiveSink", |
153 WEBRTC_AUDIO_PRIVATE_SET_ACTIVE_SINK); | 153 WEBRTC_AUDIO_PRIVATE_SET_ACTIVE_SINK); |
154 | 154 |
155 virtual bool RunImpl() OVERRIDE; | 155 virtual bool RunAsync() OVERRIDE; |
156 virtual void OnControllerList( | 156 virtual void OnControllerList( |
157 const content::RenderViewHost::AudioOutputControllerList& | 157 const content::RenderViewHost::AudioOutputControllerList& |
158 controllers) OVERRIDE; | 158 controllers) OVERRIDE; |
159 virtual void OnOutputDeviceNames( | 159 virtual void OnOutputDeviceNames( |
160 scoped_ptr<media::AudioDeviceNames> device_names) OVERRIDE; | 160 scoped_ptr<media::AudioDeviceNames> device_names) OVERRIDE; |
161 void SwitchDone(); | 161 void SwitchDone(); |
162 void DoneOnUIThread(); | 162 void DoneOnUIThread(); |
163 | 163 |
164 int tab_id_; | 164 int tab_id_; |
165 std::string sink_id_; | 165 std::string sink_id_; |
(...skipping 11 matching lines...) Expand all Loading... |
177 public: | 177 public: |
178 WebrtcAudioPrivateGetAssociatedSinkFunction(); | 178 WebrtcAudioPrivateGetAssociatedSinkFunction(); |
179 | 179 |
180 protected: | 180 protected: |
181 virtual ~WebrtcAudioPrivateGetAssociatedSinkFunction(); | 181 virtual ~WebrtcAudioPrivateGetAssociatedSinkFunction(); |
182 | 182 |
183 private: | 183 private: |
184 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.getAssociatedSink", | 184 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.getAssociatedSink", |
185 WEBRTC_AUDIO_PRIVATE_GET_ASSOCIATED_SINK); | 185 WEBRTC_AUDIO_PRIVATE_GET_ASSOCIATED_SINK); |
186 | 186 |
187 virtual bool RunImpl() OVERRIDE; | 187 virtual bool RunAsync() OVERRIDE; |
188 | 188 |
189 // This implementation is slightly complicated because of different | 189 // This implementation is slightly complicated because of different |
190 // thread requirements for the various functions we need to invoke. | 190 // thread requirements for the various functions we need to invoke. |
191 // | 191 // |
192 // Each worker function will post a task to the appropriate thread | 192 // Each worker function will post a task to the appropriate thread |
193 // for the next one. | 193 // for the next one. |
194 // | 194 // |
195 // The sequence of events is: | 195 // The sequence of events is: |
196 // 1. Get the list of source devices on the device thread. | 196 // 1. Get the list of source devices on the device thread. |
197 // 2. Given a source ID for an origin and that security origin, find | 197 // 2. Given a source ID for an origin and that security origin, find |
(...skipping 23 matching lines...) Expand all Loading... |
221 // time, no locking needed. | 221 // time, no locking needed. |
222 scoped_ptr<api::webrtc_audio_private::GetAssociatedSink::Params> params_; | 222 scoped_ptr<api::webrtc_audio_private::GetAssociatedSink::Params> params_; |
223 | 223 |
224 // Audio sources (input devices). Filled in by DoWorkOnDeviceThread. | 224 // Audio sources (input devices). Filled in by DoWorkOnDeviceThread. |
225 media::AudioDeviceNames source_devices_; | 225 media::AudioDeviceNames source_devices_; |
226 }; | 226 }; |
227 | 227 |
228 } // namespace extensions | 228 } // namespace extensions |
229 | 229 |
230 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBRTC_AUDIO_PRIVATE_WEBRTC_AUDIO_PRIVA
TE_API_H_ | 230 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBRTC_AUDIO_PRIVATE_WEBRTC_AUDIO_PRIVA
TE_API_H_ |
OLD | NEW |