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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 #include "content/renderer/android/email_detector.h" | 220 #include "content/renderer/android/email_detector.h" |
221 #include "content/renderer/android/phone_number_detector.h" | 221 #include "content/renderer/android/phone_number_detector.h" |
222 #include "content/renderer/media/stream_texture_factory_impl_android.h" | 222 #include "content/renderer/media/stream_texture_factory_impl_android.h" |
223 #include "content/renderer/media/webmediaplayer_proxy_impl_android.h" | 223 #include "content/renderer/media/webmediaplayer_proxy_impl_android.h" |
224 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" | 224 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" |
225 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" | 225 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" |
226 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHitTestResult.h" | 226 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHitTestResult.h" |
227 #include "ui/gfx/rect_f.h" | 227 #include "ui/gfx/rect_f.h" |
228 #include "webkit/media/android/webmediaplayer_android.h" | 228 #include "webkit/media/android/webmediaplayer_android.h" |
229 #include "webkit/media/android/webmediaplayer_manager_android.h" | 229 #include "webkit/media/android/webmediaplayer_manager_android.h" |
| 230 |
| 231 #if defined(GOOGLE_TV) |
| 232 #include "content/renderer/media/rtc_video_decoder_bridge_tv.h" |
| 233 #include "content/renderer/media/rtc_video_decoder_factory_tv.h" |
| 234 #endif |
| 235 |
230 #elif defined(OS_WIN) | 236 #elif defined(OS_WIN) |
231 // TODO(port): these files are currently Windows only because they concern: | 237 // TODO(port): these files are currently Windows only because they concern: |
232 // * theming | 238 // * theming |
233 #include "ui/native_theme/native_theme_win.h" | 239 #include "ui/native_theme/native_theme_win.h" |
234 #elif defined(USE_X11) | 240 #elif defined(USE_X11) |
235 #include "ui/native_theme/native_theme.h" | 241 #include "ui/native_theme/native_theme.h" |
236 #elif defined(OS_MACOSX) | 242 #elif defined(OS_MACOSX) |
237 #include "skia/ext/skia_utils_mac.h" | 243 #include "skia/ext/skia_utils_mac.h" |
238 #endif | 244 #endif |
239 | 245 |
(...skipping 2446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2686 routing_id_); | 2692 routing_id_); |
2687 } | 2693 } |
2688 } | 2694 } |
2689 | 2695 |
2690 WebMediaPlayer* RenderViewImpl::createMediaPlayer( | 2696 WebMediaPlayer* RenderViewImpl::createMediaPlayer( |
2691 WebFrame* frame, const WebKit::WebURL& url, WebMediaPlayerClient* client) { | 2697 WebFrame* frame, const WebKit::WebURL& url, WebMediaPlayerClient* client) { |
2692 FOR_EACH_OBSERVER( | 2698 FOR_EACH_OBSERVER( |
2693 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); | 2699 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); |
2694 | 2700 |
2695 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 2701 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
2696 #if defined(ENABLE_WEBRTC) | 2702 #if defined(ENABLE_WEBRTC) && !defined(GOOGLE_TV) |
2697 if (MediaStreamImpl::CheckMediaStream(url)) { | 2703 if (MediaStreamImpl::CheckMediaStream(url)) { |
2698 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) | 2704 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) |
2699 bool found_neon = | 2705 bool found_neon = |
2700 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; | 2706 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; |
2701 UMA_HISTOGRAM_BOOLEAN("Platform.WebRtcNEONFound", found_neon); | 2707 UMA_HISTOGRAM_BOOLEAN("Platform.WebRtcNEONFound", found_neon); |
2702 #endif // defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) | 2708 #endif // defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) |
2703 EnsureMediaStreamImpl(); | 2709 EnsureMediaStreamImpl(); |
2704 return new webkit_media::WebMediaPlayerMS( | 2710 return new webkit_media::WebMediaPlayerMS( |
2705 frame, client, AsWeakPtr(), media_stream_impl_, new RenderMediaLog()); | 2711 frame, client, AsWeakPtr(), media_stream_impl_, new RenderMediaLog()); |
2706 } | 2712 } |
(...skipping 12 matching lines...) Expand all Loading... |
2719 RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); | 2725 RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); |
2720 if (!context_provider) { | 2726 if (!context_provider) { |
2721 LOG(ERROR) << "Failed to get context3d for media player"; | 2727 LOG(ERROR) << "Failed to get context3d for media player"; |
2722 return NULL; | 2728 return NULL; |
2723 } | 2729 } |
2724 | 2730 |
2725 if (!media_player_proxy_) { | 2731 if (!media_player_proxy_) { |
2726 media_player_proxy_ = new WebMediaPlayerProxyImplAndroid( | 2732 media_player_proxy_ = new WebMediaPlayerProxyImplAndroid( |
2727 this, media_player_manager_.get()); | 2733 this, media_player_manager_.get()); |
2728 } | 2734 } |
2729 return new webkit_media::WebMediaPlayerAndroid( | 2735 scoped_ptr<webkit_media::WebMediaPlayerAndroid> web_media_player_android( |
2730 frame, | 2736 new webkit_media::WebMediaPlayerAndroid( |
2731 client, | 2737 frame, |
2732 media_player_manager_.get(), | 2738 client, |
2733 media_player_proxy_, | 2739 media_player_manager_.get(), |
2734 new StreamTextureFactoryImpl( | 2740 media_player_proxy_, |
2735 context_provider->Context3d(), gpu_channel_host, routing_id_), | 2741 new StreamTextureFactoryImpl( |
2736 new RenderMediaLog()); | 2742 context_provider->Context3d(), gpu_channel_host, routing_id_), |
2737 #endif | 2743 new RenderMediaLog())); |
| 2744 #if defined(ENABLE_WEBRTC) && defined(GOOGLE_TV) |
| 2745 if (MediaStreamImpl::CheckMediaStream(url)) { |
| 2746 EnsureMediaStreamImpl(); |
| 2747 RTCVideoDecoderFactoryTv* factory = RenderThreadImpl::current() |
| 2748 ->GetMediaStreamDependencyFactory()->decoder_factory_tv(); |
| 2749 // |media_stream_impl_| and |factory| outlives |web_media_player_android|. |
| 2750 if (!factory->AcquireDemuxer() || |
| 2751 !web_media_player_android->InjectMediaStream( |
| 2752 media_stream_impl_, |
| 2753 factory, |
| 2754 base::Bind( |
| 2755 base::IgnoreResult(&RTCVideoDecoderFactoryTv::ReleaseDemuxer), |
| 2756 base::Unretained(factory)))) { |
| 2757 LOG(ERROR) << "Failed to inject media stream."; |
| 2758 return NULL; |
| 2759 } |
| 2760 } |
| 2761 #endif // defined(ENABLE_WEBRTC) && defined(GOOGLE_TV) |
| 2762 return web_media_player_android.release(); |
| 2763 #endif // defined(OS_ANDROID) |
2738 | 2764 |
2739 scoped_refptr<media::AudioRendererSink> sink; | 2765 scoped_refptr<media::AudioRendererSink> sink; |
2740 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { | 2766 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { |
2741 sink = RenderThreadImpl::current()->GetAudioRendererMixerManager()-> | 2767 sink = RenderThreadImpl::current()->GetAudioRendererMixerManager()-> |
2742 CreateInput(routing_id_); | 2768 CreateInput(routing_id_); |
2743 DVLOG(1) << "Using AudioRendererMixerManager-provided sink: " << sink; | 2769 DVLOG(1) << "Using AudioRendererMixerManager-provided sink: " << sink; |
2744 } | 2770 } |
2745 | 2771 |
2746 scoped_refptr<media::GpuVideoDecoder::Factories> gpu_factories; | 2772 scoped_refptr<media::GpuVideoDecoder::Factories> gpu_factories; |
2747 WebGraphicsContext3DCommandBufferImpl* context3d = NULL; | 2773 WebGraphicsContext3DCommandBufferImpl* context3d = NULL; |
(...skipping 3792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6540 WebURL url = icon_urls[i].iconURL(); | 6566 WebURL url = icon_urls[i].iconURL(); |
6541 if (!url.isEmpty()) | 6567 if (!url.isEmpty()) |
6542 urls.push_back(FaviconURL(url, | 6568 urls.push_back(FaviconURL(url, |
6543 ToFaviconType(icon_urls[i].iconType()))); | 6569 ToFaviconType(icon_urls[i].iconType()))); |
6544 } | 6570 } |
6545 SendUpdateFaviconURL(urls); | 6571 SendUpdateFaviconURL(urls); |
6546 } | 6572 } |
6547 | 6573 |
6548 | 6574 |
6549 } // namespace content | 6575 } // namespace content |
OLD | NEW |