Chromium Code Reviews| 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..a0deb5e3944f484aa8c06c91aefb649aadb3e246 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,28 @@ 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. |
|
nasko
2016/04/26 20:18:39
nit: Empty line above comment.
RyanSturm
2016/04/27 23:27:47
Done.
|
| + std::unique_ptr<NavigationData> navigation_data(nullptr); |
| + if (rdh_ && rdh_->delegate()) |
| + navigation_data = rdh_->delegate()->GetNavigationData(request()); |
| + core_->NotifyResponseStarted(response, writer_.stream()->CreateHandle(), |
| + navigation_data.get()); |
|
nasko
2016/04/26 20:18:39
Why not clone the data here and pass it to the met
RyanSturm
2016/04/27 23:27:47
Done.
|
| *defer = true; |
| + |
| return true; |
| } |
| bool NavigationResourceHandler::OnWillStart(const GURL& url, bool* defer) { |
| return true; |
| } |
| bool NavigationResourceHandler::OnBeforeNetworkStart(const GURL& url, |
| bool* defer) { |
| return true; |