Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: content/browser/loader/navigation_resource_handler.cc

Issue 1953593002: Move DevToolsNetLogObserver to c/b/loader and create stub of network service interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comment Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/loader/navigation_resource_handler.h" 5 #include "content/browser/loader/navigation_resource_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/devtools/devtools_netlog_observer.h"
9 #include "content/browser/loader/navigation_url_loader_impl_core.h" 8 #include "content/browser/loader/navigation_url_loader_impl_core.h"
9 #include "content/browser/loader/netlog_observer.h"
10 #include "content/browser/loader/resource_request_info_impl.h" 10 #include "content/browser/loader/resource_request_info_impl.h"
11 #include "content/browser/resource_context_impl.h" 11 #include "content/browser/resource_context_impl.h"
12 #include "content/browser/streams/stream.h" 12 #include "content/browser/streams/stream.h"
13 #include "content/browser/streams/stream_context.h" 13 #include "content/browser/streams/stream_context.h"
14 #include "content/public/browser/resource_controller.h" 14 #include "content/public/browser/resource_controller.h"
15 #include "content/public/browser/stream_handle.h" 15 #include "content/public/browser/stream_handle.h"
16 #include "content/public/common/resource_response.h" 16 #include "content/public/common/resource_response.h"
17 #include "net/base/net_errors.h" 17 #include "net/base/net_errors.h"
18 #include "net/url_request/url_request.h" 18 #include "net/url_request/url_request.h"
19 19
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 58
59 bool NavigationResourceHandler::OnRequestRedirected( 59 bool NavigationResourceHandler::OnRequestRedirected(
60 const net::RedirectInfo& redirect_info, 60 const net::RedirectInfo& redirect_info,
61 ResourceResponse* response, 61 ResourceResponse* response,
62 bool* defer) { 62 bool* defer) {
63 DCHECK(core_); 63 DCHECK(core_);
64 64
65 // TODO(davidben): Perform a CSP check here, and anything else that would have 65 // TODO(davidben): Perform a CSP check here, and anything else that would have
66 // been done renderer-side. 66 // been done renderer-side.
67 DevToolsNetLogObserver::PopulateResponseInfo(request(), response); 67 NetLogObserver::PopulateResponseInfo(request(), response);
68 core_->NotifyRequestRedirected(redirect_info, response); 68 core_->NotifyRequestRedirected(redirect_info, response);
69 *defer = true; 69 *defer = true;
70 return true; 70 return true;
71 } 71 }
72 72
73 bool NavigationResourceHandler::OnResponseStarted(ResourceResponse* response, 73 bool NavigationResourceHandler::OnResponseStarted(ResourceResponse* response,
74 bool* defer) { 74 bool* defer) {
75 DCHECK(core_); 75 DCHECK(core_);
76 76
77 ResourceRequestInfoImpl* info = GetRequestInfo(); 77 ResourceRequestInfoImpl* info = GetRequestInfo();
78 78
79 // If the MimeTypeResourceHandler intercepted this request and converted it 79 // If the MimeTypeResourceHandler intercepted this request and converted it
80 // into a download, it will still call OnResponseStarted and immediately 80 // into a download, it will still call OnResponseStarted and immediately
81 // cancel. Ignore the call; OnReadCompleted will happen shortly. 81 // cancel. Ignore the call; OnReadCompleted will happen shortly.
82 // 82 //
83 // TODO(davidben): Move the dispatch out of MimeTypeResourceHandler. Perhaps 83 // TODO(davidben): Move the dispatch out of MimeTypeResourceHandler. Perhaps
84 // all the way to the UI thread. Downloads, user certificates, etc., should be 84 // all the way to the UI thread. Downloads, user certificates, etc., should be
85 // dispatched at the navigation layer. 85 // dispatched at the navigation layer.
86 if (info->IsDownload() || info->is_stream()) 86 if (info->IsDownload() || info->is_stream())
87 return true; 87 return true;
88 88
89 StreamContext* stream_context = 89 StreamContext* stream_context =
90 GetStreamContextForResourceContext(info->GetContext()); 90 GetStreamContextForResourceContext(info->GetContext());
91 writer_.InitializeStream(stream_context->registry(), 91 writer_.InitializeStream(stream_context->registry(),
92 request()->url().GetOrigin()); 92 request()->url().GetOrigin());
93 93
94 DevToolsNetLogObserver::PopulateResponseInfo(request(), response); 94 NetLogObserver::PopulateResponseInfo(request(), response);
95 core_->NotifyResponseStarted(response, writer_.stream()->CreateHandle()); 95 core_->NotifyResponseStarted(response, writer_.stream()->CreateHandle());
96 *defer = true; 96 *defer = true;
97 return true; 97 return true;
98 } 98 }
99 99
100 bool NavigationResourceHandler::OnWillStart(const GURL& url, bool* defer) { 100 bool NavigationResourceHandler::OnWillStart(const GURL& url, bool* defer) {
101 return true; 101 return true;
102 } 102 }
103 103
104 bool NavigationResourceHandler::OnBeforeNetworkStart(const GURL& url, 104 bool NavigationResourceHandler::OnBeforeNetworkStart(const GURL& url,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 NOTREACHED(); 143 NOTREACHED();
144 } 144 }
145 145
146 void NavigationResourceHandler::DetachFromCore() { 146 void NavigationResourceHandler::DetachFromCore() {
147 DCHECK(core_); 147 DCHECK(core_);
148 core_->set_resource_handler(nullptr); 148 core_->set_resource_handler(nullptr);
149 core_ = nullptr; 149 core_ = nullptr;
150 } 150 }
151 151
152 } // namespace content 152 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/async_resource_handler.cc ('k') | content/browser/loader/netlog_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698