Move StartsWith[ASCII] to base namespace.
[chromium-blink-merge.git] / components / html_viewer / media_factory.h
blob6a8c83f6b893367ba5cc461759b71a2238fdc77b
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 COMPONENTS_HTML_VIEWER_MEDIA_FACTORY_H_
6 #define COMPONENTS_HTML_VIEWER_MEDIA_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"
14 #include "mojo/application/public/interfaces/service_provider.mojom.h"
16 namespace base {
17 class SingleThreadTaskRunner;
20 namespace blink {
21 class WebContentDecryptionModule;
22 class WebEncryptedMediaClient;
23 class WebMediaPlayer;
24 class WebLocalFrame;
25 class WebURL;
26 class WebMediaPlayerClient;
29 namespace media {
30 class AudioManager;
31 class AudioRendererSink;
32 class CdmFactory;
33 class MediaPermission;
34 class MediaServiceProvider;
35 class WebEncryptedMediaClientImpl;
38 namespace mojo {
39 class ServiceProvider;
40 class Shell;
43 namespace html_viewer {
45 // Helper class used to create blink::WebMediaPlayer objects.
46 // This class stores the "global state" shared across all WebMediaPlayer
47 // instances.
48 class MediaFactory {
49 public:
50 MediaFactory(
51 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner,
52 mojo::Shell* shell);
53 ~MediaFactory();
55 blink::WebMediaPlayer* CreateMediaPlayer(
56 blink::WebLocalFrame* frame,
57 const blink::WebURL& url,
58 blink::WebMediaPlayerClient* client,
59 blink::WebContentDecryptionModule* initial_cdm,
60 mojo::Shell* shell);
62 blink::WebEncryptedMediaClient* GetEncryptedMediaClient();
64 private:
65 media::MediaServiceProvider* GetMediaServiceProvider();
66 media::MediaPermission* GetMediaPermission();
67 media::CdmFactory* GetCdmFactory();
69 #if !defined(OS_ANDROID)
70 const media::AudioHardwareConfig& GetAudioHardwareConfig();
71 scoped_refptr<media::AudioRendererSink> CreateAudioRendererSink();
72 scoped_refptr<base::SingleThreadTaskRunner> GetMediaThreadTaskRunner();
74 base::Thread media_thread_;
75 media::FakeAudioLogFactory fake_audio_log_factory_;
76 scoped_ptr<media::AudioManager> audio_manager_;
77 media::AudioHardwareConfig audio_hardware_config_;
78 #endif
80 const bool enable_mojo_media_renderer_;
81 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
82 mojo::Shell* shell_;
84 // Lazily initialized objects.
85 mojo::ServiceProviderPtr mojo_service_provider_ptr_;
86 scoped_ptr<media::MediaServiceProvider> media_service_provider_;
87 scoped_ptr<media::WebEncryptedMediaClientImpl> web_encrypted_media_client_;
88 scoped_ptr<media::MediaPermission> media_permission_;
89 scoped_ptr<media::CdmFactory> cdm_factory_;
91 DISALLOW_COPY_AND_ASSIGN(MediaFactory);
94 } // namespace html_viewer
96 #endif // COMPONENTS_HTML_VIEWER_MEDIA_FACTORY_H_