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 25 matching lines...) Expand all Loading... |
36 void Start() override; | 36 void Start() override; |
37 | 37 |
38 bool IsRedirectResponse(GURL* location, int* http_status_code) override; | 38 bool IsRedirectResponse(GURL* location, int* http_status_code) override; |
39 | 39 |
40 protected: | 40 protected: |
41 ~ExtensionResourcesJob() override {} | 41 ~ExtensionResourcesJob() override {} |
42 | 42 |
43 void ResolvePathDone(const base::FilePath& resolved_path); | 43 void ResolvePathDone(const base::FilePath& resolved_path); |
44 | 44 |
45 private: | 45 private: |
| 46 base::ThreadChecker thread_checker_; |
| 47 |
46 base::WeakPtrFactory<ExtensionResourcesJob> weak_ptr_factory_; | 48 base::WeakPtrFactory<ExtensionResourcesJob> weak_ptr_factory_; |
47 | 49 |
48 base::ThreadChecker thread_checker_; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(ExtensionResourcesJob); | 50 DISALLOW_COPY_AND_ASSIGN(ExtensionResourcesJob); |
51 }; | 51 }; |
52 | 52 |
53 void ExtensionResourcesJob::Start() { | 53 void ExtensionResourcesJob::Start() { |
54 DCHECK(thread_checker_.CalledOnValidThread()); | 54 DCHECK(thread_checker_.CalledOnValidThread()); |
55 content::BrowserThread::PostTaskAndReplyWithResult( | 55 content::BrowserThread::PostTaskAndReplyWithResult( |
56 content::BrowserThread::FILE, FROM_HERE, | 56 content::BrowserThread::FILE, FROM_HERE, |
57 base::Bind(&ResolvePath, request()->url()), | 57 base::Bind(&ResolvePath, request()->url()), |
58 base::Bind(&ExtensionResourcesJob::ResolvePathDone, | 58 base::Bind(&ExtensionResourcesJob::ResolvePathDone, |
59 weak_ptr_factory_.GetWeakPtr())); | 59 weak_ptr_factory_.GetWeakPtr())); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { | 91 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { |
92 return new ExtensionResourcesJob(request, network_delegate); | 92 return new ExtensionResourcesJob(request, network_delegate); |
93 } | 93 } |
94 | 94 |
95 } // namespace | 95 } // namespace |
96 | 96 |
97 net::URLRequestJobFactory::ProtocolHandler* | 97 net::URLRequestJobFactory::ProtocolHandler* |
98 CreateExtensionResourceProtocolHandler() { | 98 CreateExtensionResourceProtocolHandler() { |
99 return new ExtensionResourceProtocolHandler(); | 99 return new ExtensionResourceProtocolHandler(); |
100 } | 100 } |
OLD | NEW |