| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 #include "content/renderer/android/email_detector.h" | 219 #include "content/renderer/android/email_detector.h" |
| 220 #include "content/renderer/android/phone_number_detector.h" | 220 #include "content/renderer/android/phone_number_detector.h" |
| 221 #include "content/renderer/media/stream_texture_factory_impl_android.h" | 221 #include "content/renderer/media/stream_texture_factory_impl_android.h" |
| 222 #include "content/renderer/media/webmediaplayer_proxy_impl_android.h" | 222 #include "content/renderer/media/webmediaplayer_proxy_impl_android.h" |
| 223 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" | 223 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" |
| 224 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" | 224 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" |
| 225 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHitTestResult.h" | 225 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHitTestResult.h" |
| 226 #include "ui/gfx/rect_f.h" | 226 #include "ui/gfx/rect_f.h" |
| 227 #include "webkit/media/android/webmediaplayer_android.h" | 227 #include "webkit/media/android/webmediaplayer_android.h" |
| 228 #include "webkit/media/android/webmediaplayer_manager_android.h" | 228 #include "webkit/media/android/webmediaplayer_manager_android.h" |
| 229 |
| 230 #if defined(GOOGLE_TV) |
| 231 #include "content/renderer/media/rtc_video_decoder_bridge_tv.h" |
| 232 #endif |
| 233 |
| 229 #elif defined(OS_WIN) | 234 #elif defined(OS_WIN) |
| 230 // TODO(port): these files are currently Windows only because they concern: | 235 // TODO(port): these files are currently Windows only because they concern: |
| 231 // * theming | 236 // * theming |
| 232 #include "ui/native_theme/native_theme_win.h" | 237 #include "ui/native_theme/native_theme_win.h" |
| 233 #elif defined(USE_X11) | 238 #elif defined(USE_X11) |
| 234 #include "ui/native_theme/native_theme.h" | 239 #include "ui/native_theme/native_theme.h" |
| 235 #elif defined(OS_MACOSX) | 240 #elif defined(OS_MACOSX) |
| 236 #include "skia/ext/skia_utils_mac.h" | 241 #include "skia/ext/skia_utils_mac.h" |
| 237 #endif | 242 #endif |
| 238 | 243 |
| (...skipping 2442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2681 routing_id_); | 2686 routing_id_); |
| 2682 } | 2687 } |
| 2683 } | 2688 } |
| 2684 | 2689 |
| 2685 WebMediaPlayer* RenderViewImpl::createMediaPlayer( | 2690 WebMediaPlayer* RenderViewImpl::createMediaPlayer( |
| 2686 WebFrame* frame, const WebKit::WebURL& url, WebMediaPlayerClient* client) { | 2691 WebFrame* frame, const WebKit::WebURL& url, WebMediaPlayerClient* client) { |
| 2687 FOR_EACH_OBSERVER( | 2692 FOR_EACH_OBSERVER( |
| 2688 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); | 2693 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); |
| 2689 | 2694 |
| 2690 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 2695 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 2691 #if defined(ENABLE_WEBRTC) | 2696 #if defined(ENABLE_WEBRTC) && !defined(GOOGLE_TV) |
| 2692 if (MediaStreamImpl::CheckMediaStream(url)) { | 2697 if (MediaStreamImpl::CheckMediaStream(url)) { |
| 2693 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) | 2698 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) |
| 2694 bool found_neon = | 2699 bool found_neon = |
| 2695 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; | 2700 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; |
| 2696 UMA_HISTOGRAM_BOOLEAN("Platform.WebRtcNEONFound", found_neon); | 2701 UMA_HISTOGRAM_BOOLEAN("Platform.WebRtcNEONFound", found_neon); |
| 2697 #endif // defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) | 2702 #endif // defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) |
| 2698 EnsureMediaStreamImpl(); | 2703 EnsureMediaStreamImpl(); |
| 2699 return new webkit_media::WebMediaPlayerMS( | 2704 return new webkit_media::WebMediaPlayerMS( |
| 2700 frame, client, AsWeakPtr(), media_stream_impl_, new RenderMediaLog()); | 2705 frame, client, AsWeakPtr(), media_stream_impl_, new RenderMediaLog()); |
| 2701 } | 2706 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2714 RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); | 2719 RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); |
| 2715 if (!context_provider) { | 2720 if (!context_provider) { |
| 2716 LOG(ERROR) << "Failed to get context3d for media player"; | 2721 LOG(ERROR) << "Failed to get context3d for media player"; |
| 2717 return NULL; | 2722 return NULL; |
| 2718 } | 2723 } |
| 2719 | 2724 |
| 2720 if (!media_player_proxy_) { | 2725 if (!media_player_proxy_) { |
| 2721 media_player_proxy_ = new WebMediaPlayerProxyImplAndroid( | 2726 media_player_proxy_ = new WebMediaPlayerProxyImplAndroid( |
| 2722 this, media_player_manager_.get()); | 2727 this, media_player_manager_.get()); |
| 2723 } | 2728 } |
| 2724 return new webkit_media::WebMediaPlayerAndroid( | 2729 MediaStreamImpl* media_stream_impl = NULL; |
| 2725 frame, | 2730 media::Demuxer* demuxer = NULL; |
| 2726 client, | 2731 #if defined(ENABLE_WEBRTC) |
| 2727 media_player_manager_.get(), | 2732 if (MediaStreamImpl::CheckMediaStream(url)) { |
| 2728 media_player_proxy_, | 2733 EnsureMediaStreamImpl(); |
| 2729 new StreamTextureFactoryImpl( | 2734 demuxer = RTCVideoDecoderBridgeTv::Get()->CreateDemuxer( |
| 2730 context_provider->Context3d(), gpu_channel_host, routing_id_), | 2735 RenderThreadImpl::current()->GetMediaStreamDependencyFactory(), |
| 2731 new RenderMediaLog()); | 2736 base::MessageLoopProxy::current()); |
| 2732 #endif | 2737 if (demuxer) { |
| 2738 media_stream_impl = media_stream_impl_; |
| 2739 } else { |
| 2740 LOG(ERROR) << "Multiple MediaStream not supported yet."; |
| 2741 return NULL; |
| 2742 } |
| 2743 } |
| 2744 #endif // defined(ENABLE_WEBRTC) |
| 2745 webkit_media::WebMediaPlayerAndroid* web_media_player_android = |
| 2746 new webkit_media::WebMediaPlayerAndroid( |
| 2747 frame, |
| 2748 client, |
| 2749 media_player_manager_.get(), |
| 2750 media_player_proxy_, |
| 2751 new StreamTextureFactoryImpl( |
| 2752 context_provider->Context3d(), gpu_channel_host, routing_id_), |
| 2753 new RenderMediaLog(), |
| 2754 media_stream_impl, |
| 2755 demuxer); |
| 2756 #if defined(GOOGLE_TV) |
| 2757 if (media_stream_impl) { |
| 2758 // RTCVideoDecoderBridgeTv::Get() outlives web_media_player_android since |
| 2759 // it's a singleton, thus base::Unretained is safe here. |
| 2760 web_media_player_android->SetDestroyDemuxerCB( |
| 2761 base::Bind(&RTCVideoDecoderBridgeTv::DestroyDemuxer, |
| 2762 base::Unretained(RTCVideoDecoderBridgeTv::Get()))); |
| 2763 } |
| 2764 #endif // defined(GOOGLE_TV) |
| 2765 return web_media_player_android; |
| 2766 #endif // defined(OS_ANDROID) |
| 2733 | 2767 |
| 2734 scoped_refptr<media::AudioRendererSink> sink; | 2768 scoped_refptr<media::AudioRendererSink> sink; |
| 2735 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { | 2769 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { |
| 2736 sink = RenderThreadImpl::current()->GetAudioRendererMixerManager()-> | 2770 sink = RenderThreadImpl::current()->GetAudioRendererMixerManager()-> |
| 2737 CreateInput(routing_id_); | 2771 CreateInput(routing_id_); |
| 2738 DVLOG(1) << "Using AudioRendererMixerManager-provided sink: " << sink; | 2772 DVLOG(1) << "Using AudioRendererMixerManager-provided sink: " << sink; |
| 2739 } | 2773 } |
| 2740 | 2774 |
| 2741 scoped_refptr<media::GpuVideoDecoder::Factories> gpu_factories; | 2775 scoped_refptr<media::GpuVideoDecoder::Factories> gpu_factories; |
| 2742 WebGraphicsContext3DCommandBufferImpl* context3d = NULL; | 2776 WebGraphicsContext3DCommandBufferImpl* context3d = NULL; |
| (...skipping 3786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6529 WebURL url = icon_urls[i].iconURL(); | 6563 WebURL url = icon_urls[i].iconURL(); |
| 6530 if (!url.isEmpty()) | 6564 if (!url.isEmpty()) |
| 6531 urls.push_back(FaviconURL(url, | 6565 urls.push_back(FaviconURL(url, |
| 6532 ToFaviconType(icon_urls[i].iconType()))); | 6566 ToFaviconType(icon_urls[i].iconType()))); |
| 6533 } | 6567 } |
| 6534 SendUpdateFaviconURL(urls); | 6568 SendUpdateFaviconURL(urls); |
| 6535 } | 6569 } |
| 6536 | 6570 |
| 6537 | 6571 |
| 6538 } // namespace content | 6572 } // namespace content |
| OLD | NEW |