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/api/profile_keyed_api_factory.h" | 10 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" |
11 #include "chrome/browser/extensions/chrome_extension_function.h" | 11 #include "chrome/browser/extensions/chrome_extension_function.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/common/extensions/api/webrtc_audio_private.h" | 13 #include "chrome/common/extensions/api/webrtc_audio_private.h" |
14 #include "content/public/browser/render_view_host.h" | 14 #include "content/public/browser/render_view_host.h" |
15 #include "media/audio/audio_device_name.h" | 15 #include "media/audio/audio_device_name.h" |
16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class MessageLoopProxy; | 19 class SingleThreadTaskRunner; |
20 } | 20 } |
21 | 21 |
22 namespace extensions { | 22 namespace extensions { |
23 | 23 |
24 // Listens for device changes and forwards as an extension event. | 24 // Listens for device changes and forwards as an extension event. |
25 class WebrtcAudioPrivateEventService | 25 class WebrtcAudioPrivateEventService |
26 : public ProfileKeyedAPI, | 26 : public ProfileKeyedAPI, |
27 public base::SystemMonitor::DevicesChangedObserver { | 27 public base::SystemMonitor::DevicesChangedObserver { |
28 public: | 28 public: |
29 explicit WebrtcAudioPrivateEventService(Profile* profile); | 29 explicit WebrtcAudioPrivateEventService(Profile* profile); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.setActiveSink", | 100 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.setActiveSink", |
101 WEBRTC_AUDIO_PRIVATE_SET_ACTIVE_SINK); | 101 WEBRTC_AUDIO_PRIVATE_SET_ACTIVE_SINK); |
102 | 102 |
103 virtual bool RunImpl() OVERRIDE; | 103 virtual bool RunImpl() OVERRIDE; |
104 virtual void OnControllerList( | 104 virtual void OnControllerList( |
105 const content::RenderViewHost::AudioOutputControllerList& | 105 const content::RenderViewHost::AudioOutputControllerList& |
106 controllers) OVERRIDE; | 106 controllers) OVERRIDE; |
107 void SwitchDone(); | 107 void SwitchDone(); |
108 void DoneOnUIThread(); | 108 void DoneOnUIThread(); |
109 | 109 |
110 // Message loop of the thread this class is constructed on. | 110 // Task runner of the thread this class is constructed on. |
111 const scoped_refptr<base::MessageLoopProxy> message_loop_; | 111 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
112 | 112 |
113 int tab_id_; | 113 int tab_id_; |
114 std::string sink_id_; | 114 std::string sink_id_; |
115 | 115 |
116 // Number of sink IDs we are still waiting for. Can become greater | 116 // Number of sink IDs we are still waiting for. Can become greater |
117 // than 0 in OnControllerList, decreases on every OnSinkId call. | 117 // than 0 in OnControllerList, decreases on every OnSinkId call. |
118 size_t num_remaining_sink_ids_; | 118 size_t num_remaining_sink_ids_; |
119 }; | 119 }; |
120 | 120 |
121 class WebrtcAudioPrivateGetAssociatedSinkFunction | 121 class WebrtcAudioPrivateGetAssociatedSinkFunction |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // time, no locking needed. | 167 // time, no locking needed. |
168 scoped_ptr<api::webrtc_audio_private::GetAssociatedSink::Params> params_; | 168 scoped_ptr<api::webrtc_audio_private::GetAssociatedSink::Params> params_; |
169 | 169 |
170 // Filled in by DoWorkOnDeviceThread. | 170 // Filled in by DoWorkOnDeviceThread. |
171 media::AudioDeviceNames source_devices_; | 171 media::AudioDeviceNames source_devices_; |
172 }; | 172 }; |
173 | 173 |
174 } // namespace extensions | 174 } // namespace extensions |
175 | 175 |
176 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBRTC_AUDIO_PRIVATE_WEBRTC_AUDIO_PRIVA
TE_API_H_ | 176 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBRTC_AUDIO_PRIVATE_WEBRTC_AUDIO_PRIVA
TE_API_H_ |
OLD | NEW |