| 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 net::HostPortPair NavigationHandleImpl::GetSocketAddress() { | 285 net::HostPortPair NavigationHandleImpl::GetSocketAddress() { |
| 281 DCHECK(state_ == DID_COMMIT || state_ == DID_COMMIT_ERROR_PAGE); | 286 DCHECK(state_ == DID_COMMIT || state_ == DID_COMMIT_ERROR_PAGE); |
| 282 return socket_address_; | 287 return socket_address_; |
| 283 } | 288 } |
| 284 | 289 |
| 285 void NavigationHandleImpl::Resume() { | 290 void NavigationHandleImpl::Resume() { |
| 286 if (state_ != DEFERRING_START && state_ != DEFERRING_REDIRECT && | 291 if (state_ != DEFERRING_START && state_ != DEFERRING_REDIRECT && |
| 287 state_ != DEFERRING_RESPONSE) { | 292 state_ != DEFERRING_RESPONSE) { |
| 288 return; | 293 return; |
| 289 } | 294 } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 params.should_update_history = false; | 408 params.should_update_history = false; |
| 404 params.searchable_form_url = GURL(); | 409 params.searchable_form_url = GURL(); |
| 405 params.searchable_form_encoding = std::string(); | 410 params.searchable_form_encoding = std::string(); |
| 406 params.did_create_new_entry = false; | 411 params.did_create_new_entry = false; |
| 407 params.gesture = NavigationGestureUser; | 412 params.gesture = NavigationGestureUser; |
| 408 params.was_within_same_page = false; | 413 params.was_within_same_page = false; |
| 409 params.method = "GET"; | 414 params.method = "GET"; |
| 410 params.page_state = PageState::CreateFromURL(url); | 415 params.page_state = PageState::CreateFromURL(url); |
| 411 params.contents_mime_type = std::string("text/html"); | 416 params.contents_mime_type = std::string("text/html"); |
| 412 | 417 |
| 413 DidCommitNavigation(params, false, render_frame_host_); | 418 DidCommitNavigation(params, false, GURL(), render_frame_host_); |
| 414 } | 419 } |
| 415 | 420 |
| 416 bool NavigationHandleImpl::WasStartedFromContextMenu() const { | 421 bool NavigationHandleImpl::WasStartedFromContextMenu() const { |
| 417 return started_from_context_menu_; | 422 return started_from_context_menu_; |
| 418 } | 423 } |
| 419 | 424 |
| 420 const GURL& NavigationHandleImpl::GetSearchableFormURL() { | 425 const GURL& NavigationHandleImpl::GetSearchableFormURL() { |
| 421 return searchable_form_url_; | 426 return searchable_form_url_; |
| 422 } | 427 } |
| 423 | 428 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 render_frame_host_ = render_frame_host; | 574 render_frame_host_ = render_frame_host; |
| 570 state_ = READY_TO_COMMIT; | 575 state_ = READY_TO_COMMIT; |
| 571 | 576 |
| 572 if (!IsRendererDebugURL(url_)) | 577 if (!IsRendererDebugURL(url_)) |
| 573 GetDelegate()->ReadyToCommitNavigation(this); | 578 GetDelegate()->ReadyToCommitNavigation(this); |
| 574 } | 579 } |
| 575 | 580 |
| 576 void NavigationHandleImpl::DidCommitNavigation( | 581 void NavigationHandleImpl::DidCommitNavigation( |
| 577 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, | 582 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
| 578 bool same_page, | 583 bool same_page, |
| 584 const GURL& previous_url, |
| 579 RenderFrameHostImpl* render_frame_host) { | 585 RenderFrameHostImpl* render_frame_host) { |
| 580 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); | 586 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); |
| 581 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); | 587 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); |
| 582 CHECK_EQ(url_, params.url); | 588 CHECK_EQ(url_, params.url); |
| 583 | 589 |
| 584 method_ = params.method; | 590 method_ = params.method; |
| 585 has_user_gesture_ = (params.gesture == NavigationGestureUser); | 591 has_user_gesture_ = (params.gesture == NavigationGestureUser); |
| 586 transition_ = params.transition; | 592 transition_ = params.transition; |
| 587 render_frame_host_ = render_frame_host; | 593 render_frame_host_ = render_frame_host; |
| 594 previous_url_ = previous_url; |
| 588 base_url_ = params.base_url; | 595 base_url_ = params.base_url; |
| 589 socket_address_ = params.socket_address; | 596 socket_address_ = params.socket_address; |
| 590 | 597 |
| 591 // If an error page reloads, net_error_code might be 200 but we still want to | 598 // If an error page reloads, net_error_code might be 200 but we still want to |
| 592 // count it as an error page. | 599 // count it as an error page. |
| 593 if (params.base_url.spec() == kUnreachableWebDataURL || | 600 if (params.base_url.spec() == kUnreachableWebDataURL || |
| 594 net_error_code_ != net::OK) { | 601 net_error_code_ != net::OK) { |
| 595 state_ = DID_COMMIT_ERROR_PAGE; | 602 state_ = DID_COMMIT_ERROR_PAGE; |
| 596 } else { | 603 } else { |
| 597 state_ = DID_COMMIT; | 604 state_ = DID_COMMIT; |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 content::AncestorThrottle::MaybeCreateThrottleFor(this); | 848 content::AncestorThrottle::MaybeCreateThrottleFor(this); |
| 842 if (ancestor_throttle) | 849 if (ancestor_throttle) |
| 843 throttles_.push_back(std::move(ancestor_throttle)); | 850 throttles_.push_back(std::move(ancestor_throttle)); |
| 844 | 851 |
| 845 throttles_.insert(throttles_.begin(), | 852 throttles_.insert(throttles_.begin(), |
| 846 std::make_move_iterator(throttles_to_register.begin()), | 853 std::make_move_iterator(throttles_to_register.begin()), |
| 847 std::make_move_iterator(throttles_to_register.end())); | 854 std::make_move_iterator(throttles_to_register.end())); |
| 848 } | 855 } |
| 849 | 856 |
| 850 } // namespace content | 857 } // namespace content |
| OLD | NEW |