OLD | NEW |
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 "chrome/browser/extensions/extension_resource_protocols.h" | 5 #include "chrome/browser/extensions/extension_resource_protocols.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
12 #include "chrome/common/chrome_paths.h" | 12 #include "chrome/common/chrome_paths.h" |
13 #include "chrome/common/extensions/extension_file_util.h" | |
14 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 14 #include "extensions/common/file_util.h" |
15 #include "net/url_request/url_request_file_job.h" | 15 #include "net/url_request/url_request_file_job.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 base::FilePath ResolvePath(const GURL& url) { | 19 base::FilePath ResolvePath(const GURL& url) { |
20 base::FilePath root_path; | 20 base::FilePath root_path; |
21 PathService::Get(chrome::DIR_RESOURCES_EXTENSION, &root_path); | 21 PathService::Get(chrome::DIR_RESOURCES_EXTENSION, &root_path); |
22 return extension_file_util::ExtensionResourceURLToFilePath(url, root_path); | 22 return extensions::file_util::ExtensionResourceURLToFilePath(url, root_path); |
23 } | 23 } |
24 | 24 |
25 class ExtensionResourcesJob : public net::URLRequestFileJob { | 25 class ExtensionResourcesJob : public net::URLRequestFileJob { |
26 public: | 26 public: |
27 ExtensionResourcesJob(net::URLRequest* request, | 27 ExtensionResourcesJob(net::URLRequest* request, |
28 net::NetworkDelegate* network_delegate) | 28 net::NetworkDelegate* network_delegate) |
29 : net::URLRequestFileJob( | 29 : net::URLRequestFileJob( |
30 request, network_delegate, base::FilePath(), | 30 request, network_delegate, base::FilePath(), |
31 content::BrowserThread::GetBlockingPool()-> | 31 content::BrowserThread::GetBlockingPool()-> |
32 GetTaskRunnerWithShutdownBehavior( | 32 GetTaskRunnerWithShutdownBehavior( |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { | 84 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { |
85 return new ExtensionResourcesJob(request, network_delegate); | 85 return new ExtensionResourcesJob(request, network_delegate); |
86 } | 86 } |
87 | 87 |
88 } // namespace | 88 } // namespace |
89 | 89 |
90 net::URLRequestJobFactory::ProtocolHandler* | 90 net::URLRequestJobFactory::ProtocolHandler* |
91 CreateExtensionResourceProtocolHandler() { | 91 CreateExtensionResourceProtocolHandler() { |
92 return new ExtensionResourceProtocolHandler(); | 92 return new ExtensionResourceProtocolHandler(); |
93 } | 93 } |
OLD | NEW |