Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: content/browser/frame_host/navigation_request.cc

Issue 1905033002: PlzNavigate: Move navigation-level mixed content checks to the browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@console-security-message
Patch Set: Fixed external handling order change for request start and redirects. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/frame_host/navigation_request.h" 5 #include "content/browser/frame_host/navigation_request.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 9 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
10 #include "content/browser/frame_host/frame_tree.h" 10 #include "content/browser/frame_host/frame_tree.h"
11 #include "content/browser/frame_host/frame_tree_node.h" 11 #include "content/browser/frame_host/frame_tree_node.h"
12 #include "content/browser/frame_host/navigation_controller_impl.h" 12 #include "content/browser/frame_host/navigation_controller_impl.h"
13 #include "content/browser/frame_host/navigation_handle_impl.h" 13 #include "content/browser/frame_host/navigation_handle_impl.h"
14 #include "content/browser/frame_host/navigation_request_info.h" 14 #include "content/browser/frame_host/navigation_request_info.h"
15 #include "content/browser/frame_host/navigator.h" 15 #include "content/browser/frame_host/navigator.h"
16 #include "content/browser/frame_host/navigator_impl.h" 16 #include "content/browser/frame_host/navigator_impl.h"
17 #include "content/browser/loader/navigation_url_loader.h" 17 #include "content/browser/loader/navigation_url_loader.h"
18 #include "content/browser/service_worker/service_worker_context_wrapper.h" 18 #include "content/browser/service_worker/service_worker_context_wrapper.h"
19 #include "content/browser/site_instance_impl.h" 19 #include "content/browser/site_instance_impl.h"
20 #include "content/common/resource_request_body_impl.h" 20 #include "content/common/resource_request_body_impl.h"
21 #include "content/public/browser/browser_context.h" 21 #include "content/public/browser/browser_context.h"
22 #include "content/public/browser/navigation_controller.h" 22 #include "content/public/browser/navigation_controller.h"
23 #include "content/public/browser/navigation_data.h" 23 #include "content/public/browser/navigation_data.h"
24 #include "content/public/browser/storage_partition.h" 24 #include "content/public/browser/storage_partition.h"
25 #include "content/public/browser/stream_handle.h" 25 #include "content/public/browser/stream_handle.h"
26 #include "content/public/common/content_client.h" 26 #include "content/public/common/content_client.h"
27 #include "content/public/common/request_context_type.h"
27 #include "content/public/common/resource_response.h" 28 #include "content/public/common/resource_response.h"
28 #include "net/base/load_flags.h" 29 #include "net/base/load_flags.h"
29 #include "net/http/http_request_headers.h" 30 #include "net/http/http_request_headers.h"
30 #include "net/url_request/redirect_info.h" 31 #include "net/url_request/redirect_info.h"
31 #include "third_party/WebKit/public/web/WebSandboxFlags.h" 32 #include "third_party/WebKit/public/web/WebSandboxFlags.h"
32 33
33 namespace content { 34 namespace content {
34 35
35 namespace { 36 namespace {
36 37
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 DCHECK(state_ == NOT_STARTED || state_ == WAITING_FOR_RENDERER_RESPONSE); 204 DCHECK(state_ == NOT_STARTED || state_ == WAITING_FOR_RENDERER_RESPONSE);
204 state_ = STARTED; 205 state_ = STARTED;
205 RenderFrameDevToolsAgentHost::OnBeforeNavigation(navigation_handle_.get()); 206 RenderFrameDevToolsAgentHost::OnBeforeNavigation(navigation_handle_.get());
206 207
207 if (ShouldMakeNetworkRequestForURL(common_params_.url)) { 208 if (ShouldMakeNetworkRequestForURL(common_params_.url)) {
208 // It's safe to use base::Unretained because this NavigationRequest owns 209 // It's safe to use base::Unretained because this NavigationRequest owns
209 // the NavigationHandle where the callback will be stored. 210 // the NavigationHandle where the callback will be stored.
210 // TODO(clamy): pass the real value for |is_external_protocol| if needed. 211 // TODO(clamy): pass the real value for |is_external_protocol| if needed.
211 // TODO(clamy): pass the method to the NavigationHandle instead of a 212 // TODO(clamy): pass the method to the NavigationHandle instead of a
212 // boolean. 213 // boolean.
214 // TODO(carlosk): set the RequestContextType in a more correct way, if
215 // actually needed. See: determineRequestContextFromNavigationType in
216 // FrameLoader.cpp.
213 navigation_handle_->WillStartRequest( 217 navigation_handle_->WillStartRequest(
214 common_params_.method, common_params_.post_data, 218 common_params_.method, common_params_.post_data,
215 Referrer::SanitizeForRequest(common_params_.url, 219 Referrer::SanitizeForRequest(common_params_.url,
216 common_params_.referrer), 220 common_params_.referrer),
217 begin_params_.has_user_gesture, common_params_.transition, false, 221 begin_params_.has_user_gesture, common_params_.transition, false,
222 REQUEST_CONTEXT_TYPE_LOCATION,
218 base::Bind(&NavigationRequest::OnStartChecksComplete, 223 base::Bind(&NavigationRequest::OnStartChecksComplete,
219 base::Unretained(this))); 224 base::Unretained(this)));
220 return; 225 return;
221 } 226 }
222 227
223 // There is no need to make a network request for this navigation, so commit 228 // There is no need to make a network request for this navigation, so commit
224 // it immediately. 229 // it immediately.
225 state_ = RESPONSE_STARTED; 230 state_ = RESPONSE_STARTED;
226 231
227 // Select an appropriate RenderFrameHost. 232 // Select an appropriate RenderFrameHost.
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 is_view_source_); 453 is_view_source_);
449 454
450 // When navigating to a Javascript url, the NavigationRequest is not stored 455 // When navigating to a Javascript url, the NavigationRequest is not stored
451 // in the FrameTreeNode. Therefore do not reset it, as this could cancel an 456 // in the FrameTreeNode. Therefore do not reset it, as this could cancel an
452 // existing pending navigation. 457 // existing pending navigation.
453 if (!common_params_.url.SchemeIs(url::kJavaScriptScheme)) 458 if (!common_params_.url.SchemeIs(url::kJavaScriptScheme))
454 frame_tree_node_->ResetNavigationRequest(true); 459 frame_tree_node_->ResetNavigationRequest(true);
455 } 460 }
456 461
457 } // namespace content 462 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698