Vectorize website settings icons in omnibox
[chromium-blink-merge.git] / components / html_viewer / media_factory.h
blob70d1f7d6388c641a934332b68989036171a2309c
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 "media/mojo/interfaces/service_factory.mojom.h"
15 #include "mojo/application/public/interfaces/service_provider.mojom.h"
17 namespace base {
18 class SingleThreadTaskRunner;
21 namespace blink {
22 class WebContentDecryptionModule;
23 class WebEncryptedMediaClient;
24 class WebMediaPlayer;
25 class WebLocalFrame;
26 class WebURL;
27 class WebMediaPlayerClient;
28 class WebMediaPlayerEncryptedMediaClient;
31 namespace media {
32 class AudioManager;
33 class AudioRendererSink;
34 class CdmFactory;
35 class MediaPermission;
36 class WebEncryptedMediaClientImpl;
39 namespace mojo {
40 class ServiceProvider;
41 class Shell;
44 namespace html_viewer {
46 // Helper class used to create blink::WebMediaPlayer objects.
47 // This class stores the "global state" shared across all WebMediaPlayer
48 // instances.
49 class MediaFactory {
50 public:
51 MediaFactory(
52 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner,
53 mojo::Shell* shell);
54 ~MediaFactory();
56 blink::WebMediaPlayer* CreateMediaPlayer(
57 blink::WebLocalFrame* frame,
58 const blink::WebURL& url,
59 blink::WebMediaPlayerClient* client,
60 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
61 blink::WebContentDecryptionModule* initial_cdm,
62 mojo::Shell* shell);
64 blink::WebEncryptedMediaClient* GetEncryptedMediaClient();
66 private:
67 media::interfaces::ServiceFactory* GetMediaServiceFactory();
68 media::MediaPermission* GetMediaPermission();
69 media::CdmFactory* GetCdmFactory();
71 #if !defined(OS_ANDROID)
72 const media::AudioHardwareConfig& GetAudioHardwareConfig();
73 scoped_refptr<media::AudioRendererSink> CreateAudioRendererSink();
74 scoped_refptr<base::SingleThreadTaskRunner> GetMediaThreadTaskRunner();
76 base::Thread media_thread_;
77 media::FakeAudioLogFactory fake_audio_log_factory_;
78 scoped_ptr<media::AudioManager> audio_manager_;
79 media::AudioHardwareConfig audio_hardware_config_;
80 #endif
82 const bool enable_mojo_media_renderer_;
83 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
84 mojo::Shell* shell_;
86 // Lazily initialized objects.
87 media::interfaces::ServiceFactoryPtr media_service_factory_;
88 scoped_ptr<media::WebEncryptedMediaClientImpl> web_encrypted_media_client_;
89 scoped_ptr<media::MediaPermission> media_permission_;
90 scoped_ptr<media::CdmFactory> cdm_factory_;
92 DISALLOW_COPY_AND_ASSIGN(MediaFactory);
95 } // namespace html_viewer
97 #endif // COMPONENTS_HTML_VIEWER_MEDIA_FACTORY_H_