Chromium Code Reviews| 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/bind.h" | 10 #include "base/bind.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 #include "content/public/common/url_constants.h" | 55 #include "content/public/common/url_constants.h" |
| 56 #include "content/public/renderer/content_renderer_client.h" | 56 #include "content/public/renderer/content_renderer_client.h" |
| 57 #include "content/public/renderer/context_menu_client.h" | 57 #include "content/public/renderer/context_menu_client.h" |
| 58 #include "content/public/renderer/document_state.h" | 58 #include "content/public/renderer/document_state.h" |
| 59 #include "content/public/renderer/navigation_state.h" | 59 #include "content/public/renderer/navigation_state.h" |
| 60 #include "content/public/renderer/password_form_conversion_utils.h" | 60 #include "content/public/renderer/password_form_conversion_utils.h" |
| 61 #include "content/public/renderer/render_view_observer.h" | 61 #include "content/public/renderer/render_view_observer.h" |
| 62 #include "content/public/renderer/render_view_visitor.h" | 62 #include "content/public/renderer/render_view_visitor.h" |
| 63 #include "content/renderer/browser_plugin/browser_plugin.h" | 63 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 64 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 64 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
| 65 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h" | |
| 65 #include "content/renderer/device_orientation_dispatcher.h" | 66 #include "content/renderer/device_orientation_dispatcher.h" |
| 66 #include "content/renderer/devtools_agent.h" | 67 #include "content/renderer/devtools_agent.h" |
| 67 #include "content/renderer/disambiguation_popup_helper.h" | 68 #include "content/renderer/disambiguation_popup_helper.h" |
| 68 #include "content/renderer/dom_automation_controller.h" | 69 #include "content/renderer/dom_automation_controller.h" |
| 69 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 70 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
| 70 #include "content/renderer/do_not_track_bindings.h" | 71 #include "content/renderer/do_not_track_bindings.h" |
| 71 #include "content/renderer/external_popup_menu.h" | 72 #include "content/renderer/external_popup_menu.h" |
| 72 #include "content/renderer/geolocation_dispatcher.h" | 73 #include "content/renderer/geolocation_dispatcher.h" |
| 73 #include "content/renderer/gpu/compositor_thread.h" | 74 #include "content/renderer/gpu/compositor_thread.h" |
| 74 #include "content/renderer/gpu/compositor_output_surface.h" | 75 #include "content/renderer/gpu/compositor_output_surface.h" |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 569 cached_is_main_frame_pinned_to_left_(false), | 570 cached_is_main_frame_pinned_to_left_(false), |
| 570 cached_is_main_frame_pinned_to_right_(false), | 571 cached_is_main_frame_pinned_to_right_(false), |
| 571 cached_has_main_frame_horizontal_scrollbar_(false), | 572 cached_has_main_frame_horizontal_scrollbar_(false), |
| 572 cached_has_main_frame_vertical_scrollbar_(false), | 573 cached_has_main_frame_vertical_scrollbar_(false), |
| 573 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), | 574 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), |
| 574 geolocation_dispatcher_(NULL), | 575 geolocation_dispatcher_(NULL), |
| 575 input_tag_speech_dispatcher_(NULL), | 576 input_tag_speech_dispatcher_(NULL), |
| 576 speech_recognition_dispatcher_(NULL), | 577 speech_recognition_dispatcher_(NULL), |
| 577 device_orientation_dispatcher_(NULL), | 578 device_orientation_dispatcher_(NULL), |
| 578 media_stream_dispatcher_(NULL), | 579 media_stream_dispatcher_(NULL), |
| 580 browser_plugin_manager_(NULL), | |
| 579 media_stream_impl_(NULL), | 581 media_stream_impl_(NULL), |
| 580 devtools_agent_(NULL), | 582 devtools_agent_(NULL), |
| 581 accessibility_mode_(AccessibilityModeOff), | 583 accessibility_mode_(AccessibilityModeOff), |
| 582 renderer_accessibility_(NULL), | 584 renderer_accessibility_(NULL), |
| 583 java_bridge_dispatcher_(NULL), | 585 java_bridge_dispatcher_(NULL), |
| 584 mouse_lock_dispatcher_(NULL), | 586 mouse_lock_dispatcher_(NULL), |
| 585 #if defined(OS_ANDROID) | 587 #if defined(OS_ANDROID) |
| 586 body_background_color_(SK_ColorWHITE), | 588 body_background_color_(SK_ColorWHITE), |
| 587 update_frame_info_scheduled_(false), | 589 update_frame_info_scheduled_(false), |
| 588 expected_content_intent_id_(0), | 590 expected_content_intent_id_(0), |
| (...skipping 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2447 | 2449 |
| 2448 WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame, | 2450 WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame, |
| 2449 const WebPluginParams& params) { | 2451 const WebPluginParams& params) { |
| 2450 WebPlugin* plugin = NULL; | 2452 WebPlugin* plugin = NULL; |
| 2451 if (GetContentClient()->renderer()->OverrideCreatePlugin( | 2453 if (GetContentClient()->renderer()->OverrideCreatePlugin( |
| 2452 this, frame, params, &plugin)) { | 2454 this, frame, params, &plugin)) { |
| 2453 return plugin; | 2455 return plugin; |
| 2454 } | 2456 } |
| 2455 | 2457 |
| 2456 if (UTF16ToASCII(params.mimeType) == kBrowserPluginMimeType) { | 2458 if (UTF16ToASCII(params.mimeType) == kBrowserPluginMimeType) { |
| 2457 return BrowserPluginManager::Get()-> | 2459 return browser_plugin_manager()->CreateBrowserPlugin(this, frame, params); |
| 2458 CreateBrowserPlugin(this, frame, params); | |
| 2459 } | 2460 } |
| 2460 | 2461 |
| 2461 webkit::WebPluginInfo info; | 2462 webkit::WebPluginInfo info; |
| 2462 std::string mime_type; | 2463 std::string mime_type; |
| 2463 bool found = GetPluginInfo(params.url, frame->top()->document().url(), | 2464 bool found = GetPluginInfo(params.url, frame->top()->document().url(), |
| 2464 params.mimeType.utf8(), &info, &mime_type); | 2465 params.mimeType.utf8(), &info, &mime_type); |
| 2465 if (!found) | 2466 if (!found) |
| 2466 return NULL; | 2467 return NULL; |
| 2467 | 2468 |
| 2468 WebPluginParams params_to_use = params; | 2469 WebPluginParams params_to_use = params; |
| (...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3857 // This function sends those updates to the browser and updates the RVH | 3858 // This function sends those updates to the browser and updates the RVH |
| 3858 // corresponding to this object. It must be called on any events that modify | 3859 // corresponding to this object. It must be called on any events that modify |
| 3859 // the tree structure or the names of any frames. | 3860 // the tree structure or the names of any frames. |
| 3860 void RenderViewImpl::SendUpdatedFrameTree( | 3861 void RenderViewImpl::SendUpdatedFrameTree( |
| 3861 WebKit::WebFrame* exclude_frame_subtree) { | 3862 WebKit::WebFrame* exclude_frame_subtree) { |
| 3862 // TODO(nasko): Frame tree updates are causing issues with postMessage, as | 3863 // TODO(nasko): Frame tree updates are causing issues with postMessage, as |
| 3863 // described in http://crbug.com/153701. Disable them until a proper fix is | 3864 // described in http://crbug.com/153701. Disable them until a proper fix is |
| 3864 // in place. | 3865 // in place. |
| 3865 } | 3866 } |
| 3866 | 3867 |
| 3868 BrowserPluginManager* RenderViewImpl::browser_plugin_manager() { | |
| 3869 if (!browser_plugin_manager_) | |
| 3870 browser_plugin_manager_ = BrowserPluginManager::Create(this); | |
| 3871 return browser_plugin_manager_; | |
| 3872 } | |
| 3873 | |
| 3867 void RenderViewImpl::CreateFrameTree(WebKit::WebFrame* frame, | 3874 void RenderViewImpl::CreateFrameTree(WebKit::WebFrame* frame, |
| 3868 DictionaryValue* frame_tree) { | 3875 DictionaryValue* frame_tree) { |
| 3869 // TODO(nasko): Remove once http://crbug.com/153701 is fixed. | 3876 // TODO(nasko): Remove once http://crbug.com/153701 is fixed. |
| 3870 DCHECK(false); | 3877 DCHECK(false); |
| 3871 NavigateToSwappedOutURL(frame); | 3878 NavigateToSwappedOutURL(frame); |
| 3872 | 3879 |
| 3873 string16 name; | 3880 string16 name; |
| 3874 if (frame_tree->GetString(kFrameTreeNodeNameKey, &name) && !name.empty()) | 3881 if (frame_tree->GetString(kFrameTreeNodeNameKey, &name) && !name.empty()) |
| 3875 frame->setName(name); | 3882 frame->setName(name); |
| 3876 | 3883 |
| (...skipping 1923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5800 // activation state to change just like a call to setIsActive. | 5807 // activation state to change just like a call to setIsActive. |
| 5801 if (enable) | 5808 if (enable) |
| 5802 (*plugin_it)->SetWindowFocus(true); | 5809 (*plugin_it)->SetWindowFocus(true); |
| 5803 #endif | 5810 #endif |
| 5804 (*plugin_it)->SetContentAreaFocus(enable); | 5811 (*plugin_it)->SetContentAreaFocus(enable); |
| 5805 } | 5812 } |
| 5806 } | 5813 } |
| 5807 // Notify all Pepper plugins. | 5814 // Notify all Pepper plugins. |
| 5808 pepper_delegate_.OnSetFocus(enable); | 5815 pepper_delegate_.OnSetFocus(enable); |
| 5809 // Notify all BrowserPlugins of the RenderView's focus state. | 5816 // Notify all BrowserPlugins of the RenderView's focus state. |
| 5810 BrowserPluginManager::Get()->SetEmbedderFocus(this, enable); | 5817 if (has_browser_plugin_manager()) |
|
Charlie Reis
2012/11/20 00:33:34
Great-- I'm glad we can avoid creating it.
Would
Fady Samuel
2012/11/20 02:04:15
Done.
| |
| 5818 browser_plugin_manager()->SetEmbedderFocus(this, enable); | |
| 5811 } | 5819 } |
| 5812 | 5820 |
| 5813 void RenderViewImpl::PpapiPluginFocusChanged() { | 5821 void RenderViewImpl::PpapiPluginFocusChanged() { |
| 5814 UpdateTextInputState(DO_NOT_SHOW_IME); | 5822 UpdateTextInputState(DO_NOT_SHOW_IME); |
| 5815 UpdateSelectionBounds(); | 5823 UpdateSelectionBounds(); |
| 5816 } | 5824 } |
| 5817 | 5825 |
| 5818 void RenderViewImpl::PpapiPluginTextInputTypeChanged() { | 5826 void RenderViewImpl::PpapiPluginTextInputTypeChanged() { |
| 5819 UpdateTextInputState(DO_NOT_SHOW_IME); | 5827 UpdateTextInputState(DO_NOT_SHOW_IME); |
| 5820 if (renderer_accessibility_) | 5828 if (renderer_accessibility_) |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6409 } | 6417 } |
| 6410 #endif | 6418 #endif |
| 6411 | 6419 |
| 6412 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6420 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
| 6413 TransportDIB::Handle dib_handle) { | 6421 TransportDIB::Handle dib_handle) { |
| 6414 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6422 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
| 6415 RenderProcess::current()->ReleaseTransportDIB(dib); | 6423 RenderProcess::current()->ReleaseTransportDIB(dib); |
| 6416 } | 6424 } |
| 6417 | 6425 |
| 6418 } // namespace content | 6426 } // namespace content |
| OLD | NEW |