| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 #include "content/renderer/android/synchronous_compositor_factory.h" | 217 #include "content/renderer/android/synchronous_compositor_factory.h" |
| 218 #include "content/renderer/media/android/renderer_media_player_manager.h" | 218 #include "content/renderer/media/android/renderer_media_player_manager.h" |
| 219 #include "content/renderer/media/android/stream_texture_factory_android_impl.h" | 219 #include "content/renderer/media/android/stream_texture_factory_android_impl.h" |
| 220 #include "content/renderer/media/android/webmediaplayer_android.h" | 220 #include "content/renderer/media/android/webmediaplayer_android.h" |
| 221 #include "skia/ext/platform_canvas.h" | 221 #include "skia/ext/platform_canvas.h" |
| 222 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 222 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
| 223 #include "third_party/WebKit/public/platform/WebFloatRect.h" | 223 #include "third_party/WebKit/public/platform/WebFloatRect.h" |
| 224 #include "third_party/WebKit/public/web/WebHitTestResult.h" | 224 #include "third_party/WebKit/public/web/WebHitTestResult.h" |
| 225 #include "ui/gfx/rect_f.h" | 225 #include "ui/gfx/rect_f.h" |
| 226 | 226 |
| 227 #if defined(GOOGLE_TV) | |
| 228 #include "content/renderer/media/rtc_video_decoder_bridge_tv.h" | |
| 229 #include "content/renderer/media/rtc_video_decoder_factory_tv.h" | |
| 230 #endif | |
| 231 | |
| 232 #elif defined(OS_WIN) | 227 #elif defined(OS_WIN) |
| 233 // TODO(port): these files are currently Windows only because they concern: | 228 // TODO(port): these files are currently Windows only because they concern: |
| 234 // * theming | 229 // * theming |
| 235 #include "ui/native_theme/native_theme_win.h" | 230 #include "ui/native_theme/native_theme_win.h" |
| 236 #elif defined(USE_X11) | 231 #elif defined(USE_X11) |
| 237 #include "ui/native_theme/native_theme.h" | 232 #include "ui/native_theme/native_theme.h" |
| 238 #elif defined(OS_MACOSX) | 233 #elif defined(OS_MACOSX) |
| 239 #include "skia/ext/skia_utils_mac.h" | 234 #include "skia/ext/skia_utils_mac.h" |
| 240 #endif | 235 #endif |
| 241 | 236 |
| (...skipping 5748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5990 | 5985 |
| 5991 WebMediaPlayer* RenderViewImpl::CreateWebMediaPlayerForMediaStream( | 5986 WebMediaPlayer* RenderViewImpl::CreateWebMediaPlayerForMediaStream( |
| 5992 WebFrame* frame, | 5987 WebFrame* frame, |
| 5993 const blink::WebURL& url, | 5988 const blink::WebURL& url, |
| 5994 WebMediaPlayerClient* client) { | 5989 WebMediaPlayerClient* client) { |
| 5995 #if defined(ENABLE_WEBRTC) | 5990 #if defined(ENABLE_WEBRTC) |
| 5996 if (!InitializeMediaStreamClient()) { | 5991 if (!InitializeMediaStreamClient()) { |
| 5997 LOG(ERROR) << "Failed to initialize MediaStreamClient"; | 5992 LOG(ERROR) << "Failed to initialize MediaStreamClient"; |
| 5998 return NULL; | 5993 return NULL; |
| 5999 } | 5994 } |
| 6000 #if !defined(GOOGLE_TV) | |
| 6001 if (media_stream_client_->IsMediaStream(url)) { | 5995 if (media_stream_client_->IsMediaStream(url)) { |
| 6002 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) | 5996 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) |
| 6003 bool found_neon = | 5997 bool found_neon = |
| 6004 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; | 5998 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; |
| 6005 UMA_HISTOGRAM_BOOLEAN("Platform.WebRtcNEONFound", found_neon); | 5999 UMA_HISTOGRAM_BOOLEAN("Platform.WebRtcNEONFound", found_neon); |
| 6006 #endif // defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) | 6000 #endif // defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) |
| 6007 return new WebMediaPlayerMS(frame, client, AsWeakPtr(), | 6001 return new WebMediaPlayerMS(frame, client, AsWeakPtr(), |
| 6008 media_stream_client_, new RenderMediaLog()); | 6002 media_stream_client_, new RenderMediaLog()); |
| 6009 } | 6003 } |
| 6010 #endif // !defined(GOOGLE_TV) | |
| 6011 #endif // defined(ENABLE_WEBRTC) | 6004 #endif // defined(ENABLE_WEBRTC) |
| 6012 return NULL; | 6005 return NULL; |
| 6013 } | 6006 } |
| 6014 | 6007 |
| 6015 #if defined(OS_ANDROID) | 6008 #if defined(OS_ANDROID) |
| 6016 WebContentDetectionResult RenderViewImpl::detectContentAround( | 6009 WebContentDetectionResult RenderViewImpl::detectContentAround( |
| 6017 const WebHitTestResult& touch_hit) { | 6010 const WebHitTestResult& touch_hit) { |
| 6018 DCHECK(!touch_hit.isNull()); | 6011 DCHECK(!touch_hit.isNull()); |
| 6019 DCHECK(!touch_hit.node().isNull()); | 6012 DCHECK(!touch_hit.node().isNull()); |
| 6020 DCHECK(touch_hit.node().isTextNode()); | 6013 DCHECK(touch_hit.node().isTextNode()); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6100 | 6093 |
| 6101 if (!context_provider.get()) { | 6094 if (!context_provider.get()) { |
| 6102 LOG(ERROR) << "Failed to get context3d for media player"; | 6095 LOG(ERROR) << "Failed to get context3d for media player"; |
| 6103 return NULL; | 6096 return NULL; |
| 6104 } | 6097 } |
| 6105 | 6098 |
| 6106 stream_texture_factory.reset(new StreamTextureFactoryImpl( | 6099 stream_texture_factory.reset(new StreamTextureFactoryImpl( |
| 6107 context_provider->Context3d(), gpu_channel_host, routing_id_)); | 6100 context_provider->Context3d(), gpu_channel_host, routing_id_)); |
| 6108 } | 6101 } |
| 6109 | 6102 |
| 6110 scoped_ptr<WebMediaPlayerAndroid> web_media_player_android( | 6103 return new WebMediaPlayerAndroid( |
| 6111 new WebMediaPlayerAndroid( | |
| 6112 frame, | 6104 frame, |
| 6113 client, | 6105 client, |
| 6114 AsWeakPtr(), | 6106 AsWeakPtr(), |
| 6115 media_player_manager_, | 6107 media_player_manager_, |
| 6116 stream_texture_factory.release(), | 6108 stream_texture_factory.release(), |
| 6117 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(), | 6109 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(), |
| 6118 new RenderMediaLog())); | 6110 new RenderMediaLog()); |
| 6119 #if defined(ENABLE_WEBRTC) && defined(GOOGLE_TV) | |
| 6120 if (media_stream_client_ && media_stream_client_->IsMediaStream(url)) { | |
| 6121 RTCVideoDecoderFactoryTv* factory = RenderThreadImpl::current() | |
| 6122 ->GetMediaStreamDependencyFactory()->decoder_factory_tv(); | |
| 6123 // |media_stream_client| and |factory| outlives |web_media_player_android|. | |
| 6124 if (!factory->AcquireDemuxer() || | |
| 6125 !web_media_player_android->InjectMediaStream( | |
| 6126 media_stream_client_, | |
| 6127 factory, | |
| 6128 base::Bind( | |
| 6129 base::IgnoreResult(&RTCVideoDecoderFactoryTv::ReleaseDemuxer), | |
| 6130 base::Unretained(factory)))) { | |
| 6131 LOG(ERROR) << "Failed to inject media stream."; | |
| 6132 return NULL; | |
| 6133 } | |
| 6134 } | |
| 6135 #endif // defined(ENABLE_WEBRTC) && defined(GOOGLE_TV) | |
| 6136 return web_media_player_android.release(); | |
| 6137 } | 6111 } |
| 6138 | 6112 |
| 6139 #endif // defined(OS_ANDROID) | 6113 #endif // defined(OS_ANDROID) |
| 6140 | 6114 |
| 6141 #if defined(OS_MACOSX) | 6115 #if defined(OS_MACOSX) |
| 6142 void RenderViewImpl::OnSelectPopupMenuItem(int selected_index) { | 6116 void RenderViewImpl::OnSelectPopupMenuItem(int selected_index) { |
| 6143 if (external_popup_menu_ == NULL) { | 6117 if (external_popup_menu_ == NULL) { |
| 6144 // Crash reports from the field indicate that we can be notified with a | 6118 // Crash reports from the field indicate that we can be notified with a |
| 6145 // NULL external popup menu (we probably get notified twice). | 6119 // NULL external popup menu (we probably get notified twice). |
| 6146 // If you hit this please file a bug against jcivelli and include the page | 6120 // If you hit this please file a bug against jcivelli and include the page |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6369 for (size_t i = 0; i < icon_urls.size(); i++) { | 6343 for (size_t i = 0; i < icon_urls.size(); i++) { |
| 6370 WebURL url = icon_urls[i].iconURL(); | 6344 WebURL url = icon_urls[i].iconURL(); |
| 6371 if (!url.isEmpty()) | 6345 if (!url.isEmpty()) |
| 6372 urls.push_back(FaviconURL(url, | 6346 urls.push_back(FaviconURL(url, |
| 6373 ToFaviconType(icon_urls[i].iconType()))); | 6347 ToFaviconType(icon_urls[i].iconType()))); |
| 6374 } | 6348 } |
| 6375 SendUpdateFaviconURL(urls); | 6349 SendUpdateFaviconURL(urls); |
| 6376 } | 6350 } |
| 6377 | 6351 |
| 6378 } // namespace content | 6352 } // namespace content |
| OLD | NEW |