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 4177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4188 else | 4188 else |
4189 request.setFirstPartyForCookies(frame->document().firstPartyForCookies()); | 4189 request.setFirstPartyForCookies(frame->document().firstPartyForCookies()); |
4190 } | 4190 } |
4191 | 4191 |
4192 // Set the requestor origin to the same origin as the frame's document if it | 4192 // Set the requestor origin to the same origin as the frame's document if it |
4193 // hasn't yet been set. | 4193 // hasn't yet been set. |
4194 // | 4194 // |
4195 // TODO(mkwst): It would be cleaner to adjust blink::ResourceRequest to | 4195 // TODO(mkwst): It would be cleaner to adjust blink::ResourceRequest to |
4196 // initialize itself with a `nullptr` initiator so that this can be a simple | 4196 // initialize itself with a `nullptr` initiator so that this can be a simple |
4197 // `isNull()` check. https://crbug.com/625969 | 4197 // `isNull()` check. https://crbug.com/625969 |
| 4198 WebDocument frame_document = frame->document(); |
4198 if (request.requestorOrigin().isUnique() && | 4199 if (request.requestorOrigin().isUnique() && |
4199 !frame->document().getSecurityOrigin().isUnique()) { | 4200 !frame_document.getSecurityOrigin().isUnique()) { |
4200 request.setRequestorOrigin(frame->document().getSecurityOrigin()); | 4201 request.setRequestorOrigin(frame_document.getSecurityOrigin()); |
4201 } | 4202 } |
4202 | 4203 |
4203 WebDataSource* provisional_data_source = frame->provisionalDataSource(); | 4204 WebDataSource* provisional_data_source = frame->provisionalDataSource(); |
4204 WebDataSource* data_source = | 4205 WebDataSource* data_source = |
4205 provisional_data_source ? provisional_data_source : frame->dataSource(); | 4206 provisional_data_source ? provisional_data_source : frame->dataSource(); |
4206 | 4207 |
4207 DocumentState* document_state = DocumentState::FromDataSource(data_source); | 4208 DocumentState* document_state = DocumentState::FromDataSource(data_source); |
4208 DCHECK(document_state); | 4209 DCHECK(document_state); |
4209 InternalDocumentStateData* internal_data = | 4210 InternalDocumentStateData* internal_data = |
4210 InternalDocumentStateData::FromDocumentState(document_state); | 4211 InternalDocumentStateData::FromDocumentState(document_state); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4303 WebFrame* parent = frame->parent(); | 4304 WebFrame* parent = frame->parent(); |
4304 int parent_routing_id = parent ? GetRoutingIdForFrameOrProxy(parent) : -1; | 4305 int parent_routing_id = parent ? GetRoutingIdForFrameOrProxy(parent) : -1; |
4305 | 4306 |
4306 RequestExtraData* extra_data = new RequestExtraData(); | 4307 RequestExtraData* extra_data = new RequestExtraData(); |
4307 extra_data->set_visibility_state(visibilityState()); | 4308 extra_data->set_visibility_state(visibilityState()); |
4308 extra_data->set_custom_user_agent(custom_user_agent); | 4309 extra_data->set_custom_user_agent(custom_user_agent); |
4309 extra_data->set_requested_with(requested_with); | 4310 extra_data->set_requested_with(requested_with); |
4310 extra_data->set_render_frame_id(routing_id_); | 4311 extra_data->set_render_frame_id(routing_id_); |
4311 extra_data->set_is_main_frame(!parent); | 4312 extra_data->set_is_main_frame(!parent); |
4312 extra_data->set_frame_origin( | 4313 extra_data->set_frame_origin( |
4313 url::Origin(frame->document().getSecurityOrigin())); | 4314 url::Origin(frame_document.getSecurityOrigin())); |
4314 extra_data->set_parent_is_main_frame(parent && !parent->parent()); | 4315 extra_data->set_parent_is_main_frame(parent && !parent->parent()); |
4315 extra_data->set_parent_render_frame_id(parent_routing_id); | 4316 extra_data->set_parent_render_frame_id(parent_routing_id); |
4316 extra_data->set_allow_download( | 4317 extra_data->set_allow_download( |
4317 navigation_state->common_params().allow_download); | 4318 navigation_state->common_params().allow_download); |
4318 extra_data->set_transition_type(transition_type); | 4319 extra_data->set_transition_type(transition_type); |
4319 extra_data->set_should_replace_current_entry(should_replace_current_entry); | 4320 extra_data->set_should_replace_current_entry(should_replace_current_entry); |
4320 extra_data->set_service_worker_provider_id(provider_id); | 4321 extra_data->set_service_worker_provider_id(provider_id); |
4321 extra_data->set_stream_override(std::move(stream_override)); | 4322 extra_data->set_stream_override(std::move(stream_override)); |
4322 bool is_prefetch = | 4323 bool is_prefetch = |
4323 GetContentClient()->renderer()->IsPrefetchOnly(this, request); | 4324 GetContentClient()->renderer()->IsPrefetchOnly(this, request); |
4324 extra_data->set_is_prefetch(is_prefetch); | 4325 extra_data->set_is_prefetch(is_prefetch); |
4325 extra_data->set_download_to_network_cache_only( | 4326 extra_data->set_download_to_network_cache_only( |
4326 is_prefetch && | 4327 is_prefetch && |
4327 WebURLRequestToResourceType(request) != RESOURCE_TYPE_MAIN_FRAME); | 4328 WebURLRequestToResourceType(request) != RESOURCE_TYPE_MAIN_FRAME); |
4328 extra_data->set_initiated_in_secure_context( | 4329 extra_data->set_initiated_in_secure_context( |
4329 frame->document().isSecureContext()); | 4330 frame_document.isSecureContext()); |
4330 | 4331 |
4331 // Renderer process transfers apply only to navigational requests. | 4332 // Renderer process transfers apply only to navigational requests. |
4332 bool is_navigational_request = | 4333 bool is_navigational_request = |
4333 request.getFrameType() != WebURLRequest::FrameTypeNone; | 4334 request.getFrameType() != WebURLRequest::FrameTypeNone; |
4334 if (is_navigational_request) { | 4335 if (is_navigational_request) { |
4335 extra_data->set_transferred_request_child_id( | 4336 extra_data->set_transferred_request_child_id( |
4336 navigation_state->start_params().transferred_request_child_id); | 4337 navigation_state->start_params().transferred_request_child_id); |
4337 extra_data->set_transferred_request_request_id( | 4338 extra_data->set_transferred_request_request_id( |
4338 navigation_state->start_params().transferred_request_request_id); | 4339 navigation_state->start_params().transferred_request_request_id); |
4339 | 4340 |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4841 // ResourceDispatcherHostImpl, MediaStreamUIProxy, | 4842 // ResourceDispatcherHostImpl, MediaStreamUIProxy, |
4842 // SpeechRecognitionDispatcherHost and possibly others). They look up the view | 4843 // SpeechRecognitionDispatcherHost and possibly others). They look up the view |
4843 // based on the ID stored in the resource requests. Once those dependencies | 4844 // based on the ID stored in the resource requests. Once those dependencies |
4844 // are unwound or moved to RenderFrameHost (crbug.com/304341) we can move the | 4845 // are unwound or moved to RenderFrameHost (crbug.com/304341) we can move the |
4845 // client to be based on the routing_id of the RenderFrameHost. | 4846 // client to be based on the routing_id of the RenderFrameHost. |
4846 params.render_view_routing_id = render_view_->routing_id(); | 4847 params.render_view_routing_id = render_view_->routing_id(); |
4847 params.socket_address.set_host(response.remoteIPAddress().utf8()); | 4848 params.socket_address.set_host(response.remoteIPAddress().utf8()); |
4848 params.socket_address.set_port(response.remotePort()); | 4849 params.socket_address.set_port(response.remotePort()); |
4849 params.was_within_same_page = navigation_state->WasWithinSamePage(); | 4850 params.was_within_same_page = navigation_state->WasWithinSamePage(); |
4850 | 4851 |
| 4852 WebDocument frame_document = frame->document(); |
4851 // Set the origin of the frame. This will be replicated to the corresponding | 4853 // Set the origin of the frame. This will be replicated to the corresponding |
4852 // RenderFrameProxies in other processes. | 4854 // RenderFrameProxies in other processes. |
4853 params.origin = frame->document().getSecurityOrigin(); | 4855 WebSecurityOrigin frame_origin = frame_document.getSecurityOrigin(); |
| 4856 params.origin = frame_origin; |
4854 | 4857 |
4855 params.insecure_request_policy = frame->getInsecureRequestPolicy(); | 4858 params.insecure_request_policy = frame->getInsecureRequestPolicy(); |
4856 | 4859 |
4857 params.has_potentially_trustworthy_unique_origin = | 4860 params.has_potentially_trustworthy_unique_origin = |
4858 frame->document().getSecurityOrigin().isUnique() && | 4861 frame_origin.isUnique() && frame_origin.isPotentiallyTrustworthy(); |
4859 frame->document().getSecurityOrigin().isPotentiallyTrustworthy(); | |
4860 | 4862 |
4861 // Set the URL to be displayed in the browser UI to the user. | 4863 // Set the URL to be displayed in the browser UI to the user. |
4862 params.url = GetLoadingUrl(); | 4864 params.url = GetLoadingUrl(); |
4863 if (GURL(frame->document().baseURL()) != params.url) | 4865 if (GURL(frame_document.baseURL()) != params.url) |
4864 params.base_url = frame->document().baseURL(); | 4866 params.base_url = frame_document.baseURL(); |
4865 | 4867 |
4866 GetRedirectChain(ds, ¶ms.redirects); | 4868 GetRedirectChain(ds, ¶ms.redirects); |
4867 params.should_update_history = | 4869 params.should_update_history = |
4868 !ds->hasUnreachableURL() && response.httpStatusCode() != 404; | 4870 !ds->hasUnreachableURL() && response.httpStatusCode() != 404; |
4869 | 4871 |
4870 params.searchable_form_url = internal_data->searchable_form_url(); | 4872 params.searchable_form_url = internal_data->searchable_form_url(); |
4871 params.searchable_form_encoding = internal_data->searchable_form_encoding(); | 4873 params.searchable_form_encoding = internal_data->searchable_form_encoding(); |
4872 | 4874 |
4873 params.gesture = render_view_->navigation_gesture_; | 4875 params.gesture = render_view_->navigation_gesture_; |
4874 render_view_->navigation_gesture_ = NavigationGestureUnknown; | 4876 render_view_->navigation_gesture_ = NavigationGestureUnknown; |
(...skipping 1974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6849 // event target. Potentially a Pepper plugin will receive the event. | 6851 // event target. Potentially a Pepper plugin will receive the event. |
6850 // In order to tell whether a plugin gets the last mouse event and which it | 6852 // In order to tell whether a plugin gets the last mouse event and which it |
6851 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6853 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6852 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6854 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6853 // |pepper_last_mouse_event_target_|. | 6855 // |pepper_last_mouse_event_target_|. |
6854 pepper_last_mouse_event_target_ = nullptr; | 6856 pepper_last_mouse_event_target_ = nullptr; |
6855 #endif | 6857 #endif |
6856 } | 6858 } |
6857 | 6859 |
6858 } // namespace content | 6860 } // namespace content |
OLD | NEW |