diff options
author | skerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-25 16:15:14 +0000 |
---|---|---|
committer | skerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-25 16:15:14 +0000 |
commit | 26d287c32c77230e26da156ee4f8635e81e8ebab (patch) | |
tree | bf9a2a55988c5166f0e7d294927bfc449fb4ee6f /chrome/browser/extensions/extension_updater.cc | |
parent | d9e08861caa619b94d38f0528b0150ffb35f76a8 (diff) | |
download | chromium_src-26d287c32c77230e26da156ee4f8635e81e8ebab.zip chromium_src-26d287c32c77230e26da156ee4f8635e81e8ebab.tar.gz chromium_src-26d287c32c77230e26da156ee4f8635e81e8ebab.tar.bz2 |
Move ExtensionService code that manages pending extensions into its own class.
This change should have no impact on chrome's behavior.
Once all code paths that install an extension inform PendingExtensionManger that they are starting an install, we can correctly merge requests to install the same extension from multiple sources. This will remove two hacky checks to avoid install races we have seen on Chrome Os. It will also ensure that more hacks are not needed.
BUG=61000
TEST=ExtensionUpdaterTest.*:ExtensionServiceTest.*'
Review URL: http://codereview.chromium.org/6670055
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79407 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_updater.cc')
-rw-r--r-- | chrome/browser/extensions/extension_updater.cc | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc index ab01886..98e4fd6 100644 --- a/chrome/browser/extensions/extension_updater.cc +++ b/chrome/browser/extensions/extension_updater.cc @@ -847,10 +847,14 @@ void ExtensionUpdater::CheckNow() { fetches_builder.AddExtension(**iter); } - const PendingExtensionMap& pending_extensions = - service_->pending_extensions(); - for (PendingExtensionMap::const_iterator iter = pending_extensions.begin(); - iter != pending_extensions.end(); ++iter) { + const PendingExtensionManager* pending_extension_manager = + service_->pending_extension_manager(); + + PendingExtensionManager::const_iterator iter; + for (iter = pending_extension_manager->begin(); + iter != pending_extension_manager->end(); iter++) { + // TODO(skerner): Move the determination of what gets fetched into + // class PendingExtensionManager. Extension::Location location = iter->second.install_source(); if (location != Extension::EXTERNAL_PREF && location != Extension::EXTERNAL_REGISTRY) @@ -915,6 +919,8 @@ std::vector<int> ExtensionUpdater::DetermineUpdates( // This will only get set if one of possible_updates specifies // browser_min_version. scoped_ptr<Version> browser_version; + PendingExtensionManager* pending_extension_manager = + service_->pending_extension_manager(); for (size_t i = 0; i < possible_updates.list.size(); i++) { const UpdateManifest::Result* update = &possible_updates.list[i]; @@ -922,8 +928,7 @@ std::vector<int> ExtensionUpdater::DetermineUpdates( if (!fetch_data.Includes(update->extension_id)) continue; - if (service_->pending_extensions().find(update->extension_id) == - service_->pending_extensions().end()) { + if (!pending_extension_manager->IsIdPending(update->extension_id)) { // If we're not installing pending extension, and the update // version is the same or older than what's already installed, // we don't want it. @@ -959,9 +964,8 @@ std::vector<int> ExtensionUpdater::DetermineUpdates( // TODO(asargent) - We may want this to show up in the extensions UI // eventually. (http://crbug.com/12547). LOG(WARNING) << "Updated version of extension " << update->extension_id - << " available, but requires chrome version " - << update->browser_min_version; - + << " available, but requires chrome version " + << update->browser_min_version; continue; } } |