OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ |
6 #define CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ | 6 #define CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 | 10 |
| 11 namespace content { |
| 12 class RenderView; |
| 13 } |
| 14 |
11 namespace media { | 15 namespace media { |
12 class AudioRendererSink; | 16 class AudioRendererSink; |
13 } | 17 } |
14 | 18 |
15 namespace content { | 19 namespace content { |
16 | 20 |
17 // A factory for creating AudioRendererSinks. There is a global factory | 21 // A factory for creating AudioRendererSinks. There is a global factory |
18 // function that can be installed for the purposes of testing to provide | 22 // function that can be installed for the purposes of testing to provide |
19 // a specialized AudioRendererSink class. | 23 // a specialized AudioRendererSink class. |
20 // This class uses the same pattern as content::RenderViewHostFactory. | 24 // This class uses the same pattern as content::RenderViewHostFactory. |
21 class CONTENT_EXPORT AudioDeviceFactory { | 25 class CONTENT_EXPORT AudioDeviceFactory { |
22 public: | 26 public: |
23 // Creates an AudioRendererSink using the currently registered factory, | 27 // Creates an AudioRendererSink using the currently registered factory, |
24 // or the default one if no factory is registered. Ownership of the returned | 28 // or the default one if no factory is registered. Ownership of the returned |
25 // pointer will be passed to the caller. | 29 // pointer will be passed to the caller. |
26 static media::AudioRendererSink* Create(); | 30 static media::AudioRendererSink* Create(RenderView* render_view); |
27 | 31 |
28 protected: | 32 protected: |
29 AudioDeviceFactory(); | 33 AudioDeviceFactory(); |
30 virtual ~AudioDeviceFactory(); | 34 virtual ~AudioDeviceFactory(); |
31 | 35 |
32 // You can derive from this class and specify an implementation for this | 36 // You can derive from this class and specify an implementation for this |
33 // function to create a different kind of AudioRendererSink for testing. | 37 // function to create a different kind of AudioRendererSink for testing. |
34 virtual media::AudioRendererSink* CreateAudioDevice() = 0; | 38 virtual media::AudioRendererSink* CreateAudioDevice() = 0; |
35 | 39 |
36 private: | 40 private: |
37 // The current globally registered factory. This is NULL when we should | 41 // The current globally registered factory. This is NULL when we should |
38 // create the default AudioRendererSinks. | 42 // create the default AudioRendererSinks. |
39 static AudioDeviceFactory* factory_; | 43 static AudioDeviceFactory* factory_; |
40 | 44 |
41 DISALLOW_COPY_AND_ASSIGN(AudioDeviceFactory); | 45 DISALLOW_COPY_AND_ASSIGN(AudioDeviceFactory); |
42 }; | 46 }; |
43 | 47 |
44 } // namespace content | 48 } // namespace content |
45 | 49 |
46 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ | 50 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ |
OLD | NEW |