| 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 6268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6279 CHECK_EQ(0, render_view_->history_list_length_); | 6279 CHECK_EQ(0, render_view_->history_list_length_); |
| 6280 } | 6280 } |
| 6281 } | 6281 } |
| 6282 | 6282 |
| 6283 void RenderFrameImpl::BeginNavigation(const NavigationPolicyInfo& info) { | 6283 void RenderFrameImpl::BeginNavigation(const NavigationPolicyInfo& info) { |
| 6284 CHECK(IsBrowserSideNavigationEnabled()); | 6284 CHECK(IsBrowserSideNavigationEnabled()); |
| 6285 browser_side_navigation_pending_ = true; | 6285 browser_side_navigation_pending_ = true; |
| 6286 | 6286 |
| 6287 blink::WebURLRequest& request = info.url_request; | 6287 blink::WebURLRequest& request = info.url_request; |
| 6288 | 6288 |
| 6289 // Set RequestorOrigin and FirstPartyForCookies |
| 6290 WebDocument frame_document = frame_->GetDocument(); |
| 6291 if (request.GetFrameType() == blink::WebURLRequest::kFrameTypeTopLevel) |
| 6292 request.SetFirstPartyForCookies(request.Url()); |
| 6293 else |
| 6294 request.SetFirstPartyForCookies(frame_document.FirstPartyForCookies()); |
| 6295 request.SetRequestorOrigin(frame_document.GetSecurityOrigin()); |
| 6296 |
| 6289 // Note: At this stage, the goal is to apply all the modifications the | 6297 // Note: At this stage, the goal is to apply all the modifications the |
| 6290 // renderer wants to make to the request, and then send it to the browser, so | 6298 // renderer wants to make to the request, and then send it to the browser, so |
| 6291 // that the actual network request can be started. Ideally, all such | 6299 // that the actual network request can be started. Ideally, all such |
| 6292 // modifications should take place in willSendRequest, and in the | 6300 // modifications should take place in willSendRequest, and in the |
| 6293 // implementation of willSendRequest for the various InspectorAgents | 6301 // implementation of willSendRequest for the various InspectorAgents |
| 6294 // (devtools). | 6302 // (devtools). |
| 6295 // | 6303 // |
| 6296 // TODO(clamy): Apply devtools override. | 6304 // TODO(clamy): Apply devtools override. |
| 6297 // TODO(clamy): Make sure that navigation requests are not modified somewhere | 6305 // TODO(clamy): Make sure that navigation requests are not modified somewhere |
| 6298 // else in blink. | 6306 // else in blink. |
| 6299 WillSendRequest(request); | 6307 WillSendRequest(request); |
| 6300 | 6308 |
| 6301 // Set RequestorOrigin and FirstPartyForCookies. | |
| 6302 WebDocument frame_document = frame_->GetDocument(); | |
| 6303 if (request.GetFrameType() == blink::WebURLRequest::kFrameTypeTopLevel) | |
| 6304 request.SetFirstPartyForCookies(request.Url()); | |
| 6305 else | |
| 6306 request.SetFirstPartyForCookies(frame_document.FirstPartyForCookies()); | |
| 6307 request.SetRequestorOrigin(frame_document.GetSecurityOrigin()); | |
| 6308 | |
| 6309 // Update the transition type of the request for client side redirects. | 6309 // Update the transition type of the request for client side redirects. |
| 6310 if (!info.url_request.GetExtraData()) | 6310 if (!info.url_request.GetExtraData()) |
| 6311 info.url_request.SetExtraData(new RequestExtraData()); | 6311 info.url_request.SetExtraData(new RequestExtraData()); |
| 6312 if (info.is_client_redirect) { | 6312 if (info.is_client_redirect) { |
| 6313 RequestExtraData* extra_data = | 6313 RequestExtraData* extra_data = |
| 6314 static_cast<RequestExtraData*>(info.url_request.GetExtraData()); | 6314 static_cast<RequestExtraData*>(info.url_request.GetExtraData()); |
| 6315 extra_data->set_transition_type(ui::PageTransitionFromInt( | 6315 extra_data->set_transition_type(ui::PageTransitionFromInt( |
| 6316 extra_data->transition_type() | ui::PAGE_TRANSITION_CLIENT_REDIRECT)); | 6316 extra_data->transition_type() | ui::PAGE_TRANSITION_CLIENT_REDIRECT)); |
| 6317 } | 6317 } |
| 6318 | 6318 |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6864 policy(info.default_policy), | 6864 policy(info.default_policy), |
| 6865 replaces_current_history_item(info.replaces_current_history_item), | 6865 replaces_current_history_item(info.replaces_current_history_item), |
| 6866 history_navigation_in_new_child_frame( | 6866 history_navigation_in_new_child_frame( |
| 6867 info.is_history_navigation_in_new_child_frame), | 6867 info.is_history_navigation_in_new_child_frame), |
| 6868 client_redirect(info.is_client_redirect), | 6868 client_redirect(info.is_client_redirect), |
| 6869 cache_disabled(info.is_cache_disabled), | 6869 cache_disabled(info.is_cache_disabled), |
| 6870 form(info.form), | 6870 form(info.form), |
| 6871 source_location(info.source_location) {} | 6871 source_location(info.source_location) {} |
| 6872 | 6872 |
| 6873 } // namespace content | 6873 } // namespace content |
| OLD | NEW |