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