| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 return FrameTreeNode::kFrameTreeNodeInvalidId; | 183 return FrameTreeNode::kFrameTreeNodeInvalidId; |
| 184 | 184 |
| 185 return frame_tree_node_->parent()->frame_tree_node_id(); | 185 return frame_tree_node_->parent()->frame_tree_node_id(); |
| 186 } | 186 } |
| 187 | 187 |
| 188 const base::TimeTicks& NavigationHandleImpl::NavigationStart() { | 188 const base::TimeTicks& NavigationHandleImpl::NavigationStart() { |
| 189 return navigation_start_; | 189 return navigation_start_; |
| 190 } | 190 } |
| 191 | 191 |
| 192 bool NavigationHandleImpl::IsPost() { | 192 bool NavigationHandleImpl::IsPost() { |
| 193 CHECK_NE(INITIAL, state_) | 193 // This accessor should not be called before the request is started. |
| 194 << "This accessor should not be called before the request is started."; | 194 CHECK_NE(INITIAL, state_); |
| 195 return method_ == "POST"; | 195 return method_ == "POST"; |
| 196 } | 196 } |
| 197 | 197 |
| 198 const Referrer& NavigationHandleImpl::GetReferrer() { | 198 const Referrer& NavigationHandleImpl::GetReferrer() { |
| 199 CHECK_NE(INITIAL, state_) | 199 // This accessor should not be called before the request is started. |
| 200 << "This accessor should not be called before the request is started."; | 200 CHECK_NE(INITIAL, state_); |
| 201 return sanitized_referrer_; | 201 return sanitized_referrer_; |
| 202 } | 202 } |
| 203 | 203 |
| 204 bool NavigationHandleImpl::HasUserGesture() { | 204 bool NavigationHandleImpl::HasUserGesture() { |
| 205 return gesture_ == NavigationGestureUser; | 205 return gesture_ == NavigationGestureUser; |
| 206 } | 206 } |
| 207 | 207 |
| 208 ui::PageTransition NavigationHandleImpl::GetPageTransition() { | 208 ui::PageTransition NavigationHandleImpl::GetPageTransition() { |
| 209 CHECK_NE(INITIAL, state_) | 209 // This accessor should not be called before the request is started. |
| 210 << "This accessor should not be called before the request is started."; | 210 CHECK_NE(INITIAL, state_); |
| 211 return transition_; | 211 return transition_; |
| 212 } | 212 } |
| 213 | 213 |
| 214 bool NavigationHandleImpl::IsExternalProtocol() { | 214 bool NavigationHandleImpl::IsExternalProtocol() { |
| 215 CHECK_NE(INITIAL, state_) | 215 // This accessor should not be called before the request is started. |
| 216 << "This accessor should not be called before the request is started."; | 216 CHECK_NE(INITIAL, state_); |
| 217 return is_external_protocol_; | 217 return is_external_protocol_; |
| 218 } | 218 } |
| 219 | 219 |
| 220 net::Error NavigationHandleImpl::GetNetErrorCode() { | 220 net::Error NavigationHandleImpl::GetNetErrorCode() { |
| 221 return net_error_code_; | 221 return net_error_code_; |
| 222 } | 222 } |
| 223 | 223 |
| 224 RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() { | 224 RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() { |
| 225 // TODO(mkwst): Change this to check against 'READY_TO_COMMIT' once | 225 // TODO(mkwst): Change this to check against 'READY_TO_COMMIT' once |
| 226 // ReadyToCommitNavigation is available whether or not PlzNavigate is | 226 // ReadyToCommitNavigation is available whether or not PlzNavigate is |
| 227 // enabled. https://crbug.com/621856 | 227 // enabled. https://crbug.com/621856 |
| 228 CHECK_GE(state_, WILL_PROCESS_RESPONSE) | 228 // This accessor should only be called after a response has been delivered for |
| 229 << "This accessor should only be called after a response has been " | 229 // processing. |
| 230 "delivered for processing."; | 230 CHECK_GE(state_, WILL_PROCESS_RESPONSE); |
| 231 return render_frame_host_; | 231 return render_frame_host_; |
| 232 } | 232 } |
| 233 | 233 |
| 234 bool NavigationHandleImpl::IsSamePage() { | 234 bool NavigationHandleImpl::IsSamePage() { |
| 235 return is_same_page_; | 235 return is_same_page_; |
| 236 } | 236 } |
| 237 | 237 |
| 238 const net::HttpResponseHeaders* NavigationHandleImpl::GetResponseHeaders() { | 238 const net::HttpResponseHeaders* NavigationHandleImpl::GetResponseHeaders() { |
| 239 return response_headers_.get(); | 239 return response_headers_.get(); |
| 240 } | 240 } |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 throttles_to_register.push_back(std::move(clear_site_data_throttle)); | 789 throttles_to_register.push_back(std::move(clear_site_data_throttle)); |
| 790 | 790 |
| 791 if (throttles_to_register.size() > 0) { | 791 if (throttles_to_register.size() > 0) { |
| 792 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), | 792 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), |
| 793 throttles_to_register.end()); | 793 throttles_to_register.end()); |
| 794 throttles_to_register.weak_clear(); | 794 throttles_to_register.weak_clear(); |
| 795 } | 795 } |
| 796 } | 796 } |
| 797 | 797 |
| 798 } // namespace content | 798 } // namespace content |
| OLD | NEW |