summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authorkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-05 00:21:16 +0000
committerkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-05 00:21:16 +0000
commit974899a3559bd4c1a3b5d00a0f709c28cb03da65 (patch)
treedf3ce267814645cff4bb4d2763e7fc8c1797e85c /chrome/installer
parent0ebb5701c641d30980d82bf638b19ff1b9b5f61a (diff)
downloadchromium_src-974899a3559bd4c1a3b5d00a0f709c28cb03da65.zip
chromium_src-974899a3559bd4c1a3b5d00a0f709c28cb03da65.tar.gz
chromium_src-974899a3559bd4c1a3b5d00a0f709c28cb03da65.tar.bz2
Temporary code to upgrade Chrome open command for existing users.
From 'chrome %1' to 'chrome -- %1'. For more information see r4016 and crbug.com/3808 Review URL: http://codereview.chromium.org/8988 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4713 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/setup/main.cc41
1 files changed, 39 insertions, 2 deletions
diff --git a/chrome/installer/setup/main.cc b/chrome/installer/setup/main.cc
index d0a5298..fec04a7 100644
--- a/chrome/installer/setup/main.cc
+++ b/chrome/installer/setup/main.cc
@@ -160,6 +160,37 @@ installer::Version* GetVersionFromDir(const std::wstring& chrome_path) {
return version;
}
+// This method is temporary and only called by UpdateChromeOpenCmd() below.
+void ReplaceRegistryValue(const std::wstring& reg_key,
+ const std::wstring& old_val,
+ const std::wstring& new_val) {
+ RegKey key;
+ std::wstring value;
+ if (key.Open(HKEY_CLASSES_ROOT, reg_key.c_str(), KEY_READ) &&
+ key.ReadValue(NULL, &value) && (old_val == value)) {
+ std::wstring key_path = L"Software\\Classes\\" + reg_key;
+ if (key.Open(HKEY_CURRENT_USER, key_path.c_str(), KEY_WRITE))
+ key.WriteValue(NULL, new_val.c_str());
+ if (key.Open(HKEY_LOCAL_MACHINE, key_path.c_str(), KEY_WRITE))
+ key.WriteValue(NULL, new_val.c_str());
+ }
+}
+
+// This method is only temporary to update Chrome open cmd for existing users
+// of Chrome. This can be deleted once we make one release including this patch
+// to every user.
+void UpdateChromeOpenCmd(bool system_install) {
+ std::wstring chrome_exe = installer::GetChromeInstallPath(system_install);
+ file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe);
+ std::wstring old_open_cmd = L"\"" + chrome_exe + L"\" \"%1\"";
+ std::wstring new_open_cmd = ShellUtil::GetChromeShellOpenCmd(chrome_exe);
+ std::wstring reg_key[] = { L"ChromeHTML\\shell\\open\\command",
+ L"http\\shell\\open\\command",
+ L"https\\shell\\open\\command" };
+ for (int i = 0; i < _countof(reg_key); i++)
+ ReplaceRegistryValue(reg_key[i], old_open_cmd, new_open_cmd);
+}
+
installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line,
const installer::Version* installed_version, bool system_install) {
// For install the default location for chrome.packed.7z is in current
@@ -234,12 +265,18 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line,
installer_util::switches::kDoNotLaunchChrome)) {
std::wstring chrome_exe =
installer::GetChromeInstallPath(system_install);
- InstallUtil::WriteInstallerResult(system_install, install_status,
- 0, &chrome_exe);
+ if (!chrome_exe.empty()) {
+ file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe);
+ InstallUtil::WriteInstallerResult(system_install, install_status,
+ 0, &chrome_exe);
+ }
} else {
installer::LaunchChrome(system_install);
}
} else if (install_status == installer_util::NEW_VERSION_UPDATED) {
+ // This is temporary hack and will be deleted after one release.
+ UpdateChromeOpenCmd(system_install);
+
#if defined(GOOGLE_CHROME_BUILD)
// TODO(kuchhal): This is just temporary until all users move to the
// new Chromium version which ships with gears.dll.