OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/extensions/extension_resource_protocols.h" | |
6 | |
7 #include "base/file_path.h" | |
8 #include "base/path_service.h" | |
9 #include "chrome/common/chrome_paths.h" | |
10 #include "chrome/common/extensions/extension_file_util.h" | |
11 #include "net/url_request/url_request_file_job.h" | |
12 | |
13 namespace { | |
14 | |
15 class ExtensionResourceProtocolHandler | |
16 : public net::URLRequestJobFactory::ProtocolHandler { | |
17 public: | |
18 ExtensionResourceProtocolHandler() {} | |
19 virtual ~ExtensionResourceProtocolHandler() {} | |
20 | |
21 virtual net::URLRequestJob* MaybeCreateJob( | |
22 net::URLRequest* request) const OVERRIDE; | |
23 | |
24 private: | |
25 DISALLOW_COPY_AND_ASSIGN(ExtensionResourceProtocolHandler); | |
26 }; | |
27 | |
28 class ExtensionResourcesJob : public net::URLRequestFileJob { | |
29 }; | |
30 | |
31 // Creates URLRequestJobs for chrome-extension-resource:// URLs. | |
32 net::URLRequestJob* | |
33 ExtensionResourceProtocolHandler::MaybeCreateJob( | |
34 net::URLRequest* request) const { | |
35 FilePath root_path; | |
36 PathService::Get(chrome::DIR_RESOURCES_EXTENSION, &root_path); | |
37 FilePath path; | |
38 { | |
39 base::ThreadRestrictions::ScopedAllowIO allow_io; | |
Elliot Glaysher
2012/05/17 19:23:41
The presubmit check is doing its job by complainin
Peng
2012/05/17 19:26:11
I can not find a easy way to fix it. :( Do you hav
| |
40 path = extension_file_util::ExtensionResourceURLToFilePath( | |
41 request->url(), root_path); | |
42 } | |
43 return new net::URLRequestFileJob(request, path); | |
44 } | |
45 | |
46 } // namespace | |
47 | |
48 net::URLRequestJobFactory::ProtocolHandler* | |
49 CreateExtensionResourceProtocolHandler() { | |
50 return new ExtensionResourceProtocolHandler(); | |
51 } | |
OLD | NEW |