| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_request.h" | 5 #include "content/browser/frame_host/navigation_request.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "content/browser/frame_host/frame_tree.h" | 9 #include "content/browser/frame_host/frame_tree.h" |
| 10 #include "content/browser/frame_host/frame_tree_node.h" | 10 #include "content/browser/frame_host/frame_tree_node.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 // TODO(clamy): pass the real value for |is_external_protocol| if needed. | 251 // TODO(clamy): pass the real value for |is_external_protocol| if needed. |
| 252 navigation_handle_->WillRedirectRequest( | 252 navigation_handle_->WillRedirectRequest( |
| 253 common_params_.url, begin_params_.method == "POST", | 253 common_params_.url, begin_params_.method == "POST", |
| 254 common_params_.referrer.url, false, response->head.headers, | 254 common_params_.referrer.url, false, response->head.headers, |
| 255 base::Bind(&NavigationRequest::OnRedirectChecksComplete, | 255 base::Bind(&NavigationRequest::OnRedirectChecksComplete, |
| 256 base::Unretained(this))); | 256 base::Unretained(this))); |
| 257 } | 257 } |
| 258 | 258 |
| 259 void NavigationRequest::OnResponseStarted( | 259 void NavigationRequest::OnResponseStarted( |
| 260 const scoped_refptr<ResourceResponse>& response, | 260 const scoped_refptr<ResourceResponse>& response, |
| 261 scoped_ptr<StreamHandle> body) { | 261 scoped_ptr<StreamHandle> body, |
| 262 mojo::ScopedDataPipeConsumerHandle data_consumer_handle) { |
| 262 DCHECK(state_ == STARTED); | 263 DCHECK(state_ == STARTED); |
| 263 state_ = RESPONSE_STARTED; | 264 state_ = RESPONSE_STARTED; |
| 264 | 265 |
| 265 // Update the service worker params of the request params. | 266 // Update the service worker params of the request params. |
| 266 request_params_.should_create_service_worker = | 267 request_params_.should_create_service_worker = |
| 267 (frame_tree_node_->pending_sandbox_flags() & | 268 (frame_tree_node_->pending_sandbox_flags() & |
| 268 blink::WebSandboxFlags::Origin) != blink::WebSandboxFlags::Origin; | 269 blink::WebSandboxFlags::Origin) != blink::WebSandboxFlags::Origin; |
| 269 if (navigation_handle_->service_worker_handle()) { | 270 if (navigation_handle_->service_worker_handle()) { |
| 270 request_params_.service_worker_provider_id = | 271 request_params_.service_worker_provider_id = |
| 271 navigation_handle_->service_worker_handle() | 272 navigation_handle_->service_worker_handle() |
| 272 ->service_worker_provider_host_id(); | 273 ->service_worker_provider_host_id(); |
| 273 } | 274 } |
| 274 | 275 |
| 275 frame_tree_node_->navigator()->CommitNavigation( | 276 frame_tree_node_->navigator()->CommitNavigation( |
| 276 frame_tree_node_, response.get(), std::move(body)); | 277 frame_tree_node_, response.get(), std::move(body), std::move(data_consumer
_handle)); |
| 277 } | 278 } |
| 278 | 279 |
| 279 void NavigationRequest::OnRequestFailed(bool has_stale_copy_in_cache, | 280 void NavigationRequest::OnRequestFailed(bool has_stale_copy_in_cache, |
| 280 int net_error) { | 281 int net_error) { |
| 281 DCHECK(state_ == STARTED); | 282 DCHECK(state_ == STARTED); |
| 282 state_ = FAILED; | 283 state_ = FAILED; |
| 283 navigation_handle_->set_net_error_code(static_cast<net::Error>(net_error)); | 284 navigation_handle_->set_net_error_code(static_cast<net::Error>(net_error)); |
| 284 frame_tree_node_->navigator()->FailedNavigation( | 285 frame_tree_node_->navigator()->FailedNavigation( |
| 285 frame_tree_node_, has_stale_copy_in_cache, net_error); | 286 frame_tree_node_, has_stale_copy_in_cache, net_error); |
| 286 } | 287 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 browser_context, navigating_frame_host->GetSiteInstance()); | 355 browser_context, navigating_frame_host->GetSiteInstance()); |
| 355 DCHECK(partition); | 356 DCHECK(partition); |
| 356 | 357 |
| 357 ServiceWorkerContextWrapper* service_worker_context = | 358 ServiceWorkerContextWrapper* service_worker_context = |
| 358 static_cast<ServiceWorkerContextWrapper*>( | 359 static_cast<ServiceWorkerContextWrapper*>( |
| 359 partition->GetServiceWorkerContext()); | 360 partition->GetServiceWorkerContext()); |
| 360 navigation_handle_->InitServiceWorkerHandle(service_worker_context); | 361 navigation_handle_->InitServiceWorkerHandle(service_worker_context); |
| 361 } | 362 } |
| 362 | 363 |
| 363 } // namespace content | 364 } // namespace content |
| OLD | NEW |