summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authorkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-20 18:22:40 +0000
committerkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-20 18:22:40 +0000
commit6b208c8951739a6e27b7569601420842022af4bd (patch)
treeb2e12a9c9af271e58e7f1faf14f031b00ba46fc1 /chrome/installer
parentcc50156fdf206d2190f52032211bc34e8766f47c (diff)
downloadchromium_src-6b208c8951739a6e27b7569601420842022af4bd.zip
chromium_src-6b208c8951739a6e27b7569601420842022af4bd.tar.gz
chromium_src-6b208c8951739a6e27b7569601420842022af4bd.tar.bz2
During uninstall if Chrome is set as default, allow user to choose another browser as default.
BUG=14023 TEST=Make sure the option of choosing a different browser shows up during uninstall (and works as intended) iff chrome is set as default browser. Review URL: http://codereview.chromium.org/172080 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23841 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/util/shell_util.cc26
-rw-r--r--chrome/installer/util/shell_util.h6
2 files changed, 32 insertions, 0 deletions
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index 88674dc..f21aeab 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -583,6 +583,32 @@ bool ShellUtil::GetQuickLaunchPath(bool system_level, std::wstring* path) {
return true;
}
+void ShellUtil::GetRegisteredBrowsers(std::map<std::wstring,
+ std::wstring>* browsers) {
+ std::wstring base_key(ShellUtil::kRegStartMenuInternet);
+ HKEY root = HKEY_LOCAL_MACHINE;
+ for (RegistryKeyIterator iter(root, base_key.c_str()); iter.Valid(); ++iter) {
+ std::wstring key = base_key + L"\\" + iter.Name();
+ RegKey capabilities(root, (key + L"\\Capabilities").c_str());
+ std::wstring name;
+ if (!capabilities.Valid() ||
+ !capabilities.ReadValue(L"ApplicationName", &name)) {
+ RegKey base_key(root, key.c_str());
+ if (!base_key.ReadValue(L"", &name))
+ continue;
+ }
+ RegKey install_info(root, (key + L"\\InstallInfo").c_str());
+ std::wstring command;
+ if (!install_info.Valid() ||
+ !install_info.ReadValue(L"ReinstallCommand", &command))
+ continue;
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ if (!name.empty() && !command.empty() &&
+ name.find(dist->GetApplicationName()) == std::wstring::npos)
+ (*browsers)[name] = command;
+ }
+}
+
bool ShellUtil::GetUserSpecificDefaultBrowserSuffix(std::wstring* entry) {
wchar_t user_name[256];
DWORD size = _countof(user_name);
diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h
index ca6eac7..99f88b8 100644
--- a/chrome/installer/util/shell_util.h
+++ b/chrome/installer/util/shell_util.h
@@ -10,6 +10,7 @@
#define CHROME_INSTALLER_UTIL_SHELL_UTIL_H_
#include <windows.h>
+#include <map>
#include <string>
#include "base/basictypes.h"
@@ -139,6 +140,11 @@ class ShellUtil {
// User's profile only affects any new user profiles (not existing ones).
static bool GetQuickLaunchPath(bool system_level, std::wstring* path);
+ // Gets a mapping of all registered browser (on local machine) names and
+ // thier reinstall command (which usually sets browser as default).
+ static void GetRegisteredBrowsers(std::map<std::wstring,
+ std::wstring>* browsers);
+
// This function gets a suffix (user's login name) that can be added
// to Chromium default browser entry in the registry to create a unique name
// if there are multiple users on the machine, each with their own copy of