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

Side by Side Diff: content/browser/resource_context_impl.cc

Issue 10855209: Refactoring: ProtocolHandler::MaybeCreateJob takes NetworkDelegate as argument (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest merge Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/resource_context_impl.h" 5 #include "content/browser/resource_context_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/appcache/chrome_appcache_service.h" 8 #include "content/browser/appcache/chrome_appcache_service.h"
9 #include "content/browser/fileapi/browser_file_system_helper.h" 9 #include "content/browser/fileapi/browser_file_system_helper.h"
10 #include "content/browser/fileapi/chrome_blob_storage_context.h" 10 #include "content/browser/fileapi/chrome_blob_storage_context.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 : public net::URLRequestJobFactory::Interceptor { 87 : public net::URLRequestJobFactory::Interceptor {
88 public: 88 public:
89 DeveloperProtocolHandler( 89 DeveloperProtocolHandler(
90 AppCacheService* appcache_service, 90 AppCacheService* appcache_service,
91 BlobStorageController* blob_storage_controller) 91 BlobStorageController* blob_storage_controller)
92 : appcache_service_(appcache_service), 92 : appcache_service_(appcache_service),
93 blob_storage_controller_(blob_storage_controller) {} 93 blob_storage_controller_(blob_storage_controller) {}
94 virtual ~DeveloperProtocolHandler() {} 94 virtual ~DeveloperProtocolHandler() {}
95 95
96 virtual net::URLRequestJob* MaybeIntercept( 96 virtual net::URLRequestJob* MaybeIntercept(
97 net::URLRequest* request) const OVERRIDE { 97 net::URLRequest* request,
98 net::NetworkDelegate* network_delegate) const OVERRIDE {
98 // Check for chrome://view-http-cache/*, which uses its own job type. 99 // Check for chrome://view-http-cache/*, which uses its own job type.
99 if (ViewHttpCacheJobFactory::IsSupportedURL(request->url())) 100 if (ViewHttpCacheJobFactory::IsSupportedURL(request->url()))
100 return ViewHttpCacheJobFactory::CreateJobForRequest(request); 101 return ViewHttpCacheJobFactory::CreateJobForRequest(request,
102 network_delegate);
101 103
102 // Next check for chrome://appcache-internals/, which uses its own job type. 104 // Next check for chrome://appcache-internals/, which uses its own job type.
103 if (request->url().SchemeIs(chrome::kChromeUIScheme) && 105 if (request->url().SchemeIs(chrome::kChromeUIScheme) &&
104 request->url().host() == chrome::kChromeUIAppCacheInternalsHost) { 106 request->url().host() == chrome::kChromeUIAppCacheInternalsHost) {
105 return appcache::ViewAppCacheInternalsJobFactory::CreateJobForRequest( 107 return appcache::ViewAppCacheInternalsJobFactory::CreateJobForRequest(
106 request, appcache_service_); 108 request, network_delegate, appcache_service_);
107 } 109 }
108 110
109 // Next check for chrome://blob-internals/, which uses its own job type. 111 // Next check for chrome://blob-internals/, which uses its own job type.
110 if (ViewBlobInternalsJobFactory::IsSupportedURL(request->url())) { 112 if (ViewBlobInternalsJobFactory::IsSupportedURL(request->url())) {
111 return ViewBlobInternalsJobFactory::CreateJobForRequest( 113 return ViewBlobInternalsJobFactory::CreateJobForRequest(
112 request, blob_storage_controller_); 114 request, network_delegate, blob_storage_controller_);
113 } 115 }
114 116
115 #if defined(USE_TCMALLOC) 117 #if defined(USE_TCMALLOC)
116 // Next check for chrome://tcmalloc/, which uses its own job type. 118 // Next check for chrome://tcmalloc/, which uses its own job type.
117 if (request->url().SchemeIs(chrome::kChromeUIScheme) && 119 if (request->url().SchemeIs(chrome::kChromeUIScheme) &&
118 request->url().host() == chrome::kChromeUITcmallocHost) { 120 request->url().host() == chrome::kChromeUITcmallocHost) {
119 return new TcmallocInternalsRequestJob(request); 121 return new TcmallocInternalsRequestJob(request, network_delegate);
120 } 122 }
121 #endif 123 #endif
122 124
123 // Next check for chrome://histograms/, which uses its own job type. 125 // Next check for chrome://histograms/, which uses its own job type.
124 if (request->url().SchemeIs(chrome::kChromeUIScheme) && 126 if (request->url().SchemeIs(chrome::kChromeUIScheme) &&
125 request->url().host() == chrome::kChromeUIHistogramHost) { 127 request->url().host() == chrome::kChromeUIHistogramHost) {
126 return new HistogramInternalsRequestJob(request); 128 return new HistogramInternalsRequestJob(request, network_delegate);
127 } 129 }
128 130
129 return NULL; 131 return NULL;
130 } 132 }
131 133
132 virtual net::URLRequestJob* MaybeInterceptRedirect( 134 virtual net::URLRequestJob* MaybeInterceptRedirect(
133 const GURL& location, 135 const GURL& location,
134 net::URLRequest* request) const OVERRIDE { 136 net::URLRequest* request,
137 net::NetworkDelegate* network_delegate) const OVERRIDE {
135 return NULL; 138 return NULL;
136 } 139 }
137 140
138 virtual net::URLRequestJob* MaybeInterceptResponse( 141 virtual net::URLRequestJob* MaybeInterceptResponse(
139 net::URLRequest* request) const OVERRIDE { 142 net::URLRequest* request,
143 net::NetworkDelegate* network_delegate) const OVERRIDE {
140 return NULL; 144 return NULL;
141 } 145 }
142 146
143 virtual bool WillHandleProtocol(const std::string& protocol) const { 147 virtual bool WillHandleProtocol(const std::string& protocol) const {
144 return protocol == chrome::kChromeUIScheme; 148 return protocol == chrome::kChromeUIScheme;
145 } 149 }
146 150
147 private: 151 private:
148 AppCacheService* appcache_service_; 152 AppCacheService* appcache_service_;
149 BlobStorageController* blob_storage_controller_; 153 BlobStorageController* blob_storage_controller_;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 BrowserThread::PostTask( 292 BrowserThread::PostTask(
289 BrowserThread::IO, FROM_HERE, 293 BrowserThread::IO, FROM_HERE,
290 base::Bind(&InitializeRequestContext, 294 base::Bind(&InitializeRequestContext,
291 resource_context, 295 resource_context,
292 make_scoped_refptr( 296 make_scoped_refptr(
293 browser_context->GetMediaRequestContext()))); 297 browser_context->GetMediaRequestContext())));
294 } 298 }
295 } 299 }
296 300
297 } // namespace content 301 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/resource_dispatcher_host_unittest.cc ('k') | content/browser/tcmalloc_internals_request_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698