summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/crx_installer.cc
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-20 18:58:19 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-20 18:58:19 +0000
commitb6ab96da13cdfe15f38fbebcd22e0a1db5a50381 (patch)
tree99e4977793b780210f6aceca8ae544612065a33a /chrome/browser/extensions/crx_installer.cc
parent49c97336d0262072c413ca802c4818a419e3b620 (diff)
downloadchromium_src-b6ab96da13cdfe15f38fbebcd22e0a1db5a50381.zip
chromium_src-b6ab96da13cdfe15f38fbebcd22e0a1db5a50381.tar.gz
chromium_src-b6ab96da13cdfe15f38fbebcd22e0a1db5a50381.tar.bz2
Get rid of the extension's "Current Version" file.
The entire manifest.json value is now stored in the prefs file. This will allow for quick extension checks on startup. BUG=18293 TEST=Make sure installing/upgrading/uninstalling extensions works as expected. Review URL: http://codereview.chromium.org/174036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23848 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/crx_installer.cc')
-rw-r--r--chrome/browser/extensions/crx_installer.cc25
1 files changed, 14 insertions, 11 deletions
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc
index 352cd8c..677aada 100644
--- a/chrome/browser/extensions/crx_installer.cc
+++ b/chrome/browser/extensions/crx_installer.cc
@@ -171,6 +171,9 @@ void CrxInstaller::ConfirmInstall() {
return;
}
+ current_version_ =
+ frontend_->extension_prefs()->GetVersionString(extension_->id());
+
if (client_.get()) {
AddRef(); // balanced in ContinueInstall() and AbortInstall().
client_->ConfirmInstall(this, extension_.get(), install_icon_.get());
@@ -199,17 +202,10 @@ void CrxInstaller::CompleteInstall() {
DCHECK(MessageLoop::current() == file_loop_);
FilePath version_dir;
- Extension::InstallType install_type = Extension::INSTALL_ERROR;
- std::string error_msg;
- if (!extension_file_util::InstallExtension(unpacked_extension_root_,
- install_directory_,
- extension_->id(),
- extension_->VersionString(),
- &version_dir,
- &install_type, &error_msg)) {
- ReportFailureFromFileThread(error_msg);
- return;
- }
+ Extension::InstallType install_type =
+ extension_file_util::CompareToInstalledVersion(
+ install_directory_, extension_->id(), current_version_,
+ extension_->VersionString(), &version_dir);
if (install_type == Extension::DOWNGRADE) {
ReportFailureFromFileThread("Attempted to downgrade extension.");
@@ -222,6 +218,13 @@ void CrxInstaller::CompleteInstall() {
return;
}
+ std::string error_msg;
+ if (!extension_file_util::InstallExtension(unpacked_extension_root_,
+ version_dir, &error_msg)) {
+ ReportFailureFromFileThread(error_msg);
+ return;
+ }
+
// This is lame, but we must reload the extension because absolute paths
// inside the content scripts are established inside InitFromValue() and we
// just moved the extension.