summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorhuanr@chromium.org <huanr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-17 03:24:45 +0000
committerhuanr@chromium.org <huanr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-17 03:24:45 +0000
commit1bcb9751195e00e3caa8d2ef1f4593da391154fd (patch)
tree0005020b7566ad51ede90cbdec87af143a116efe /chrome
parent4b92b19e3788372083133825f53c9b35972a8d36 (diff)
downloadchromium_src-1bcb9751195e00e3caa8d2ef1f4593da391154fd.zip
chromium_src-1bcb9751195e00e3caa8d2ef1f4593da391154fd.tar.gz
chromium_src-1bcb9751195e00e3caa8d2ef1f4593da391154fd.tar.bz2
Add google chrome sxs distribution for installer and omaha launcher.
BUG=35574 TEST=setup.exe can install/uninstall Google Chrome as before. setup.exe --chrome-sxs can install/uninstall Chrome to alternative path. Both versions of Chrome can co-exist. Review URL: http://codereview.chromium.org/596069 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39186 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/installer/installer_util.gypi2
-rw-r--r--chrome/installer/setup/install.cc5
-rw-r--r--chrome/installer/util/browser_distribution.cc7
-rw-r--r--chrome/installer/util/google_chrome_distribution.cc23
-rw-r--r--chrome/installer/util/google_chrome_distribution.h13
-rw-r--r--chrome/installer/util/google_chrome_sxs_distribution.cc28
-rw-r--r--chrome/installer/util/google_chrome_sxs_distribution.h31
-rw-r--r--chrome/installer/util/install_util.cc18
-rw-r--r--chrome/installer/util/install_util.h6
-rw-r--r--chrome/installer/util/util_constants.cc6
-rw-r--r--chrome/installer/util/util_constants.h4
11 files changed, 132 insertions, 11 deletions
diff --git a/chrome/installer/installer_util.gypi b/chrome/installer/installer_util.gypi
index 497248e..f613386 100644
--- a/chrome/installer/installer_util.gypi
+++ b/chrome/installer/installer_util.gypi
@@ -27,6 +27,8 @@
'util/delete_tree_work_item.h',
'util/google_chrome_distribution.cc',
'util/google_chrome_distribution.h',
+ 'util/google_chrome_sxs_distribution.cc',
+ 'util/google_chrome_sxs_distribution.h',
'util/google_update_constants.cc',
'util/google_update_constants.h',
'util/google_update_settings.cc',
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index 145b7ce..d3533d4 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -94,6 +94,11 @@ void AppendUninstallCommandLineFlags(std::wstring* uninstall_cmd_line,
uninstall_cmd_line->append(installer_util::switches::kChromeFrame);
}
+ if (InstallUtil::IsChromeSxSProcess()) {
+ uninstall_cmd_line->append(L" --");
+ uninstall_cmd_line->append(installer_util::switches::kChromeSxS);
+ }
+
// Propagate the verbose logging switch to uninstalls too.
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(installer_util::switches::kVerboseLogging)) {
diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc
index d3a2ac3..aced1fb 100644
--- a/chrome/installer/util/browser_distribution.cc
+++ b/chrome/installer/util/browser_distribution.cc
@@ -15,6 +15,7 @@
#include "chrome/common/env_vars.h"
#include "chrome/installer/util/chrome_frame_distribution.h"
#include "chrome/installer/util/google_chrome_distribution.h"
+#include "chrome/installer/util/google_chrome_sxs_distribution.h"
#include "chrome/installer/util/install_util.h"
#include "chrome/installer/util/l10n_string_util.h"
@@ -33,7 +34,11 @@ BrowserDistribution* BrowserDistribution::GetDistribution(bool chrome_frame) {
dist = new ChromeFrameDistribution();
} else {
#if defined(GOOGLE_CHROME_BUILD)
- dist = new GoogleChromeDistribution();
+ if (InstallUtil::IsChromeSxSProcess()) {
+ dist = new GoogleChromeSxSDistribution();
+ } else {
+ dist = new GoogleChromeDistribution();
+ }
#else
dist = new BrowserDistribution();
#endif
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc
index 5922382..2376f6a 100644
--- a/chrome/installer/util/google_chrome_distribution.cc
+++ b/chrome/installer/util/google_chrome_distribution.cc
@@ -157,6 +157,10 @@ bool RelaunchSetupAsConsoleUser(const std::wstring& flag) {
} // namespace
+GoogleChromeDistribution::GoogleChromeDistribution()
+ : product_guid_(kChromeGuid) {
+}
+
// The functions below are not used by the 64-bit Windows binary -
// see the comment in google_chrome_distribution_dummy.cc
#ifndef _WIN64
@@ -278,7 +282,7 @@ void GoogleChromeDistribution::DoPostUninstallOperations(
}
std::wstring GoogleChromeDistribution::GetAppGuid() {
- return kChromeGuid;
+ return product_guid();
}
std::wstring GoogleChromeDistribution::GetApplicationName() {
@@ -294,7 +298,10 @@ std::wstring GoogleChromeDistribution::GetAlternateApplicationName() {
}
std::wstring GoogleChromeDistribution::GetInstallSubDir() {
- return L"Google\\Chrome";
+ std::wstring sub_dir(installer_util::kGoogleChromeInstallSubDir1);
+ sub_dir.append(L"\\");
+ sub_dir.append(installer_util::kGoogleChromeInstallSubDir2);
+ return sub_dir;
}
std::wstring GoogleChromeDistribution::GetNewGoogleUpdateApKey(
@@ -342,14 +349,14 @@ std::string GoogleChromeDistribution::GetSafeBrowsingName() {
std::wstring GoogleChromeDistribution::GetStateKey() {
std::wstring key(google_update::kRegPathClientState);
key.append(L"\\");
- key.append(kChromeGuid);
+ key.append(product_guid());
return key;
}
std::wstring GoogleChromeDistribution::GetStateMediumKey() {
std::wstring key(google_update::kRegPathClientStateMedium);
key.append(L"\\");
- key.append(kChromeGuid);
+ key.append(product_guid());
return key;
}
@@ -361,7 +368,7 @@ std::wstring GoogleChromeDistribution::GetDistributionData(RegKey* key) {
DCHECK(NULL != key);
std::wstring sub_key(google_update::kRegPathClientState);
sub_key.append(L"\\");
- sub_key.append(kChromeGuid);
+ sub_key.append(product_guid());
RegKey client_state_key(key->Handle(), sub_key.c_str());
std::wstring result;
@@ -408,7 +415,7 @@ std::wstring GoogleChromeDistribution::GetUninstallRegPath() {
std::wstring GoogleChromeDistribution::GetVersionKey() {
std::wstring key(google_update::kRegPathClients);
key.append(L"\\");
- key.append(kChromeGuid);
+ key.append(product_guid());
return key;
}
@@ -428,7 +435,7 @@ void GoogleChromeDistribution::UpdateDiffInstallStatus(bool system_install,
std::wstring ap_key_value;
std::wstring reg_key(google_update::kRegPathClientState);
reg_key.append(L"\\");
- reg_key.append(kChromeGuid);
+ reg_key.append(product_guid());
if (!key.Open(reg_root, reg_key.c_str(), KEY_ALL_ACCESS) ||
!key.ReadValue(google_update::kRegApField, &ap_key_value)) {
LOG(INFO) << "Application key not found.";
@@ -439,7 +446,7 @@ void GoogleChromeDistribution::UpdateDiffInstallStatus(bool system_install,
} else if (!key.Valid()) {
reg_key.assign(google_update::kRegPathClientState);
if (!key.Open(reg_root, reg_key.c_str(), KEY_ALL_ACCESS) ||
- !key.CreateKey(kChromeGuid, KEY_ALL_ACCESS)) {
+ !key.CreateKey(product_guid().c_str(), KEY_ALL_ACCESS)) {
LOG(ERROR) << "Failed to create application key.";
key.Close();
return;
diff --git a/chrome/installer/util/google_chrome_distribution.h b/chrome/installer/util/google_chrome_distribution.h
index c31ca07..0af7e3f 100644
--- a/chrome/installer/util/google_chrome_distribution.h
+++ b/chrome/installer/util/google_chrome_distribution.h
@@ -88,8 +88,17 @@ class GoogleChromeDistribution : public BrowserDistribution {
// outcome in the registry.
virtual void InactiveUserToastExperiment(int flavor, bool system_install);
+ std::wstring product_guid() { return product_guid_; }
+
+ protected:
+ void set_product_guid(std::wstring guid) { product_guid_ = guid; }
+
+ // Disallow construction from others.
+ GoogleChromeDistribution();
+
private:
friend class BrowserDistribution;
+
FRIEND_TEST(GoogleChromeDistributionTest, TestExtractUninstallMetrics);
// Extracts uninstall metrics from the JSON file located at file_path.
@@ -111,8 +120,8 @@ class GoogleChromeDistribution : public BrowserDistribution {
virtual bool BuildUninstallMetricsString(
DictionaryValue* uninstall_metrics_dict, std::wstring* metrics);
- // Disallow construction from non-friends.
- GoogleChromeDistribution() {}
+ // The product ID for Google Update.
+ std::wstring product_guid_;
};
#endif // CHROME_INSTALLER_UTIL_GOOGLE_CHROME_DISTRIBUTION_H_
diff --git a/chrome/installer/util/google_chrome_sxs_distribution.cc b/chrome/installer/util/google_chrome_sxs_distribution.cc
new file mode 100644
index 0000000..446fa24
--- /dev/null
+++ b/chrome/installer/util/google_chrome_sxs_distribution.cc
@@ -0,0 +1,28 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// This file defines implementation of GoogleChromeSxSDistribution.
+
+#include "chrome/installer/util/google_chrome_sxs_distribution.h"
+
+
+namespace {
+
+const wchar_t kChromeSxSGuid[] = L"{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}";
+
+} // namespace
+
+GoogleChromeSxSDistribution::GoogleChromeSxSDistribution() {
+ GoogleChromeDistribution::set_product_guid(kChromeSxSGuid);
+}
+
+std::wstring GoogleChromeSxSDistribution::GetInstallSubDir() {
+ return GoogleChromeDistribution::GetInstallSubDir().append(
+ installer_util::kSxSSuffix);
+}
+
+std::wstring GoogleChromeSxSDistribution::GetUninstallRegPath() {
+ return GoogleChromeDistribution::GetUninstallRegPath().append(
+ installer_util::kSxSSuffix);
+}
diff --git a/chrome/installer/util/google_chrome_sxs_distribution.h b/chrome/installer/util/google_chrome_sxs_distribution.h
new file mode 100644
index 0000000..4ab3a9d
--- /dev/null
+++ b/chrome/installer/util/google_chrome_sxs_distribution.h
@@ -0,0 +1,31 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_INSTALLER_UTIL_GOOGLE_CHROME_SXS_DISTRIBUTION_H_
+#define CHROME_INSTALLER_UTIL_GOOGLE_CHROME_SXS_DISTRIBUTION_H_
+
+#include "chrome/installer/util/browser_distribution.h"
+#include "chrome/installer/util/google_chrome_distribution.h"
+#include "chrome/installer/util/util_constants.h"
+
+
+// GoogleChromeSxSDistribution encapsulates properties of Google Chrome Sxs
+// distribution which can co-exist with other Google Chrome distributions.
+// Google Chrome Sxs distribution is installed to a different path, runs
+// alongside with normally installed Google Chrome, and is updated separately.
+// It is mainly used for developer preview and testing, and is disabled for
+// system level install and setting as default browser.
+class GoogleChromeSxSDistribution : public GoogleChromeDistribution {
+ public:
+ virtual std::wstring GetInstallSubDir();
+ virtual std::wstring GetUninstallRegPath();
+
+ private:
+ friend class BrowserDistribution;
+
+ // Disallow construction from non-friends.
+ GoogleChromeSxSDistribution();
+};
+
+#endif // CHROME_INSTALLER_UTIL_GOOGLE_CHROME_SXS_DISTRIBUTION_H_
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index a6114e5..e3e7d45 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -145,6 +145,24 @@ bool InstallUtil::IsChromeFrameProcess() {
module_name == installer_util::kChromeFrameDll;
}
+bool InstallUtil::IsChromeSxSProcess() {
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ CHECK(command_line);
+
+ if (command_line->HasSwitch(installer_util::switches::kChromeSxS))
+ return true;
+
+ // Also return true if we are running from Chrome SxS installed path.
+ FilePath exe_dir;
+ PathService::Get(base::DIR_EXE, &exe_dir);
+ std::wstring chrome_sxs_dir(installer_util::kGoogleChromeInstallSubDir2);
+ chrome_sxs_dir.append(installer_util::kSxSSuffix);
+ return FilePath::CompareEqualIgnoreCase(exe_dir.BaseName().value(),
+ installer_util::kInstallBinaryDir) &&
+ FilePath::CompareEqualIgnoreCase(exe_dir.DirName().BaseName().value(),
+ chrome_sxs_dir);
+}
+
bool InstallUtil::BuildDLLRegistrationList(const std::wstring& install_path,
const wchar_t** const dll_names,
int dll_names_count,
diff --git a/chrome/installer/util/install_util.h b/chrome/installer/util/install_util.h
index 8f9e0d8..f1f07c4 100644
--- a/chrome/installer/util/install_util.h
+++ b/chrome/installer/util/install_util.h
@@ -60,6 +60,12 @@ class InstallUtil {
// inside of the Chrome Frame dll.
static bool IsChromeFrameProcess();
+ // Returns true if this is running setup process for Chrome SxS (as
+ // indicated by the presence of --chrome-sxs on the command line) or if this
+ // is running Chrome process from the Chrome SxS installation (as indicated
+ // by either --chrome-sxs or the executable path).
+ static bool IsChromeSxSProcess();
+
// Adds all DLLs in install_path whose names are given by dll_names to a
// work item list containing registration or unregistration actions.
//
diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc
index f77eed1..87aaea3 100644
--- a/chrome/installer/util/util_constants.cc
+++ b/chrome/installer/util/util_constants.cc
@@ -11,6 +11,9 @@ namespace switches {
// Run the installer in Chrome Frame mode.
const wchar_t kChromeFrame[] = L"chrome-frame";
+// Run the installer for Chrome SxS.
+const wchar_t kChromeSxS[] = L"chrome-sxs";
+
// Create Desktop and QuickLaunch shortcuts
const wchar_t kCreateAllShortcuts[] = L"create-all-shortcuts";
@@ -110,6 +113,8 @@ const wchar_t kSystemLevelToast[] = L"system-level-toast";
} // namespace switches
+const wchar_t kGoogleChromeInstallSubDir1[] = L"Google";
+const wchar_t kGoogleChromeInstallSubDir2[] = L"Chrome";
const wchar_t kInstallBinaryDir[] = L"Application";
const wchar_t kInstallUserDataDir[] = L"User Data";
const wchar_t kChromeExe[] = L"chrome.exe";
@@ -120,6 +125,7 @@ const wchar_t kChromeNaCl64Dll[] = L"chrome_nacl_win64.dll";
const wchar_t kChromeFrameDll[] = L"npchrome_frame.dll";
const wchar_t kSetupExe[] = L"setup.exe";
const wchar_t kInstallerDir[] = L"Installer";
+const wchar_t kSxSSuffix[] = L" SxS";
const wchar_t kUninstallStringField[] = L"UninstallString";
const wchar_t kUninstallDisplayNameField[] = L"DisplayName";
diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h
index 3d779bc..a197303 100644
--- a/chrome/installer/util/util_constants.h
+++ b/chrome/installer/util/util_constants.h
@@ -48,6 +48,7 @@ enum InstallStatus {
namespace switches {
extern const wchar_t kChromeFrame[];
+extern const wchar_t kChromeSxS[];
extern const wchar_t kCreateAllShortcuts[];
extern const wchar_t kDeleteProfile[];
extern const wchar_t kDisableLogging[];
@@ -77,6 +78,8 @@ extern const wchar_t kInactiveUserToast[];
extern const wchar_t kSystemLevelToast[];
} // namespace switches
+extern const wchar_t kGoogleChromeInstallSubDir1[];
+extern const wchar_t kGoogleChromeInstallSubDir2[];
extern const wchar_t kInstallBinaryDir[];
extern const wchar_t kInstallUserDataDir[];
extern const wchar_t kChromeExe[];
@@ -87,6 +90,7 @@ extern const wchar_t kChromeNaCl64Dll[];
extern const wchar_t kChromeFrameDll[];
extern const wchar_t kSetupExe[];
extern const wchar_t kInstallerDir[];
+extern const wchar_t kSxSSuffix[];
extern const wchar_t kUninstallStringField[];
extern const wchar_t kUninstallDisplayNameField[];