Index: chrome/installer/util/shell_util.cc |
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc |
index 19f1f4cb444ec0f79eda572d40b3207c1698f74e..076a93c83130740948188df02f8a5d5ea8d11580 100644 |
--- a/chrome/installer/util/shell_util.cc |
+++ b/chrome/installer/util/shell_util.cc |
@@ -53,6 +53,7 @@ |
#include "chrome/installer/util/master_preferences_constants.h" |
#include "chrome/installer/util/registry_entry.h" |
#include "chrome/installer/util/scoped_user_protocol_entry.h" |
+#include "chrome/installer/util/shell_registry_util.h" |
#include "chrome/installer/util/util_constants.h" |
#include "chrome/installer/util/work_item.h" |
@@ -78,29 +79,6 @@ enum RegistrationConfirmationLevel { |
CONFIRM_SHELL_REGISTRATION_IN_HKLM, |
}; |
-const wchar_t kReinstallCommand[] = L"ReinstallCommand"; |
- |
-// Returns the current (or installed) browser's ProgId (e.g. |
-// "ChromeHTML|suffix|"). |
-// |suffix| can be the empty string. |
-base::string16 GetBrowserProgId(const base::string16& suffix) { |
- BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
- base::string16 chrome_html(dist->GetBrowserProgIdPrefix()); |
- chrome_html.append(suffix); |
- |
- // ProgIds cannot be longer than 39 characters. |
- // Ref: http://msdn.microsoft.com/en-us/library/aa911706.aspx. |
- // Make all new registrations comply with this requirement (existing |
- // registrations must be preserved). |
- base::string16 new_style_suffix; |
- if (ShellUtil::GetUserSpecificRegistrySuffix(&new_style_suffix) && |
- suffix == new_style_suffix && chrome_html.length() > 39) { |
- NOTREACHED(); |
- chrome_html.erase(39); |
- } |
- return chrome_html; |
-} |
- |
// This class is used to initialize and cache a base 32 encoding of the md5 hash |
// of this user's sid preceded by a dot. |
// This is guaranteed to be unique on the machine and 27 characters long |
@@ -156,461 +134,6 @@ bool UserSpecificRegistrySuffix::GetSuffix(base::string16* suffix) { |
return true; |
} |
-// Details about a Windows application, to be entered into the registry for the |
-// purpose of file associations. |
-struct ApplicationInfo { |
- ApplicationInfo() : file_type_icon_index(0), application_icon_index(0) {} |
- |
- // The ProgId used by Windows for file associations with this application. |
- // Must not be empty or start with a '.'. |
- base::string16 prog_id; |
- // The friendly name, and the path of the icon that will be used for files of |
- // these types when associated with this application by default. (They are NOT |
- // the name/icon that will represent the application under the Open With |
- // menu.) |
- base::string16 file_type_name; |
- base::FilePath file_type_icon_path; |
- int file_type_icon_index; |
- // The command to execute when opening a file via this association. It should |
- // contain "%1" (to tell Windows to pass the filename as an argument). |
- // TODO(mgiuca): |command_line| should be a base::CommandLine. |
- base::string16 command_line; |
- // The AppUserModelId used by Windows 8 for this application. Distinct from |
- // |prog_id|. |
- base::string16 app_id; |
- |
- // User-visible details about this application. Any of these may be empty. |
- base::string16 application_name; |
- base::FilePath application_icon_path; |
- int application_icon_index; |
- base::string16 application_description; |
- base::string16 publisher_name; |
- |
- // The CLSID for the application's DelegateExecute handler. May be empty. |
- base::string16 delegate_clsid; |
-}; |
- |
-// Returns the Windows browser client registration key for Chrome. For example: |
-// "Software\Clients\StartMenuInternet\Chromium[.user]". Strictly speaking, we |
-// should use the name of the executable (e.g., "chrome.exe"), but that ship has |
-// sailed. The cost of switching now is re-prompting users to make Chrome their |
-// default browser, which isn't polite. |suffix| is the user-specific |
-// registration suffix; see GetUserSpecificDefaultBrowserSuffix in shell_util.h |
-// for details. |
-base::string16 GetBrowserClientKey(BrowserDistribution* dist, |
- const base::string16& suffix) { |
- DCHECK(suffix.empty() || suffix[0] == L'.'); |
- return base::string16(ShellUtil::kRegStartMenuInternet) |
- .append(1, L'\\') |
- .append(dist->GetBaseAppName()) |
- .append(suffix); |
-} |
- |
-// Returns the Windows Default Programs capabilities key for Chrome. For |
-// example: |
-// "Software\Clients\StartMenuInternet\Chromium[.user]\Capabilities". |
-base::string16 GetCapabilitiesKey(BrowserDistribution* dist, |
- const base::string16& suffix) { |
- return GetBrowserClientKey(dist, suffix).append(L"\\Capabilities"); |
-} |
- |
-// DelegateExecute ProgId. Needed for Chrome Metro in Windows 8. This is only |
-// needed for registring a web browser, not for general associations. |
-ScopedVector<RegistryEntry> GetChromeDelegateExecuteEntries( |
- const base::FilePath& chrome_exe, |
- const ApplicationInfo& app_info) { |
- ScopedVector<RegistryEntry> entries; |
- |
- base::string16 app_id_shell_key(ShellUtil::kRegClasses); |
- app_id_shell_key.push_back(base::FilePath::kSeparators[0]); |
- app_id_shell_key.append(app_info.app_id); |
- app_id_shell_key.append(ShellUtil::kRegExePath); |
- app_id_shell_key.append(ShellUtil::kRegShellPath); |
- |
- // <root hkey>\Software\Classes\<app_id>\.exe\shell @=open |
- entries.push_back( |
- new RegistryEntry(app_id_shell_key, ShellUtil::kRegVerbOpen)); |
- |
- // The command to execute when opening this application via the Metro UI. |
- const base::string16 delegate_command( |
- ShellUtil::GetChromeDelegateCommand(chrome_exe)); |
- |
- // Each of Chrome's shortcuts has an appid; which, as of Windows 8, is |
- // registered to handle some verbs. This registration has the side-effect |
- // that these verbs now show up in the shortcut's context menu. We |
- // mitigate this side-effect by making the context menu entries |
- // user readable/localized strings. See relevant MSDN article: |
- // http://msdn.microsoft.com/en-US/library/windows/desktop/cc144171.aspx |
- static const struct { |
- const wchar_t* verb; |
- int name_id; |
- } verbs[] = { |
- {ShellUtil::kRegVerbOpen, -1}, |
- {ShellUtil::kRegVerbOpenNewWindow, IDS_SHORTCUT_NEW_WINDOW_BASE}, |
- }; |
- for (const auto& verb_and_id : verbs) { |
- base::string16 sub_path(app_id_shell_key); |
- sub_path.push_back(base::FilePath::kSeparators[0]); |
- sub_path.append(verb_and_id.verb); |
- |
- // <root hkey>\Software\Classes\<app_id>\.exe\shell\<verb> |
- if (verb_and_id.name_id != -1) { |
- // TODO(grt): http://crbug.com/75152 Write a reference to a localized |
- // resource. |
- const base::string16 verb_name( |
- installer::GetLocalizedString(verb_and_id.name_id)); |
- entries.push_back(new RegistryEntry(sub_path, verb_name.c_str())); |
- } |
- entries.push_back( |
- new RegistryEntry(sub_path, L"CommandId", L"Browser.Launch")); |
- |
- sub_path.push_back(base::FilePath::kSeparators[0]); |
- sub_path.append(ShellUtil::kRegCommand); |
- |
- // <root hkey>\Software\Classes\<app_id>\.exe\shell\<verb>\command |
- entries.push_back(new RegistryEntry(sub_path, delegate_command)); |
- entries.push_back(new RegistryEntry( |
- sub_path, ShellUtil::kRegDelegateExecute, app_info.delegate_clsid)); |
- } |
- |
- return entries; |
-} |
- |
-// Gets the registry entries to register an application in the Windows registry. |
-// |app_info| provides all of the information needed. |
-void GetProgIdEntries(const ApplicationInfo& app_info, |
- ScopedVector<RegistryEntry>* entries) { |
- // Basic sanity checks. |
- DCHECK(!app_info.prog_id.empty()); |
- DCHECK_NE(L'.', app_info.prog_id[0]); |
- |
- // File association ProgId |
- base::string16 prog_id_path(ShellUtil::kRegClasses); |
- prog_id_path.push_back(base::FilePath::kSeparators[0]); |
- prog_id_path.append(app_info.prog_id); |
- entries->push_back(new RegistryEntry(prog_id_path, app_info.file_type_name)); |
- entries->push_back(new RegistryEntry( |
- prog_id_path + ShellUtil::kRegDefaultIcon, |
- ShellUtil::FormatIconLocation(app_info.file_type_icon_path, |
- app_info.file_type_icon_index))); |
- entries->push_back(new RegistryEntry(prog_id_path + ShellUtil::kRegShellOpen, |
- app_info.command_line)); |
- if (!app_info.delegate_clsid.empty()) { |
- entries->push_back(new RegistryEntry( |
- prog_id_path + ShellUtil::kRegShellOpen, ShellUtil::kRegDelegateExecute, |
- app_info.delegate_clsid)); |
- // TODO(scottmg): Simplify after Metro removal. https://crbug.com/558054. |
- entries->back()->set_removal_flag(RegistryEntry::RemovalFlag::VALUE); |
- } |
- |
- // The following entries are required as of Windows 8, but do not |
- // depend on the DelegateExecute verb handler being set. |
- if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
- if (!app_info.app_id.empty()) { |
- entries->push_back(new RegistryEntry( |
- prog_id_path, ShellUtil::kRegAppUserModelId, app_info.app_id)); |
- } |
- |
- // Add \Software\Classes\<prog_id>\Application entries |
- base::string16 application_path(prog_id_path + ShellUtil::kRegApplication); |
- if (!app_info.app_id.empty()) { |
- entries->push_back(new RegistryEntry( |
- application_path, ShellUtil::kRegAppUserModelId, app_info.app_id)); |
- } |
- if (!app_info.application_icon_path.empty()) { |
- entries->push_back(new RegistryEntry( |
- application_path, ShellUtil::kRegApplicationIcon, |
- ShellUtil::FormatIconLocation(app_info.application_icon_path, |
- app_info.application_icon_index))); |
- } |
- if (!app_info.application_name.empty()) { |
- entries->push_back(new RegistryEntry(application_path, |
- ShellUtil::kRegApplicationName, |
- app_info.application_name)); |
- } |
- if (!app_info.application_description.empty()) { |
- entries->push_back(new RegistryEntry( |
- application_path, ShellUtil::kRegApplicationDescription, |
- app_info.application_description)); |
- } |
- if (!app_info.publisher_name.empty()) { |
- entries->push_back(new RegistryEntry(application_path, |
- ShellUtil::kRegApplicationCompany, |
- app_info.publisher_name)); |
- } |
- } |
-} |
- |
-// This method returns a list of all the registry entries that are needed to |
-// register this installation's ProgId and AppId. These entries need to be |
-// registered in HKLM prior to Win8. |
-void GetChromeProgIdEntries(BrowserDistribution* dist, |
- const base::FilePath& chrome_exe, |
- const base::string16& suffix, |
- ScopedVector<RegistryEntry>* entries) { |
- int chrome_icon_index = |
- dist->GetIconIndex(BrowserDistribution::SHORTCUT_CHROME); |
- |
- ApplicationInfo app_info; |
- app_info.prog_id = GetBrowserProgId(suffix); |
- app_info.file_type_name = dist->GetBrowserProgIdDesc(); |
- // File types associated with Chrome are just given the Chrome icon. |
- app_info.file_type_icon_path = chrome_exe; |
- app_info.file_type_icon_index = chrome_icon_index; |
- app_info.command_line = ShellUtil::GetChromeShellOpenCmd(chrome_exe); |
- // For user-level installs: entries for the app id will be in HKCU; thus we |
- // do not need a suffix on those entries. |
- app_info.app_id = ShellUtil::GetBrowserModelId( |
- dist, InstallUtil::IsPerUserInstall(chrome_exe)); |
- |
- // TODO(grt): http://crbug.com/75152 Write a reference to a localized |
- // resource for name, description, and company. |
- app_info.application_name = dist->GetDisplayName(); |
- app_info.application_icon_path = chrome_exe; |
- app_info.application_icon_index = chrome_icon_index; |
- app_info.application_description = dist->GetAppDescription(); |
- app_info.publisher_name = dist->GetPublisherName(); |
- |
- app_info.delegate_clsid = dist->GetCommandExecuteImplClsid(); |
- |
- GetProgIdEntries(app_info, entries); |
- |
- if (!app_info.delegate_clsid.empty()) { |
- ScopedVector<RegistryEntry> delegate_execute_entries = |
- GetChromeDelegateExecuteEntries(chrome_exe, app_info); |
- // Remove the keys (not only their values) so that Windows will continue |
- // to launch Chrome without a pesky association error. |
- // TODO(scottmg): Simplify after Metro removal. https://crbug.com/558054. |
- for (RegistryEntry* entry : delegate_execute_entries) |
- entry->set_removal_flag(RegistryEntry::RemovalFlag::KEY); |
- // Move |delegate_execute_entries| to |entries|. |
- entries->insert(entries->end(), delegate_execute_entries.begin(), |
- delegate_execute_entries.end()); |
- delegate_execute_entries.weak_clear(); |
- } |
-} |
- |
-// This method returns a list of the registry entries needed to declare a |
-// capability of handling a protocol on Windows. |
-void GetProtocolCapabilityEntries(BrowserDistribution* dist, |
- const base::string16& suffix, |
- const base::string16& protocol, |
- ScopedVector<RegistryEntry>* entries) { |
- entries->push_back(new RegistryEntry( |
- GetCapabilitiesKey(dist, suffix).append(L"\\URLAssociations"), protocol, |
- GetBrowserProgId(suffix))); |
-} |
- |
-// This method returns a list of the registry entries required to register this |
-// installation in "RegisteredApplications" on Windows (to appear in Default |
-// Programs, StartMenuInternet, etc.). These entries need to be registered in |
-// HKLM prior to Win8. If |suffix| is not empty, these entries are guaranteed to |
-// be unique on this machine. |
-void GetShellIntegrationEntries(BrowserDistribution* dist, |
- const base::FilePath& chrome_exe, |
- const base::string16& suffix, |
- ScopedVector<RegistryEntry>* entries) { |
- const base::string16 icon_path(ShellUtil::FormatIconLocation( |
- chrome_exe, dist->GetIconIndex(BrowserDistribution::SHORTCUT_CHROME))); |
- const base::string16 quoted_exe_path(L"\"" + chrome_exe.value() + L"\""); |
- |
- // Register for the Start Menu "Internet" link (pre-Win7). |
- const base::string16 start_menu_entry(GetBrowserClientKey(dist, suffix)); |
- // Register Chrome's display name. |
- // TODO(grt): http://crbug.com/75152 Also set LocalizedString; see |
- // http://msdn.microsoft.com/en-us/library/windows/desktop/cc144109(v=VS.85).aspx#registering_the_display_name |
- entries->push_back( |
- new RegistryEntry(start_menu_entry, dist->GetDisplayName())); |
- // Register the "open" verb for launching Chrome via the "Internet" link. |
- entries->push_back(new RegistryEntry( |
- start_menu_entry + ShellUtil::kRegShellOpen, quoted_exe_path)); |
- // Register Chrome's icon for the Start Menu "Internet" link. |
- entries->push_back(new RegistryEntry( |
- start_menu_entry + ShellUtil::kRegDefaultIcon, icon_path)); |
- |
- // Register installation information. |
- base::string16 install_info(start_menu_entry + L"\\InstallInfo"); |
- // Note: not using CommandLine since it has ambiguous rules for quoting |
- // strings. |
- entries->push_back( |
- new RegistryEntry(install_info, kReinstallCommand, |
- quoted_exe_path + L" --" + |
- base::ASCIIToUTF16(switches::kMakeDefaultBrowser))); |
- entries->push_back(new RegistryEntry( |
- install_info, L"HideIconsCommand", |
- quoted_exe_path + L" --" + base::ASCIIToUTF16(switches::kHideIcons))); |
- entries->push_back(new RegistryEntry( |
- install_info, L"ShowIconsCommand", |
- quoted_exe_path + L" --" + base::ASCIIToUTF16(switches::kShowIcons))); |
- entries->push_back(new RegistryEntry(install_info, L"IconsVisible", 1)); |
- |
- // Register with Default Programs. |
- const base::string16 reg_app_name(dist->GetBaseAppName().append(suffix)); |
- // Tell Windows where to find Chrome's Default Programs info. |
- const base::string16 capabilities(GetCapabilitiesKey(dist, suffix)); |
- entries->push_back(new RegistryEntry(ShellUtil::kRegRegisteredApplications, |
- reg_app_name, capabilities)); |
- // Write out Chrome's Default Programs info. |
- // TODO(grt): http://crbug.com/75152 Write a reference to a localized |
- // resource rather than this. |
- entries->push_back(new RegistryEntry(capabilities, |
- ShellUtil::kRegApplicationDescription, |
- dist->GetLongAppDescription())); |
- entries->push_back(new RegistryEntry( |
- capabilities, ShellUtil::kRegApplicationIcon, icon_path)); |
- entries->push_back(new RegistryEntry( |
- capabilities, ShellUtil::kRegApplicationName, dist->GetDisplayName())); |
- |
- entries->push_back(new RegistryEntry(capabilities + L"\\Startmenu", |
- L"StartMenuInternet", reg_app_name)); |
- |
- const base::string16 html_prog_id(GetBrowserProgId(suffix)); |
- for (int i = 0; ShellUtil::kPotentialFileAssociations[i] != NULL; i++) { |
- entries->push_back(new RegistryEntry( |
- capabilities + L"\\FileAssociations", |
- ShellUtil::kPotentialFileAssociations[i], html_prog_id)); |
- } |
- for (int i = 0; ShellUtil::kPotentialProtocolAssociations[i] != NULL; i++) { |
- entries->push_back(new RegistryEntry( |
- capabilities + L"\\URLAssociations", |
- ShellUtil::kPotentialProtocolAssociations[i], html_prog_id)); |
- } |
-} |
- |
-// Gets the registry entries to register an application as a handler for a |
-// particular file extension. |prog_id| is the ProgId used by Windows for the |
-// application. |ext| is the file extension, which must begin with a '.'. |
-void GetAppExtRegistrationEntries(const base::string16& prog_id, |
- const base::string16& ext, |
- ScopedVector<RegistryEntry>* entries) { |
- // In HKEY_CURRENT_USER\Software\Classes\EXT\OpenWithProgids, create an |
- // empty value with this class's ProgId. |
- base::string16 key_name(ShellUtil::kRegClasses); |
- key_name.push_back(base::FilePath::kSeparators[0]); |
- key_name.append(ext); |
- key_name.push_back(base::FilePath::kSeparators[0]); |
- key_name.append(ShellUtil::kRegOpenWithProgids); |
- entries->push_back(new RegistryEntry(key_name, prog_id, base::string16())); |
-} |
- |
-// This method returns a list of the registry entries required for this |
-// installation to be registered in the Windows shell. |
-// In particular: |
-// - App Paths |
-// http://msdn.microsoft.com/en-us/library/windows/desktop/ee872121 |
-// - File Associations |
-// http://msdn.microsoft.com/en-us/library/bb166549 |
-// These entries need to be registered in HKLM prior to Win8. |
-void GetChromeAppRegistrationEntries(const base::FilePath& chrome_exe, |
- const base::string16& suffix, |
- ScopedVector<RegistryEntry>* entries) { |
- base::string16 app_path_key(ShellUtil::kAppPathsRegistryKey); |
- app_path_key.push_back(base::FilePath::kSeparators[0]); |
- app_path_key.append(chrome_exe.BaseName().value()); |
- entries->push_back(new RegistryEntry(app_path_key, chrome_exe.value())); |
- entries->push_back(new RegistryEntry(app_path_key, |
- ShellUtil::kAppPathsRegistryPathName, |
- chrome_exe.DirName().value())); |
- |
- const base::string16 html_prog_id(GetBrowserProgId(suffix)); |
- for (int i = 0; ShellUtil::kPotentialFileAssociations[i] != NULL; i++) { |
- GetAppExtRegistrationEntries( |
- html_prog_id, ShellUtil::kPotentialFileAssociations[i], entries); |
- } |
-} |
- |
-// Gets the registry entries to register an application as the default handler |
-// for a particular file extension. |prog_id| is the ProgId used by Windows for |
-// the application. |ext| is the file extension, which must begin with a '.'. If |
-// |overwrite_existing|, always sets the default handler; otherwise only sets if |
-// there is no existing default. |
-// |
-// This has no effect on Windows 8. Windows 8 ignores the default and lets the |
-// user choose. If there is only one handler for a file, it will automatically |
-// become the default. Otherwise, the first time the user opens a file, they are |
-// presented with the dialog to set the default handler. (This is roughly |
-// equivalent to being called with |overwrite_existing| false.) |
-void GetAppDefaultRegistrationEntries(const base::string16& prog_id, |
- const base::string16& ext, |
- bool overwrite_existing, |
- ScopedVector<RegistryEntry>* entries) { |
- // Set the default value of HKEY_CURRENT_USER\Software\Classes\EXT to this |
- // class's name. |
- base::string16 key_name(ShellUtil::kRegClasses); |
- key_name.push_back(base::FilePath::kSeparators[0]); |
- key_name.append(ext); |
- scoped_ptr<RegistryEntry> default_association( |
- new RegistryEntry(key_name, prog_id)); |
- if (overwrite_existing || |
- !default_association->KeyExistsInRegistry(RegistryEntry::LOOK_IN_HKCU)) { |
- entries->push_back(default_association.release()); |
- } |
-} |
- |
-// This method returns a list of all the user level registry entries that are |
-// needed to make Chromium the default handler for a protocol on XP. |
-void GetXPStyleUserProtocolEntries(const base::string16& protocol, |
- const base::string16& chrome_icon, |
- const base::string16& chrome_open, |
- ScopedVector<RegistryEntry>* entries) { |
- // Protocols associations. |
- base::string16 url_key(ShellUtil::kRegClasses); |
- url_key.push_back(base::FilePath::kSeparators[0]); |
- url_key.append(protocol); |
- |
- // This registry value tells Windows that this 'class' is a URL scheme |
- // so IE, explorer and other apps will route it to our handler. |
- // <root hkey>\Software\Classes\<protocol>\URL Protocol |
- entries->push_back( |
- new RegistryEntry(url_key, ShellUtil::kRegUrlProtocol, base::string16())); |
- |
- // <root hkey>\Software\Classes\<protocol>\DefaultIcon |
- base::string16 icon_key = url_key + ShellUtil::kRegDefaultIcon; |
- entries->push_back(new RegistryEntry(icon_key, chrome_icon)); |
- |
- // <root hkey>\Software\Classes\<protocol>\shell\open\command |
- base::string16 shell_key = url_key + ShellUtil::kRegShellOpen; |
- entries->push_back(new RegistryEntry(shell_key, chrome_open)); |
- |
- // <root hkey>\Software\Classes\<protocol>\shell\open\ddeexec |
- base::string16 dde_key = url_key + L"\\shell\\open\\ddeexec"; |
- entries->push_back(new RegistryEntry(dde_key, base::string16())); |
- |
- // <root hkey>\Software\Classes\<protocol>\shell\@ |
- base::string16 protocol_shell_key = url_key + ShellUtil::kRegShellPath; |
- entries->push_back(new RegistryEntry(protocol_shell_key, L"open")); |
-} |
- |
-// This method returns a list of all the user level registry entries that are |
-// needed to make Chromium default browser on XP. Some of these entries are |
-// irrelevant in recent versions of Windows, but we register them anyways as |
-// some legacy apps are hardcoded to lookup those values. |
-void GetXPStyleDefaultBrowserUserEntries(BrowserDistribution* dist, |
- const base::FilePath& chrome_exe, |
- const base::string16& suffix, |
- ScopedVector<RegistryEntry>* entries) { |
- // File extension associations. |
- base::string16 html_prog_id(GetBrowserProgId(suffix)); |
- for (int i = 0; ShellUtil::kDefaultFileAssociations[i] != NULL; i++) { |
- GetAppDefaultRegistrationEntries( |
- html_prog_id, ShellUtil::kDefaultFileAssociations[i], true, entries); |
- } |
- |
- // Protocols associations. |
- base::string16 chrome_open = ShellUtil::GetChromeShellOpenCmd(chrome_exe); |
- base::string16 chrome_icon = ShellUtil::FormatIconLocation( |
- chrome_exe, dist->GetIconIndex(BrowserDistribution::SHORTCUT_CHROME)); |
- for (int i = 0; ShellUtil::kBrowserProtocolAssociations[i] != NULL; i++) { |
- GetXPStyleUserProtocolEntries(ShellUtil::kBrowserProtocolAssociations[i], |
- chrome_icon, chrome_open, entries); |
- } |
- |
- // start->Internet shortcut. |
- base::string16 start_menu(ShellUtil::kRegStartMenuInternet); |
- base::string16 app_name = dist->GetBaseAppName() + suffix; |
- entries->push_back(new RegistryEntry(start_menu, app_name)); |
-} |
- |
// Checks that all |entries| are present on this computer (or absent if their |
// |removal_flag_| is set). |look_for_in| is passed to |
// RegistryEntry::ExistsInRegistry(). Documentation for it can be found there. |
@@ -638,9 +161,10 @@ bool IsChromeRegistered(BrowserDistribution* dist, |
const base::string16& suffix, |
uint32_t look_for_in) { |
ScopedVector<RegistryEntry> entries; |
- GetChromeProgIdEntries(dist, chrome_exe, suffix, &entries); |
- GetShellIntegrationEntries(dist, chrome_exe, suffix, &entries); |
- GetChromeAppRegistrationEntries(chrome_exe, suffix, &entries); |
+ installer_util::GetChromeProgIdEntries(dist, chrome_exe, suffix, &entries); |
+ installer_util::GetShellIntegrationEntries(dist, chrome_exe, suffix, |
+ &entries); |
+ installer_util::GetChromeAppRegistrationEntries(chrome_exe, suffix, &entries); |
return AreEntriesAsDesired(entries, look_for_in); |
} |
@@ -652,7 +176,8 @@ bool IsChromeRegisteredForProtocol(BrowserDistribution* dist, |
const base::string16& protocol, |
uint32_t look_for_in) { |
ScopedVector<RegistryEntry> entries; |
- GetProtocolCapabilityEntries(dist, suffix, protocol, &entries); |
+ installer_util::GetProtocolCapabilityEntries(dist, suffix, protocol, |
+ &entries); |
return AreEntriesAsDesired(entries, look_for_in); |
} |
@@ -773,7 +298,7 @@ bool QuickIsChromeRegistered(BrowserDistribution* dist, |
case CONFIRM_SHELL_REGISTRATION: |
case CONFIRM_SHELL_REGISTRATION_IN_HKLM: |
// Software\Clients\StartMenuInternet\Google Chrome|suffix| |
- reg_key = GetBrowserClientKey(dist, suffix); |
+ reg_key = installer_util::GetBrowserClientKey(dist, suffix); |
break; |
default: |
NOTREACHED(); |
@@ -855,7 +380,7 @@ bool RegisterChromeAsDefaultXPStyle(BrowserDistribution* dist, |
const base::FilePath& chrome_exe) { |
bool ret = true; |
ScopedVector<RegistryEntry> entries; |
- GetXPStyleDefaultBrowserUserEntries( |
+ installer_util::GetXPStyleDefaultBrowserUserEntries( |
dist, chrome_exe, |
ShellUtil::GetCurrentInstallationSuffix(dist, chrome_exe), &entries); |
@@ -891,7 +416,8 @@ bool RegisterChromeAsDefaultProtocolClientXPStyle( |
ShellUtil::FormatIconLocation( |
chrome_exe, |
dist->GetIconIndex(BrowserDistribution::SHORTCUT_CHROME))); |
- GetXPStyleUserProtocolEntries(protocol, chrome_icon, chrome_open, &entries); |
+ installer_util::GetXPStyleUserProtocolEntries(protocol, chrome_icon, |
+ chrome_open, &entries); |
// Change the default protocol handler for current user. |
if (!ShellUtil::AddRegistryEntries(HKEY_CURRENT_USER, entries)) { |
LOG(ERROR) << "Could not make Chrome default protocol client (XP)."; |
@@ -1632,7 +1158,8 @@ void ShellUtil::GetRegisteredBrowsers( |
// Read the browser's reinstall command. |
if (key.Open(root, (client_path + L"\\InstallInfo").c_str(), |
KEY_QUERY_VALUE) == ERROR_SUCCESS && |
- key.ReadValue(kReinstallCommand, &command) == ERROR_SUCCESS && |
+ key.ReadValue(installer_util::kReinstallCommand, &command) == |
+ ERROR_SUCCESS && |
!command.empty()) { |
(*browsers)[name] = command; |
} |
@@ -2039,11 +1566,12 @@ bool ShellUtil::RegisterChromeBrowser(BrowserDistribution* dist, |
// an admin. |
ScopedVector<RegistryEntry> progid_and_appreg_entries; |
ScopedVector<RegistryEntry> shell_entries; |
- GetChromeProgIdEntries(dist, chrome_exe, suffix, |
- &progid_and_appreg_entries); |
- GetChromeAppRegistrationEntries(chrome_exe, suffix, |
- &progid_and_appreg_entries); |
- GetShellIntegrationEntries(dist, chrome_exe, suffix, &shell_entries); |
+ installer_util::GetChromeProgIdEntries(dist, chrome_exe, suffix, |
+ &progid_and_appreg_entries); |
+ installer_util::GetChromeAppRegistrationEntries(chrome_exe, suffix, |
+ &progid_and_appreg_entries); |
+ installer_util::GetShellIntegrationEntries(dist, chrome_exe, suffix, |
+ &shell_entries); |
result = (AddRegistryEntries(root, progid_and_appreg_entries) && |
AddRegistryEntries(root, shell_entries)); |
} else if (elevate_if_not_admin && |
@@ -2058,7 +1586,8 @@ bool ShellUtil::RegisterChromeBrowser(BrowserDistribution* dist, |
// If we got to this point then all we can do is create ProgId and basic app |
// registrations under HKCU. |
ScopedVector<RegistryEntry> entries; |
- GetChromeProgIdEntries(dist, chrome_exe, base::string16(), &entries); |
+ installer_util::GetChromeProgIdEntries(dist, chrome_exe, base::string16(), |
+ &entries); |
// Prefer to use |suffix|; unless Chrome's ProgIds are already registered |
// with no suffix (as per the old registration style): in which case some |
// other registry entries could refer to them and since we were not able to |
@@ -2066,8 +1595,10 @@ bool ShellUtil::RegisterChromeBrowser(BrowserDistribution* dist, |
if (!AreEntriesAsDesired(entries, RegistryEntry::LOOK_IN_HKCU)) { |
if (!suffix.empty()) { |
entries.clear(); |
- GetChromeProgIdEntries(dist, chrome_exe, suffix, &entries); |
- GetChromeAppRegistrationEntries(chrome_exe, suffix, &entries); |
+ installer_util::GetChromeProgIdEntries(dist, chrome_exe, suffix, |
+ &entries); |
+ installer_util::GetChromeAppRegistrationEntries(chrome_exe, suffix, |
+ &entries); |
} |
result = AddRegistryEntries(HKEY_CURRENT_USER, entries); |
} else { |
@@ -2076,7 +1607,8 @@ bool ShellUtil::RegisterChromeBrowser(BrowserDistribution* dist, |
// thus needs to be done after the above check for the unsuffixed |
// registration). |
entries.clear(); |
- GetChromeAppRegistrationEntries(chrome_exe, base::string16(), &entries); |
+ installer_util::GetChromeAppRegistrationEntries( |
+ chrome_exe, base::string16(), &entries); |
result = AddRegistryEntries(HKEY_CURRENT_USER, entries); |
} |
} |
@@ -2123,7 +1655,8 @@ bool ShellUtil::RegisterChromeForProtocol(BrowserDistribution* dist, |
// Write in the capabillity for the protocol. |
ScopedVector<RegistryEntry> entries; |
- GetProtocolCapabilityEntries(dist, suffix, protocol, &entries); |
+ installer_util::GetProtocolCapabilityEntries(dist, suffix, protocol, |
+ &entries); |
return AddRegistryEntries(root, entries); |
} else if (elevate_if_not_admin && |
base::win::GetVersion() >= base::win::VERSION_VISTA) { |
@@ -2276,13 +1809,13 @@ bool ShellUtil::AddFileAssociations( |
ScopedVector<RegistryEntry> entries; |
// Create a class for this app. |
- ApplicationInfo app_info; |
+ installer_util::ApplicationInfo app_info; |
app_info.prog_id = prog_id; |
app_info.file_type_name = file_type_name; |
app_info.file_type_icon_path = icon_path; |
app_info.file_type_icon_index = 0; |
app_info.command_line = command_line.GetCommandLineStringWithPlaceholders(); |
- GetProgIdEntries(app_info, &entries); |
+ installer_util::GetProgIdEntries(app_info, &entries); |
// Associate each extension that the app can handle with the class. Set this |
// app as the default handler if and only if there is no existing default. |
@@ -2294,13 +1827,14 @@ bool ShellUtil::AddFileAssociations( |
DCHECK_NE(L'.', (*it)[0]); |
base::string16 ext(1, L'.'); |
ext.append(*it); |
- GetAppExtRegistrationEntries(prog_id, ext, &entries); |
+ installer_util::GetAppExtRegistrationEntries(prog_id, ext, &entries); |
// Regstering as the default will have no effect on Windows 8 (see |
// documentation for GetAppDefaultRegistrationEntries). However, if our app |
// is the only handler, it will automatically become the default, so the |
// same effect is achieved. |
- GetAppDefaultRegistrationEntries(prog_id, ext, false, &entries); |
+ installer_util::GetAppDefaultRegistrationEntries(prog_id, ext, false, |
+ &entries); |
} |
return AddRegistryEntries(HKEY_CURRENT_USER, entries); |