base: Change DCHECK_IS_ON to a macro DCHECK_IS_ON().
[chromium-blink-merge.git] / mojo / services / html_viewer / webmediaplayer_factory.h
blob687011a2a0808777df5f924082f75cabd9513e67
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MOJO_SERVICES_HTML_VIEWER_WEBMEDIAPLAYER_FACTORY_H_
6 #define MOJO_SERVICES_HTML_VIEWER_WEBMEDIAPLAYER_FACTORY_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/threading/thread.h"
12 #include "media/audio/fake_audio_log_factory.h"
13 #include "media/base/audio_hardware_config.h"
15 namespace base {
16 class SingleThreadTaskRunner;
19 namespace blink {
20 class WebContentDecryptionModule;
21 class WebMediaPlayer;
22 class WebLocalFrame;
23 class WebURL;
24 class WebMediaPlayerClient;
27 namespace media {
28 class AudioManager;
29 class AudioRendererSink;
32 namespace mojo {
33 class Shell;
36 namespace html_viewer {
38 // Helper class used to create blink::WebMediaPlayer objects.
39 // This class stores the "global state" shared across all WebMediaPlayer
40 // instances.
41 class WebMediaPlayerFactory {
42 public:
43 explicit WebMediaPlayerFactory(const scoped_refptr<
44 base::SingleThreadTaskRunner>& compositor_task_runner,
45 bool enable_mojo_media_renderer);
46 ~WebMediaPlayerFactory();
48 blink::WebMediaPlayer* CreateMediaPlayer(
49 blink::WebLocalFrame* frame,
50 const blink::WebURL& url,
51 blink::WebMediaPlayerClient* client,
52 blink::WebContentDecryptionModule* initial_cdm,
53 mojo::Shell* shell);
55 private:
56 const media::AudioHardwareConfig& GetAudioHardwareConfig();
57 scoped_refptr<media::AudioRendererSink> CreateAudioRendererSink();
58 scoped_refptr<base::SingleThreadTaskRunner> GetMediaThreadTaskRunner();
60 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
61 const bool enable_mojo_media_renderer_;
62 base::Thread media_thread_;
63 media::FakeAudioLogFactory fake_audio_log_factory_;
64 scoped_ptr<media::AudioManager> audio_manager_;
65 media::AudioHardwareConfig audio_hardware_config_;
67 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerFactory);
70 } // namespace html_viewer
72 #endif // MOJO_SERVICES_HTML_VIEWER_WEBMEDIAPLAYER_FACTORY_H_