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 #include "content/renderer/media/android/webmediaplayer_android.h" | 5 #include "content/renderer/media/android/webmediaplayer_android.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "cc/layers/video_layer.h" | 18 #include "cc/layers/video_layer.h" |
19 #include "content/public/common/content_client.h" | 19 #include "content/public/common/content_client.h" |
20 #include "content/public/common/content_switches.h" | 20 #include "content/public/common/content_switches.h" |
21 #include "content/public/renderer/render_frame.h" | 21 #include "content/public/renderer/render_frame.h" |
| 22 #include "content/renderer/compositor_bindings/web_layer_impl.h" |
22 #include "content/renderer/media/android/renderer_demuxer_android.h" | 23 #include "content/renderer/media/android/renderer_demuxer_android.h" |
23 #include "content/renderer/media/android/renderer_media_player_manager.h" | 24 #include "content/renderer/media/android/renderer_media_player_manager.h" |
24 #include "content/renderer/media/crypto/key_systems.h" | 25 #include "content/renderer/media/crypto/key_systems.h" |
25 #include "content/renderer/media/crypto/renderer_cdm_manager.h" | 26 #include "content/renderer/media/crypto/renderer_cdm_manager.h" |
26 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" | 27 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" |
27 #include "content/renderer/media/webmediaplayer_delegate.h" | 28 #include "content/renderer/media/webmediaplayer_delegate.h" |
28 #include "content/renderer/media/webmediaplayer_util.h" | 29 #include "content/renderer/media/webmediaplayer_util.h" |
29 #include "content/renderer/render_frame_impl.h" | 30 #include "content/renderer/render_frame_impl.h" |
30 #include "content/renderer/render_thread_impl.h" | 31 #include "content/renderer/render_thread_impl.h" |
31 #include "gpu/GLES2/gl2extchromium.h" | 32 #include "gpu/GLES2/gl2extchromium.h" |
(...skipping 12 matching lines...) Expand all Loading... |
44 #include "third_party/WebKit/public/web/WebDocument.h" | 45 #include "third_party/WebKit/public/web/WebDocument.h" |
45 #include "third_party/WebKit/public/web/WebFrame.h" | 46 #include "third_party/WebKit/public/web/WebFrame.h" |
46 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 47 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
47 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 48 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
48 #include "third_party/WebKit/public/web/WebView.h" | 49 #include "third_party/WebKit/public/web/WebView.h" |
49 #include "third_party/skia/include/core/SkBitmap.h" | 50 #include "third_party/skia/include/core/SkBitmap.h" |
50 #include "third_party/skia/include/core/SkCanvas.h" | 51 #include "third_party/skia/include/core/SkCanvas.h" |
51 #include "third_party/skia/include/core/SkPaint.h" | 52 #include "third_party/skia/include/core/SkPaint.h" |
52 #include "third_party/skia/include/core/SkTypeface.h" | 53 #include "third_party/skia/include/core/SkTypeface.h" |
53 #include "ui/gfx/image/image.h" | 54 #include "ui/gfx/image/image.h" |
54 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" | |
55 | 55 |
56 static const uint32 kGLTextureExternalOES = 0x8D65; | 56 static const uint32 kGLTextureExternalOES = 0x8D65; |
57 | 57 |
58 using blink::WebMediaPlayer; | 58 using blink::WebMediaPlayer; |
59 using blink::WebSize; | 59 using blink::WebSize; |
60 using blink::WebString; | 60 using blink::WebString; |
61 using blink::WebTimeRanges; | 61 using blink::WebTimeRanges; |
62 using blink::WebURL; | 62 using blink::WebURL; |
63 using gpu::gles2::GLES2Interface; | 63 using gpu::gles2::GLES2Interface; |
64 using media::MediaPlayerAndroid; | 64 using media::MediaPlayerAndroid; |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 // previously called. | 722 // previously called. |
723 if (!paused() && needs_establish_peer_) | 723 if (!paused() && needs_establish_peer_) |
724 EstablishSurfaceTexturePeer(); | 724 EstablishSurfaceTexturePeer(); |
725 | 725 |
726 natural_size_.width = width; | 726 natural_size_.width = width; |
727 natural_size_.height = height; | 727 natural_size_.height = height; |
728 ReallocateVideoFrame(); | 728 ReallocateVideoFrame(); |
729 | 729 |
730 // Lazily allocate compositing layer. | 730 // Lazily allocate compositing layer. |
731 if (!video_weblayer_) { | 731 if (!video_weblayer_) { |
732 video_weblayer_.reset( | 732 video_weblayer_.reset(new WebLayerImpl(cc::VideoLayer::Create(this))); |
733 new webkit::WebLayerImpl(cc::VideoLayer::Create(this))); | |
734 client_->setWebLayer(video_weblayer_.get()); | 733 client_->setWebLayer(video_weblayer_.get()); |
735 } | 734 } |
736 | 735 |
737 // TODO(qinmin): This is a hack. We need the media element to stop showing the | 736 // TODO(qinmin): This is a hack. We need the media element to stop showing the |
738 // poster image by forcing it to call setDisplayMode(video). Should move the | 737 // poster image by forcing it to call setDisplayMode(video). Should move the |
739 // logic into HTMLMediaElement.cpp. | 738 // logic into HTMLMediaElement.cpp. |
740 client_->timeChanged(); | 739 client_->timeChanged(); |
741 } | 740 } |
742 | 741 |
743 void WebMediaPlayerAndroid::OnTimeUpdate(const base::TimeDelta& current_time) { | 742 void WebMediaPlayerAndroid::OnTimeUpdate(const base::TimeDelta& current_time) { |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1547 | 1546 |
1548 void WebMediaPlayerAndroid::exitFullscreen() { | 1547 void WebMediaPlayerAndroid::exitFullscreen() { |
1549 player_manager_->ExitFullscreen(player_id_); | 1548 player_manager_->ExitFullscreen(player_id_); |
1550 } | 1549 } |
1551 | 1550 |
1552 bool WebMediaPlayerAndroid::canEnterFullscreen() const { | 1551 bool WebMediaPlayerAndroid::canEnterFullscreen() const { |
1553 return player_manager_->CanEnterFullscreen(frame_); | 1552 return player_manager_->CanEnterFullscreen(frame_); |
1554 } | 1553 } |
1555 | 1554 |
1556 } // namespace content | 1555 } // namespace content |
OLD | NEW |