| 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> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "content/browser/frame_host/frame_tree_node.h" | 9 #include "content/browser/frame_host/frame_tree_node.h" |
| 10 #include "content/browser/frame_host/navigator.h" | 10 #include "content/browser/frame_host/navigator.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 WillRedirectRequest(new_url, new_method_is_post, new_referrer_url, | 250 WillRedirectRequest(new_url, new_method_is_post, new_referrer_url, |
| 251 new_is_external_protocol, | 251 new_is_external_protocol, |
| 252 scoped_refptr<net::HttpResponseHeaders>(), | 252 scoped_refptr<net::HttpResponseHeaders>(), |
| 253 base::Bind(&UpdateThrottleCheckResult, &result)); | 253 base::Bind(&UpdateThrottleCheckResult, &result)); |
| 254 | 254 |
| 255 // Reset the callback to ensure it will not be called later. | 255 // Reset the callback to ensure it will not be called later. |
| 256 complete_callback_.Reset(); | 256 complete_callback_.Reset(); |
| 257 return result; | 257 return result; |
| 258 } | 258 } |
| 259 | 259 |
| 260 bool NavigationHandleImpl::IsUsingLofi() const { |
| 261 DCHECK(state_ == DID_COMMIT || state_ == DID_COMMIT_ERROR_PAGE); |
| 262 return is_using_lofi_; |
| 263 } |
| 264 |
| 265 bool NavigationHandleImpl::UsedDataReductionProxy() const { |
| 266 DCHECK(state_ == DID_COMMIT || state_ == DID_COMMIT_ERROR_PAGE); |
| 267 return used_data_reduction_proxy_; |
| 268 } |
| 269 |
| 260 void NavigationHandleImpl::InitServiceWorkerHandle( | 270 void NavigationHandleImpl::InitServiceWorkerHandle( |
| 261 ServiceWorkerContextWrapper* service_worker_context) { | 271 ServiceWorkerContextWrapper* service_worker_context) { |
| 262 DCHECK(IsBrowserSideNavigationEnabled()); | 272 DCHECK(IsBrowserSideNavigationEnabled()); |
| 263 service_worker_handle_.reset( | 273 service_worker_handle_.reset( |
| 264 new ServiceWorkerNavigationHandle(service_worker_context)); | 274 new ServiceWorkerNavigationHandle(service_worker_context)); |
| 265 } | 275 } |
| 266 | 276 |
| 267 void NavigationHandleImpl::WillStartRequest( | 277 void NavigationHandleImpl::WillStartRequest( |
| 268 bool is_post, | 278 bool is_post, |
| 269 const Referrer& sanitized_referrer, | 279 const Referrer& sanitized_referrer, |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 RenderFrameHostImpl* render_frame_host) { | 380 RenderFrameHostImpl* render_frame_host) { |
| 371 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); | 381 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); |
| 372 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); | 382 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); |
| 373 CHECK_EQ(url_, params.url); | 383 CHECK_EQ(url_, params.url); |
| 374 | 384 |
| 375 is_post_ = params.is_post; | 385 is_post_ = params.is_post; |
| 376 has_user_gesture_ = (params.gesture == NavigationGestureUser); | 386 has_user_gesture_ = (params.gesture == NavigationGestureUser); |
| 377 transition_ = params.transition; | 387 transition_ = params.transition; |
| 378 render_frame_host_ = render_frame_host; | 388 render_frame_host_ = render_frame_host; |
| 379 is_same_page_ = same_page; | 389 is_same_page_ = same_page; |
| 390 is_using_lofi_ = params.is_using_lofi; |
| 391 used_data_reduction_proxy_ = params.used_data_reduction_proxy; |
| 380 | 392 |
| 381 state_ = net_error_code_ == net::OK ? DID_COMMIT : DID_COMMIT_ERROR_PAGE; | 393 state_ = net_error_code_ == net::OK ? DID_COMMIT : DID_COMMIT_ERROR_PAGE; |
| 382 } | 394 } |
| 383 | 395 |
| 384 NavigationThrottle::ThrottleCheckResult | 396 NavigationThrottle::ThrottleCheckResult |
| 385 NavigationHandleImpl::CheckWillStartRequest() { | 397 NavigationHandleImpl::CheckWillStartRequest() { |
| 386 DCHECK(state_ == WILL_SEND_REQUEST || state_ == DEFERRING_START); | 398 DCHECK(state_ == WILL_SEND_REQUEST || state_ == DEFERRING_START); |
| 387 DCHECK(state_ != WILL_SEND_REQUEST || next_index_ == 0); | 399 DCHECK(state_ != WILL_SEND_REQUEST || next_index_ == 0); |
| 388 DCHECK(state_ != DEFERRING_START || next_index_ != 0); | 400 DCHECK(state_ != DEFERRING_START || next_index_ != 0); |
| 389 for (size_t i = next_index_; i < throttles_.size(); ++i) { | 401 for (size_t i = next_index_; i < throttles_.size(); ++i) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 complete_callback_.Reset(); | 496 complete_callback_.Reset(); |
| 485 | 497 |
| 486 if (!callback.is_null()) | 498 if (!callback.is_null()) |
| 487 callback.Run(result); | 499 callback.Run(result); |
| 488 | 500 |
| 489 // No code after running the callback, as it might have resulted in our | 501 // No code after running the callback, as it might have resulted in our |
| 490 // destruction. | 502 // destruction. |
| 491 } | 503 } |
| 492 | 504 |
| 493 } // namespace content | 505 } // namespace content |
| OLD | NEW |