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" | |
11 #include "chrome/browser/extensions/chrome_extension_function.h" | 10 #include "chrome/browser/extensions/chrome_extension_function.h" |
12 #include "chrome/common/extensions/api/webrtc_audio_private.h" | 11 #include "chrome/common/extensions/api/webrtc_audio_private.h" |
13 #include "content/public/browser/render_view_host.h" | 12 #include "content/public/browser/render_view_host.h" |
| 13 #include "extensions/browser/browser_context_keyed_api_factory.h" |
14 #include "media/audio/audio_device_name.h" | 14 #include "media/audio/audio_device_name.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 class ResourceContext; | 18 class ResourceContext; |
19 } | 19 } |
20 | 20 |
21 namespace extensions { | 21 namespace extensions { |
22 | 22 |
23 // Listens for device changes and forwards as an extension event. | 23 // Listens for device changes and forwards as an extension event. |
24 class WebrtcAudioPrivateEventService | 24 class WebrtcAudioPrivateEventService |
25 : public ProfileKeyedAPI, | 25 : public BrowserContextKeyedAPI, |
26 public base::SystemMonitor::DevicesChangedObserver { | 26 public base::SystemMonitor::DevicesChangedObserver { |
27 public: | 27 public: |
28 explicit WebrtcAudioPrivateEventService(content::BrowserContext* context); | 28 explicit WebrtcAudioPrivateEventService(content::BrowserContext* context); |
29 virtual ~WebrtcAudioPrivateEventService(); | 29 virtual ~WebrtcAudioPrivateEventService(); |
30 | 30 |
31 // ProfileKeyedAPI implementation. | 31 // BrowserContextKeyedAPI implementation. |
32 virtual void Shutdown() OVERRIDE; | 32 virtual void Shutdown() OVERRIDE; |
33 static ProfileKeyedAPIFactory<WebrtcAudioPrivateEventService>* | 33 static BrowserContextKeyedAPIFactory<WebrtcAudioPrivateEventService>* |
34 GetFactoryInstance(); | 34 GetFactoryInstance(); |
35 static const char* service_name(); | 35 static const char* service_name(); |
36 | 36 |
37 // base::SystemMonitor::DevicesChangedObserver implementation. | 37 // base::SystemMonitor::DevicesChangedObserver implementation. |
38 virtual void OnDevicesChanged( | 38 virtual void OnDevicesChanged( |
39 base::SystemMonitor::DeviceType device_type) OVERRIDE; | 39 base::SystemMonitor::DeviceType device_type) OVERRIDE; |
40 | 40 |
41 private: | 41 private: |
42 friend class ProfileKeyedAPIFactory<WebrtcAudioPrivateEventService>; | 42 friend class BrowserContextKeyedAPIFactory<WebrtcAudioPrivateEventService>; |
43 | 43 |
44 void SignalEvent(); | 44 void SignalEvent(); |
45 | 45 |
46 content::BrowserContext* browser_context_; | 46 content::BrowserContext* browser_context_; |
47 }; | 47 }; |
48 | 48 |
49 // Common base for WebrtcAudioPrivate functions, that provides a | 49 // Common base for WebrtcAudioPrivate functions, that provides a |
50 // couple of optionally-used common implementations. | 50 // couple of optionally-used common implementations. |
51 class WebrtcAudioPrivateFunction : public ChromeAsyncExtensionFunction { | 51 class WebrtcAudioPrivateFunction : public ChromeAsyncExtensionFunction { |
52 protected: | 52 protected: |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |