OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
6 #define CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 6 #define CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 namespace cc_blink { | 49 namespace cc_blink { |
50 class WebLayerImpl; | 50 class WebLayerImpl; |
51 } | 51 } |
52 | 52 |
53 namespace gpu { | 53 namespace gpu { |
54 struct MailboxHolder; | 54 struct MailboxHolder; |
55 } | 55 } |
56 | 56 |
57 namespace media { | 57 namespace media { |
58 class MediaLog; | 58 class MediaLog; |
| 59 class WebMediaPlayerDelegate; |
59 } | 60 } |
60 | 61 |
61 namespace content { | 62 namespace content { |
62 class RendererCdmManager; | 63 class RendererCdmManager; |
63 class RendererMediaPlayerManager; | 64 class RendererMediaPlayerManager; |
64 class WebContentDecryptionModuleImpl; | 65 class WebContentDecryptionModuleImpl; |
65 class WebMediaPlayerDelegate; | |
66 | 66 |
67 // This class implements blink::WebMediaPlayer by keeping the android | 67 // This class implements blink::WebMediaPlayer by keeping the android |
68 // media player in the browser process. It listens to all the status changes | 68 // media player in the browser process. It listens to all the status changes |
69 // sent from the browser process and sends playback controls to the media | 69 // sent from the browser process and sends playback controls to the media |
70 // player. | 70 // player. |
71 class WebMediaPlayerAndroid : public blink::WebMediaPlayer, | 71 class WebMediaPlayerAndroid : public blink::WebMediaPlayer, |
72 public cc::VideoFrameProvider, | 72 public cc::VideoFrameProvider, |
73 public RenderFrameObserver { | 73 public RenderFrameObserver { |
74 public: | 74 public: |
75 // Construct a WebMediaPlayerAndroid object. This class communicates with the | 75 // Construct a WebMediaPlayerAndroid object. This class communicates with the |
76 // MediaPlayerAndroid object in the browser process through |proxy|. | 76 // MediaPlayerAndroid object in the browser process through |proxy|. |
77 // TODO(qinmin): |frame| argument is used to determine whether the current | 77 // TODO(qinmin): |frame| argument is used to determine whether the current |
78 // player can enter fullscreen. This logic should probably be moved into | 78 // player can enter fullscreen. This logic should probably be moved into |
79 // blink, so that enterFullscreen() will not be called if another video is | 79 // blink, so that enterFullscreen() will not be called if another video is |
80 // already in fullscreen. | 80 // already in fullscreen. |
81 WebMediaPlayerAndroid( | 81 WebMediaPlayerAndroid( |
82 blink::WebFrame* frame, | 82 blink::WebFrame* frame, |
83 blink::WebMediaPlayerClient* client, | 83 blink::WebMediaPlayerClient* client, |
84 base::WeakPtr<WebMediaPlayerDelegate> delegate, | 84 base::WeakPtr<media::WebMediaPlayerDelegate> delegate, |
85 RendererMediaPlayerManager* player_manager, | 85 RendererMediaPlayerManager* player_manager, |
86 RendererCdmManager* cdm_manager, | 86 RendererCdmManager* cdm_manager, |
87 scoped_refptr<StreamTextureFactory> factory, | 87 scoped_refptr<StreamTextureFactory> factory, |
88 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 88 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
89 media::MediaLog* media_log); | 89 media::MediaLog* media_log); |
90 virtual ~WebMediaPlayerAndroid(); | 90 virtual ~WebMediaPlayerAndroid(); |
91 | 91 |
92 // blink::WebMediaPlayer implementation. | 92 // blink::WebMediaPlayer implementation. |
93 virtual void enterFullscreen(); | 93 virtual void enterFullscreen(); |
94 virtual bool canEnterFullscreen() const; | 94 virtual bool canEnterFullscreen() const; |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 324 |
325 blink::WebFrame* const frame_; | 325 blink::WebFrame* const frame_; |
326 | 326 |
327 blink::WebMediaPlayerClient* const client_; | 327 blink::WebMediaPlayerClient* const client_; |
328 | 328 |
329 // |delegate_| is used to notify the browser process of the player status, so | 329 // |delegate_| is used to notify the browser process of the player status, so |
330 // that the browser process can control screen locks. | 330 // that the browser process can control screen locks. |
331 // TODO(qinmin): Currently android mediaplayer takes care of the screen | 331 // TODO(qinmin): Currently android mediaplayer takes care of the screen |
332 // lock. So this is only used for media source. Will apply this to regular | 332 // lock. So this is only used for media source. Will apply this to regular |
333 // media tag once http://crbug.com/247892 is fixed. | 333 // media tag once http://crbug.com/247892 is fixed. |
334 base::WeakPtr<WebMediaPlayerDelegate> delegate_; | 334 base::WeakPtr<media::WebMediaPlayerDelegate> delegate_; |
335 | 335 |
336 // Save the list of buffered time ranges. | 336 // Save the list of buffered time ranges. |
337 blink::WebTimeRanges buffered_; | 337 blink::WebTimeRanges buffered_; |
338 | 338 |
339 // Size of the video. | 339 // Size of the video. |
340 blink::WebSize natural_size_; | 340 blink::WebSize natural_size_; |
341 | 341 |
342 // Size that has been sent to StreamTexture. | 342 // Size that has been sent to StreamTexture. |
343 blink::WebSize cached_stream_texture_size_; | 343 blink::WebSize cached_stream_texture_size_; |
344 | 344 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 | 495 |
496 // NOTE: Weak pointers must be invalidated before all other member variables. | 496 // NOTE: Weak pointers must be invalidated before all other member variables. |
497 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; | 497 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; |
498 | 498 |
499 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 499 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
500 }; | 500 }; |
501 | 501 |
502 } // namespace content | 502 } // namespace content |
503 | 503 |
504 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 504 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
OLD | NEW |