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