OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 COMPONENTS_HTML_VIEWER_MEDIA_FACTORY_H_ | 5 #ifndef COMPONENTS_HTML_VIEWER_MEDIA_FACTORY_H_ |
6 #define COMPONENTS_HTML_VIEWER_MEDIA_FACTORY_H_ | 6 #define COMPONENTS_HTML_VIEWER_MEDIA_FACTORY_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 namespace media { | 34 namespace media { |
35 class AudioManager; | 35 class AudioManager; |
36 class RestartableAudioRendererSink; | 36 class RestartableAudioRendererSink; |
37 class CdmFactory; | 37 class CdmFactory; |
38 class MediaPermission; | 38 class MediaPermission; |
39 class UrlIndex; | 39 class UrlIndex; |
40 class WebEncryptedMediaClientImpl; | 40 class WebEncryptedMediaClientImpl; |
41 } | 41 } |
42 | 42 |
43 namespace mojo { | 43 namespace mojo { |
44 class ServiceProvider; | |
45 namespace shell { | |
46 namespace mojom { | |
47 class Shell; | 44 class Shell; |
48 } | 45 } |
49 } | |
50 } | |
51 | 46 |
52 namespace html_viewer { | 47 namespace html_viewer { |
53 | 48 |
54 // Helper class used to create blink::WebMediaPlayer objects. | 49 // Helper class used to create blink::WebMediaPlayer objects. |
55 // This class stores the "global state" shared across all WebMediaPlayer | 50 // This class stores the "global state" shared across all WebMediaPlayer |
56 // instances. | 51 // instances. |
57 class MediaFactory { | 52 class MediaFactory { |
58 public: | 53 public: |
59 MediaFactory( | 54 MediaFactory( |
60 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner, | 55 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner, |
61 mojo::shell::mojom::Shell* shell); | 56 mojo::Shell* shell); |
62 ~MediaFactory(); | 57 ~MediaFactory(); |
63 | 58 |
64 blink::WebMediaPlayer* CreateMediaPlayer( | 59 blink::WebMediaPlayer* CreateMediaPlayer( |
65 blink::WebLocalFrame* frame, | 60 blink::WebLocalFrame* frame, |
66 const blink::WebURL& url, | 61 const blink::WebURL& url, |
67 blink::WebMediaPlayerClient* client, | 62 blink::WebMediaPlayerClient* client, |
68 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, | 63 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, |
69 blink::WebContentDecryptionModule* initial_cdm, | 64 blink::WebContentDecryptionModule* initial_cdm, |
70 mojo::shell::mojom::Shell* shell); | 65 mojo::Shell* shell); |
71 | 66 |
72 blink::WebEncryptedMediaClient* GetEncryptedMediaClient(); | 67 blink::WebEncryptedMediaClient* GetEncryptedMediaClient(); |
73 | 68 |
74 private: | 69 private: |
75 media::interfaces::ServiceFactory* GetMediaServiceFactory(); | 70 media::interfaces::ServiceFactory* GetMediaServiceFactory(); |
76 media::MediaPermission* GetMediaPermission(); | 71 media::MediaPermission* GetMediaPermission(); |
77 media::CdmFactory* GetCdmFactory(); | 72 media::CdmFactory* GetCdmFactory(); |
78 | 73 |
79 #if !defined(OS_ANDROID) | 74 #if !defined(OS_ANDROID) |
80 const media::AudioHardwareConfig& GetAudioHardwareConfig(); | 75 const media::AudioHardwareConfig& GetAudioHardwareConfig(); |
81 scoped_refptr<media::RestartableAudioRendererSink> CreateAudioRendererSink(); | 76 scoped_refptr<media::RestartableAudioRendererSink> CreateAudioRendererSink(); |
82 scoped_refptr<base::SingleThreadTaskRunner> GetMediaThreadTaskRunner(); | 77 scoped_refptr<base::SingleThreadTaskRunner> GetMediaThreadTaskRunner(); |
83 | 78 |
84 base::Thread media_thread_; | 79 base::Thread media_thread_; |
85 media::FakeAudioLogFactory fake_audio_log_factory_; | 80 media::FakeAudioLogFactory fake_audio_log_factory_; |
86 scoped_ptr<media::AudioManager> audio_manager_; | 81 scoped_ptr<media::AudioManager> audio_manager_; |
87 media::AudioHardwareConfig audio_hardware_config_; | 82 media::AudioHardwareConfig audio_hardware_config_; |
88 #endif | 83 #endif |
89 | 84 |
90 const bool enable_mojo_media_renderer_; | 85 const bool enable_mojo_media_renderer_; |
91 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; | 86 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; |
92 mojo::shell::mojom::Shell* shell_; | 87 mojo::Shell* shell_; |
93 | 88 |
94 // Lazily initialized objects. | 89 // Lazily initialized objects. |
95 media::interfaces::ServiceFactoryPtr media_service_factory_; | 90 media::interfaces::ServiceFactoryPtr media_service_factory_; |
96 scoped_ptr<media::WebEncryptedMediaClientImpl> web_encrypted_media_client_; | 91 scoped_ptr<media::WebEncryptedMediaClientImpl> web_encrypted_media_client_; |
97 scoped_ptr<media::MediaPermission> media_permission_; | 92 scoped_ptr<media::MediaPermission> media_permission_; |
98 scoped_ptr<media::CdmFactory> cdm_factory_; | 93 scoped_ptr<media::CdmFactory> cdm_factory_; |
99 | 94 |
100 // Media resource cache, lazily initialized. | 95 // Media resource cache, lazily initialized. |
101 linked_ptr<media::UrlIndex> url_index_; | 96 linked_ptr<media::UrlIndex> url_index_; |
102 | 97 |
103 DISALLOW_COPY_AND_ASSIGN(MediaFactory); | 98 DISALLOW_COPY_AND_ASSIGN(MediaFactory); |
104 }; | 99 }; |
105 | 100 |
106 } // namespace html_viewer | 101 } // namespace html_viewer |
107 | 102 |
108 #endif // COMPONENTS_HTML_VIEWER_MEDIA_FACTORY_H_ | 103 #endif // COMPONENTS_HTML_VIEWER_MEDIA_FACTORY_H_ |
OLD | NEW |