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/extensions/crx_installer.h" | 17 #include "chrome/browser/extensions/crx_installer.h" |
18 #include "chrome/browser/extensions/external_provider_impl.h" | 18 #include "chrome/browser/extensions/external_provider_impl.h" |
19 #include "chrome/browser/extensions/updater/chrome_extension_downloader_factory.
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" |
25 #include "extensions/browser/notification_types.h" | 24 #include "extensions/browser/notification_types.h" |
26 #include "extensions/common/extension.h" | 25 #include "extensions/common/extension.h" |
27 #include "net/url_request/url_request_context_getter.h" | 26 #include "net/url_request/url_request_context_getter.h" |
28 | 27 |
29 namespace chromeos { | 28 namespace chromeos { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 if (delegate_) | 202 if (delegate_) |
204 delegate_->OnExtensionListsUpdated(cached_extensions_.get()); | 203 delegate_->OnExtensionListsUpdated(cached_extensions_.get()); |
205 } | 204 } |
206 | 205 |
207 void ExternalCache::CheckCache() { | 206 void ExternalCache::CheckCache() { |
208 if (local_cache_.is_shutdown()) | 207 if (local_cache_.is_shutdown()) |
209 return; | 208 return; |
210 | 209 |
211 // If request_context_ is missing we can't download anything. | 210 // If request_context_ is missing we can't download anything. |
212 if (!downloader_ && request_context_) { | 211 if (!downloader_ && request_context_) { |
213 downloader_ = ChromeExtensionDownloaderFactory::CreateForRequestContext( | 212 downloader_.reset( |
214 request_context_, this); | 213 new extensions::ExtensionDownloader(this, request_context_)); |
215 } | 214 } |
216 | 215 |
217 cached_extensions_->Clear(); | 216 cached_extensions_->Clear(); |
218 for (base::DictionaryValue::Iterator it(*extensions_.get()); | 217 for (base::DictionaryValue::Iterator it(*extensions_.get()); |
219 !it.IsAtEnd(); it.Advance()) { | 218 !it.IsAtEnd(); it.Advance()) { |
220 const base::DictionaryValue* entry = NULL; | 219 const base::DictionaryValue* entry = NULL; |
221 if (!it.value().GetAsDictionary(&entry)) { | 220 if (!it.value().GetAsDictionary(&entry)) { |
222 LOG(ERROR) << "ExternalCache found bad entry with type " | 221 LOG(ERROR) << "ExternalCache found bad entry with type " |
223 << it.value().GetType(); | 222 << it.value().GetType(); |
224 continue; | 223 continue; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 delegate_->OnExtensionLoadedInCache(id); | 320 delegate_->OnExtensionLoadedInCache(id); |
322 UpdateExtensionLoader(); | 321 UpdateExtensionLoader(); |
323 } | 322 } |
324 | 323 |
325 std::string ExternalCache::Delegate::GetInstalledExtensionVersion( | 324 std::string ExternalCache::Delegate::GetInstalledExtensionVersion( |
326 const std::string& id) { | 325 const std::string& id) { |
327 return std::string(); | 326 return std::string(); |
328 } | 327 } |
329 | 328 |
330 } // namespace chromeos | 329 } // namespace chromeos |
OLD | NEW |