Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Unified Diff: chrome/browser/extensions/updater/extension_updater.cc

Issue 9718028: Allow autoupdate to update disabled extensions. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Review fixes and added tests. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/updater/extension_updater.cc
diff --git a/chrome/browser/extensions/updater/extension_updater.cc b/chrome/browser/extensions/updater/extension_updater.cc
index ff3fdafc80c93acad17f929281b49a6ae4e04399..f32f4296026e54f08d9cbcff0b7aaea37cf40814 100644
--- a/chrome/browser/extensions/updater/extension_updater.cc
+++ b/chrome/browser/extensions/updater/extension_updater.cc
@@ -262,6 +262,25 @@ void ExtensionUpdater::DoCheckSoon() {
will_check_soon_ = false;
}
+void ExtensionUpdater::AddToDownloader(const ExtensionSet* extensions,
+ const std::set<std::string>& pending_ids) {
+ for (ExtensionSet::const_iterator iter = extensions->begin();
+ iter != extensions->end(); ++iter) {
+ const Extension& extension = **iter;
+ if (!Extension::IsAutoUpdateableLocation(extension.location())) {
+ VLOG(2) << "Extension " << extension.id() << " is not auto updateable";
+ continue;
+ }
+ // An extension might be overwritten by policy, and have its update url
+ // changed. Make sure existing extensions aren't fetched again, if a
+ // pending fetch for an extension with the same id already exists.
+ if (!ContainsKey(pending_ids, extension.id())) {
+ if (downloader_->AddExtension(extension))
+ in_progress_ids_.insert(extension.id());
+ }
+ }
+}
+
void ExtensionUpdater::CheckNow() {
VLOG(2) << "Starting update check";
DCHECK(alive_);
@@ -296,24 +315,8 @@ void ExtensionUpdater::CheckNow() {
in_progress_ids_.insert(*iter);
}
- // Add fetch records for extensions that are installed and have an
- // update URL.
- const ExtensionSet* extensions = service_->extensions();
- for (ExtensionSet::const_iterator iter = extensions->begin();
- iter != extensions->end(); ++iter) {
- const Extension& extension = **iter;
- if (!Extension::IsAutoUpdateableLocation(extension.location())) {
- VLOG(2) << "Extension " << extension.id() << " is not auto updateable";
- continue;
- }
- // An extension might be overwritten by policy, and have its update url
- // changed. Make sure existing extensions aren't fetched again, if a
- // pending fetch for an extension with the same id already exists.
- if (!ContainsKey(pending_ids, extension.id())) {
- if (downloader_->AddExtension(extension))
- in_progress_ids_.insert(extension.id());
- }
- }
+ AddToDownloader(service_->extensions(), pending_ids);
+ AddToDownloader(service_->disabled_extensions(), pending_ids);
// Start a fetch of the blacklist if needed.
if (blacklist_checks_enabled_) {
@@ -417,7 +420,7 @@ bool ExtensionUpdater::GetExtensionExistingVersion(const std::string& id,
*version = prefs_->GetString(kExtensionBlacklistUpdateVersion);
return true;
}
- const Extension* extension = service_->GetExtensionById(id, false);
+ const Extension* extension = service_->GetExtensionById(id, true);
if (!extension)
return false;
*version = extension->version()->GetString();

Powered by Google App Engine
This is Rietveld 408576698