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" | |
13 #include "chrome/common/extensions/api/webrtc_audio_private.h" | 12 #include "chrome/common/extensions/api/webrtc_audio_private.h" |
14 #include "content/public/browser/render_view_host.h" | 13 #include "content/public/browser/render_view_host.h" |
15 #include "media/audio/audio_device_name.h" | 14 #include "media/audio/audio_device_name.h" |
16 #include "url/gurl.h" | 15 #include "url/gurl.h" |
17 | 16 |
18 namespace extensions { | 17 namespace extensions { |
19 | 18 |
20 // Listens for device changes and forwards as an extension event. | 19 // Listens for device changes and forwards as an extension event. |
21 class WebrtcAudioPrivateEventService | 20 class WebrtcAudioPrivateEventService |
22 : public ProfileKeyedAPI, | 21 : public ProfileKeyedAPI, |
23 public base::SystemMonitor::DevicesChangedObserver { | 22 public base::SystemMonitor::DevicesChangedObserver { |
24 public: | 23 public: |
25 explicit WebrtcAudioPrivateEventService(Profile* profile); | 24 explicit WebrtcAudioPrivateEventService(content::BrowserContext* context); |
26 virtual ~WebrtcAudioPrivateEventService(); | 25 virtual ~WebrtcAudioPrivateEventService(); |
27 | 26 |
28 // ProfileKeyedAPI implementation. | 27 // ProfileKeyedAPI implementation. |
29 virtual void Shutdown() OVERRIDE; | 28 virtual void Shutdown() OVERRIDE; |
30 static ProfileKeyedAPIFactory<WebrtcAudioPrivateEventService>* | 29 static ProfileKeyedAPIFactory<WebrtcAudioPrivateEventService>* |
31 GetFactoryInstance(); | 30 GetFactoryInstance(); |
32 static const char* service_name(); | 31 static const char* service_name(); |
33 | 32 |
34 // base::SystemMonitor::DevicesChangedObserver implementation. | 33 // base::SystemMonitor::DevicesChangedObserver implementation. |
35 virtual void OnDevicesChanged( | 34 virtual void OnDevicesChanged( |
36 base::SystemMonitor::DeviceType device_type) OVERRIDE; | 35 base::SystemMonitor::DeviceType device_type) OVERRIDE; |
37 | 36 |
38 private: | 37 private: |
39 friend class ProfileKeyedAPIFactory<WebrtcAudioPrivateEventService>; | 38 friend class ProfileKeyedAPIFactory<WebrtcAudioPrivateEventService>; |
40 | 39 |
41 void SignalEvent(); | 40 void SignalEvent(); |
42 | 41 |
43 Profile* profile_; | 42 content::BrowserContext* browser_context_; |
44 }; | 43 }; |
45 | 44 |
46 // Common base for WebrtcAudioPrivate functions, that provides a | 45 // Common base for WebrtcAudioPrivate functions, that provides a |
47 // couple of optionally-used common implementations. | 46 // couple of optionally-used common implementations. |
48 class WebrtcAudioPrivateFunction : public ChromeAsyncExtensionFunction { | 47 class WebrtcAudioPrivateFunction : public ChromeAsyncExtensionFunction { |
49 protected: | 48 protected: |
50 WebrtcAudioPrivateFunction(); | 49 WebrtcAudioPrivateFunction(); |
51 virtual ~WebrtcAudioPrivateFunction(); | 50 virtual ~WebrtcAudioPrivateFunction(); |
52 | 51 |
53 protected: | 52 protected: |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // time, no locking needed. | 217 // time, no locking needed. |
219 scoped_ptr<api::webrtc_audio_private::GetAssociatedSink::Params> params_; | 218 scoped_ptr<api::webrtc_audio_private::GetAssociatedSink::Params> params_; |
220 | 219 |
221 // Audio sources (input devices). Filled in by DoWorkOnDeviceThread. | 220 // Audio sources (input devices). Filled in by DoWorkOnDeviceThread. |
222 media::AudioDeviceNames source_devices_; | 221 media::AudioDeviceNames source_devices_; |
223 }; | 222 }; |
224 | 223 |
225 } // namespace extensions | 224 } // namespace extensions |
226 | 225 |
227 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBRTC_AUDIO_PRIVATE_WEBRTC_AUDIO_PRIVA
TE_API_H_ | 226 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBRTC_AUDIO_PRIVATE_WEBRTC_AUDIO_PRIVA
TE_API_H_ |
OLD | NEW |