| OLD | NEW |
| 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 <iterator> | 7 #include <iterator> |
| 8 | 8 |
| 9 #include "base/debug/dump_without_crashing.h" | 9 #include "base/debug/dump_without_crashing.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 navigation_start_(navigation_start), | 101 navigation_start_(navigation_start), |
| 102 pending_nav_entry_id_(pending_nav_entry_id), | 102 pending_nav_entry_id_(pending_nav_entry_id), |
| 103 request_context_type_(REQUEST_CONTEXT_TYPE_UNSPECIFIED), | 103 request_context_type_(REQUEST_CONTEXT_TYPE_UNSPECIFIED), |
| 104 mixed_content_context_type_(blink::WebMixedContentContextType::Blockable), | 104 mixed_content_context_type_(blink::WebMixedContentContextType::Blockable), |
| 105 should_replace_current_entry_(false), | 105 should_replace_current_entry_(false), |
| 106 redirect_chain_(redirect_chain), | 106 redirect_chain_(redirect_chain), |
| 107 is_download_(false), | 107 is_download_(false), |
| 108 is_stream_(false), | 108 is_stream_(false), |
| 109 started_from_context_menu_(started_from_context_menu), | 109 started_from_context_menu_(started_from_context_menu), |
| 110 reload_type_(ReloadType::NONE), | 110 reload_type_(ReloadType::NONE), |
| 111 navigation_type_(NAVIGATION_TYPE_UNKNOWN), |
| 111 weak_factory_(this) { | 112 weak_factory_(this) { |
| 112 DCHECK(!navigation_start.is_null()); | 113 DCHECK(!navigation_start.is_null()); |
| 113 if (redirect_chain_.empty()) | 114 if (redirect_chain_.empty()) |
| 114 redirect_chain_.push_back(url); | 115 redirect_chain_.push_back(url); |
| 115 | 116 |
| 116 starting_site_instance_ = | 117 starting_site_instance_ = |
| 117 frame_tree_node_->current_frame_host()->GetSiteInstance(); | 118 frame_tree_node_->current_frame_host()->GetSiteInstance(); |
| 118 | 119 |
| 119 if (pending_nav_entry_id_) { | 120 if (pending_nav_entry_id_) { |
| 120 NavigationControllerImpl* nav_controller = | 121 NavigationControllerImpl* nav_controller = |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 params.should_update_history = false; | 425 params.should_update_history = false; |
| 425 params.searchable_form_url = GURL(); | 426 params.searchable_form_url = GURL(); |
| 426 params.searchable_form_encoding = std::string(); | 427 params.searchable_form_encoding = std::string(); |
| 427 params.did_create_new_entry = false; | 428 params.did_create_new_entry = false; |
| 428 params.gesture = NavigationGestureUser; | 429 params.gesture = NavigationGestureUser; |
| 429 params.was_within_same_page = false; | 430 params.was_within_same_page = false; |
| 430 params.method = "GET"; | 431 params.method = "GET"; |
| 431 params.page_state = PageState::CreateFromURL(url); | 432 params.page_state = PageState::CreateFromURL(url); |
| 432 params.contents_mime_type = std::string("text/html"); | 433 params.contents_mime_type = std::string("text/html"); |
| 433 | 434 |
| 434 DidCommitNavigation(params, false, GURL(), render_frame_host_); | 435 DidCommitNavigation(params, false, GURL(), NAVIGATION_TYPE_NEW_PAGE, |
| 436 render_frame_host_); |
| 435 } | 437 } |
| 436 | 438 |
| 437 bool NavigationHandleImpl::WasStartedFromContextMenu() const { | 439 bool NavigationHandleImpl::WasStartedFromContextMenu() const { |
| 438 return started_from_context_menu_; | 440 return started_from_context_menu_; |
| 439 } | 441 } |
| 440 | 442 |
| 441 const GURL& NavigationHandleImpl::GetSearchableFormURL() { | 443 const GURL& NavigationHandleImpl::GetSearchableFormURL() { |
| 442 return searchable_form_url_; | 444 return searchable_form_url_; |
| 443 } | 445 } |
| 444 | 446 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 state_ = READY_TO_COMMIT; | 606 state_ = READY_TO_COMMIT; |
| 605 | 607 |
| 606 if (!IsRendererDebugURL(url_) && !IsSamePage()) | 608 if (!IsRendererDebugURL(url_) && !IsSamePage()) |
| 607 GetDelegate()->ReadyToCommitNavigation(this); | 609 GetDelegate()->ReadyToCommitNavigation(this); |
| 608 } | 610 } |
| 609 | 611 |
| 610 void NavigationHandleImpl::DidCommitNavigation( | 612 void NavigationHandleImpl::DidCommitNavigation( |
| 611 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, | 613 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
| 612 bool did_replace_entry, | 614 bool did_replace_entry, |
| 613 const GURL& previous_url, | 615 const GURL& previous_url, |
| 616 NavigationType navigation_type, |
| 614 RenderFrameHostImpl* render_frame_host) { | 617 RenderFrameHostImpl* render_frame_host) { |
| 615 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); | 618 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); |
| 616 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); | 619 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); |
| 617 CHECK_EQ(url_, params.url); | 620 CHECK_EQ(url_, params.url); |
| 618 | 621 |
| 619 did_replace_entry_ = did_replace_entry; | 622 did_replace_entry_ = did_replace_entry; |
| 620 method_ = params.method; | 623 method_ = params.method; |
| 621 has_user_gesture_ = (params.gesture == NavigationGestureUser); | 624 has_user_gesture_ = (params.gesture == NavigationGestureUser); |
| 622 transition_ = params.transition; | 625 transition_ = params.transition; |
| 623 should_update_history_ = params.should_update_history; | 626 should_update_history_ = params.should_update_history; |
| 624 render_frame_host_ = render_frame_host; | 627 render_frame_host_ = render_frame_host; |
| 625 previous_url_ = previous_url; | 628 previous_url_ = previous_url; |
| 626 base_url_ = params.base_url; | 629 base_url_ = params.base_url; |
| 627 socket_address_ = params.socket_address; | 630 socket_address_ = params.socket_address; |
| 631 navigation_type_ = navigation_type; |
| 628 | 632 |
| 629 // If an error page reloads, net_error_code might be 200 but we still want to | 633 // If an error page reloads, net_error_code might be 200 but we still want to |
| 630 // count it as an error page. | 634 // count it as an error page. |
| 631 if (params.base_url.spec() == kUnreachableWebDataURL || | 635 if (params.base_url.spec() == kUnreachableWebDataURL || |
| 632 net_error_code_ != net::OK) { | 636 net_error_code_ != net::OK) { |
| 633 state_ = DID_COMMIT_ERROR_PAGE; | 637 state_ = DID_COMMIT_ERROR_PAGE; |
| 634 } else { | 638 } else { |
| 635 state_ = DID_COMMIT; | 639 state_ = DID_COMMIT; |
| 636 } | 640 } |
| 637 } | 641 } |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 content::AncestorThrottle::MaybeCreateThrottleFor(this); | 883 content::AncestorThrottle::MaybeCreateThrottleFor(this); |
| 880 if (ancestor_throttle) | 884 if (ancestor_throttle) |
| 881 throttles_.push_back(std::move(ancestor_throttle)); | 885 throttles_.push_back(std::move(ancestor_throttle)); |
| 882 | 886 |
| 883 throttles_.insert(throttles_.begin(), | 887 throttles_.insert(throttles_.begin(), |
| 884 std::make_move_iterator(throttles_to_register.begin()), | 888 std::make_move_iterator(throttles_to_register.begin()), |
| 885 std::make_move_iterator(throttles_to_register.end())); | 889 std::make_move_iterator(throttles_to_register.end())); |
| 886 } | 890 } |
| 887 | 891 |
| 888 } // namespace content | 892 } // namespace content |
| OLD | NEW |