summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-18 09:12:27 +0000
committerxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-18 09:12:27 +0000
commit18170159cf15fde40430a4cf25509dc3ee6085f6 (patch)
tree3d1261b109a48dada0f039d8ae098db3a9cb13d6
parent9ecfde729ca11b59726403fe98f025c80b5c8fb5 (diff)
downloadchromium_src-18170159cf15fde40430a4cf25509dc3ee6085f6.zip
chromium_src-18170159cf15fde40430a4cf25509dc3ee6085f6.tar.gz
chromium_src-18170159cf15fde40430a4cf25509dc3ee6085f6.tar.bz2
Component installer: Verify installation when searching for latest dir.
If a version folder is corrupted (e.g. the component binary is deleted accidently), we should not call the component installer with ComponentReady() with this folder. Instead, we should remove the corrupted folder and trigger a new update. Review URL: https://codereview.chromium.org/138383004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245766 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/component_updater/default_component_installer.cc6
-rw-r--r--chrome/browser/component_updater/default_component_installer.h3
2 files changed, 9 insertions, 0 deletions
diff --git a/chrome/browser/component_updater/default_component_installer.cc b/chrome/browser/component_updater/default_component_installer.cc
index 9743d5d..1447ca3 100644
--- a/chrome/browser/component_updater/default_component_installer.cc
+++ b/chrome/browser/component_updater/default_component_installer.cc
@@ -131,8 +131,14 @@ void DefaultComponentInstaller::StartRegistration(
!path.value().empty();
path = file_enumerator.Next()) {
base::Version version(path.BaseName().MaybeAsASCII());
+ // Ignore folders that don't have valid version names. These folders are not
+ // managed by component installer so do not try to remove them.
if (!version.IsValid())
continue;
+ if (!installer_traits_->VerifyInstallation(path)) {
+ older_dirs.push_back(path);
+ continue;
+ }
if (found) {
if (version.CompareTo(latest_version) > 0) {
older_dirs.push_back(latest_dir);
diff --git a/chrome/browser/component_updater/default_component_installer.h b/chrome/browser/component_updater/default_component_installer.h
index 1405b35..3c9f52d 100644
--- a/chrome/browser/component_updater/default_component_installer.h
+++ b/chrome/browser/component_updater/default_component_installer.h
@@ -30,6 +30,9 @@ class ComponentInstallerTraits {
// Verifies that a working installation resides within the directory specified
// by |dir|. |dir| is of the form <base directory>/<version>.
+ // Called only from a thread belonging to a blocking thread pool.
+ // The implementation of this function must be efficient since the function
+ // can be called when Chrome starts.
virtual bool VerifyInstallation(const base::FilePath& dir) const = 0;
// Returns true if the component can be automatically updated. Called once