OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chromeos/extensions/external_cache.h" | 5 #include "chrome/browser/chromeos/extensions/external_cache.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/files/file_enumerator.h" | 11 #include "base/files/file_enumerator.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "base/version.h" | 16 #include "base/version.h" |
17 #include "chrome/browser/chrome_notification_types.h" | |
18 #include "chrome/browser/extensions/crx_installer.h" | 17 #include "chrome/browser/extensions/crx_installer.h" |
19 #include "chrome/browser/extensions/external_provider_impl.h" | 18 #include "chrome/browser/extensions/external_provider_impl.h" |
20 #include "chrome/browser/extensions/updater/extension_downloader.h" | 19 #include "chrome/browser/extensions/updater/extension_downloader.h" |
21 #include "chrome/common/extensions/extension_constants.h" | 20 #include "chrome/common/extensions/extension_constants.h" |
22 #include "content/public/browser/notification_details.h" | 21 #include "content/public/browser/notification_details.h" |
23 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
24 #include "content/public/browser/notification_source.h" | 23 #include "content/public/browser/notification_source.h" |
| 24 #include "extensions/browser/notification_types.h" |
25 #include "extensions/common/extension.h" | 25 #include "extensions/common/extension.h" |
26 #include "net/url_request/url_request_context_getter.h" | 26 #include "net/url_request/url_request_context_getter.h" |
27 | 27 |
28 namespace chromeos { | 28 namespace chromeos { |
29 | 29 |
30 ExternalCache::ExternalCache(const base::FilePath& cache_dir, | 30 ExternalCache::ExternalCache(const base::FilePath& cache_dir, |
31 net::URLRequestContextGetter* request_context, | 31 net::URLRequestContextGetter* request_context, |
32 const scoped_refptr<base::SequencedTaskRunner>& | 32 const scoped_refptr<base::SequencedTaskRunner>& |
33 backend_task_runner, | 33 backend_task_runner, |
34 Delegate* delegate, | 34 Delegate* delegate, |
35 bool always_check_updates, | 35 bool always_check_updates, |
36 bool wait_for_cache_initialization) | 36 bool wait_for_cache_initialization) |
37 : local_cache_(cache_dir, 0, base::TimeDelta(), backend_task_runner), | 37 : local_cache_(cache_dir, 0, base::TimeDelta(), backend_task_runner), |
38 request_context_(request_context), | 38 request_context_(request_context), |
39 backend_task_runner_(backend_task_runner), | 39 backend_task_runner_(backend_task_runner), |
40 delegate_(delegate), | 40 delegate_(delegate), |
41 always_check_updates_(always_check_updates), | 41 always_check_updates_(always_check_updates), |
42 wait_for_cache_initialization_(wait_for_cache_initialization), | 42 wait_for_cache_initialization_(wait_for_cache_initialization), |
43 cached_extensions_(new base::DictionaryValue()), | 43 cached_extensions_(new base::DictionaryValue()), |
44 weak_ptr_factory_(this) { | 44 weak_ptr_factory_(this) { |
45 notification_registrar_.Add( | 45 notification_registrar_.Add( |
46 this, | 46 this, |
47 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, | 47 extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR, |
48 content::NotificationService::AllBrowserContextsAndSources()); | 48 content::NotificationService::AllBrowserContextsAndSources()); |
49 } | 49 } |
50 | 50 |
51 ExternalCache::~ExternalCache() { | 51 ExternalCache::~ExternalCache() { |
52 } | 52 } |
53 | 53 |
54 void ExternalCache::Shutdown(const base::Closure& callback) { | 54 void ExternalCache::Shutdown(const base::Closure& callback) { |
55 local_cache_.Shutdown(callback); | 55 local_cache_.Shutdown(callback); |
56 } | 56 } |
57 | 57 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 bool ExternalCache::GetExtension(const std::string& id, | 123 bool ExternalCache::GetExtension(const std::string& id, |
124 base::FilePath* file_path, | 124 base::FilePath* file_path, |
125 std::string* version) { | 125 std::string* version) { |
126 return local_cache_.GetExtension(id, file_path, version); | 126 return local_cache_.GetExtension(id, file_path, version); |
127 } | 127 } |
128 | 128 |
129 void ExternalCache::Observe(int type, | 129 void ExternalCache::Observe(int type, |
130 const content::NotificationSource& source, | 130 const content::NotificationSource& source, |
131 const content::NotificationDetails& details) { | 131 const content::NotificationDetails& details) { |
132 switch (type) { | 132 switch (type) { |
133 case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: { | 133 case extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR: { |
134 extensions::CrxInstaller* installer = | 134 extensions::CrxInstaller* installer = |
135 content::Source<extensions::CrxInstaller>(source).ptr(); | 135 content::Source<extensions::CrxInstaller>(source).ptr(); |
136 OnDamagedFileDetected(installer->source_file()); | 136 OnDamagedFileDetected(installer->source_file()); |
137 break; | 137 break; |
138 } | 138 } |
139 | 139 |
140 default: | 140 default: |
141 NOTREACHED(); | 141 NOTREACHED(); |
142 } | 142 } |
143 } | 143 } |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 delegate_->OnExtensionLoadedInCache(id); | 320 delegate_->OnExtensionLoadedInCache(id); |
321 UpdateExtensionLoader(); | 321 UpdateExtensionLoader(); |
322 } | 322 } |
323 | 323 |
324 std::string ExternalCache::Delegate::GetInstalledExtensionVersion( | 324 std::string ExternalCache::Delegate::GetInstalledExtensionVersion( |
325 const std::string& id) { | 325 const std::string& id) { |
326 return std::string(); | 326 return std::string(); |
327 } | 327 } |
328 | 328 |
329 } // namespace chromeos | 329 } // namespace chromeos |
OLD | NEW |