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 "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/browsing_data/clear_site_data_throttle.h" | 9 #include "content/browser/browsing_data/clear_site_data_throttle.h" |
10 #include "content/browser/child_process_security_policy_impl.h" | 10 #include "content/browser/child_process_security_policy_impl.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 << "This accessor should not be called before the request is started."; | 199 << "This accessor should not be called before the request is started."; |
200 return method_ == "POST"; | 200 return method_ == "POST"; |
201 } | 201 } |
202 | 202 |
203 const Referrer& NavigationHandleImpl::GetReferrer() { | 203 const Referrer& NavigationHandleImpl::GetReferrer() { |
204 CHECK_NE(INITIAL, state_) | 204 CHECK_NE(INITIAL, state_) |
205 << "This accessor should not be called before the request is started."; | 205 << "This accessor should not be called before the request is started."; |
206 return sanitized_referrer_; | 206 return sanitized_referrer_; |
207 } | 207 } |
208 | 208 |
209 bool NavigationHandleImpl::HasUserGesture() { | 209 NavigationGesture NavigationHandleImpl::GetNavigationGesture() { |
210 return gesture_ == NavigationGestureUser; | 210 return gesture_; |
211 } | 211 } |
212 | 212 |
213 ui::PageTransition NavigationHandleImpl::GetPageTransition() { | 213 ui::PageTransition NavigationHandleImpl::GetPageTransition() { |
214 CHECK_NE(INITIAL, state_) | 214 CHECK_NE(INITIAL, state_) |
215 << "This accessor should not be called before the request is started."; | 215 << "This accessor should not be called before the request is started."; |
216 return transition_; | 216 return transition_; |
217 } | 217 } |
218 | 218 |
219 bool NavigationHandleImpl::IsExternalProtocol() { | 219 bool NavigationHandleImpl::IsExternalProtocol() { |
220 CHECK_NE(INITIAL, state_) | 220 CHECK_NE(INITIAL, state_) |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 GetDelegate()->ReadyToCommitNavigation(this); | 533 GetDelegate()->ReadyToCommitNavigation(this); |
534 } | 534 } |
535 | 535 |
536 void NavigationHandleImpl::DidCommitNavigation( | 536 void NavigationHandleImpl::DidCommitNavigation( |
537 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, | 537 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
538 bool same_page, | 538 bool same_page, |
539 RenderFrameHostImpl* render_frame_host) { | 539 RenderFrameHostImpl* render_frame_host) { |
540 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); | 540 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); |
541 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); | 541 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); |
542 CHECK_EQ(url_, params.url); | 542 CHECK_EQ(url_, params.url); |
543 // TODO(clamy): DCHECK that params.gesture matches | 543 // TODO(clamy): DCHECK_EQ(gesture_, params.gesture). See crbug.com/667572. |
544 // has_user_gesture_. See crbug.com/667572. | |
545 | 544 |
546 method_ = params.method; | 545 method_ = params.method; |
547 transition_ = params.transition; | 546 transition_ = params.transition; |
548 render_frame_host_ = render_frame_host; | 547 render_frame_host_ = render_frame_host; |
549 | 548 |
550 // If an error page reloads, net_error_code might be 200 but we still want to | 549 // If an error page reloads, net_error_code might be 200 but we still want to |
551 // count it as an error page. | 550 // count it as an error page. |
552 if (params.base_url.spec() == kUnreachableWebDataURL || | 551 if (params.base_url.spec() == kUnreachableWebDataURL || |
553 net_error_code_ != net::OK) { | 552 net_error_code_ != net::OK) { |
554 state_ = DID_COMMIT_ERROR_PAGE; | 553 state_ = DID_COMMIT_ERROR_PAGE; |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 throttles_to_register.push_back(std::move(clear_site_data_throttle)); | 785 throttles_to_register.push_back(std::move(clear_site_data_throttle)); |
787 | 786 |
788 if (throttles_to_register.size() > 0) { | 787 if (throttles_to_register.size() > 0) { |
789 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), | 788 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), |
790 throttles_to_register.end()); | 789 throttles_to_register.end()); |
791 throttles_to_register.weak_clear(); | 790 throttles_to_register.weak_clear(); |
792 } | 791 } |
793 } | 792 } |
794 | 793 |
795 } // namespace content | 794 } // namespace content |
OLD | NEW |