| Index: chrome/browser/extensions/extension_protocols.cc
|
| diff --git a/chrome/browser/extensions/extension_protocols.cc b/chrome/browser/extensions/extension_protocols.cc
|
| index 4b551533b00188845870845d9d44b1bd55a41d48..92aa528ef5aa540d3f39d2853164a9cc939d9c3f 100644
|
| --- a/chrome/browser/extensions/extension_protocols.cc
|
| +++ b/chrome/browser/extensions/extension_protocols.cc
|
| @@ -8,6 +8,7 @@
|
|
|
| #include "base/compiler_specific.h"
|
| #include "base/file_path.h"
|
| +#include "base/file_util.h"
|
| #include "base/logging.h"
|
| #include "base/message_loop.h"
|
| #include "base/path_service.h"
|
| @@ -240,7 +241,7 @@ class ExtensionProtocolHandler
|
| DISALLOW_COPY_AND_ASSIGN(ExtensionProtocolHandler);
|
| };
|
|
|
| -// Creates URLRequestJobs for extension:// URLs.
|
| +// Creates URLRequestJobs for chrome-extension:// URLs.
|
| net::URLRequestJob*
|
| ExtensionProtocolHandler::MaybeCreateJob(net::URLRequest* request) const {
|
| // TODO(mpcomplete): better error code.
|
| @@ -317,11 +318,35 @@ ExtensionProtocolHandler::MaybeCreateJob(net::URLRequest* request) const {
|
| base::ThreadRestrictions::ScopedAllowIO allow_io;
|
| resource_file_path = resource.GetFilePath();
|
| }
|
| -
|
| return new URLRequestExtensionJob(request, resource_file_path,
|
| content_security_policy, send_cors_header);
|
| }
|
|
|
| +class ExtensionResourceProtocolHandler
|
| + : public net::URLRequestJobFactory::ProtocolHandler {
|
| + public:
|
| + ExtensionResourceProtocolHandler() {}
|
| + virtual ~ExtensionResourceProtocolHandler() {}
|
| +
|
| + virtual net::URLRequestJob* MaybeCreateJob(
|
| + net::URLRequest* request) const OVERRIDE;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(ExtensionResourceProtocolHandler);
|
| +};
|
| +
|
| +// Creates URLRequestJobs for chrome-extension-resource:// URLs.
|
| +net::URLRequestJob*
|
| +ExtensionResourceProtocolHandler::MaybeCreateJob(
|
| + net::URLRequest* request) const {
|
| + FilePath root_path;
|
| + PathService::Get(chrome::DIR_RESOURCES_EXTENSION, &root_path);
|
| + FilePath path =
|
| + extension_file_util::ExtensionResourceURLToFilePath(
|
| + request->url(), root_path);
|
| + return new net::URLRequestFileJob(request, path);
|
| +}
|
| +
|
| } // namespace
|
|
|
| net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler(
|
| @@ -329,3 +354,8 @@ net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler(
|
| ExtensionInfoMap* extension_info_map) {
|
| return new ExtensionProtocolHandler(is_incognito, extension_info_map);
|
| }
|
| +
|
| +net::URLRequestJobFactory::ProtocolHandler*
|
| +CreateExtensionResourceProtocolHandler() {
|
| + return new ExtensionResourceProtocolHandler();
|
| +}
|
|
|