diff options
author | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 19:54:02 +0000 |
---|---|---|
committer | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 19:54:02 +0000 |
commit | 36b6f4f462adc4ff57d65acef4c60939c2dfd8fe (patch) | |
tree | 38f40e2fa1773ff67ccb6b2283bf722fa54c9ab5 /chrome/installer/util | |
parent | 15e7eba9c74140f4e976c0d152ba738c36f14bb5 (diff) | |
download | chromium_src-36b6f4f462adc4ff57d65acef4c60939c2dfd8fe.zip chromium_src-36b6f4f462adc4ff57d65acef4c60939c2dfd8fe.tar.gz chromium_src-36b6f4f462adc4ff57d65acef4c60939c2dfd8fe.tar.bz2 |
Support for GCF ready-mode.
The installer can now be run in a way that installs both Chrome and Chrome Frame
at the same time, into a shared directory. The command line to do this is:
mini_installer.exe --multi-install --chrome --chrome-frame --ready-mode
--system-level --verbose-logging
This installs both products although only Chrome will have an entry in the
add/remove programs dialog that serves as an uninstallation command for both
products. Chrome Frame will be installed in ready-mode, which means that the
user will have to opt-in or opt-out of using it. The installer will create a
REG_DWORD value to indicate this mode, here:
HKEY_LOCAL_MACHINE\SOFTWARE\Google\Update\ClientState\{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}
Value name: ChromeFrameReadyMode
Value: 1
If the user opts-in to use GCF, setup will be run again to remove this value,
update Chrome's uninstallation commands to only uninstall Chrome, and add an
entry to the Add/Remove Programs dialog for GCF. To do this, the installer
needs to be run with this switch:
--multi-install --chrome-frame --system-level --ready-mode-opt-in --verbose-logging
If the user opts-out, Chrome Frame will be uninstalled by running the installer
with these arguments:
--uninstall --chrome-frame --ready-mode --system-level --multi-install --verbose-logging
In addition to uninstalling GCF, this updates Chrome's uninstallation commands
accordingly and sets the ChromeFrameReadyMode value to 0 to avoid enabling ready
mode again.
Requirements that must currently be met in order to install Chrome and Chrome
Frame into the same shared location:
- Chrome Frame must not already be installed
OR
- Chrome Frame must be already installed as multi, into the shared location
**** other changes ****
The installer does no use the ap value for detecting other multi-install
products anymore. Instead we inspect the uninstallation switches to see if
--multi-install is present. Updated unit tests accordingly.
When uninstalling Chrome Frame along with Chrome, the Chrome Frame
uninstallation prompt is not shown.
Added safeguards:
If we attempt to install Chrome Frame multi over a single, install aborts and returns an error.
If we attempt to install Chrome Frame single over a multi, install aborts and returns an error.
TEST=See description above.
BUG=61609
Review URL: http://codereview.chromium.org/5989007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70083 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util')
-rw-r--r-- | chrome/installer/util/browser_distribution.cc | 4 | ||||
-rw-r--r-- | chrome/installer/util/browser_distribution.h | 4 | ||||
-rw-r--r-- | chrome/installer/util/chrome_frame_distribution.cc | 21 | ||||
-rw-r--r-- | chrome/installer/util/chrome_frame_distribution.h | 5 | ||||
-rw-r--r-- | chrome/installer/util/delete_after_reboot_helper.cc | 6 | ||||
-rw-r--r-- | chrome/installer/util/helper.cc | 77 | ||||
-rw-r--r-- | chrome/installer/util/helper.h | 16 | ||||
-rw-r--r-- | chrome/installer/util/install_util.cc | 6 | ||||
-rw-r--r-- | chrome/installer/util/master_preferences.cc | 2 | ||||
-rw-r--r-- | chrome/installer/util/master_preferences_constants.cc | 1 | ||||
-rw-r--r-- | chrome/installer/util/master_preferences_constants.h | 2 | ||||
-rw-r--r-- | chrome/installer/util/package.cc | 17 | ||||
-rw-r--r-- | chrome/installer/util/package_unittest.cc | 43 | ||||
-rw-r--r-- | chrome/installer/util/product.cc | 31 | ||||
-rw-r--r-- | chrome/installer/util/product.h | 12 | ||||
-rw-r--r-- | chrome/installer/util/util_constants.cc | 10 | ||||
-rw-r--r-- | chrome/installer/util/util_constants.h | 87 |
17 files changed, 262 insertions, 82 deletions
diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc index 3ac4b1c..d684c97 100644 --- a/chrome/installer/util/browser_distribution.cc +++ b/chrome/installer/util/browser_distribution.cc @@ -232,3 +232,7 @@ void BrowserDistribution::AppendUninstallCommandLineFlags( DCHECK(cmd_line); cmd_line->AppendSwitch(installer::switches::kChrome); } + +bool BrowserDistribution::ShouldCreateUninstallEntry() { + return true; +} diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h index 5175656..a967116 100644 --- a/chrome/installer/util/browser_distribution.h +++ b/chrome/installer/util/browser_distribution.h @@ -124,6 +124,10 @@ class BrowserDistribution { // for this distribution will require. virtual void AppendUninstallCommandLineFlags(CommandLine* cmd_line); + // Returns true if install should create an uninstallation entry in the + // Add/Remove Programs dialog for this distribution. + virtual bool ShouldCreateUninstallEntry(); + protected: explicit BrowserDistribution(const installer::MasterPreferences& prefs); diff --git a/chrome/installer/util/chrome_frame_distribution.cc b/chrome/installer/util/chrome_frame_distribution.cc index 0798366..c02e643 100644 --- a/chrome/installer/util/chrome_frame_distribution.cc +++ b/chrome/installer/util/chrome_frame_distribution.cc @@ -17,6 +17,7 @@ #include "chrome/installer/util/install_util.h" #include "chrome/installer/util/l10n_string_util.h" #include "chrome/installer/util/master_preferences.h" +#include "chrome/installer/util/master_preferences_constants.h" #include "installer_util_strings.h" // NOLINT @@ -26,9 +27,11 @@ const wchar_t kChromeFrameGuid[] = L"{8BA986DA-5100-405E-AA35-86F34A02ACBF}"; ChromeFrameDistribution::ChromeFrameDistribution( const installer::MasterPreferences& prefs) - : BrowserDistribution(prefs) { + : BrowserDistribution(prefs), ceee_(prefs.install_ceee()), + ready_mode_(false) { type_ = BrowserDistribution::CHROME_FRAME; - ceee_ = prefs.install_ceee(); + prefs.GetBool(installer::master_preferences::kChromeFrameReadyMode, + &ready_mode_); } std::wstring ChromeFrameDistribution::GetAppGuid() { @@ -137,9 +140,17 @@ std::vector<FilePath> ChromeFrameDistribution::GetComDllList() { void ChromeFrameDistribution::AppendUninstallCommandLineFlags( CommandLine* cmd_line) { DCHECK(cmd_line); - cmd_line->AppendSwitch(installer::switches::kDeleteProfile); cmd_line->AppendSwitch(installer::switches::kChromeFrame); - if (ceee_) { + + if (ceee_) cmd_line->AppendSwitch(installer::switches::kCeee); - } + + if (ready_mode_) + cmd_line->AppendSwitch(installer::switches::kChromeFrameReadyMode); +} + +bool ChromeFrameDistribution::ShouldCreateUninstallEntry() { + // If Chrome Frame is being installed in ready mode, then we will not + // add an entry to the add/remove dialog. + return !ready_mode_; } diff --git a/chrome/installer/util/chrome_frame_distribution.h b/chrome/installer/util/chrome_frame_distribution.h index 6bf7e0f..94df4bd 100644 --- a/chrome/installer/util/chrome_frame_distribution.h +++ b/chrome/installer/util/chrome_frame_distribution.h @@ -62,6 +62,8 @@ class ChromeFrameDistribution : public BrowserDistribution { virtual void AppendUninstallCommandLineFlags(CommandLine* cmd_line); + virtual bool ShouldCreateUninstallEntry(); + protected: friend class BrowserDistribution; @@ -72,6 +74,9 @@ class ChromeFrameDistribution : public BrowserDistribution { // Determines whether this Chrome Frame distribution is being used to work // with CEEE bits as well. bool ceee_; + + // True when Chrome Frame is installed in ready mode (users have to opt in). + bool ready_mode_; }; #endif // CHROME_INSTALLER_UTIL_CHROME_FRAME_DISTRIBUTION_H_ diff --git a/chrome/installer/util/delete_after_reboot_helper.cc b/chrome/installer/util/delete_after_reboot_helper.cc index 1c44676..a678c73 100644 --- a/chrome/installer/util/delete_after_reboot_helper.cc +++ b/chrome/installer/util/delete_after_reboot_helper.cc @@ -243,11 +243,13 @@ std::wstring GetShortPathName(const wchar_t* path) { std::wstring short_path; DWORD length = GetShortPathName(path, WriteInto(&short_path, MAX_PATH), MAX_PATH); - DLOG_IF(WARNING, length == 0) << __FUNCTION__ << " gle=" << GetLastError(); + DWORD last_error = ::GetLastError(); + DLOG_IF(WARNING, length == 0 && last_error != ERROR_PATH_NOT_FOUND) + << __FUNCTION__ << " gle=" << last_error; if (length == 0) { // GetShortPathName fails if the path is no longer present. Instead of // returning an empty string, just return the original string. This will - // serve for our purposes. + // serve our purposes. return path; } diff --git a/chrome/installer/util/helper.cc b/chrome/installer/util/helper.cc index d0151fd..c1b9d42 100644 --- a/chrome/installer/util/helper.cc +++ b/chrome/installer/util/helper.cc @@ -4,9 +4,16 @@ #include "chrome/installer/util/helper.h" +#include "base/command_line.h" #include "base/file_path.h" +#include "base/logging.h" #include "base/path_service.h" +#include "base/win/registry.h" #include "chrome/installer/util/browser_distribution.h" +#include "chrome/installer/util/install_util.h" +#include "chrome/installer/util/master_preferences.h" + +using base::win::RegKey; namespace { @@ -30,13 +37,73 @@ FilePath GetChromeInstallBasePath(bool system, } // namespace -FilePath installer::GetChromeInstallPath(bool system_install, - BrowserDistribution* dist) { +namespace installer { + +bool IsInstalledAsMulti(bool system_install, BrowserDistribution* dist) { + bool installed_as_multi = false; + HKEY root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; + RegKey key(root, dist->GetStateKey().c_str(), KEY_READ); + if (key.Valid()) { + std::wstring args; + key.ReadValue(installer::kUninstallArgumentsField, &args); + if (!args.empty()) { + args.insert(0, L"fake.exe "); + CommandLine cmd(CommandLine::FromString(args)); + installed_as_multi = cmd.HasSwitch(installer::switches::kMultiInstall); + } + } + return installed_as_multi; +} + +FilePath GetChromeInstallPath(bool system_install, BrowserDistribution* dist) { return GetChromeInstallBasePath(system_install, dist, installer::kInstallBinaryDir); } -FilePath installer::GetChromeUserDataPath(BrowserDistribution* dist) { - return GetChromeInstallBasePath(false, dist, - installer::kInstallUserDataDir); +FilePath GetChromeUserDataPath(BrowserDistribution* dist) { + return GetChromeInstallBasePath(false, dist, kInstallUserDataDir); } + +FilePath GetChromeFrameInstallPath(bool multi_install, bool system_install, + BrowserDistribution* dist) { + DCHECK_EQ(BrowserDistribution::CHROME_FRAME, dist->GetType()); + + scoped_ptr<Version> installed_version( + InstallUtil::GetChromeVersion(dist, system_install)); + + if (!multi_install) { + // Check if Chrome Frame is installed as multi. If it is, return an empty + // path and log an error. + if (installed_version.get() && IsInstalledAsMulti(system_install, dist)) { + LOG(ERROR) << "Cannot install Chrome Frame in single mode as a multi mode" + " installation already exists."; + return FilePath(); + } + VLOG(1) << "Chrome Frame will be installed as 'single'"; + return GetChromeInstallPath(system_install, dist); + } + + // TODO(tommi): If Chrome Frame is installed as single and the installed + // channel is older than the one we're installing, we should migrate + // CF to Chrome's install folder and change its channel. + + // Multi install. Check if Chrome Frame is already installed. + // If CF is installed as single (i.e. not multi), we will return an empty + // path (for now). Otherwise, if CF is not installed or if it is installed + // as multi, we will return Chrome's install folder. + if (installed_version.get() && !IsInstalledAsMulti(system_install, dist)) { + LOG(ERROR) << "Cannot install Chrome Frame in multi mode as a single mode" + " installation already exists."; + return FilePath(); + } + + // Return Chrome's installation folder. + VLOG(1) << "Chrome Frame will be installed as 'multi'"; + const MasterPreferences& prefs = MasterPreferences::ForCurrentProcess(); + BrowserDistribution* chrome = + BrowserDistribution::GetSpecificDistribution( + BrowserDistribution::CHROME_BROWSER, prefs); + return GetChromeInstallPath(system_install, chrome); +} + +} // namespace installer. diff --git a/chrome/installer/util/helper.h b/chrome/installer/util/helper.h index 07bc893..3845806 100644 --- a/chrome/installer/util/helper.h +++ b/chrome/installer/util/helper.h @@ -13,6 +13,9 @@ class FilePath; namespace installer { +// Checks if a distribution is currently installed as part of a multi-install. +bool IsInstalledAsMulti(bool system_install, BrowserDistribution* dist); + // This function returns the install path for Chrome depending on whether its // system wide install or user specific install. // system_install: if true, the function returns system wide location @@ -26,6 +29,19 @@ FilePath GetChromeInstallPath(bool system_install, BrowserDistribution* dist); // that it can be overriden with a command line parameter. FilePath GetChromeUserDataPath(BrowserDistribution* dist); +// This is a workaround while we unify Chrome and Chrome Frame installation +// folders. Right now, Chrome Frame can be installed into two different +// folders: 1) A special "Chrome Frame" folder next to Chrome's folder +// 2) The same folder as Chrome is installed into. +// Right now this function will only return Chrome's installation folder +// if Chrome Frame is not already installed or if Chrome Frame is installed +// in multi_install mode. +// If multi_install is false or if CF is installed in single mode, then the +// returned path will be the "Chrome Frame" subfolder of either the user or +// system default installation folders. +FilePath GetChromeFrameInstallPath(bool multi_install, bool system_install, + BrowserDistribution* dist); + } // namespace installer #endif // CHROME_INSTALLER_UTIL_HELPER_H_ diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc index db5c17d8..9ba1cec 100644 --- a/chrome/installer/util/install_util.cc +++ b/chrome/installer/util/install_util.cc @@ -87,12 +87,14 @@ Version* InstallUtil::GetChromeVersion(BrowserDistribution* dist, HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; if (!key.Open(reg_root, dist->GetVersionKey().c_str(), KEY_READ) || !key.ReadValue(google_update::kRegVersionField, &version_str)) { - VLOG(1) << "No existing Chrome install found."; + VLOG(1) << "No existing " << dist->GetApplicationName() + << " install found."; key.Close(); return NULL; } key.Close(); - VLOG(1) << "Existing Chrome version found " << version_str; + VLOG(1) << "Existing " << dist->GetApplicationName() + << " version found " << version_str; return Version::GetVersionFromString(version_str); } diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc index 2ca1a58..898e370 100644 --- a/chrome/installer/util/master_preferences.cc +++ b/chrome/installer/util/master_preferences.cc @@ -140,6 +140,8 @@ void MasterPreferences::InitializeFromCommandLine(const CommandLine& cmd_line) { installer::master_preferences::kChrome }, { installer::switches::kChromeFrame, installer::master_preferences::kChromeFrame }, + { installer::switches::kChromeFrameReadyMode, + installer::master_preferences::kChromeFrameReadyMode }, { installer::switches::kCreateAllShortcuts, installer::master_preferences::kCreateAllShortcuts }, { installer::switches::kDisableLogging, diff --git a/chrome/installer/util/master_preferences_constants.cc b/chrome/installer/util/master_preferences_constants.cc index 0b71d9e..cea5b7f 100644 --- a/chrome/installer/util/master_preferences_constants.cc +++ b/chrome/installer/util/master_preferences_constants.cc @@ -11,6 +11,7 @@ namespace master_preferences { const char kCeee[] = "ceee"; const char kChrome[] = "chrome"; const char kChromeFrame[] = "chrome_frame"; + const char kChromeFrameReadyMode[] = "ready_mode"; const char kChromeShortcutIconIndex[] = "chrome_shortcut_icon_index"; const char kCreateAllShortcuts[] = "create_all_shortcuts"; const char kDisableLogging[] = "disable_logging"; diff --git a/chrome/installer/util/master_preferences_constants.h b/chrome/installer/util/master_preferences_constants.h index 1220a38..cd3d034 100644 --- a/chrome/installer/util/master_preferences_constants.h +++ b/chrome/installer/util/master_preferences_constants.h @@ -27,6 +27,8 @@ extern const char kCeee[]; extern const char kChrome[]; // Boolean. This is to be a Chrome Frame install. extern const char kChromeFrame[]; +// Boolean. Chrome Frame is to be installed in ready-mode. +extern const char kChromeFrameReadyMode[]; // Integer. Icon index from chrome.exe to use for shortcuts. extern const char kChromeShortcutIconIndex[]; // Boolean. Create Desktop and QuickLaunch shortcuts. Cmd line override present. diff --git a/chrome/installer/util/package.cc b/chrome/installer/util/package.cc index 5f5ff57..72c819c 100644 --- a/chrome/installer/util/package.cc +++ b/chrome/installer/util/package.cc @@ -11,6 +11,7 @@ #include "chrome/installer/util/channel_info.h" #include "chrome/installer/util/delete_tree_work_item.h" #include "chrome/installer/util/google_update_constants.h" +#include "chrome/installer/util/helper.h" #include "chrome/installer/util/install_util.h" #include "chrome/installer/util/l10n_string_util.h" #include "chrome/installer/util/master_preferences.h" @@ -200,19 +201,9 @@ size_t Package::GetMultiInstallDependencyCount() const { if (!version_key.Valid()) { VLOG(1) << "Product not installed: " << dist->GetApplicationName(); } else { - RegKey key(root_key, dist->GetStateKey().c_str(), KEY_READ); - ChannelInfo channel_info; - if (channel_info.Initialize(key)) { - if (channel_info.IsMultiInstall()) { - VLOG(1) << "Product dependency: " << dist->GetApplicationName(); - ret++; - } else { - VLOG(1) << "Product is installed, but not multi: " - << dist->GetApplicationName(); - } - } else { - LOG(INFO) << "Product missing 'ap' value: " - << dist->GetApplicationName(); + if (installer::IsInstalledAsMulti(system_level_, dist)) { + VLOG(1) << "Product dependency: " << dist->GetApplicationName(); + ++ret; } } } diff --git a/chrome/installer/util/package_unittest.cc b/chrome/installer/util/package_unittest.cc index 2bfd44aa..c456482 100644 --- a/chrome/installer/util/package_unittest.cc +++ b/chrome/installer/util/package_unittest.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/command_line.h" #include "base/logging.h" #include "base/scoped_handle.h" #include "base/utf_string_conversions.h" #include "chrome/installer/util/browser_distribution.h" -#include "chrome/installer/util/channel_info.h" #include "chrome/installer/util/google_update_constants.h" #include "chrome/installer/util/master_preferences.h" #include "chrome/installer/util/package.h" @@ -17,7 +17,6 @@ using base::win::RegKey; using base::win::ScopedHandle; -using installer::ChannelInfo; using installer::ChromePackageProperties; using installer::ChromiumPackageProperties; using installer::Package; @@ -134,6 +133,21 @@ TEST_F(PackageTest, WithProduct) { } } +namespace { +bool SetUninstallArguments(HKEY root, BrowserDistribution* dist, + const CommandLine& args) { + RegKey key(root, dist->GetStateKey().c_str(), KEY_ALL_ACCESS); + return key.WriteValue(installer::kUninstallArgumentsField, + args.command_line_string().c_str()); +} + +bool SetInstalledVersion(HKEY root, BrowserDistribution* dist, + const std::wstring& version) { + RegKey key(root, dist->GetVersionKey().c_str(), KEY_ALL_ACCESS); + return key.WriteValue(google_update::kRegVersionField, version.c_str()); +} +} // end namespace + TEST_F(PackageTest, Dependency) { const bool multi_install = false; const bool system_level = true; @@ -152,26 +166,25 @@ TEST_F(PackageTest, Dependency) { BrowserDistribution* cf = BrowserDistribution::GetSpecificDistribution( BrowserDistribution::CHROME_FRAME, prefs); + CommandLine multi_uninstall_cmd(CommandLine::NO_PROGRAM); + multi_uninstall_cmd.AppendSwitch(installer::switches::kUninstall); + multi_uninstall_cmd.AppendSwitch(installer::switches::kMultiInstall); + + CommandLine single_uninstall_cmd(CommandLine::NO_PROGRAM); + single_uninstall_cmd.AppendSwitch(installer::switches::kUninstall); + // "install" Chrome. - RegKey chrome_version_key(root, chrome->GetVersionKey().c_str(), - KEY_ALL_ACCESS); - RegKey chrome_key(root, chrome->GetStateKey().c_str(), KEY_ALL_ACCESS); - ChannelInfo channel; - channel.set_value(L""); - channel.SetMultiInstall(true); - channel.Write(&chrome_key); + SetUninstallArguments(root, chrome, multi_uninstall_cmd); + SetInstalledVersion(root, chrome, L"1.2.3.4"); EXPECT_EQ(1U, package->GetMultiInstallDependencyCount()); // "install" Chrome Frame without multi-install. - RegKey cf_version_key(root, cf->GetVersionKey().c_str(), KEY_ALL_ACCESS); - RegKey cf_key(root, cf->GetStateKey().c_str(), KEY_ALL_ACCESS); - channel.SetMultiInstall(false); - channel.Write(&cf_key); + SetUninstallArguments(root, cf, single_uninstall_cmd); + SetInstalledVersion(root, cf, L"1.2.3.4"); EXPECT_EQ(1U, package->GetMultiInstallDependencyCount()); // "install" Chrome Frame with multi-install. - channel.SetMultiInstall(true); - channel.Write(&cf_key); + SetUninstallArguments(root, cf, multi_uninstall_cmd); EXPECT_EQ(2U, package->GetMultiInstallDependencyCount()); } diff --git a/chrome/installer/util/product.cc b/chrome/installer/util/product.cc index 8d4617a..43f371a 100644 --- a/chrome/installer/util/product.cc +++ b/chrome/installer/util/product.cc @@ -117,8 +117,7 @@ bool Product::IsMsi() const { if ((cache_state_ & MSI_STATE) == 0) { msi_ = false; // Covers failure cases below. - const MasterPreferences& prefs = - installer::MasterPreferences::ForCurrentProcess(); + const MasterPreferences& prefs = MasterPreferences::ForCurrentProcess(); bool is_msi = false; prefs.GetBool(installer::master_preferences::kMsi, &is_msi); @@ -177,6 +176,15 @@ bool Product::IsInstalled() const { return GetInstalledVersion() != NULL; } +bool Product::ShouldCreateUninstallEntry() const { + if (IsMsi()) { + // MSI installations will manage their own uninstall shortcuts. + return false; + } + + return distribution_->ShouldCreateUninstallEntry(); +} + /////////////////////////////////////////////////////////////////////////////// ProductPackageMapping::ProductPackageMapping(bool multi_install, bool system_level) @@ -202,7 +210,22 @@ bool ProductPackageMapping::AddDistribution(BrowserDistribution* distribution) { // Each product type can be added exactly once. DCHECK(FindProduct(products_, distribution->GetType()) == NULL); - FilePath install_package(GetChromeInstallPath(system_level_, distribution)); + FilePath install_package; + if (distribution->GetType() == BrowserDistribution::CHROME_BROWSER) { + install_package = GetChromeInstallPath(system_level_, distribution); + } else { + DCHECK_EQ(BrowserDistribution::CHROME_FRAME, distribution->GetType()); + install_package = GetChromeFrameInstallPath(multi_install_, system_level_, + distribution); + } + + if (install_package.empty()) { + LOG(ERROR) << "Got an empty installation path for " + << distribution->GetApplicationName() + << ". It's likely that there's a conflicting " + "installation present"; + return false; + } scoped_refptr<Package> target_package; for (size_t i = 0; i < packages_.size(); ++i) { @@ -234,7 +257,7 @@ bool ProductPackageMapping::AddDistribution(BrowserDistribution* distribution) { bool ProductPackageMapping::AddDistribution( BrowserDistribution::Type type, - const installer::MasterPreferences& prefs) { + const MasterPreferences& prefs) { BrowserDistribution* distribution = BrowserDistribution::GetSpecificDistribution(type, prefs); if (!distribution) { diff --git a/chrome/installer/util/product.h b/chrome/installer/util/product.h index 4204071..36362af 100644 --- a/chrome/installer/util/product.h +++ b/chrome/installer/util/product.h @@ -60,6 +60,14 @@ class Product : public base::RefCounted<Product> { return package().system_level(); } + bool is_chrome() const { + return distribution_->GetType() == BrowserDistribution::CHROME_BROWSER; + } + + bool is_chrome_frame() const { + return distribution_->GetType() == BrowserDistribution::CHROME_FRAME; + } + // Returns the path to the directory that holds the user data. This is always // inside "Users\<user>\Local Settings". Note that this is the default user // data directory and does not take into account that it can be overriden with @@ -95,6 +103,10 @@ class Product : public base::RefCounted<Product> { // found. The returned Version object is owned by |this| Product instance. const Version* GetInstalledVersion() const; + // Returns true if setup should create an entry in the Add/Remove list + // of installed applications. + bool ShouldCreateUninstallEntry() const; + // Returns true if the product is already installed. bool IsInstalled() const; diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc index f3a062f..cda927d 100644 --- a/chrome/installer/util/util_constants.cc +++ b/chrome/installer/util/util_constants.cc @@ -15,9 +15,16 @@ const char kCeee[] = "ceee"; // Currently this is only required when used in combination with kMultiInstall. const char kChrome[] = "chrome"; -// Run the installer in Chrome Frame mode. +// Install Chrome Frame. const char kChromeFrame[] = "chrome-frame"; +// When installing Chrome Frame, install it in ready mode. +// If --chrome-frame is not on the command line, this switch has no effect. +const char kChromeFrameReadyMode[] = "ready-mode"; + +// GCF ready mode opt-in. This enables a full installation of GCF. +const char kChromeFrameReadyModeOptIn[] = "ready-mode-opt-in"; + // Run the installer for Chrome SxS. const char kChromeSxS[] = "chrome-sxs"; @@ -139,6 +146,7 @@ const wchar_t kChromeExe[] = L"chrome.exe"; const wchar_t kChromeFrameDll[] = L"npchrome_frame.dll"; const wchar_t kChromeFrameHelperExe[] = L"chrome_frame_helper.exe"; const wchar_t kChromeFrameHelperWndClass[] = L"ChromeFrameHelperWindowClass"; +const wchar_t kChromeFrameReadyModeField[] = L"ChromeFrameReadyMode"; const wchar_t kChromeNaCl64Dll[] = L"nacl64.dll"; const wchar_t kChromeNewExe[] = L"new_chrome.exe"; const wchar_t kChromeOldExe[] = L"old_chrome.exe"; diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h index 933cab5..0028c78 100644 --- a/chrome/installer/util/util_constants.h +++ b/chrome/installer/util/util_constants.h @@ -13,47 +13,63 @@ namespace installer { // Return status of installer enum InstallStatus { - FIRST_INSTALL_SUCCESS, // Successfully installed Chrome for the first time - INSTALL_REPAIRED, // Same version reinstalled for repair - NEW_VERSION_UPDATED, // Chrome successfully updated to new version - EXISTING_VERSION_LAUNCHED, // No work done, just launched existing chrome - HIGHER_VERSION_EXISTS, // Higher version of Chrome already exists - USER_LEVEL_INSTALL_EXISTS, // User level install already exists - SYSTEM_LEVEL_INSTALL_EXISTS, // Machine level install already exists - INSTALL_FAILED, // Install/update failed - SETUP_PATCH_FAILED, // Failed to patch setup.exe - OS_NOT_SUPPORTED, // Current OS not supported - OS_ERROR, // OS API call failed - TEMP_DIR_FAILED, // Unable to get Temp directory - UNCOMPRESSION_FAILED, // Failed to uncompress Chrome archive - INVALID_ARCHIVE, // Something wrong with the installer archive - INSUFFICIENT_RIGHTS, // User trying system level install is not Admin - CHROME_NOT_INSTALLED, // Chrome not installed (returned in case of uninstall) - CHROME_RUNNING, // Chrome currently running (when trying to uninstall) - UNINSTALL_CONFIRMED, // User has confirmed Chrome uninstall - UNINSTALL_DELETE_PROFILE, // User confirmed uninstall and profile deletion - UNINSTALL_SUCCESSFUL, // Chrome successfully uninstalled - UNINSTALL_FAILED, // Chrome uninstallation failed - UNINSTALL_CANCELLED, // User cancelled Chrome uninstallation - UNKNOWN_STATUS, // Unknown status (this should never happen) - RENAME_SUCCESSFUL, // Rename of new_chrome.exe to chrome.exe worked - RENAME_FAILED, // Rename of new_chrome.exe failed - EULA_REJECTED, // EULA dialog was not accepted by user. - EULA_ACCEPTED, // EULA dialog was accepted by user. - EULA_ACCEPTED_OPT_IN, // EULA accepted wtih the crash optin selected. - INSTALL_DIR_IN_USE, // Installation directory is in use by another process - UNINSTALL_REQUIRES_REBOOT, // Uninstallation required a reboot. - IN_USE_UPDATED, // Chrome successfully updated but old version running - SAME_VERSION_REPAIR_FAILED, // Chrome repair failed as Chrome was running - REENTRY_SYS_UPDATE, // Setup has been re-launched as the interactive user - SXS_OPTION_NOT_SUPPORTED // The chrome-sxs option provided does not work - // with other command line options. + FIRST_INSTALL_SUCCESS, // 0. Successfully installed Chrome for the first time + INSTALL_REPAIRED, // 1. Same version reinstalled for repair + NEW_VERSION_UPDATED, // 2. Chrome successfully updated to new version + EXISTING_VERSION_LAUNCHED, // 3. No work done, just launched existing chrome + HIGHER_VERSION_EXISTS, // 4. Higher version of Chrome already exists + USER_LEVEL_INSTALL_EXISTS, // 5. User level install already exists + SYSTEM_LEVEL_INSTALL_EXISTS, // 6. Machine level install already exists + INSTALL_FAILED, // 7. Install/update failed + SETUP_PATCH_FAILED, // 8. Failed to patch setup.exe + OS_NOT_SUPPORTED, // 9. Current OS not supported + OS_ERROR, // 10. OS API call failed + TEMP_DIR_FAILED, // 11. Unable to get Temp directory + UNCOMPRESSION_FAILED, // 12. Failed to uncompress Chrome archive + INVALID_ARCHIVE, // 13. Something wrong with the installer archive + INSUFFICIENT_RIGHTS, // 14. User trying system level install is not Admin + CHROME_NOT_INSTALLED, // 15. Chrome not installed (returned in case of + // uninstall) + CHROME_RUNNING, // 16. Chrome currently running (when trying to + // uninstall) + UNINSTALL_CONFIRMED, // 17. User has confirmed Chrome uninstall + UNINSTALL_DELETE_PROFILE, // 18. User confirmed uninstall and profile deletion + UNINSTALL_SUCCESSFUL, // 19. Chrome successfully uninstalled + UNINSTALL_FAILED, // 20. Chrome uninstallation failed + UNINSTALL_CANCELLED, // 21. User cancelled Chrome uninstallation + UNKNOWN_STATUS, // 22. Unknown status (this should never happen) + RENAME_SUCCESSFUL, // 23. Rename of new_chrome.exe to chrome.exe worked + RENAME_FAILED, // 24. Rename of new_chrome.exe failed + EULA_REJECTED, // 25. EULA dialog was not accepted by user. + EULA_ACCEPTED, // 26. EULA dialog was accepted by user. + EULA_ACCEPTED_OPT_IN, // 27. EULA accepted wtih the crash optin selected. + INSTALL_DIR_IN_USE, // 28. Installation directory is in use by another + // process + UNINSTALL_REQUIRES_REBOOT, // 29. Uninstallation required a reboot. + IN_USE_UPDATED, // 30. Chrome successfully updated but old version + // running + SAME_VERSION_REPAIR_FAILED, // 31. Chrome repair failed as Chrome was running + REENTRY_SYS_UPDATE, // 32. Setup has been re-launched as the interactive + // user + SXS_OPTION_NOT_SUPPORTED, // 33. The chrome-sxs option provided does not work + // with other command line options. + NON_MULTI_INSTALLATION_EXISTS, // 34. We tried to do a multi-install but + // failed because there's an existing + // installation of the same product on the + // system, but in 'single' mode. + MULTI_INSTALLATION_EXISTS, // 35. We tried to do a 'single' install but + // failed because there's an existing + // multi-install installation of the same product + // on the system. + READY_MODE_OPT_IN_FAILED, // 36. Failed to opt-into Chrome Frame. }; namespace switches { extern const char kCeee[]; extern const char kChrome[]; extern const char kChromeFrame[]; +extern const char kChromeFrameReadyMode[]; +extern const char kChromeFrameReadyModeOptIn[]; extern const char kChromeSxS[]; extern const char kCreateAllShortcuts[]; extern const char kDeleteProfile[]; @@ -95,6 +111,7 @@ extern const wchar_t kChromeExe[]; extern const wchar_t kChromeFrameDll[]; extern const wchar_t kChromeFrameHelperExe[]; extern const wchar_t kChromeFrameHelperWndClass[]; +extern const wchar_t kChromeFrameReadyModeField[]; extern const wchar_t kChromeNaCl64Dll[]; extern const wchar_t kChromeOldExe[]; extern const wchar_t kChromeNewExe[]; |