| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 #include "content/renderer/gpu/render_widget_compositor.h" | 82 #include "content/renderer/gpu/render_widget_compositor.h" |
| 83 #include "content/renderer/history_controller.h" | 83 #include "content/renderer/history_controller.h" |
| 84 #include "content/renderer/history_serialization.h" | 84 #include "content/renderer/history_serialization.h" |
| 85 #include "content/renderer/idle_user_detector.h" | 85 #include "content/renderer/idle_user_detector.h" |
| 86 #include "content/renderer/ime_event_guard.h" | 86 #include "content/renderer/ime_event_guard.h" |
| 87 #include "content/renderer/input/input_handler_manager.h" | 87 #include "content/renderer/input/input_handler_manager.h" |
| 88 #include "content/renderer/input_tag_speech_dispatcher.h" | 88 #include "content/renderer/input_tag_speech_dispatcher.h" |
| 89 #include "content/renderer/internal_document_state_data.h" | 89 #include "content/renderer/internal_document_state_data.h" |
| 90 #include "content/renderer/load_progress_tracker.h" | 90 #include "content/renderer/load_progress_tracker.h" |
| 91 #include "content/renderer/media/audio_device_factory.h" | 91 #include "content/renderer/media/audio_device_factory.h" |
| 92 #include "content/renderer/media/audio_renderer_mixer_manager.h" | |
| 93 #include "content/renderer/media/media_stream_dependency_factory.h" | 92 #include "content/renderer/media/media_stream_dependency_factory.h" |
| 94 #include "content/renderer/media/media_stream_dispatcher.h" | 93 #include "content/renderer/media/media_stream_dispatcher.h" |
| 95 #include "content/renderer/media/media_stream_impl.h" | |
| 96 #include "content/renderer/media/midi_dispatcher.h" | 94 #include "content/renderer/media/midi_dispatcher.h" |
| 97 #include "content/renderer/media/render_media_log.h" | |
| 98 #include "content/renderer/media/video_capture_impl_manager.h" | 95 #include "content/renderer/media/video_capture_impl_manager.h" |
| 99 #include "content/renderer/media/webmediaplayer_impl.h" | |
| 100 #include "content/renderer/media/webmediaplayer_ms.h" | |
| 101 #include "content/renderer/media/webmediaplayer_params.h" | |
| 102 #include "content/renderer/memory_benchmarking_extension.h" | 96 #include "content/renderer/memory_benchmarking_extension.h" |
| 103 #include "content/renderer/mhtml_generator.h" | 97 #include "content/renderer/mhtml_generator.h" |
| 104 #include "content/renderer/push_messaging_dispatcher.h" | 98 #include "content/renderer/push_messaging_dispatcher.h" |
| 105 #include "content/renderer/render_frame_impl.h" | 99 #include "content/renderer/render_frame_impl.h" |
| 106 #include "content/renderer/render_process.h" | 100 #include "content/renderer/render_process.h" |
| 107 #include "content/renderer/render_thread_impl.h" | 101 #include "content/renderer/render_thread_impl.h" |
| 108 #include "content/renderer/render_view_impl_params.h" | 102 #include "content/renderer/render_view_impl_params.h" |
| 109 #include "content/renderer/render_view_mouse_lock_dispatcher.h" | 103 #include "content/renderer/render_view_mouse_lock_dispatcher.h" |
| 110 #include "content/renderer/render_widget_fullscreen_pepper.h" | 104 #include "content/renderer/render_widget_fullscreen_pepper.h" |
| 111 #include "content/renderer/renderer_webapplicationcachehost_impl.h" | 105 #include "content/renderer/renderer_webapplicationcachehost_impl.h" |
| 112 #include "content/renderer/resizing_mode_selector.h" | 106 #include "content/renderer/resizing_mode_selector.h" |
| 113 #include "content/renderer/savable_resources.h" | 107 #include "content/renderer/savable_resources.h" |
| 114 #include "content/renderer/skia_benchmarking_extension.h" | 108 #include "content/renderer/skia_benchmarking_extension.h" |
| 115 #include "content/renderer/speech_recognition_dispatcher.h" | 109 #include "content/renderer/speech_recognition_dispatcher.h" |
| 116 #include "content/renderer/stats_collection_controller.h" | 110 #include "content/renderer/stats_collection_controller.h" |
| 117 #include "content/renderer/stats_collection_observer.h" | 111 #include "content/renderer/stats_collection_observer.h" |
| 118 #include "content/renderer/text_input_client_observer.h" | 112 #include "content/renderer/text_input_client_observer.h" |
| 119 #include "content/renderer/v8_value_converter_impl.h" | 113 #include "content/renderer/v8_value_converter_impl.h" |
| 120 #include "content/renderer/web_ui_extension.h" | 114 #include "content/renderer/web_ui_extension.h" |
| 121 #include "content/renderer/web_ui_extension_data.h" | 115 #include "content/renderer/web_ui_extension_data.h" |
| 122 #include "content/renderer/web_ui_mojo.h" | 116 #include "content/renderer/web_ui_mojo.h" |
| 123 #include "content/renderer/websharedworker_proxy.h" | 117 #include "content/renderer/websharedworker_proxy.h" |
| 124 #include "media/audio/audio_output_device.h" | 118 #include "media/audio/audio_output_device.h" |
| 125 #include "media/base/audio_renderer_mixer_input.h" | |
| 126 #include "media/base/filter_collection.h" | 119 #include "media/base/filter_collection.h" |
| 127 #include "media/base/media_switches.h" | 120 #include "media/base/media_switches.h" |
| 128 #include "media/filters/audio_renderer_impl.h" | 121 #include "media/filters/audio_renderer_impl.h" |
| 129 #include "media/filters/gpu_video_accelerator_factories.h" | 122 #include "media/filters/gpu_video_accelerator_factories.h" |
| 130 #include "net/base/data_url.h" | 123 #include "net/base/data_url.h" |
| 131 #include "net/base/escape.h" | 124 #include "net/base/escape.h" |
| 132 #include "net/base/net_errors.h" | 125 #include "net/base/net_errors.h" |
| 133 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 126 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 134 #include "net/http/http_util.h" | 127 #include "net/http/http_util.h" |
| 135 #include "third_party/WebKit/public/platform/WebCString.h" | 128 #include "third_party/WebKit/public/platform/WebCString.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 171 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
| 179 #include "third_party/WebKit/public/web/WebPluginDocument.h" | 172 #include "third_party/WebKit/public/web/WebPluginDocument.h" |
| 180 #include "third_party/WebKit/public/web/WebRange.h" | 173 #include "third_party/WebKit/public/web/WebRange.h" |
| 181 #include "third_party/WebKit/public/web/WebScriptSource.h" | 174 #include "third_party/WebKit/public/web/WebScriptSource.h" |
| 182 #include "third_party/WebKit/public/web/WebSearchableFormData.h" | 175 #include "third_party/WebKit/public/web/WebSearchableFormData.h" |
| 183 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 176 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
| 184 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 177 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
| 185 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h" | 178 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h" |
| 186 #include "third_party/WebKit/public/web/WebSettings.h" | 179 #include "third_party/WebKit/public/web/WebSettings.h" |
| 187 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | 180 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
| 188 #include "third_party/WebKit/public/web/WebUserMediaClient.h" | |
| 189 #include "third_party/WebKit/public/web/WebView.h" | 181 #include "third_party/WebKit/public/web/WebView.h" |
| 190 #include "third_party/WebKit/public/web/WebWindowFeatures.h" | 182 #include "third_party/WebKit/public/web/WebWindowFeatures.h" |
| 191 #include "third_party/WebKit/public/web/default/WebRenderTheme.h" | 183 #include "third_party/WebKit/public/web/default/WebRenderTheme.h" |
| 192 #include "ui/base/clipboard/clipboard.h" | 184 #include "ui/base/clipboard/clipboard.h" |
| 193 #include "ui/base/ui_base_switches_util.h" | 185 #include "ui/base/ui_base_switches_util.h" |
| 194 #include "ui/events/latency_info.h" | 186 #include "ui/events/latency_info.h" |
| 195 #include "ui/gfx/native_widget_types.h" | 187 #include "ui/gfx/native_widget_types.h" |
| 196 #include "ui/gfx/point.h" | 188 #include "ui/gfx/point.h" |
| 197 #include "ui/gfx/rect.h" | 189 #include "ui/gfx/rect.h" |
| 198 #include "ui/gfx/rect_conversions.h" | 190 #include "ui/gfx/rect_conversions.h" |
| 199 #include "ui/gfx/size_conversions.h" | 191 #include "ui/gfx/size_conversions.h" |
| 200 #include "ui/shell_dialogs/selected_file_info.h" | 192 #include "ui/shell_dialogs/selected_file_info.h" |
| 201 #include "v8/include/v8.h" | 193 #include "v8/include/v8.h" |
| 202 #include "webkit/child/weburlresponse_extradata_impl.h" | 194 #include "webkit/child/weburlresponse_extradata_impl.h" |
| 203 | 195 |
| 204 #if defined(OS_ANDROID) | 196 #if defined(OS_ANDROID) |
| 205 #include <cpu-features.h> | 197 #include <cpu-features.h> |
| 206 | 198 |
| 207 #include "content/common/gpu/client/context_provider_command_buffer.h" | |
| 208 #include "content/renderer/android/address_detector.h" | 199 #include "content/renderer/android/address_detector.h" |
| 209 #include "content/renderer/android/content_detector.h" | 200 #include "content/renderer/android/content_detector.h" |
| 210 #include "content/renderer/android/email_detector.h" | 201 #include "content/renderer/android/email_detector.h" |
| 211 #include "content/renderer/android/phone_number_detector.h" | 202 #include "content/renderer/android/phone_number_detector.h" |
| 212 #include "content/renderer/android/synchronous_compositor_factory.h" | |
| 213 #include "content/renderer/media/android/renderer_media_player_manager.h" | 203 #include "content/renderer/media/android/renderer_media_player_manager.h" |
| 214 #include "content/renderer/media/android/stream_texture_factory_impl.h" | |
| 215 #include "content/renderer/media/android/webmediaplayer_android.h" | |
| 216 #include "net/android/network_library.h" | 204 #include "net/android/network_library.h" |
| 217 #include "skia/ext/platform_canvas.h" | 205 #include "skia/ext/platform_canvas.h" |
| 218 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 206 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
| 219 #include "third_party/WebKit/public/platform/WebFloatRect.h" | 207 #include "third_party/WebKit/public/platform/WebFloatRect.h" |
| 220 #include "third_party/WebKit/public/web/WebHitTestResult.h" | 208 #include "third_party/WebKit/public/web/WebHitTestResult.h" |
| 221 #include "ui/gfx/rect_f.h" | 209 #include "ui/gfx/rect_f.h" |
| 222 | 210 |
| 223 #elif defined(OS_WIN) | 211 #elif defined(OS_WIN) |
| 224 // TODO(port): these files are currently Windows only because they concern: | 212 // TODO(port): these files are currently Windows only because they concern: |
| 225 // * theming | 213 // * theming |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 using blink::WebFormElement; | 252 using blink::WebFormElement; |
| 265 using blink::WebFrame; | 253 using blink::WebFrame; |
| 266 using blink::WebGestureEvent; | 254 using blink::WebGestureEvent; |
| 267 using blink::WebHistoryItem; | 255 using blink::WebHistoryItem; |
| 268 using blink::WebHTTPBody; | 256 using blink::WebHTTPBody; |
| 269 using blink::WebIconURL; | 257 using blink::WebIconURL; |
| 270 using blink::WebImage; | 258 using blink::WebImage; |
| 271 using blink::WebInputElement; | 259 using blink::WebInputElement; |
| 272 using blink::WebInputEvent; | 260 using blink::WebInputEvent; |
| 273 using blink::WebLocalFrame; | 261 using blink::WebLocalFrame; |
| 274 using blink::WebMediaPlayer; | |
| 275 using blink::WebMediaPlayerAction; | 262 using blink::WebMediaPlayerAction; |
| 276 using blink::WebMediaPlayerClient; | |
| 277 using blink::WebMouseEvent; | 263 using blink::WebMouseEvent; |
| 278 using blink::WebNavigationPolicy; | 264 using blink::WebNavigationPolicy; |
| 279 using blink::WebNavigationType; | 265 using blink::WebNavigationType; |
| 280 using blink::WebNode; | 266 using blink::WebNode; |
| 281 using blink::WebPageSerializer; | 267 using blink::WebPageSerializer; |
| 282 using blink::WebPageSerializerClient; | 268 using blink::WebPageSerializerClient; |
| 283 using blink::WebPeerConnection00Handler; | 269 using blink::WebPeerConnection00Handler; |
| 284 using blink::WebPeerConnection00HandlerClient; | 270 using blink::WebPeerConnection00HandlerClient; |
| 285 using blink::WebPeerConnectionHandler; | 271 using blink::WebPeerConnectionHandler; |
| 286 using blink::WebPeerConnectionHandlerClient; | 272 using blink::WebPeerConnectionHandlerClient; |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 #endif | 654 #endif |
| 669 cached_is_main_frame_pinned_to_left_(false), | 655 cached_is_main_frame_pinned_to_left_(false), |
| 670 cached_is_main_frame_pinned_to_right_(false), | 656 cached_is_main_frame_pinned_to_right_(false), |
| 671 has_scrolled_focused_editable_node_into_rect_(false), | 657 has_scrolled_focused_editable_node_into_rect_(false), |
| 672 push_messaging_dispatcher_(NULL), | 658 push_messaging_dispatcher_(NULL), |
| 673 geolocation_dispatcher_(NULL), | 659 geolocation_dispatcher_(NULL), |
| 674 input_tag_speech_dispatcher_(NULL), | 660 input_tag_speech_dispatcher_(NULL), |
| 675 speech_recognition_dispatcher_(NULL), | 661 speech_recognition_dispatcher_(NULL), |
| 676 media_stream_dispatcher_(NULL), | 662 media_stream_dispatcher_(NULL), |
| 677 browser_plugin_manager_(NULL), | 663 browser_plugin_manager_(NULL), |
| 678 media_stream_client_(NULL), | |
| 679 web_user_media_client_(NULL), | |
| 680 midi_dispatcher_(NULL), | 664 midi_dispatcher_(NULL), |
| 681 devtools_agent_(NULL), | 665 devtools_agent_(NULL), |
| 682 accessibility_mode_(AccessibilityModeOff), | 666 accessibility_mode_(AccessibilityModeOff), |
| 683 renderer_accessibility_(NULL), | 667 renderer_accessibility_(NULL), |
| 684 mouse_lock_dispatcher_(NULL), | 668 mouse_lock_dispatcher_(NULL), |
| 685 #if defined(OS_ANDROID) | 669 #if defined(OS_ANDROID) |
| 686 expected_content_intent_id_(0), | 670 expected_content_intent_id_(0), |
| 687 media_player_manager_(NULL), | 671 media_player_manager_(NULL), |
| 688 #endif | 672 #endif |
| 689 #if defined(OS_WIN) | 673 #if defined(OS_WIN) |
| (...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2009 void RenderViewImpl::initializeLayerTreeView() { | 1993 void RenderViewImpl::initializeLayerTreeView() { |
| 2010 RenderWidget::initializeLayerTreeView(); | 1994 RenderWidget::initializeLayerTreeView(); |
| 2011 RenderWidgetCompositor* rwc = compositor(); | 1995 RenderWidgetCompositor* rwc = compositor(); |
| 2012 if (!rwc || !webview() || !webview()->devToolsAgent()) | 1996 if (!rwc || !webview() || !webview()->devToolsAgent()) |
| 2013 return; | 1997 return; |
| 2014 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); | 1998 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); |
| 2015 } | 1999 } |
| 2016 | 2000 |
| 2017 // blink::WebFrameClient ----------------------------------------------------- | 2001 // blink::WebFrameClient ----------------------------------------------------- |
| 2018 | 2002 |
| 2019 blink::WebMediaPlayer* RenderViewImpl::CreateMediaPlayer( | |
| 2020 RenderFrame* render_frame, | |
| 2021 blink::WebLocalFrame* frame, | |
| 2022 const blink::WebURL& url, | |
| 2023 blink::WebMediaPlayerClient* client) { | |
| 2024 FOR_EACH_OBSERVER( | |
| 2025 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); | |
| 2026 | |
| 2027 WebMediaPlayer* player = CreateWebMediaPlayerForMediaStream(frame, url, | |
| 2028 client); | |
| 2029 if (player) | |
| 2030 return player; | |
| 2031 | |
| 2032 #if defined(OS_ANDROID) | |
| 2033 return CreateAndroidWebMediaPlayer(frame, url, client); | |
| 2034 #else | |
| 2035 WebMediaPlayerParams params( | |
| 2036 base::Bind(&ContentRendererClient::DeferMediaLoad, | |
| 2037 base::Unretained(GetContentClient()->renderer()), | |
| 2038 static_cast<RenderFrame*>(render_frame)), | |
| 2039 RenderThreadImpl::current()->GetAudioRendererMixerManager()->CreateInput( | |
| 2040 routing_id_, render_frame->GetRoutingID())); | |
| 2041 return new WebMediaPlayerImpl(frame, client, AsWeakPtr(), params); | |
| 2042 #endif // defined(OS_ANDROID) | |
| 2043 } | |
| 2044 | |
| 2045 void RenderViewImpl::Repaint(const gfx::Size& size) { | 2003 void RenderViewImpl::Repaint(const gfx::Size& size) { |
| 2046 OnRepaint(size); | 2004 OnRepaint(size); |
| 2047 } | 2005 } |
| 2048 | 2006 |
| 2049 void RenderViewImpl::SetEditCommandForNextKeyEvent(const std::string& name, | 2007 void RenderViewImpl::SetEditCommandForNextKeyEvent(const std::string& name, |
| 2050 const std::string& value) { | 2008 const std::string& value) { |
| 2051 EditCommands edit_commands; | 2009 EditCommands edit_commands; |
| 2052 edit_commands.push_back(EditCommand(name, value)); | 2010 edit_commands.push_back(EditCommand(name, value)); |
| 2053 OnSetEditCommandsForNextKeyEvent(edit_commands); | 2011 OnSetEditCommandsForNextKeyEvent(edit_commands); |
| 2054 } | 2012 } |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2355 Send(new ViewHostMsg_DidContentsPreferredSizeChange(routing_id_, | 2313 Send(new ViewHostMsg_DidContentsPreferredSizeChange(routing_id_, |
| 2356 preferred_size_)); | 2314 preferred_size_)); |
| 2357 } | 2315 } |
| 2358 | 2316 |
| 2359 BrowserPluginManager* RenderViewImpl::GetBrowserPluginManager() { | 2317 BrowserPluginManager* RenderViewImpl::GetBrowserPluginManager() { |
| 2360 if (!browser_plugin_manager_.get()) | 2318 if (!browser_plugin_manager_.get()) |
| 2361 browser_plugin_manager_ = BrowserPluginManager::Create(this); | 2319 browser_plugin_manager_ = BrowserPluginManager::Create(this); |
| 2362 return browser_plugin_manager_.get(); | 2320 return browser_plugin_manager_.get(); |
| 2363 } | 2321 } |
| 2364 | 2322 |
| 2365 bool RenderViewImpl::InitializeMediaStreamClient() { | |
| 2366 if (media_stream_client_) | |
| 2367 return true; | |
| 2368 | |
| 2369 if (!RenderThreadImpl::current()) // Will be NULL during unit tests. | |
| 2370 return false; | |
| 2371 | |
| 2372 #if defined(OS_ANDROID) | |
| 2373 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableWebRTC)) | |
| 2374 return false; | |
| 2375 #endif | |
| 2376 | |
| 2377 #if defined(ENABLE_WEBRTC) | |
| 2378 if (!media_stream_dispatcher_) | |
| 2379 media_stream_dispatcher_ = new MediaStreamDispatcher(this); | |
| 2380 | |
| 2381 MediaStreamImpl* media_stream_impl = new MediaStreamImpl( | |
| 2382 this, | |
| 2383 media_stream_dispatcher_, | |
| 2384 RenderThreadImpl::current()->GetMediaStreamDependencyFactory()); | |
| 2385 media_stream_client_ = media_stream_impl; | |
| 2386 web_user_media_client_ = media_stream_impl; | |
| 2387 return true; | |
| 2388 #else | |
| 2389 return false; | |
| 2390 #endif | |
| 2391 } | |
| 2392 | |
| 2393 void RenderViewImpl::UpdateScrollState(WebFrame* frame) { | 2323 void RenderViewImpl::UpdateScrollState(WebFrame* frame) { |
| 2394 WebSize offset = frame->scrollOffset(); | 2324 WebSize offset = frame->scrollOffset(); |
| 2395 WebSize minimum_offset = frame->minimumScrollOffset(); | 2325 WebSize minimum_offset = frame->minimumScrollOffset(); |
| 2396 WebSize maximum_offset = frame->maximumScrollOffset(); | 2326 WebSize maximum_offset = frame->maximumScrollOffset(); |
| 2397 | 2327 |
| 2398 bool is_pinned_to_left = offset.width <= minimum_offset.width; | 2328 bool is_pinned_to_left = offset.width <= minimum_offset.width; |
| 2399 bool is_pinned_to_right = offset.width >= maximum_offset.width; | 2329 bool is_pinned_to_right = offset.width >= maximum_offset.width; |
| 2400 | 2330 |
| 2401 if (is_pinned_to_left != cached_is_main_frame_pinned_to_left_ || | 2331 if (is_pinned_to_left != cached_is_main_frame_pinned_to_left_ || |
| 2402 is_pinned_to_right != cached_is_main_frame_pinned_to_right_) { | 2332 is_pinned_to_right != cached_is_main_frame_pinned_to_right_) { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2587 } | 2517 } |
| 2588 | 2518 |
| 2589 void RenderViewImpl::DidStartLoading() { | 2519 void RenderViewImpl::DidStartLoading() { |
| 2590 main_render_frame_->didStartLoading(true); | 2520 main_render_frame_->didStartLoading(true); |
| 2591 } | 2521 } |
| 2592 | 2522 |
| 2593 void RenderViewImpl::DidStopLoading() { | 2523 void RenderViewImpl::DidStopLoading() { |
| 2594 main_render_frame_->didStopLoading(); | 2524 main_render_frame_->didStopLoading(); |
| 2595 } | 2525 } |
| 2596 | 2526 |
| 2597 void RenderViewImpl::DidPlay(blink::WebMediaPlayer* player) { | |
| 2598 Send(new ViewHostMsg_MediaPlayingNotification(routing_id_, | |
| 2599 reinterpret_cast<int64>(player), | |
| 2600 player->hasVideo(), | |
| 2601 player->hasAudio())); | |
| 2602 } | |
| 2603 | |
| 2604 void RenderViewImpl::DidPause(blink::WebMediaPlayer* player) { | |
| 2605 Send(new ViewHostMsg_MediaPausedNotification( | |
| 2606 routing_id_, reinterpret_cast<int64>(player))); | |
| 2607 } | |
| 2608 | |
| 2609 void RenderViewImpl::PlayerGone(blink::WebMediaPlayer* player) { | |
| 2610 DidPause(player); | |
| 2611 } | |
| 2612 | |
| 2613 void RenderViewImpl::SyncNavigationState() { | 2527 void RenderViewImpl::SyncNavigationState() { |
| 2614 if (!webview()) | 2528 if (!webview()) |
| 2615 return; | 2529 return; |
| 2616 SendUpdateState(history_controller_->GetCurrentEntry()); | 2530 SendUpdateState(history_controller_->GetCurrentEntry()); |
| 2617 } | 2531 } |
| 2618 | 2532 |
| 2619 GURL RenderViewImpl::GetLoadingUrl(blink::WebFrame* frame) const { | 2533 GURL RenderViewImpl::GetLoadingUrl(blink::WebFrame* frame) const { |
| 2620 WebDataSource* ds = frame->dataSource(); | 2534 WebDataSource* ds = frame->dataSource(); |
| 2621 if (ds->hasUnreachableURL()) | 2535 if (ds->hasUnreachableURL()) |
| 2622 return ds->unreachableURL(); | 2536 return ds->unreachableURL(); |
| (...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3942 blink::WebPageVisibilityStateVisible; | 3856 blink::WebPageVisibilityStateVisible; |
| 3943 blink::WebPageVisibilityState override_state = current_state; | 3857 blink::WebPageVisibilityState override_state = current_state; |
| 3944 // TODO(jam): move this method to WebFrameClient. | 3858 // TODO(jam): move this method to WebFrameClient. |
| 3945 if (GetContentClient()->renderer()-> | 3859 if (GetContentClient()->renderer()-> |
| 3946 ShouldOverridePageVisibilityState(main_render_frame_.get(), | 3860 ShouldOverridePageVisibilityState(main_render_frame_.get(), |
| 3947 &override_state)) | 3861 &override_state)) |
| 3948 return override_state; | 3862 return override_state; |
| 3949 return current_state; | 3863 return current_state; |
| 3950 } | 3864 } |
| 3951 | 3865 |
| 3952 blink::WebUserMediaClient* RenderViewImpl::userMediaClient() { | |
| 3953 // This can happen in tests, in which case it's OK to return NULL. | |
| 3954 if (!InitializeMediaStreamClient()) | |
| 3955 return NULL; | |
| 3956 | |
| 3957 return web_user_media_client_; | |
| 3958 } | |
| 3959 | |
| 3960 blink::WebMIDIClient* RenderViewImpl::webMIDIClient() { | 3866 blink::WebMIDIClient* RenderViewImpl::webMIDIClient() { |
| 3961 if (!midi_dispatcher_) | 3867 if (!midi_dispatcher_) |
| 3962 midi_dispatcher_ = new MidiDispatcher(this); | 3868 midi_dispatcher_ = new MidiDispatcher(this); |
| 3963 return midi_dispatcher_; | 3869 return midi_dispatcher_; |
| 3964 } | 3870 } |
| 3965 | 3871 |
| 3966 blink::WebPushClient* RenderViewImpl::webPushClient() { | 3872 blink::WebPushClient* RenderViewImpl::webPushClient() { |
| 3967 if (!push_messaging_dispatcher_) | 3873 if (!push_messaging_dispatcher_) |
| 3968 push_messaging_dispatcher_ = new PushMessagingDispatcher(this); | 3874 push_messaging_dispatcher_ = new PushMessagingDispatcher(this); |
| 3969 return push_messaging_dispatcher_; | 3875 return push_messaging_dispatcher_; |
| 3970 } | 3876 } |
| 3971 | 3877 |
| 3972 void RenderViewImpl::draggableRegionsChanged() { | 3878 void RenderViewImpl::draggableRegionsChanged() { |
| 3973 FOR_EACH_OBSERVER( | 3879 FOR_EACH_OBSERVER( |
| 3974 RenderViewObserver, | 3880 RenderViewObserver, |
| 3975 observers_, | 3881 observers_, |
| 3976 DraggableRegionsChanged(webview()->mainFrame())); | 3882 DraggableRegionsChanged(webview()->mainFrame())); |
| 3977 } | 3883 } |
| 3978 | 3884 |
| 3979 WebMediaPlayer* RenderViewImpl::CreateWebMediaPlayerForMediaStream( | |
| 3980 WebFrame* frame, | |
| 3981 const blink::WebURL& url, | |
| 3982 WebMediaPlayerClient* client) { | |
| 3983 #if defined(ENABLE_WEBRTC) | |
| 3984 if (!InitializeMediaStreamClient()) { | |
| 3985 LOG(ERROR) << "Failed to initialize MediaStreamClient"; | |
| 3986 return NULL; | |
| 3987 } | |
| 3988 if (media_stream_client_->IsMediaStream(url)) { | |
| 3989 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) | |
| 3990 bool found_neon = | |
| 3991 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; | |
| 3992 UMA_HISTOGRAM_BOOLEAN("Platform.WebRtcNEONFound", found_neon); | |
| 3993 #endif // defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) | |
| 3994 return new WebMediaPlayerMS(frame, client, AsWeakPtr(), | |
| 3995 media_stream_client_, new RenderMediaLog()); | |
| 3996 } | |
| 3997 #endif // defined(ENABLE_WEBRTC) | |
| 3998 return NULL; | |
| 3999 } | |
| 4000 | |
| 4001 #if defined(OS_ANDROID) | 3885 #if defined(OS_ANDROID) |
| 4002 WebContentDetectionResult RenderViewImpl::detectContentAround( | 3886 WebContentDetectionResult RenderViewImpl::detectContentAround( |
| 4003 const WebHitTestResult& touch_hit) { | 3887 const WebHitTestResult& touch_hit) { |
| 4004 DCHECK(!touch_hit.isNull()); | 3888 DCHECK(!touch_hit.isNull()); |
| 4005 DCHECK(!touch_hit.node().isNull()); | 3889 DCHECK(!touch_hit.node().isNull()); |
| 4006 DCHECK(touch_hit.node().isTextNode()); | 3890 DCHECK(touch_hit.node().isTextNode()); |
| 4007 | 3891 |
| 4008 // Process the position with all the registered content detectors until | 3892 // Process the position with all the registered content detectors until |
| 4009 // a match is found. Priority is provided by their relative order. | 3893 // a match is found. Priority is provided by their relative order. |
| 4010 for (ContentDetectorList::const_iterator it = content_detectors_.begin(); | 3894 for (ContentDetectorList::const_iterator it = content_detectors_.begin(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4054 date_time_picker_client_.reset( | 3938 date_time_picker_client_.reset( |
| 4055 new RendererDateTimePicker(this, params, completion)); | 3939 new RendererDateTimePicker(this, params, completion)); |
| 4056 return date_time_picker_client_->Open(); | 3940 return date_time_picker_client_->Open(); |
| 4057 } | 3941 } |
| 4058 | 3942 |
| 4059 void RenderViewImpl::DismissDateTimeDialog() { | 3943 void RenderViewImpl::DismissDateTimeDialog() { |
| 4060 DCHECK(date_time_picker_client_); | 3944 DCHECK(date_time_picker_client_); |
| 4061 date_time_picker_client_.reset(NULL); | 3945 date_time_picker_client_.reset(NULL); |
| 4062 } | 3946 } |
| 4063 | 3947 |
| 4064 WebMediaPlayer* RenderViewImpl::CreateAndroidWebMediaPlayer( | |
| 4065 WebFrame* frame, | |
| 4066 const blink::WebURL& url, | |
| 4067 WebMediaPlayerClient* client) { | |
| 4068 GpuChannelHost* gpu_channel_host = | |
| 4069 RenderThreadImpl::current()->EstablishGpuChannelSync( | |
| 4070 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); | |
| 4071 if (!gpu_channel_host) { | |
| 4072 LOG(ERROR) << "Failed to establish GPU channel for media player"; | |
| 4073 return NULL; | |
| 4074 } | |
| 4075 | |
| 4076 scoped_refptr<StreamTextureFactory> stream_texture_factory; | |
| 4077 if (UsingSynchronousRendererCompositor()) { | |
| 4078 SynchronousCompositorFactory* factory = | |
| 4079 SynchronousCompositorFactory::GetInstance(); | |
| 4080 stream_texture_factory = factory->CreateStreamTextureFactory(routing_id_); | |
| 4081 } else { | |
| 4082 scoped_refptr<webkit::gpu::ContextProviderWebContext> context_provider = | |
| 4083 RenderThreadImpl::current()->SharedMainThreadContextProvider(); | |
| 4084 | |
| 4085 if (!context_provider.get()) { | |
| 4086 LOG(ERROR) << "Failed to get context3d for media player"; | |
| 4087 return NULL; | |
| 4088 } | |
| 4089 | |
| 4090 stream_texture_factory = StreamTextureFactoryImpl::Create( | |
| 4091 context_provider, gpu_channel_host, routing_id_); | |
| 4092 } | |
| 4093 | |
| 4094 return new WebMediaPlayerAndroid( | |
| 4095 frame, | |
| 4096 client, | |
| 4097 AsWeakPtr(), | |
| 4098 media_player_manager_, | |
| 4099 stream_texture_factory, | |
| 4100 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(), | |
| 4101 new RenderMediaLog()); | |
| 4102 } | |
| 4103 | |
| 4104 #endif // defined(OS_ANDROID) | 3948 #endif // defined(OS_ANDROID) |
| 4105 | 3949 |
| 4106 #if defined(OS_MACOSX) | 3950 #if defined(OS_MACOSX) |
| 4107 void RenderViewImpl::OnSelectPopupMenuItem(int selected_index) { | 3951 void RenderViewImpl::OnSelectPopupMenuItem(int selected_index) { |
| 4108 if (external_popup_menu_ == NULL) | 3952 if (external_popup_menu_ == NULL) |
| 4109 return; | 3953 return; |
| 4110 external_popup_menu_->DidSelectItem(selected_index); | 3954 external_popup_menu_->DidSelectItem(selected_index); |
| 4111 external_popup_menu_.reset(); | 3955 external_popup_menu_.reset(); |
| 4112 } | 3956 } |
| 4113 #endif | 3957 #endif |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4284 | 4128 |
| 4285 void RenderViewImpl::EnableAutoResizeForTesting(const gfx::Size& min_size, | 4129 void RenderViewImpl::EnableAutoResizeForTesting(const gfx::Size& min_size, |
| 4286 const gfx::Size& max_size) { | 4130 const gfx::Size& max_size) { |
| 4287 OnEnableAutoResize(min_size, max_size); | 4131 OnEnableAutoResize(min_size, max_size); |
| 4288 } | 4132 } |
| 4289 | 4133 |
| 4290 void RenderViewImpl::DisableAutoResizeForTesting(const gfx::Size& new_size) { | 4134 void RenderViewImpl::DisableAutoResizeForTesting(const gfx::Size& new_size) { |
| 4291 OnDisableAutoResize(new_size); | 4135 OnDisableAutoResize(new_size); |
| 4292 } | 4136 } |
| 4293 | 4137 |
| 4294 void RenderViewImpl::SetMediaStreamClientForTesting( | |
| 4295 MediaStreamClient* media_stream_client) { | |
| 4296 DCHECK(!media_stream_client_); | |
| 4297 DCHECK(!web_user_media_client_); | |
| 4298 media_stream_client_ = media_stream_client; | |
| 4299 } | |
| 4300 | |
| 4301 void RenderViewImpl::OnReleaseDisambiguationPopupBitmap( | 4138 void RenderViewImpl::OnReleaseDisambiguationPopupBitmap( |
| 4302 const cc::SharedBitmapId& id) { | 4139 const cc::SharedBitmapId& id) { |
| 4303 BitmapMap::iterator it = disambiguation_bitmaps_.find(id); | 4140 BitmapMap::iterator it = disambiguation_bitmaps_.find(id); |
| 4304 DCHECK(it != disambiguation_bitmaps_.end()); | 4141 DCHECK(it != disambiguation_bitmaps_.end()); |
| 4305 delete it->second; | 4142 delete it->second; |
| 4306 disambiguation_bitmaps_.erase(it); | 4143 disambiguation_bitmaps_.erase(it); |
| 4307 } | 4144 } |
| 4308 | 4145 |
| 4309 void RenderViewImpl::DidCommitCompositorFrame() { | 4146 void RenderViewImpl::DidCommitCompositorFrame() { |
| 4310 RenderWidget::DidCommitCompositorFrame(); | 4147 RenderWidget::DidCommitCompositorFrame(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 4330 std::vector<gfx::Size> sizes; | 4167 std::vector<gfx::Size> sizes; |
| 4331 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4168 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 4332 if (!url.isEmpty()) | 4169 if (!url.isEmpty()) |
| 4333 urls.push_back( | 4170 urls.push_back( |
| 4334 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4171 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 4335 } | 4172 } |
| 4336 SendUpdateFaviconURL(urls); | 4173 SendUpdateFaviconURL(urls); |
| 4337 } | 4174 } |
| 4338 | 4175 |
| 4339 } // namespace content | 4176 } // namespace content |
| OLD | NEW |