| 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/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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 return sanitized_referrer_; | 195 return sanitized_referrer_; |
| 196 } | 196 } |
| 197 | 197 |
| 198 bool NavigationHandleImpl::HasUserGesture() { | 198 bool NavigationHandleImpl::HasUserGesture() { |
| 199 CHECK_NE(INITIAL, state_) | 199 CHECK_NE(INITIAL, state_) |
| 200 << "This accessor should not be called before the request is started."; | 200 << "This accessor should not be called before the request is started."; |
| 201 return has_user_gesture_; | 201 return has_user_gesture_; |
| 202 } | 202 } |
| 203 | 203 |
| 204 ui::PageTransition NavigationHandleImpl::GetPageTransition() { | 204 ui::PageTransition NavigationHandleImpl::GetPageTransition() { |
| 205 CHECK_NE(INITIAL, state_) | 205 return state_ == INITIAL ? ui::PAGE_TRANSITION_TYPED : transition_; |
| 206 << "This accessor should not be called before the request is started."; | |
| 207 return transition_; | |
| 208 } | 206 } |
| 209 | 207 |
| 210 bool NavigationHandleImpl::IsExternalProtocol() { | 208 bool NavigationHandleImpl::IsExternalProtocol() { |
| 211 CHECK_NE(INITIAL, state_) | 209 CHECK_NE(INITIAL, state_) |
| 212 << "This accessor should not be called before the request is started."; | 210 << "This accessor should not be called before the request is started."; |
| 213 return is_external_protocol_; | 211 return is_external_protocol_; |
| 214 } | 212 } |
| 215 | 213 |
| 216 net::Error NavigationHandleImpl::GetNetErrorCode() { | 214 net::Error NavigationHandleImpl::GetNetErrorCode() { |
| 217 return net_error_code_; | 215 return net_error_code_; |
| 218 } | 216 } |
| 219 | 217 |
| 220 RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() { | 218 RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() { |
| 221 // TODO(mkwst): Change this to check against 'READY_TO_COMMIT' once | 219 return state_ >= READY_TO_COMMIT ? render_frame_host_ : nullptr; |
| 222 // ReadyToCommitNavigation is available whether or not PlzNavigate is | |
| 223 // enabled. https://crbug.com/621856 | |
| 224 CHECK_GE(state_, WILL_PROCESS_RESPONSE) | |
| 225 << "This accessor should only be called after a response has been " | |
| 226 "delivered for processing."; | |
| 227 return render_frame_host_; | |
| 228 } | 220 } |
| 229 | 221 |
| 230 bool NavigationHandleImpl::IsSamePage() { | 222 bool NavigationHandleImpl::IsSamePage() { |
| 231 return is_same_page_; | 223 return is_same_page_; |
| 232 } | 224 } |
| 233 | 225 |
| 234 const net::HttpResponseHeaders* NavigationHandleImpl::GetResponseHeaders() { | 226 const net::HttpResponseHeaders* NavigationHandleImpl::GetResponseHeaders() { |
| 235 return response_headers_.get(); | 227 return response_headers_.get(); |
| 236 } | 228 } |
| 237 | 229 |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 throttles_.push_back(std::move(ancestor_throttle)); | 786 throttles_.push_back(std::move(ancestor_throttle)); |
| 795 | 787 |
| 796 if (throttles_to_register.size() > 0) { | 788 if (throttles_to_register.size() > 0) { |
| 797 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), | 789 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), |
| 798 throttles_to_register.end()); | 790 throttles_to_register.end()); |
| 799 throttles_to_register.weak_clear(); | 791 throttles_to_register.weak_clear(); |
| 800 } | 792 } |
| 801 } | 793 } |
| 802 | 794 |
| 803 } // namespace content | 795 } // namespace content |
| OLD | NEW |