| Index: content/browser/loader/navigation_resource_handler.cc
|
| diff --git a/content/browser/loader/navigation_resource_handler.cc b/content/browser/loader/navigation_resource_handler.cc
|
| index 91616f36fba131de4b616bcf94b1f058c760ace6..82c5c0686e7b340e1c6f5d181f94a757c765418f 100644
|
| --- a/content/browser/loader/navigation_resource_handler.cc
|
| +++ b/content/browser/loader/navigation_resource_handler.cc
|
| @@ -1,36 +1,42 @@
|
| // Copyright 2014 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| #include "content/browser/loader/navigation_resource_handler.h"
|
|
|
| +#include <memory>
|
| +
|
| #include "base/logging.h"
|
| #include "content/browser/loader/navigation_url_loader_impl_core.h"
|
| #include "content/browser/loader/netlog_observer.h"
|
| #include "content/browser/loader/resource_request_info_impl.h"
|
| #include "content/browser/resource_context_impl.h"
|
| #include "content/browser/streams/stream.h"
|
| #include "content/browser/streams/stream_context.h"
|
| +#include "content/public/browser/navigation_data.h"
|
| #include "content/public/browser/resource_controller.h"
|
| +#include "content/public/browser/resource_dispatcher_host_delegate.h"
|
| #include "content/public/browser/stream_handle.h"
|
| #include "content/public/common/resource_response.h"
|
| #include "net/base/net_errors.h"
|
| #include "net/url_request/url_request.h"
|
|
|
| namespace content {
|
|
|
| NavigationResourceHandler::NavigationResourceHandler(
|
| net::URLRequest* request,
|
| - NavigationURLLoaderImplCore* core)
|
| + NavigationURLLoaderImplCore* core,
|
| + ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate)
|
| : ResourceHandler(request),
|
| - core_(core) {
|
| + core_(core),
|
| + resource_dispatcher_host_delegate_(resource_dispatcher_host_delegate) {
|
| core_->set_resource_handler(this);
|
| writer_.set_immediate_mode(true);
|
| }
|
|
|
| NavigationResourceHandler::~NavigationResourceHandler() {
|
| if (core_) {
|
| core_->NotifyRequestFailed(false, net::ERR_ABORTED);
|
| DetachFromCore();
|
| }
|
| }
|
| @@ -85,22 +91,36 @@ bool NavigationResourceHandler::OnResponseStarted(ResourceResponse* response,
|
| // dispatched at the navigation layer.
|
| if (info->IsDownload() || info->is_stream())
|
| return true;
|
|
|
| StreamContext* stream_context =
|
| GetStreamContextForResourceContext(info->GetContext());
|
| writer_.InitializeStream(stream_context->registry(),
|
| request()->url().GetOrigin());
|
|
|
| NetLogObserver::PopulateResponseInfo(request(), response);
|
| - core_->NotifyResponseStarted(response, writer_.stream()->CreateHandle());
|
| +
|
| + std::unique_ptr<NavigationData> cloned_data;
|
| + if (resource_dispatcher_host_delegate_) {
|
| + // Ask the embedder for a NavigationData instance.
|
| + NavigationData* navigation_data =
|
| + resource_dispatcher_host_delegate_->GetNavigationData(request());
|
| +
|
| + // Clone the embedder's NavigationData before moving it to the UI thread.
|
| + if (navigation_data)
|
| + cloned_data = navigation_data->Clone();
|
| + }
|
| +
|
| + core_->NotifyResponseStarted(response, writer_.stream()->CreateHandle(),
|
| + std::move(cloned_data));
|
| *defer = true;
|
| +
|
| return true;
|
| }
|
|
|
| bool NavigationResourceHandler::OnWillStart(const GURL& url, bool* defer) {
|
| return true;
|
| }
|
|
|
| bool NavigationResourceHandler::OnBeforeNetworkStart(const GURL& url,
|
| bool* defer) {
|
| return true;
|
|
|