| 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 6e1694be6cdabb8555bb05bcc77362db99c4bdef..c358e5fd4a6774d33b7917fcff4452b6fbf6e30a 100644
|
| --- a/content/browser/loader/navigation_resource_handler.cc
|
| +++ b/content/browser/loader/navigation_resource_handler.cc
|
| @@ -1,36 +1,41 @@
|
| // 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/devtools/devtools_netlog_observer.h"
|
| #include "content/browser/loader/navigation_url_loader_impl_core.h"
|
| +#include "content/browser/loader/resource_dispatcher_host_impl.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)
|
| - : ResourceHandler(request),
|
| - core_(core) {
|
| + NavigationURLLoaderImplCore* core,
|
| + ResourceDispatcherHostImpl* rdh)
|
| + : ResourceHandler(request), core_(core), rdh_(rdh) {
|
| core_->set_resource_handler(this);
|
| writer_.set_immediate_mode(true);
|
| }
|
|
|
| NavigationResourceHandler::~NavigationResourceHandler() {
|
| if (core_) {
|
| core_->NotifyRequestFailed(false, net::ERR_ABORTED);
|
| DetachFromCore();
|
| }
|
| }
|
| @@ -85,22 +90,32 @@ 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());
|
|
|
| DevToolsNetLogObserver::PopulateResponseInfo(request(), response);
|
| - core_->NotifyResponseStarted(response, writer_.stream()->CreateHandle());
|
| +
|
| + // Ask the embedder for a NavigationData instance.
|
| + std::unique_ptr<NavigationData> navigation_data(nullptr);
|
| + if (rdh_ && rdh_->delegate())
|
| + navigation_data = rdh_->delegate()->GetNavigationData(request());
|
| + // Clone the embedder NavigationData before moving it to the UI thread.
|
| + std::unique_ptr<NavigationData> clone_data(
|
| + navigation_data.get() ? navigation_data->Clone() : nullptr);
|
| + core_->NotifyResponseStarted(response, writer_.stream()->CreateHandle(),
|
| + std::move(clone_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;
|
|
|