| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 #include "content/public/renderer/renderer_ppapi_host.h" | 93 #include "content/public/renderer/renderer_ppapi_host.h" |
| 94 #include "content/renderer/accessibility/render_accessibility_impl.h" | 94 #include "content/renderer/accessibility/render_accessibility_impl.h" |
| 95 #include "content/renderer/browser_plugin/browser_plugin.h" | 95 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 96 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 96 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
| 97 #include "content/renderer/child_frame_compositing_helper.h" | 97 #include "content/renderer/child_frame_compositing_helper.h" |
| 98 #include "content/renderer/context_menu_params_builder.h" | 98 #include "content/renderer/context_menu_params_builder.h" |
| 99 #include "content/renderer/devtools/devtools_agent.h" | 99 #include "content/renderer/devtools/devtools_agent.h" |
| 100 #include "content/renderer/dom_automation_controller.h" | 100 #include "content/renderer/dom_automation_controller.h" |
| 101 #include "content/renderer/effective_connection_type_helper.h" | 101 #include "content/renderer/effective_connection_type_helper.h" |
| 102 #include "content/renderer/external_popup_menu.h" | 102 #include "content/renderer/external_popup_menu.h" |
| 103 #include "content/renderer/frame_owner_properties.h" |
| 103 #include "content/renderer/gpu/gpu_benchmarking_extension.h" | 104 #include "content/renderer/gpu/gpu_benchmarking_extension.h" |
| 104 #include "content/renderer/history_entry.h" | 105 #include "content/renderer/history_entry.h" |
| 105 #include "content/renderer/history_serialization.h" | 106 #include "content/renderer/history_serialization.h" |
| 106 #include "content/renderer/image_downloader/image_downloader_impl.h" | 107 #include "content/renderer/image_downloader/image_downloader_impl.h" |
| 107 #include "content/renderer/ime_event_guard.h" | 108 #include "content/renderer/ime_event_guard.h" |
| 108 #include "content/renderer/input/input_handler_manager.h" | 109 #include "content/renderer/input/input_handler_manager.h" |
| 109 #include "content/renderer/internal_document_state_data.h" | 110 #include "content/renderer/internal_document_state_data.h" |
| 110 #include "content/renderer/manifest/manifest_manager.h" | 111 #include "content/renderer/manifest/manifest_manager.h" |
| 111 #include "content/renderer/media/audio_device_factory.h" | 112 #include "content/renderer/media/audio_device_factory.h" |
| 112 #include "content/renderer/media/media_devices_listener_impl.h" | 113 #include "content/renderer/media/media_devices_listener_impl.h" |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 render_frame = | 956 render_frame = |
| 956 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); | 957 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); |
| 957 render_frame->InitializeBlameContext(FromRoutingID(parent_routing_id)); | 958 render_frame->InitializeBlameContext(FromRoutingID(parent_routing_id)); |
| 958 web_frame = parent_web_frame->createLocalChild( | 959 web_frame = parent_web_frame->createLocalChild( |
| 959 replicated_state.scope, WebString::fromUTF8(replicated_state.name), | 960 replicated_state.scope, WebString::fromUTF8(replicated_state.name), |
| 960 WebString::fromUTF8(replicated_state.unique_name), | 961 WebString::fromUTF8(replicated_state.unique_name), |
| 961 replicated_state.sandbox_flags, render_frame, | 962 replicated_state.sandbox_flags, render_frame, |
| 962 render_frame->blink_interface_provider_.get(), | 963 render_frame->blink_interface_provider_.get(), |
| 963 render_frame->blink_interface_registry_.get(), | 964 render_frame->blink_interface_registry_.get(), |
| 964 previous_sibling_web_frame, | 965 previous_sibling_web_frame, |
| 965 frame_owner_properties.ToWebFrameOwnerProperties(), | 966 ConvertFrameOwnerPropertiesToWebFrameOwnerProperties( |
| 967 frame_owner_properties), |
| 966 ResolveOpener(opener_routing_id)); | 968 ResolveOpener(opener_routing_id)); |
| 967 | 969 |
| 968 // The RenderFrame is created and inserted into the frame tree in the above | 970 // The RenderFrame is created and inserted into the frame tree in the above |
| 969 // call to createLocalChild. | 971 // call to createLocalChild. |
| 970 render_frame->in_frame_tree_ = true; | 972 render_frame->in_frame_tree_ = true; |
| 971 } else { | 973 } else { |
| 972 RenderFrameProxy* proxy = | 974 RenderFrameProxy* proxy = |
| 973 RenderFrameProxy::FromRoutingID(proxy_routing_id); | 975 RenderFrameProxy::FromRoutingID(proxy_routing_id); |
| 974 // The remote frame could've been detached while the remote-to-local | 976 // The remote frame could've been detached while the remote-to-local |
| 975 // navigation was being initiated in the browser process. Drop the | 977 // navigation was being initiated in the browser process. Drop the |
| (...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2132 } | 2134 } |
| 2133 | 2135 |
| 2134 void RenderFrameImpl::OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags) { | 2136 void RenderFrameImpl::OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags) { |
| 2135 frame_->setFrameOwnerSandboxFlags(flags); | 2137 frame_->setFrameOwnerSandboxFlags(flags); |
| 2136 } | 2138 } |
| 2137 | 2139 |
| 2138 void RenderFrameImpl::OnSetFrameOwnerProperties( | 2140 void RenderFrameImpl::OnSetFrameOwnerProperties( |
| 2139 const FrameOwnerProperties& frame_owner_properties) { | 2141 const FrameOwnerProperties& frame_owner_properties) { |
| 2140 DCHECK(frame_); | 2142 DCHECK(frame_); |
| 2141 frame_->setFrameOwnerProperties( | 2143 frame_->setFrameOwnerProperties( |
| 2142 frame_owner_properties.ToWebFrameOwnerProperties()); | 2144 ConvertFrameOwnerPropertiesToWebFrameOwnerProperties( |
| 2145 frame_owner_properties)); |
| 2143 } | 2146 } |
| 2144 | 2147 |
| 2145 void RenderFrameImpl::OnAdvanceFocus(blink::WebFocusType type, | 2148 void RenderFrameImpl::OnAdvanceFocus(blink::WebFocusType type, |
| 2146 int32_t source_routing_id) { | 2149 int32_t source_routing_id) { |
| 2147 RenderFrameProxy* source_frame = | 2150 RenderFrameProxy* source_frame = |
| 2148 RenderFrameProxy::FromRoutingID(source_routing_id); | 2151 RenderFrameProxy::FromRoutingID(source_routing_id); |
| 2149 if (!source_frame) | 2152 if (!source_frame) |
| 2150 return; | 2153 return; |
| 2151 | 2154 |
| 2152 render_view_->webview()->advanceFocusAcrossFrames( | 2155 render_view_->webview()->advanceFocusAcrossFrames( |
| (...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3029 const blink::WebFrameOwnerProperties& frame_owner_properties) { | 3032 const blink::WebFrameOwnerProperties& frame_owner_properties) { |
| 3030 // Synchronously notify the browser of a child frame creation to get the | 3033 // Synchronously notify the browser of a child frame creation to get the |
| 3031 // routing_id for the RenderFrame. | 3034 // routing_id for the RenderFrame. |
| 3032 int child_routing_id = MSG_ROUTING_NONE; | 3035 int child_routing_id = MSG_ROUTING_NONE; |
| 3033 FrameHostMsg_CreateChildFrame_Params params; | 3036 FrameHostMsg_CreateChildFrame_Params params; |
| 3034 params.parent_routing_id = routing_id_; | 3037 params.parent_routing_id = routing_id_; |
| 3035 params.scope = scope; | 3038 params.scope = scope; |
| 3036 params.frame_name = name.utf8(); | 3039 params.frame_name = name.utf8(); |
| 3037 params.frame_unique_name = unique_name.utf8(); | 3040 params.frame_unique_name = unique_name.utf8(); |
| 3038 params.sandbox_flags = sandbox_flags; | 3041 params.sandbox_flags = sandbox_flags; |
| 3039 params.frame_owner_properties = FrameOwnerProperties(frame_owner_properties); | 3042 params.frame_owner_properties = |
| 3043 ConvertWebFrameOwnerPropertiesToFrameOwnerProperties( |
| 3044 frame_owner_properties); |
| 3040 Send(new FrameHostMsg_CreateChildFrame(params, &child_routing_id)); | 3045 Send(new FrameHostMsg_CreateChildFrame(params, &child_routing_id)); |
| 3041 | 3046 |
| 3042 // Allocation of routing id failed, so we can't create a child frame. This can | 3047 // Allocation of routing id failed, so we can't create a child frame. This can |
| 3043 // happen if the synchronous IPC message above has failed. This can | 3048 // happen if the synchronous IPC message above has failed. This can |
| 3044 // legitimately happen when the browser process has already destroyed | 3049 // legitimately happen when the browser process has already destroyed |
| 3045 // RenderProcessHost, but the renderer process hasn't quit yet. | 3050 // RenderProcessHost, but the renderer process hasn't quit yet. |
| 3046 if (child_routing_id == MSG_ROUTING_NONE) | 3051 if (child_routing_id == MSG_ROUTING_NONE) |
| 3047 return nullptr; | 3052 return nullptr; |
| 3048 | 3053 |
| 3049 // This method is always called by local frames, never remote frames. | 3054 // This method is always called by local frames, never remote frames. |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3211 header.type = type; | 3216 header.type = type; |
| 3212 header.source = source; | 3217 header.source = source; |
| 3213 Send(new FrameHostMsg_DidAddContentSecurityPolicy(routing_id_, header)); | 3218 Send(new FrameHostMsg_DidAddContentSecurityPolicy(routing_id_, header)); |
| 3214 } | 3219 } |
| 3215 | 3220 |
| 3216 void RenderFrameImpl::didChangeFrameOwnerProperties( | 3221 void RenderFrameImpl::didChangeFrameOwnerProperties( |
| 3217 blink::WebFrame* child_frame, | 3222 blink::WebFrame* child_frame, |
| 3218 const blink::WebFrameOwnerProperties& frame_owner_properties) { | 3223 const blink::WebFrameOwnerProperties& frame_owner_properties) { |
| 3219 Send(new FrameHostMsg_DidChangeFrameOwnerProperties( | 3224 Send(new FrameHostMsg_DidChangeFrameOwnerProperties( |
| 3220 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), | 3225 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), |
| 3221 FrameOwnerProperties(frame_owner_properties))); | 3226 ConvertWebFrameOwnerPropertiesToFrameOwnerProperties( |
| 3227 frame_owner_properties))); |
| 3222 } | 3228 } |
| 3223 | 3229 |
| 3224 void RenderFrameImpl::didMatchCSS( | 3230 void RenderFrameImpl::didMatchCSS( |
| 3225 blink::WebLocalFrame* frame, | 3231 blink::WebLocalFrame* frame, |
| 3226 const blink::WebVector<blink::WebString>& newly_matching_selectors, | 3232 const blink::WebVector<blink::WebString>& newly_matching_selectors, |
| 3227 const blink::WebVector<blink::WebString>& stopped_matching_selectors) { | 3233 const blink::WebVector<blink::WebString>& stopped_matching_selectors) { |
| 3228 DCHECK_EQ(frame_, frame); | 3234 DCHECK_EQ(frame_, frame); |
| 3229 | 3235 |
| 3230 for (auto& observer : observers_) | 3236 for (auto& observer : observers_) |
| 3231 observer.DidMatchCSS(newly_matching_selectors, stopped_matching_selectors); | 3237 observer.DidMatchCSS(newly_matching_selectors, stopped_matching_selectors); |
| (...skipping 3591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6823 // event target. Potentially a Pepper plugin will receive the event. | 6829 // event target. Potentially a Pepper plugin will receive the event. |
| 6824 // In order to tell whether a plugin gets the last mouse event and which it | 6830 // In order to tell whether a plugin gets the last mouse event and which it |
| 6825 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6831 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6826 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6832 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6827 // |pepper_last_mouse_event_target_|. | 6833 // |pepper_last_mouse_event_target_|. |
| 6828 pepper_last_mouse_event_target_ = nullptr; | 6834 pepper_last_mouse_event_target_ = nullptr; |
| 6829 #endif | 6835 #endif |
| 6830 } | 6836 } |
| 6831 | 6837 |
| 6832 } // namespace content | 6838 } // namespace content |
| OLD | NEW |