Chromium Code Reviews| 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 <utility> | |
| 8 | |
| 9 #include "base/debug/dump_without_crashing.h" | 7 #include "base/debug/dump_without_crashing.h" |
| 10 #include "base/logging.h" | 8 #include "base/logging.h" |
| 11 #include "content/browser/browsing_data/clear_site_data_throttle.h" | 9 #include "content/browser/browsing_data/clear_site_data_throttle.h" |
| 12 #include "content/browser/child_process_security_policy_impl.h" | 10 #include "content/browser/child_process_security_policy_impl.h" |
| 13 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 11 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
| 14 #include "content/browser/frame_host/frame_tree_node.h" | 12 #include "content/browser/frame_host/frame_tree_node.h" |
| 15 #include "content/browser/frame_host/navigator.h" | 13 #include "content/browser/frame_host/navigator.h" |
| 16 #include "content/browser/frame_host/navigator_delegate.h" | 14 #include "content/browser/frame_host/navigator_delegate.h" |
| 17 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 15 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 18 #include "content/browser/service_worker/service_worker_navigation_handle.h" | 16 #include "content/browser/service_worker/service_worker_navigation_handle.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 << "This accessor should not be called before the request is started."; | 194 << "This accessor should not be called before the request is started."; |
| 197 return transition_; | 195 return transition_; |
| 198 } | 196 } |
| 199 | 197 |
| 200 bool NavigationHandleImpl::IsExternalProtocol() { | 198 bool NavigationHandleImpl::IsExternalProtocol() { |
| 201 CHECK_NE(INITIAL, state_) | 199 CHECK_NE(INITIAL, state_) |
| 202 << "This accessor should not be called before the request is started."; | 200 << "This accessor should not be called before the request is started."; |
| 203 return is_external_protocol_; | 201 return is_external_protocol_; |
| 204 } | 202 } |
| 205 | 203 |
| 204 bool NavigationHandleImpl::HasNetworkResponseStarted() { | |
| 205 return state_ >= WILL_PROCESS_RESPONSE; | |
| 206 } | |
| 207 | |
| 206 net::Error NavigationHandleImpl::GetNetErrorCode() { | 208 net::Error NavigationHandleImpl::GetNetErrorCode() { |
| 207 return net_error_code_; | 209 return net_error_code_; |
| 208 } | 210 } |
| 209 | 211 |
| 210 RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() { | 212 RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() { |
| 211 // TODO(mkwst): Change this to check against 'READY_TO_COMMIT' once | 213 // TODO(mkwst): Change this to check against 'READY_TO_COMMIT' once |
| 212 // ReadyToCommitNavigation is available whether or not PlzNavigate is | 214 // ReadyToCommitNavigation is available whether or not PlzNavigate is |
| 213 // enabled. https://crbug.com/621856 | 215 // enabled. https://crbug.com/621856 |
| 214 CHECK_GE(state_, WILL_PROCESS_RESPONSE) | 216 CHECK_GE(state_, WILL_PROCESS_RESPONSE) |
| 215 << "This accessor should only be called after a response has been " | 217 << "This accessor should only be called after a response has been " |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 params.page_state = PageState::CreateFromURL(url); | 358 params.page_state = PageState::CreateFromURL(url); |
| 357 params.contents_mime_type = std::string("text/html"); | 359 params.contents_mime_type = std::string("text/html"); |
| 358 | 360 |
| 359 DidCommitNavigation(params, false, render_frame_host_); | 361 DidCommitNavigation(params, false, render_frame_host_); |
| 360 } | 362 } |
| 361 | 363 |
| 362 NavigationData* NavigationHandleImpl::GetNavigationData() { | 364 NavigationData* NavigationHandleImpl::GetNavigationData() { |
| 363 return navigation_data_.get(); | 365 return navigation_data_.get(); |
| 364 } | 366 } |
| 365 | 367 |
| 368 const GlobalRequestID& NavigationHandleImpl::GetGlobalRequestID() { | |
| 369 DCHECK_GE(state_, WILL_PROCESS_RESPONSE); | |
|
clamy
2016/11/04 14:44:17
This should be changed to
DCHECK(state_ == WILL_PR
Not at Google. Contact bengr
2016/11/07 22:17:18
Done.
| |
| 370 return request_id_; | |
| 371 } | |
| 372 | |
| 366 void NavigationHandleImpl::InitServiceWorkerHandle( | 373 void NavigationHandleImpl::InitServiceWorkerHandle( |
| 367 ServiceWorkerContextWrapper* service_worker_context) { | 374 ServiceWorkerContextWrapper* service_worker_context) { |
| 368 DCHECK(IsBrowserSideNavigationEnabled()); | 375 DCHECK(IsBrowserSideNavigationEnabled()); |
| 369 service_worker_handle_.reset( | 376 service_worker_handle_.reset( |
| 370 new ServiceWorkerNavigationHandle(service_worker_context)); | 377 new ServiceWorkerNavigationHandle(service_worker_context)); |
| 371 } | 378 } |
| 372 | 379 |
| 373 void NavigationHandleImpl::WillStartRequest( | 380 void NavigationHandleImpl::WillStartRequest( |
| 374 const std::string& method, | 381 const std::string& method, |
| 375 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, | 382 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 743 throttles_to_register.end()); | 750 throttles_to_register.end()); |
| 744 throttles_to_register.weak_clear(); | 751 throttles_to_register.weak_clear(); |
| 745 } | 752 } |
| 746 } | 753 } |
| 747 | 754 |
| 748 bool NavigationHandleImpl::WasStartedFromContextMenu() const { | 755 bool NavigationHandleImpl::WasStartedFromContextMenu() const { |
| 749 return started_from_context_menu_; | 756 return started_from_context_menu_; |
| 750 } | 757 } |
| 751 | 758 |
| 752 } // namespace content | 759 } // namespace content |
| OLD | NEW |