| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 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( |
| 33 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)), | 33 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)), |
| 34 weak_ptr_factory_(this) {} | 34 weak_ptr_factory_(this) {} |
| 35 | 35 |
| 36 virtual void Start() OVERRIDE; | 36 virtual void Start() override; |
| 37 | 37 |
| 38 protected: | 38 protected: |
| 39 virtual ~ExtensionResourcesJob() {} | 39 virtual ~ExtensionResourcesJob() {} |
| 40 | 40 |
| 41 void ResolvePathDone(const base::FilePath& resolved_path); | 41 void ResolvePathDone(const base::FilePath& resolved_path); |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 base::WeakPtrFactory<ExtensionResourcesJob> weak_ptr_factory_; | 44 base::WeakPtrFactory<ExtensionResourcesJob> weak_ptr_factory_; |
| 45 | 45 |
| 46 base::ThreadChecker thread_checker_; | 46 base::ThreadChecker thread_checker_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 class ExtensionResourceProtocolHandler | 67 class ExtensionResourceProtocolHandler |
| 68 : public net::URLRequestJobFactory::ProtocolHandler { | 68 : public net::URLRequestJobFactory::ProtocolHandler { |
| 69 public: | 69 public: |
| 70 ExtensionResourceProtocolHandler() {} | 70 ExtensionResourceProtocolHandler() {} |
| 71 virtual ~ExtensionResourceProtocolHandler() {} | 71 virtual ~ExtensionResourceProtocolHandler() {} |
| 72 | 72 |
| 73 virtual net::URLRequestJob* MaybeCreateJob( | 73 virtual net::URLRequestJob* MaybeCreateJob( |
| 74 net::URLRequest* request, | 74 net::URLRequest* request, |
| 75 net::NetworkDelegate* network_delegate) const OVERRIDE; | 75 net::NetworkDelegate* network_delegate) const override; |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 DISALLOW_COPY_AND_ASSIGN(ExtensionResourceProtocolHandler); | 78 DISALLOW_COPY_AND_ASSIGN(ExtensionResourceProtocolHandler); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 // Creates URLRequestJobs for chrome-extension-resource:// URLs. | 81 // Creates URLRequestJobs for chrome-extension-resource:// URLs. |
| 82 net::URLRequestJob* | 82 net::URLRequestJob* |
| 83 ExtensionResourceProtocolHandler::MaybeCreateJob( | 83 ExtensionResourceProtocolHandler::MaybeCreateJob( |
| 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 |