| 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 } | 270 } |
| 271 | 271 |
| 272 bool NavigationHandleImpl::HasCommitted() { | 272 bool NavigationHandleImpl::HasCommitted() { |
| 273 return state_ == DID_COMMIT || state_ == DID_COMMIT_ERROR_PAGE; | 273 return state_ == DID_COMMIT || state_ == DID_COMMIT_ERROR_PAGE; |
| 274 } | 274 } |
| 275 | 275 |
| 276 bool NavigationHandleImpl::IsErrorPage() { | 276 bool NavigationHandleImpl::IsErrorPage() { |
| 277 return state_ == DID_COMMIT_ERROR_PAGE; | 277 return state_ == DID_COMMIT_ERROR_PAGE; |
| 278 } | 278 } |
| 279 | 279 |
| 280 const GURL& NavigationHandleImpl::GetPreviousURL() { |
| 281 DCHECK(state_ == DID_COMMIT || state_ == DID_COMMIT_ERROR_PAGE); |
| 282 return previous_url_; |
| 283 } |
| 284 |
| 280 void NavigationHandleImpl::Resume() { | 285 void NavigationHandleImpl::Resume() { |
| 281 if (state_ != DEFERRING_START && state_ != DEFERRING_REDIRECT && | 286 if (state_ != DEFERRING_START && state_ != DEFERRING_REDIRECT && |
| 282 state_ != DEFERRING_RESPONSE) { | 287 state_ != DEFERRING_RESPONSE) { |
| 283 return; | 288 return; |
| 284 } | 289 } |
| 285 | 290 |
| 286 NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER; | 291 NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER; |
| 287 if (state_ == DEFERRING_START) { | 292 if (state_ == DEFERRING_START) { |
| 288 result = CheckWillStartRequest(); | 293 result = CheckWillStartRequest(); |
| 289 } else if (state_ == DEFERRING_REDIRECT) { | 294 } else if (state_ == DEFERRING_REDIRECT) { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 params.should_update_history = false; | 403 params.should_update_history = false; |
| 399 params.searchable_form_url = GURL(); | 404 params.searchable_form_url = GURL(); |
| 400 params.searchable_form_encoding = std::string(); | 405 params.searchable_form_encoding = std::string(); |
| 401 params.did_create_new_entry = false; | 406 params.did_create_new_entry = false; |
| 402 params.gesture = NavigationGestureUser; | 407 params.gesture = NavigationGestureUser; |
| 403 params.was_within_same_page = false; | 408 params.was_within_same_page = false; |
| 404 params.method = "GET"; | 409 params.method = "GET"; |
| 405 params.page_state = PageState::CreateFromURL(url); | 410 params.page_state = PageState::CreateFromURL(url); |
| 406 params.contents_mime_type = std::string("text/html"); | 411 params.contents_mime_type = std::string("text/html"); |
| 407 | 412 |
| 408 DidCommitNavigation(params, false, render_frame_host_); | 413 DidCommitNavigation(params, false, GURL(), render_frame_host_); |
| 409 } | 414 } |
| 410 | 415 |
| 411 bool NavigationHandleImpl::WasStartedFromContextMenu() const { | 416 bool NavigationHandleImpl::WasStartedFromContextMenu() const { |
| 412 return started_from_context_menu_; | 417 return started_from_context_menu_; |
| 413 } | 418 } |
| 414 | 419 |
| 415 const GURL& NavigationHandleImpl::GetSearchableFormURL() { | 420 const GURL& NavigationHandleImpl::GetSearchableFormURL() { |
| 416 return searchable_form_url_; | 421 return searchable_form_url_; |
| 417 } | 422 } |
| 418 | 423 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 render_frame_host_ = render_frame_host; | 569 render_frame_host_ = render_frame_host; |
| 565 state_ = READY_TO_COMMIT; | 570 state_ = READY_TO_COMMIT; |
| 566 | 571 |
| 567 if (!IsRendererDebugURL(url_)) | 572 if (!IsRendererDebugURL(url_)) |
| 568 GetDelegate()->ReadyToCommitNavigation(this); | 573 GetDelegate()->ReadyToCommitNavigation(this); |
| 569 } | 574 } |
| 570 | 575 |
| 571 void NavigationHandleImpl::DidCommitNavigation( | 576 void NavigationHandleImpl::DidCommitNavigation( |
| 572 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, | 577 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
| 573 bool same_page, | 578 bool same_page, |
| 579 const GURL& previous_url, |
| 574 RenderFrameHostImpl* render_frame_host) { | 580 RenderFrameHostImpl* render_frame_host) { |
| 575 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); | 581 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); |
| 576 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); | 582 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); |
| 577 CHECK_EQ(url_, params.url); | 583 CHECK_EQ(url_, params.url); |
| 578 | 584 |
| 579 method_ = params.method; | 585 method_ = params.method; |
| 580 has_user_gesture_ = (params.gesture == NavigationGestureUser); | 586 has_user_gesture_ = (params.gesture == NavigationGestureUser); |
| 581 transition_ = params.transition; | 587 transition_ = params.transition; |
| 582 render_frame_host_ = render_frame_host; | 588 render_frame_host_ = render_frame_host; |
| 589 previous_url_ = previous_url; |
| 583 | 590 |
| 584 // If an error page reloads, net_error_code might be 200 but we still want to | 591 // If an error page reloads, net_error_code might be 200 but we still want to |
| 585 // count it as an error page. | 592 // count it as an error page. |
| 586 if (params.base_url.spec() == kUnreachableWebDataURL || | 593 if (params.base_url.spec() == kUnreachableWebDataURL || |
| 587 net_error_code_ != net::OK) { | 594 net_error_code_ != net::OK) { |
| 588 state_ = DID_COMMIT_ERROR_PAGE; | 595 state_ = DID_COMMIT_ERROR_PAGE; |
| 589 } else { | 596 } else { |
| 590 state_ = DID_COMMIT; | 597 state_ = DID_COMMIT; |
| 591 } | 598 } |
| 592 } | 599 } |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 content::AncestorThrottle::MaybeCreateThrottleFor(this); | 841 content::AncestorThrottle::MaybeCreateThrottleFor(this); |
| 835 if (ancestor_throttle) | 842 if (ancestor_throttle) |
| 836 throttles_.push_back(std::move(ancestor_throttle)); | 843 throttles_.push_back(std::move(ancestor_throttle)); |
| 837 | 844 |
| 838 throttles_.insert(throttles_.begin(), | 845 throttles_.insert(throttles_.begin(), |
| 839 std::make_move_iterator(throttles_to_register.begin()), | 846 std::make_move_iterator(throttles_to_register.begin()), |
| 840 std::make_move_iterator(throttles_to_register.end())); | 847 std::make_move_iterator(throttles_to_register.end())); |
| 841 } | 848 } |
| 842 | 849 |
| 843 } // namespace content | 850 } // namespace content |
| OLD | NEW |