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

Side by Side Diff: chrome/browser/extensions/extension_protocols.cc

Issue 5863001: net: Add namespace net to URLRequestErrorJob. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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
« no previous file with comments | « chrome/browser/chrome_plugin_host.cc ('k') | net/url_request/url_request_error_job.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/extensions/extension_protocols.h" 5 #include "chrome/browser/extensions/extension_protocols.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "app/resource_bundle.h" 9 #include "app/resource_bundle.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // Factory registered with net::URLRequest to create URLRequestJobs for 145 // Factory registered with net::URLRequest to create URLRequestJobs for
146 // extension:// URLs. 146 // extension:// URLs.
147 static net::URLRequestJob* CreateExtensionURLRequestJob( 147 static net::URLRequestJob* CreateExtensionURLRequestJob(
148 net::URLRequest* request, 148 net::URLRequest* request,
149 const std::string& scheme) { 149 const std::string& scheme) {
150 ChromeURLRequestContext* context = 150 ChromeURLRequestContext* context =
151 static_cast<ChromeURLRequestContext*>(request->context()); 151 static_cast<ChromeURLRequestContext*>(request->context());
152 152
153 // TODO(mpcomplete): better error code. 153 // TODO(mpcomplete): better error code.
154 if (!AllowExtensionResourceLoad(request, context, scheme)) 154 if (!AllowExtensionResourceLoad(request, context, scheme))
155 return new URLRequestErrorJob(request, net::ERR_ADDRESS_UNREACHABLE); 155 return new net::URLRequestErrorJob(request, net::ERR_ADDRESS_UNREACHABLE);
156 156
157 // chrome-extension://extension-id/resource/path.js 157 // chrome-extension://extension-id/resource/path.js
158 const std::string& extension_id = request->url().host(); 158 const std::string& extension_id = request->url().host();
159 FilePath directory_path = context->extension_info_map()-> 159 FilePath directory_path = context->extension_info_map()->
160 GetPathForExtension(extension_id); 160 GetPathForExtension(extension_id);
161 if (directory_path.value().empty()) { 161 if (directory_path.value().empty()) {
162 LOG(WARNING) << "Failed to GetPathForExtension: " << extension_id; 162 LOG(WARNING) << "Failed to GetPathForExtension: " << extension_id;
163 return NULL; 163 return NULL;
164 } 164 }
165 165
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 return new net::URLRequestFileJob(request, resource.GetFilePath()); 219 return new net::URLRequestFileJob(request, resource.GetFilePath());
220 } 220 }
221 221
222 void RegisterExtensionProtocols() { 222 void RegisterExtensionProtocols() {
223 net::URLRequest::RegisterProtocolFactory(chrome::kExtensionScheme, 223 net::URLRequest::RegisterProtocolFactory(chrome::kExtensionScheme,
224 &CreateExtensionURLRequestJob); 224 &CreateExtensionURLRequestJob);
225 net::URLRequest::RegisterProtocolFactory(chrome::kUserScriptScheme, 225 net::URLRequest::RegisterProtocolFactory(chrome::kUserScriptScheme,
226 &CreateUserScriptURLRequestJob); 226 &CreateUserScriptURLRequestJob);
227 } 227 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_plugin_host.cc ('k') | net/url_request/url_request_error_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698