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

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

Issue 7605001: Extensions installed by policy overrun previously installed extensions. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: More tests. Created 9 years, 4 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/extension_updater.cc
diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc
index ae62dcac31b47dfd07a9d8c00ebc5c514b140b3c..32679af4e5545c81d38063ec82f52580d12b2652 100644
--- a/chrome/browser/extensions/extension_updater.cc
+++ b/chrome/browser/extensions/extension_updater.cc
@@ -1000,14 +1000,9 @@ void ExtensionUpdater::CheckNow() {
NotifyStarted();
ManifestFetchesBuilder fetches_builder(service_, extension_prefs_);
- const ExtensionList* extensions = service_->extensions();
- for (ExtensionList::const_iterator iter = extensions->begin();
- iter != extensions->end(); ++iter) {
- fetches_builder.AddExtension(**iter);
- }
-
const PendingExtensionManager* pending_extension_manager =
service_->pending_extension_manager();
+ std::set<std::string> pending_ids;
PendingExtensionManager::const_iterator iter;
for (iter = pending_extension_manager->begin();
@@ -1016,8 +1011,21 @@ void ExtensionUpdater::CheckNow() {
// class PendingExtensionManager.
Extension::Location location = iter->second.install_source();
if (location != Extension::EXTERNAL_PREF &&
- location != Extension::EXTERNAL_REGISTRY)
+ location != Extension::EXTERNAL_REGISTRY) {
fetches_builder.AddPendingExtension(iter->first, iter->second);
+ pending_ids.insert(iter->first);
+ }
+ }
+
+ const ExtensionList* extensions = service_->extensions();
+ for (ExtensionList::const_iterator iter = extensions->begin();
+ iter != extensions->end(); ++iter) {
+ // 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, (*iter)->id())) {
+ fetches_builder.AddExtension(**iter);
+ }
}
fetches_builder.ReportStats();

Powered by Google App Engine
This is Rietveld 408576698