diff options
author | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-19 23:05:25 +0000 |
---|---|---|
committer | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-19 23:05:25 +0000 |
commit | 8f794cb1c1a3a989cf1fb2e453a56afadfa8db4c (patch) | |
tree | 3c6caa4facc64ee5e257591b135554b26027a2ff /chrome/installer | |
parent | 721c3f17a7fb36edaa17f607a11db9c82ba720ca (diff) | |
download | chromium_src-8f794cb1c1a3a989cf1fb2e453a56afadfa8db4c.zip chromium_src-8f794cb1c1a3a989cf1fb2e453a56afadfa8db4c.tar.gz chromium_src-8f794cb1c1a3a989cf1fb2e453a56afadfa8db4c.tar.bz2 |
Move creation of 'open with' registry keys to installer. We should place nice and not create these keys on every Chrome start just in case user wants a customized open with list. So now we only create these keys at installation or when user choses to make Chrome default browser. Also we clean them up on uninstall.
BUG=1190855
Review URL: http://codereview.chromium.org/11491
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5726 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r-- | chrome/installer/setup/uninstall.cc | 19 | ||||
-rw-r--r-- | chrome/installer/util/shell_util.cc | 15 | ||||
-rw-r--r-- | chrome/installer/util/shell_util.h | 3 |
3 files changed, 35 insertions, 2 deletions
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 4bf5856..27e8801 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -258,12 +258,29 @@ installer_util::InstallStatus installer_setup::UninstallChrome( DeleteRegistryValue(reg_root, ShellUtil::kRegRegisteredApplications, dist->GetApplicationName()); + + // Cleanup Software\Classes\Applications\chrome.exe and OpenWithList + RegKey hklm_key(HKEY_LOCAL_MACHINE, L"", KEY_ALL_ACCESS); + std::wstring app_key(ShellUtil::kRegClasses); + file_util::AppendToPath(&app_key, L"Applications"); + file_util::AppendToPath(&app_key, installer_util::kChromeExe); + DeleteRegistryKey(key, app_key); + if (remove_all) + DeleteRegistryKey(hklm_key, app_key); + for (int i = 0; ShellUtil::kFileAssociations[i] != NULL; i++) { + std::wstring open_with_key(ShellUtil::kRegClasses); + file_util::AppendToPath(&open_with_key, ShellUtil::kFileAssociations[i]); + file_util::AppendToPath(&open_with_key, L"OpenWithList"); + file_util::AppendToPath(&open_with_key, installer_util::kChromeExe); + DeleteRegistryKey(key, open_with_key); + if (remove_all) + DeleteRegistryKey(hklm_key, open_with_key); + } key.Close(); // Delete shared registry keys as well (these require admin rights) if // remove_all option is specified. if (remove_all) { - RegKey hklm_key(HKEY_LOCAL_MACHINE, L"", KEY_ALL_ACCESS); DeleteRegistryKey(hklm_key, set_access_key); DeleteRegistryKey(hklm_key, html_prog_id); DeleteRegistryValue(HKEY_LOCAL_MACHINE, diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 4f97cd6..ba8c0fe 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -11,7 +11,7 @@ #include <shellapi.h> #include <shlobj.h> -#include "shell_util.h" +#include "chrome/installer/util/shell_util.h" #include "base/file_util.h" #include "base/logging.h" @@ -57,6 +57,17 @@ class RegistryEntry { entries.push_front(new RegistryEntry( L"Software\\Classes\\ChromeHTML\\shell\\open\\command", open_cmd)); + std::wstring exe_name = file_util::GetFilenameFromPath(chrome_exe); + std::wstring app_key = L"Software\\Classes\\Applications\\" + exe_name + + L"\\shell\\open\\command"; + entries.push_front(new RegistryEntry(app_key, open_cmd)); + for (int i = 0; ShellUtil::kFileAssociations[i] != NULL; i++) { + std::wstring open_with_key(L"Software\\Classes\\"); + open_with_key.append(ShellUtil::kFileAssociations[i]); + open_with_key.append(L"\\OpenWithList\\" + exe_name); + entries.push_front(new RegistryEntry(open_with_key, std::wstring())); + } + BrowserDistribution* dist = BrowserDistribution::GetDistribution(); entries.push_front(new RegistryEntry( L"Software\\Clients\\StartMenuInternet\\chrome.exe", @@ -333,6 +344,8 @@ const wchar_t* ShellUtil::kRegRegisteredApplications = const wchar_t* ShellUtil::kRegShellChromeHTML = L"\\shell\\ChromeHTML"; const wchar_t* ShellUtil::kRegShellChromeHTMLCommand = L"\\shell\\ChromeHTML\\command"; +const wchar_t* ShellUtil::kRegVistaUrlPrefs = + L"Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice"; const wchar_t* ShellUtil::kChromeHTMLProgId = L"ChromeHTML"; const wchar_t* ShellUtil::kFileAssociations[] = {L".htm", L".html", L".shtml", diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h index bdf77a19..ee7153a 100644 --- a/chrome/installer/util/shell_util.h +++ b/chrome/installer/util/shell_util.h @@ -65,6 +65,9 @@ class ShellUtil { // (i.e. \\shell\\ChromeHTML\\command). static const wchar_t* kRegShellChromeHTMLCommand; + // Registry path that stores url associations on Vista. + static const wchar_t* kRegVistaUrlPrefs; + // File extensions that Chrome registers itself for. static const wchar_t* kFileAssociations[]; |