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

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

Issue 2625633002: Supporting changes in preparation of browser side mixed content checking. (Closed)
Patch Set: Address code review comments. Created 3 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_handle_impl.h" 5 #include "content/browser/frame_host/navigation_handle_impl.h"
6 6
7 #include "base/debug/dump_without_crashing.h" 7 #include "base/debug/dump_without_crashing.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "content/browser/appcache/appcache_navigation_handle.h" 9 #include "content/browser/appcache/appcache_navigation_handle.h"
10 #include "content/browser/appcache/appcache_service_impl.h" 10 #include "content/browser/appcache/appcache_service_impl.h"
(...skipping 12 matching lines...) Expand all
23 #include "content/common/resource_request_body_impl.h" 23 #include "content/common/resource_request_body_impl.h"
24 #include "content/common/site_isolation_policy.h" 24 #include "content/common/site_isolation_policy.h"
25 #include "content/public/browser/content_browser_client.h" 25 #include "content/public/browser/content_browser_client.h"
26 #include "content/public/browser/navigation_ui_data.h" 26 #include "content/public/browser/navigation_ui_data.h"
27 #include "content/public/browser/site_instance.h" 27 #include "content/public/browser/site_instance.h"
28 #include "content/public/common/browser_side_navigation_policy.h" 28 #include "content/public/common/browser_side_navigation_policy.h"
29 #include "content/public/common/content_client.h" 29 #include "content/public/common/content_client.h"
30 #include "content/public/common/url_constants.h" 30 #include "content/public/common/url_constants.h"
31 #include "net/base/net_errors.h" 31 #include "net/base/net_errors.h"
32 #include "net/url_request/redirect_info.h" 32 #include "net/url_request/redirect_info.h"
33 #include "third_party/WebKit/public/platform/WebMixedContentContextType.h"
33 #include "url/gurl.h" 34 #include "url/gurl.h"
34 #include "url/url_constants.h" 35 #include "url/url_constants.h"
35 36
36 namespace content { 37 namespace content {
37 38
38 namespace { 39 namespace {
39 40
40 void UpdateThrottleCheckResult( 41 void UpdateThrottleCheckResult(
41 NavigationThrottle::ThrottleCheckResult* to_update, 42 NavigationThrottle::ThrottleCheckResult* to_update,
42 NavigationThrottle::ThrottleCheckResult result) { 43 NavigationThrottle::ThrottleCheckResult result) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 was_redirected_(false), 86 was_redirected_(false),
86 connection_info_(net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN), 87 connection_info_(net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN),
87 original_url_(url), 88 original_url_(url),
88 state_(INITIAL), 89 state_(INITIAL),
89 is_transferring_(false), 90 is_transferring_(false),
90 frame_tree_node_(frame_tree_node), 91 frame_tree_node_(frame_tree_node),
91 next_index_(0), 92 next_index_(0),
92 navigation_start_(navigation_start), 93 navigation_start_(navigation_start),
93 pending_nav_entry_id_(pending_nav_entry_id), 94 pending_nav_entry_id_(pending_nav_entry_id),
94 request_context_type_(REQUEST_CONTEXT_TYPE_UNSPECIFIED), 95 request_context_type_(REQUEST_CONTEXT_TYPE_UNSPECIFIED),
96 mixed_content_context_type_(blink::WebMixedContentContextType::Blockable),
95 should_replace_current_entry_(false), 97 should_replace_current_entry_(false),
96 is_download_(false), 98 is_download_(false),
97 is_stream_(false), 99 is_stream_(false),
98 started_from_context_menu_(started_from_context_menu), 100 started_from_context_menu_(started_from_context_menu),
99 weak_factory_(this) { 101 weak_factory_(this) {
100 DCHECK(!navigation_start.is_null()); 102 DCHECK(!navigation_start.is_null());
101 redirect_chain_.push_back(url); 103 redirect_chain_.push_back(url);
102 104
103 starting_site_instance_ = 105 starting_site_instance_ =
104 frame_tree_node_->current_frame_host()->GetSiteInstance(); 106 frame_tree_node_->current_frame_host()->GetSiteInstance();
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 method = "POST"; 310 method = "POST";
309 311
310 std::string body = "test=body"; 312 std::string body = "test=body";
311 resource_request_body = new ResourceRequestBodyImpl(); 313 resource_request_body = new ResourceRequestBodyImpl();
312 resource_request_body->AppendBytes(body.data(), body.size()); 314 resource_request_body->AppendBytes(body.data(), body.size());
313 } 315 }
314 316
315 WillStartRequest(method, resource_request_body, sanitized_referrer, 317 WillStartRequest(method, resource_request_body, sanitized_referrer,
316 has_user_gesture, transition, is_external_protocol, 318 has_user_gesture, transition, is_external_protocol,
317 REQUEST_CONTEXT_TYPE_LOCATION, 319 REQUEST_CONTEXT_TYPE_LOCATION,
320 blink::WebMixedContentContextType::Blockable,
318 base::Bind(&UpdateThrottleCheckResult, &result)); 321 base::Bind(&UpdateThrottleCheckResult, &result));
319 322
320 // Reset the callback to ensure it will not be called later. 323 // Reset the callback to ensure it will not be called later.
321 complete_callback_.Reset(); 324 complete_callback_.Reset();
322 return result; 325 return result;
323 } 326 }
324 327
325 NavigationThrottle::ThrottleCheckResult 328 NavigationThrottle::ThrottleCheckResult
326 NavigationHandleImpl::CallWillRedirectRequestForTesting( 329 NavigationHandleImpl::CallWillRedirectRequestForTesting(
327 const GURL& new_url, 330 const GURL& new_url,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 } 418 }
416 419
417 void NavigationHandleImpl::WillStartRequest( 420 void NavigationHandleImpl::WillStartRequest(
418 const std::string& method, 421 const std::string& method,
419 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, 422 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body,
420 const Referrer& sanitized_referrer, 423 const Referrer& sanitized_referrer,
421 bool has_user_gesture, 424 bool has_user_gesture,
422 ui::PageTransition transition, 425 ui::PageTransition transition,
423 bool is_external_protocol, 426 bool is_external_protocol,
424 RequestContextType request_context_type, 427 RequestContextType request_context_type,
428 blink::WebMixedContentContextType mixed_content_context_type,
425 const ThrottleChecksFinishedCallback& callback) { 429 const ThrottleChecksFinishedCallback& callback) {
426 if (method != "POST") 430 if (method != "POST")
427 DCHECK(!resource_request_body); 431 DCHECK(!resource_request_body);
428 432
429 // Update the navigation parameters. 433 // Update the navigation parameters.
430 method_ = method; 434 method_ = method;
431 if (method_ == "POST") 435 if (method_ == "POST")
432 resource_request_body_ = resource_request_body; 436 resource_request_body_ = resource_request_body;
433 sanitized_referrer_ = sanitized_referrer; 437 sanitized_referrer_ = sanitized_referrer;
434 has_user_gesture_ = has_user_gesture; 438 has_user_gesture_ = has_user_gesture;
435 transition_ = transition; 439 transition_ = transition;
436 is_external_protocol_ = is_external_protocol; 440 is_external_protocol_ = is_external_protocol;
437 request_context_type_ = request_context_type; 441 request_context_type_ = request_context_type;
442 mixed_content_context_type_ = mixed_content_context_type;
438 state_ = WILL_SEND_REQUEST; 443 state_ = WILL_SEND_REQUEST;
439 complete_callback_ = callback; 444 complete_callback_ = callback;
440 445
441 RegisterNavigationThrottles(); 446 RegisterNavigationThrottles();
442 447
443 if (IsBrowserSideNavigationEnabled()) 448 if (IsBrowserSideNavigationEnabled())
444 navigation_ui_data_ = GetDelegate()->GetNavigationUIData(this); 449 navigation_ui_data_ = GetDelegate()->GetNavigationUIData(this);
445 450
446 // Notify each throttle of the request. 451 // Notify each throttle of the request.
447 NavigationThrottle::ThrottleCheckResult result = CheckWillStartRequest(); 452 NavigationThrottle::ThrottleCheckResult result = CheckWillStartRequest();
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 throttles_.push_back(std::move(ancestor_throttle)); 806 throttles_.push_back(std::move(ancestor_throttle));
802 807
803 if (throttles_to_register.size() > 0) { 808 if (throttles_to_register.size() > 0) {
804 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), 809 throttles_.insert(throttles_.begin(), throttles_to_register.begin(),
805 throttles_to_register.end()); 810 throttles_to_register.end());
806 throttles_to_register.weak_clear(); 811 throttles_to_register.weak_clear();
807 } 812 }
808 } 813 }
809 814
810 } // namespace content 815 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl.h ('k') | content/browser/frame_host/navigation_handle_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698