| 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/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
| 10 #include "chrome/common/extensions/extension_file_util.h" | 10 #include "chrome/common/extensions/extension_file_util.h" |
| 11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
| 12 #include "net/url_request/url_request_file_job.h" | 12 #include "net/url_request/url_request_file_job.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 class ExtensionResourcesJob : public net::URLRequestFileJob { | 16 class ExtensionResourcesJob : public net::URLRequestFileJob { |
| 17 public: | 17 public: |
| 18 ExtensionResourcesJob(net::URLRequest* request, | 18 ExtensionResourcesJob(net::URLRequest* request, |
| 19 net::NetworkDelegate* network_delegate) | 19 net::NetworkDelegate* network_delegate) |
| 20 : net::URLRequestFileJob(request, network_delegate, FilePath()), | 20 : net::URLRequestFileJob(request, network_delegate, FilePath()), |
| 21 thread_id_(content::BrowserThread::UI) { | 21 thread_id_(content::BrowserThread::UI) { |
| 22 } | 22 } |
| 23 | 23 |
| 24 virtual void Start() OVERRIDE; | 24 virtual void Start() OVERRIDE; |
| 25 | 25 |
| 26 protected: | 26 protected: |
| 27 ~ExtensionResourcesJob() {} | 27 virtual ~ExtensionResourcesJob() {} |
| 28 | 28 |
| 29 void ResolvePath(); | 29 void ResolvePath(); |
| 30 void ResolvePathDone(); | 30 void ResolvePathDone(); |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 content::BrowserThread::ID thread_id_; | 33 content::BrowserThread::ID thread_id_; |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 void ExtensionResourcesJob::Start() { | 36 void ExtensionResourcesJob::Start() { |
| 37 bool result = | 37 bool result = |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { | 76 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { |
| 77 return new ExtensionResourcesJob(request, network_delegate); | 77 return new ExtensionResourcesJob(request, network_delegate); |
| 78 } | 78 } |
| 79 | 79 |
| 80 } // namespace | 80 } // namespace |
| 81 | 81 |
| 82 net::URLRequestJobFactory::ProtocolHandler* | 82 net::URLRequestJobFactory::ProtocolHandler* |
| 83 CreateExtensionResourceProtocolHandler() { | 83 CreateExtensionResourceProtocolHandler() { |
| 84 return new ExtensionResourceProtocolHandler(); | 84 return new ExtensionResourceProtocolHandler(); |
| 85 } | 85 } |
| OLD | NEW |