Commit 8fc94ef2 authored by Greg Thompson's avatar Greg Thompson Committed by Commit Bot

Switch to install_static::GetClientStateKeyPath() in ElevateAndRegisterChrome.

This removes the last use of BrowserDistribution in ShellUtil.

BUG=879568

Change-Id: Ib6ec1ab03913f16f17495ce67f603c7f1eb7ba1a
Reviewed-on: https://chromium-review.googlesource.com/1215282Reviewed-by: default avatarOwen Min <zmin@chromium.org>
Commit-Queue: Greg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589947}
parent 5a0ccdd2
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
#include "chrome/common/chrome_paths_internal.h" #include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/install_static/install_util.h" #include "chrome/install_static/install_util.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/install_util.h" #include "chrome/installer/util/install_util.h"
#include "chrome/installer/util/scoped_user_protocol_entry.h" #include "chrome/installer/util/scoped_user_protocol_entry.h"
#include "chrome/installer/util/shell_util.h" #include "chrome/installer/util/shell_util.h"
...@@ -537,8 +536,7 @@ bool SetAsDefaultBrowser() { ...@@ -537,8 +536,7 @@ bool SetAsDefaultBrowser() {
} }
// From UI currently we only allow setting default browser for current user. // From UI currently we only allow setting default browser for current user.
BrowserDistribution* dist = BrowserDistribution::GetDistribution(); if (!ShellUtil::MakeChromeDefault(ShellUtil::CURRENT_USER, chrome_exe,
if (!ShellUtil::MakeChromeDefault(dist, ShellUtil::CURRENT_USER, chrome_exe,
true /* elevate_if_not_admin */)) { true /* elevate_if_not_admin */)) {
LOG(ERROR) << "Chrome could not be set as default browser."; LOG(ERROR) << "Chrome could not be set as default browser.";
return false; return false;
...@@ -561,9 +559,7 @@ bool SetAsDefaultProtocolClient(const std::string& protocol) { ...@@ -561,9 +559,7 @@ bool SetAsDefaultProtocolClient(const std::string& protocol) {
} }
base::string16 wprotocol(base::UTF8ToUTF16(protocol)); base::string16 wprotocol(base::UTF8ToUTF16(protocol));
BrowserDistribution* dist = BrowserDistribution::GetDistribution(); if (!ShellUtil::MakeChromeDefaultProtocolClient(chrome_exe, wprotocol)) {
if (!ShellUtil::MakeChromeDefaultProtocolClient(dist, chrome_exe,
wprotocol)) {
LOG(ERROR) << "Chrome could not be set as default handler for " LOG(ERROR) << "Chrome could not be set as default handler for "
<< protocol << "."; << protocol << ".";
return false; return false;
...@@ -640,8 +636,7 @@ bool SetAsDefaultBrowserUsingIntentPicker() { ...@@ -640,8 +636,7 @@ bool SetAsDefaultBrowserUsingIntentPicker() {
return false; return false;
} }
BrowserDistribution* dist = BrowserDistribution::GetDistribution(); if (!ShellUtil::ShowMakeChromeDefaultSystemUI(chrome_exe)) {
if (!ShellUtil::ShowMakeChromeDefaultSystemUI(dist, chrome_exe)) {
LOG(ERROR) << "Failed to launch the set-default-browser Windows UI."; LOG(ERROR) << "Failed to launch the set-default-browser Windows UI.";
return false; return false;
} }
...@@ -666,7 +661,6 @@ void SetAsDefaultBrowserUsingSystemSettings( ...@@ -666,7 +661,6 @@ void SetAsDefaultBrowserUsingSystemSettings(
std::unique_ptr<DefaultBrowserActionRecorder> recorder( std::unique_ptr<DefaultBrowserActionRecorder> recorder(
new DefaultBrowserActionRecorder(base::Bind( new DefaultBrowserActionRecorder(base::Bind(
base::IgnoreResult(&ShellUtil::ShowMakeChromeDefaultSystemUI), base::IgnoreResult(&ShellUtil::ShowMakeChromeDefaultSystemUI),
base::Unretained(BrowserDistribution::GetDistribution()),
chrome_exe))); chrome_exe)));
// The helper manages its own lifetime. Bind the action recorder // The helper manages its own lifetime. Bind the action recorder
...@@ -687,9 +681,8 @@ bool SetAsDefaultProtocolClientUsingIntentPicker(const std::string& protocol) { ...@@ -687,9 +681,8 @@ bool SetAsDefaultProtocolClientUsingIntentPicker(const std::string& protocol) {
return false; return false;
} }
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
base::string16 wprotocol(base::UTF8ToUTF16(protocol)); base::string16 wprotocol(base::UTF8ToUTF16(protocol));
if (!ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI(dist, chrome_exe, if (!ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI(chrome_exe,
wprotocol)) { wprotocol)) {
LOG(ERROR) << "Failed to launch the set-default-client Windows UI."; LOG(ERROR) << "Failed to launch the set-default-client Windows UI.";
return false; return false;
...@@ -716,9 +709,7 @@ void SetAsDefaultProtocolClientUsingSystemSettings( ...@@ -716,9 +709,7 @@ void SetAsDefaultProtocolClientUsingSystemSettings(
const wchar_t* const kProtocols[] = {wprotocol.c_str(), nullptr}; const wchar_t* const kProtocols[] = {wprotocol.c_str(), nullptr};
OpenSystemSettingsHelper::Begin(kProtocols, on_finished_callback); OpenSystemSettingsHelper::Begin(kProtocols, on_finished_callback);
BrowserDistribution* dist = BrowserDistribution::GetDistribution(); ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI(chrome_exe, wprotocol);
ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI(dist, chrome_exe,
wprotocol);
} }
base::string16 GetAppModelIdForProfile(const base::string16& app_name, base::string16 GetAppModelIdForProfile(const base::string16& app_name,
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include "chrome/installer/setup/update_active_setup_version_work_item.h" #include "chrome/installer/setup/update_active_setup_version_work_item.h"
#include "chrome/installer/setup/user_experiment.h" #include "chrome/installer/setup/user_experiment.h"
#include "chrome/installer/util/beacons.h" #include "chrome/installer/util/beacons.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/create_reg_key_work_item.h" #include "chrome/installer/util/create_reg_key_work_item.h"
#include "chrome/installer/util/delete_after_reboot_helper.h" #include "chrome/installer/util/delete_after_reboot_helper.h"
#include "chrome/installer/util/delete_old_versions.h" #include "chrome/installer/util/delete_old_versions.h"
...@@ -445,7 +444,6 @@ void RegisterChromeOnMachine(const InstallerState& installer_state, ...@@ -445,7 +444,6 @@ void RegisterChromeOnMachine(const InstallerState& installer_state,
// Make Chrome the default browser if desired when possible. Otherwise, only // Make Chrome the default browser if desired when possible. Otherwise, only
// register it with Windows. // register it with Windows.
BrowserDistribution* dist = product.distribution();
const base::FilePath chrome_exe( const base::FilePath chrome_exe(
installer_state.target_path().Append(kChromeExe)); installer_state.target_path().Append(kChromeExe));
VLOG(1) << "Registering Chrome as browser: " << chrome_exe.value(); VLOG(1) << "Registering Chrome as browser: " << chrome_exe.value();
...@@ -454,9 +452,9 @@ void RegisterChromeOnMachine(const InstallerState& installer_state, ...@@ -454,9 +452,9 @@ void RegisterChromeOnMachine(const InstallerState& installer_state,
int level = ShellUtil::CURRENT_USER; int level = ShellUtil::CURRENT_USER;
if (installer_state.system_install()) if (installer_state.system_install())
level = level | ShellUtil::SYSTEM_LEVEL; level = level | ShellUtil::SYSTEM_LEVEL;
ShellUtil::MakeChromeDefault(dist, level, chrome_exe, true); ShellUtil::MakeChromeDefault(level, chrome_exe, true);
} else { } else {
ShellUtil::RegisterChromeBrowser(dist, chrome_exe, base::string16(), false); ShellUtil::RegisterChromeBrowser(chrome_exe, base::string16(), false);
} }
} }
...@@ -552,8 +550,6 @@ InstallStatus InstallOrUpdateProduct(const InstallationState& original_state, ...@@ -552,8 +550,6 @@ InstallStatus InstallOrUpdateProduct(const InstallationState& original_state,
make_chrome_default || force_chrome_default_for_user, new_version); make_chrome_default || force_chrome_default_for_user, new_version);
if (!installer_state.system_install()) { if (!installer_state.system_install()) {
DCHECK_EQ(chrome_product.distribution(),
BrowserDistribution::GetDistribution());
UpdateDefaultBrowserBeaconForPath( UpdateDefaultBrowserBeaconForPath(
installer_state.target_path().Append(kChromeExe)); installer_state.target_path().Append(kChromeExe));
} }
......
...@@ -730,10 +730,8 @@ installer::InstallStatus RegisterDevChrome( ...@@ -730,10 +730,8 @@ installer::InstallStatus RegisterDevChrome(
const InstallerState& installer_state, const InstallerState& installer_state,
const base::FilePath& setup_exe, const base::FilePath& setup_exe,
const base::CommandLine& cmd_line) { const base::CommandLine& cmd_line) {
BrowserDistribution* chrome_dist = BrowserDistribution::GetDistribution();
// Only proceed with registering a dev chrome if no real Chrome installation // Only proceed with registering a dev chrome if no real Chrome installation
// of the same distribution are present on this system. // of the same install mode is present on this system.
const ProductState* existing_chrome = original_state.GetProductState(false); const ProductState* existing_chrome = original_state.GetProductState(false);
if (!existing_chrome) if (!existing_chrome)
existing_chrome = original_state.GetProductState(true); existing_chrome = original_state.GetProductState(true);
...@@ -772,10 +770,9 @@ installer::InstallStatus RegisterDevChrome( ...@@ -772,10 +770,9 @@ installer::InstallStatus RegisterDevChrome(
// Register Chrome at user-level and make it default. // Register Chrome at user-level and make it default.
if (ShellUtil::CanMakeChromeDefaultUnattended()) { if (ShellUtil::CanMakeChromeDefaultUnattended()) {
ShellUtil::MakeChromeDefault(chrome_dist, ShellUtil::CURRENT_USER, ShellUtil::MakeChromeDefault(ShellUtil::CURRENT_USER, chrome_exe, true);
chrome_exe, true);
} else { } else {
ShellUtil::ShowMakeChromeDefaultSystemUI(chrome_dist, chrome_exe); ShellUtil::ShowMakeChromeDefaultSystemUI(chrome_exe);
} }
} else { } else {
LOG(ERROR) << "Path not found: " << chrome_exe.value(); LOG(ERROR) << "Path not found: " << chrome_exe.value();
...@@ -882,7 +879,6 @@ bool HandleNonInstallCmdLineOptions(const base::FilePath& setup_exe, ...@@ -882,7 +879,6 @@ bool HandleNonInstallCmdLineOptions(const base::FilePath& setup_exe,
*exit_code = InstallUtil::GetInstallReturnCode(status); *exit_code = InstallUtil::GetInstallReturnCode(status);
} else if (cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowser)) { } else if (cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowser)) {
installer::InstallStatus status = installer::UNKNOWN_STATUS; installer::InstallStatus status = installer::UNKNOWN_STATUS;
const Product& chrome_install = installer_state->product();
// If --register-chrome-browser option is specified, register all Chrome // If --register-chrome-browser option is specified, register all Chrome
// protocol/file associations, as well as register it as a valid browser for // protocol/file associations, as well as register it as a valid browser for
// Start Menu->Internet shortcut. This switch will also register Chrome as a // Start Menu->Internet shortcut. This switch will also register Chrome as a
...@@ -911,13 +907,11 @@ bool HandleNonInstallCmdLineOptions(const base::FilePath& setup_exe, ...@@ -911,13 +907,11 @@ bool HandleNonInstallCmdLineOptions(const base::FilePath& setup_exe,
// ShellUtil::RegisterChromeForProtocol performs all registration // ShellUtil::RegisterChromeForProtocol performs all registration
// done by ShellUtil::RegisterChromeBrowser, as well as registering // done by ShellUtil::RegisterChromeBrowser, as well as registering
// with Windows as capable of handling the supplied protocol. // with Windows as capable of handling the supplied protocol.
if (ShellUtil::RegisterChromeForProtocol(chrome_install.distribution(), if (ShellUtil::RegisterChromeForProtocol(chrome_exe, suffix, protocol,
chrome_exe, suffix, protocol,
false)) false))
status = installer::IN_USE_UPDATED; status = installer::IN_USE_UPDATED;
} else { } else {
if (ShellUtil::RegisterChromeBrowser(chrome_install.distribution(), if (ShellUtil::RegisterChromeBrowser(chrome_exe, suffix, false))
chrome_exe, suffix, false))
status = installer::IN_USE_UPDATED; status = installer::IN_USE_UPDATED;
} }
*exit_code = InstallUtil::GetInstallReturnCode(status); *exit_code = InstallUtil::GetInstallReturnCode(status);
......
...@@ -55,7 +55,6 @@ ...@@ -55,7 +55,6 @@
#include "chrome/install_static/install_modes.h" #include "chrome/install_static/install_modes.h"
#include "chrome/install_static/install_util.h" #include "chrome/install_static/install_util.h"
#include "chrome/installer/util/beacons.h" #include "chrome/installer/util/beacons.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/helper.h" #include "chrome/installer/util/helper.h"
#include "chrome/installer/util/install_util.h" #include "chrome/installer/util/install_util.h"
#include "chrome/installer/util/installer_util_strings.h" #include "chrome/installer/util/installer_util_strings.h"
...@@ -689,8 +688,7 @@ bool IsChromeRegisteredForProtocol(const base::string16& suffix, ...@@ -689,8 +688,7 @@ bool IsChromeRegisteredForProtocol(const base::string16& suffix,
// registration on Windows 7 for per-user installs where setup.exe did not have // registration on Windows 7 for per-user installs where setup.exe did not have
// permission to register Chrome during install. It may also be used on Windows // permission to register Chrome during install. It may also be used on Windows
// 7 for system-level installs to register Chrome for a specific protocol. // 7 for system-level installs to register Chrome for a specific protocol.
bool ElevateAndRegisterChrome(BrowserDistribution* dist, bool ElevateAndRegisterChrome(const base::FilePath& chrome_exe,
const base::FilePath& chrome_exe,
const base::string16& suffix, const base::string16& suffix,
const base::string16& protocol) { const base::string16& protocol) {
// Check for setup.exe in the same directory as chrome.exe, as is the case // Check for setup.exe in the same directory as chrome.exe, as is the case
...@@ -703,7 +701,8 @@ bool ElevateAndRegisterChrome(BrowserDistribution* dist, ...@@ -703,7 +701,8 @@ bool ElevateAndRegisterChrome(BrowserDistribution* dist,
const bool is_per_user = InstallUtil::IsPerUserInstall(); const bool is_per_user = InstallUtil::IsPerUserInstall();
if (!base::PathExists(exe_path)) { if (!base::PathExists(exe_path)) {
RegKey key(is_per_user ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE, RegKey key(is_per_user ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
dist->GetStateKey().c_str(), KEY_QUERY_VALUE | KEY_WOW64_32KEY); install_static::GetClientStateKeyPath().c_str(),
KEY_QUERY_VALUE | KEY_WOW64_32KEY);
base::string16 uninstall_string; base::string16 uninstall_string;
if (key.ReadValue(installer::kUninstallStringField, &uninstall_string) == if (key.ReadValue(installer::kUninstallStringField, &uninstall_string) ==
ERROR_SUCCESS) { ERROR_SUCCESS) {
...@@ -1964,13 +1963,9 @@ ShellUtil::InteractiveSetDefaultMode ShellUtil::GetInteractiveSetDefaultMode() { ...@@ -1964,13 +1963,9 @@ ShellUtil::InteractiveSetDefaultMode ShellUtil::GetInteractiveSetDefaultMode() {
return InteractiveSetDefaultMode::INTENT_PICKER; return InteractiveSetDefaultMode::INTENT_PICKER;
} }
bool ShellUtil::MakeChromeDefault(BrowserDistribution* dist, bool ShellUtil::MakeChromeDefault(int shell_change,
int shell_change,
const base::FilePath& chrome_exe, const base::FilePath& chrome_exe,
bool elevate_if_not_admin) { bool elevate_if_not_admin) {
// Assert that this is only called with the one relevant distribution.
// TODO(grt): Remove this when BrowserDistribution goes away.
DCHECK_EQ(BrowserDistribution::GetDistribution(), dist);
DCHECK(!(shell_change & SYSTEM_LEVEL) || IsUserAnAdmin()); DCHECK(!(shell_change & SYSTEM_LEVEL) || IsUserAnAdmin());
if (!install_static::SupportsSetAsDefaultBrowser()) if (!install_static::SupportsSetAsDefaultBrowser())
...@@ -1983,8 +1978,8 @@ bool ShellUtil::MakeChromeDefault(BrowserDistribution* dist, ...@@ -1983,8 +1978,8 @@ bool ShellUtil::MakeChromeDefault(BrowserDistribution* dist,
return false; return false;
} }
if (!RegisterChromeBrowser( if (!RegisterChromeBrowser(chrome_exe, base::string16(),
dist, chrome_exe, base::string16(), elevate_if_not_admin)) { elevate_if_not_admin)) {
return false; return false;
} }
...@@ -2054,18 +2049,14 @@ bool ShellUtil::LaunchUninstallAppsSettings() { ...@@ -2054,18 +2049,14 @@ bool ShellUtil::LaunchUninstallAppsSettings() {
#endif // defined(GOOGLE_CHROME_BUILD) #endif // defined(GOOGLE_CHROME_BUILD)
bool ShellUtil::ShowMakeChromeDefaultSystemUI( bool ShellUtil::ShowMakeChromeDefaultSystemUI(
BrowserDistribution* dist,
const base::FilePath& chrome_exe) { const base::FilePath& chrome_exe) {
// Assert that this is only called with the one relevant distribution.
// TODO(grt): Remove this when BrowserDistribution goes away.
DCHECK_EQ(BrowserDistribution::GetDistribution(), dist);
DCHECK(!CanMakeChromeDefaultUnattended()); DCHECK(!CanMakeChromeDefaultUnattended());
if (!install_static::SupportsSetAsDefaultBrowser()) if (!install_static::SupportsSetAsDefaultBrowser())
return false; return false;
if (!RegisterChromeBrowser(dist, chrome_exe, base::string16(), true)) if (!RegisterChromeBrowser(chrome_exe, base::string16(), true))
return false; return false;
bool succeeded = true; bool succeeded = true;
bool is_default = (GetChromeDefaultState() == IS_DEFAULT); bool is_default = (GetChromeDefaultState() == IS_DEFAULT);
...@@ -2098,17 +2089,12 @@ bool ShellUtil::ShowMakeChromeDefaultSystemUI( ...@@ -2098,17 +2089,12 @@ bool ShellUtil::ShowMakeChromeDefaultSystemUI(
} }
bool ShellUtil::MakeChromeDefaultProtocolClient( bool ShellUtil::MakeChromeDefaultProtocolClient(
BrowserDistribution* dist,
const base::FilePath& chrome_exe, const base::FilePath& chrome_exe,
const base::string16& protocol) { const base::string16& protocol) {
// Assert that this is only called with the one relevant distribution.
// TODO(grt): Remove this when BrowserDistribution goes away.
DCHECK_EQ(BrowserDistribution::GetDistribution(), dist);
if (!install_static::SupportsSetAsDefaultBrowser()) if (!install_static::SupportsSetAsDefaultBrowser())
return false; return false;
if (!RegisterChromeForProtocol( if (!RegisterChromeForProtocol(chrome_exe, base::string16(), protocol, true))
dist, chrome_exe, base::string16(), protocol, true))
return false; return false;
// Windows 8 does not permit making a browser default just like that. // Windows 8 does not permit making a browser default just like that.
...@@ -2146,19 +2132,14 @@ bool ShellUtil::MakeChromeDefaultProtocolClient( ...@@ -2146,19 +2132,14 @@ bool ShellUtil::MakeChromeDefaultProtocolClient(
} }
bool ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI( bool ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI(
BrowserDistribution* dist,
const base::FilePath& chrome_exe, const base::FilePath& chrome_exe,
const base::string16& protocol) { const base::string16& protocol) {
// Assert that this is only called with the one relevant distribution.
// TODO(grt): Remove this when BrowserDistribution goes away.
DCHECK_EQ(BrowserDistribution::GetDistribution(), dist);
DCHECK(!CanMakeChromeDefaultUnattended()); DCHECK(!CanMakeChromeDefaultUnattended());
if (!install_static::SupportsSetAsDefaultBrowser()) if (!install_static::SupportsSetAsDefaultBrowser())
return false; return false;
if (!RegisterChromeForProtocol( if (!RegisterChromeForProtocol(chrome_exe, base::string16(), protocol, true))
dist, chrome_exe, base::string16(), protocol, true))
return false; return false;
bool succeeded = true; bool succeeded = true;
...@@ -2191,13 +2172,9 @@ bool ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI( ...@@ -2191,13 +2172,9 @@ bool ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI(
return succeeded; return succeeded;
} }
bool ShellUtil::RegisterChromeBrowser(BrowserDistribution* dist, bool ShellUtil::RegisterChromeBrowser(const base::FilePath& chrome_exe,
const base::FilePath& chrome_exe,
const base::string16& unique_suffix, const base::string16& unique_suffix,
bool elevate_if_not_admin) { bool elevate_if_not_admin) {
// Assert that this is only called with the one relevant distribution.
// TODO(grt): Remove this when BrowserDistribution goes away.
DCHECK_EQ(BrowserDistribution::GetDistribution(), dist);
base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();
base::string16 suffix; base::string16 suffix;
...@@ -2256,7 +2233,7 @@ bool ShellUtil::RegisterChromeBrowser(BrowserDistribution* dist, ...@@ -2256,7 +2233,7 @@ bool ShellUtil::RegisterChromeBrowser(BrowserDistribution* dist,
// Try to elevate and register if requested for per-user installs if the user // Try to elevate and register if requested for per-user installs if the user
// is not an admin. // is not an admin.
if (elevate_if_not_admin && if (elevate_if_not_admin &&
ElevateAndRegisterChrome(dist, chrome_exe, suffix, base::string16())) { ElevateAndRegisterChrome(chrome_exe, suffix, base::string16())) {
return true; return true;
} }
// If we got to this point then all we can do is create ProgId and basic app // If we got to this point then all we can do is create ProgId and basic app
...@@ -2283,14 +2260,10 @@ bool ShellUtil::RegisterChromeBrowser(BrowserDistribution* dist, ...@@ -2283,14 +2260,10 @@ bool ShellUtil::RegisterChromeBrowser(BrowserDistribution* dist,
return AddRegistryEntries(HKEY_CURRENT_USER, entries); return AddRegistryEntries(HKEY_CURRENT_USER, entries);
} }
bool ShellUtil::RegisterChromeForProtocol(BrowserDistribution* dist, bool ShellUtil::RegisterChromeForProtocol(const base::FilePath& chrome_exe,
const base::FilePath& chrome_exe,
const base::string16& unique_suffix, const base::string16& unique_suffix,
const base::string16& protocol, const base::string16& protocol,
bool elevate_if_not_admin) { bool elevate_if_not_admin) {
// Assert that this is only called with the one relevant distribution.
// TODO(grt): Remove this when BrowserDistribution goes away.
DCHECK_EQ(BrowserDistribution::GetDistribution(), dist);
base::string16 suffix; base::string16 suffix;
if (!unique_suffix.empty()) { if (!unique_suffix.empty()) {
suffix = unique_suffix; suffix = unique_suffix;
...@@ -2315,7 +2288,7 @@ bool ShellUtil::RegisterChromeForProtocol(BrowserDistribution* dist, ...@@ -2315,7 +2288,7 @@ bool ShellUtil::RegisterChromeForProtocol(BrowserDistribution* dist,
if (root == HKEY_CURRENT_USER || IsUserAnAdmin()) { if (root == HKEY_CURRENT_USER || IsUserAnAdmin()) {
// We can do this operation directly. // We can do this operation directly.
// First, make sure Chrome is fully registered on this machine. // First, make sure Chrome is fully registered on this machine.
if (!RegisterChromeBrowser(dist, chrome_exe, suffix, false)) if (!RegisterChromeBrowser(chrome_exe, suffix, false))
return false; return false;
// Write in the capabillity for the protocol. // Write in the capabillity for the protocol.
...@@ -2324,7 +2297,7 @@ bool ShellUtil::RegisterChromeForProtocol(BrowserDistribution* dist, ...@@ -2324,7 +2297,7 @@ bool ShellUtil::RegisterChromeForProtocol(BrowserDistribution* dist,
return AddRegistryEntries(root, entries); return AddRegistryEntries(root, entries);
} else if (elevate_if_not_admin) { } else if (elevate_if_not_admin) {
// Elevate to do the whole job // Elevate to do the whole job
return ElevateAndRegisterChrome(dist, chrome_exe, suffix, protocol); return ElevateAndRegisterChrome(chrome_exe, suffix, protocol);
} else { } else {
// Admin rights are required to register capabilities before Windows 8. // Admin rights are required to register capabilities before Windows 8.
return false; return false;
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "chrome/installer/util/work_item_list.h" #include "chrome/installer/util/work_item_list.h"
class BrowserDistribution;
class RegistryEntry; class RegistryEntry;
namespace base { namespace base {
...@@ -464,8 +463,7 @@ class ShellUtil { ...@@ -464,8 +463,7 @@ class ShellUtil {
// chrome_exe: The chrome.exe path to register as default browser. // chrome_exe: The chrome.exe path to register as default browser.
// elevate_if_not_admin: On Vista if user is not admin, try to elevate for // elevate_if_not_admin: On Vista if user is not admin, try to elevate for
// Chrome registration. // Chrome registration.
static bool MakeChromeDefault(BrowserDistribution* dist, static bool MakeChromeDefault(int shell_change,
int shell_change,
const base::FilePath& chrome_exe, const base::FilePath& chrome_exe,
bool elevate_if_not_admin); bool elevate_if_not_admin);
...@@ -485,16 +483,13 @@ class ShellUtil { ...@@ -485,16 +483,13 @@ class ShellUtil {
// dialog focused on default apps is launched. The function does not wait // dialog focused on default apps is launched. The function does not wait
// in this case. // in this case.
// //
// |dist| gives the type of browser distribution currently in use.
// |chrome_exe| The chrome.exe path to register as default browser. // |chrome_exe| The chrome.exe path to register as default browser.
static bool ShowMakeChromeDefaultSystemUI(BrowserDistribution* dist, static bool ShowMakeChromeDefaultSystemUI(const base::FilePath& chrome_exe);
const base::FilePath& chrome_exe);
// Make Chrome the default application for a protocol. // Make Chrome the default application for a protocol.
// chrome_exe: The chrome.exe path to register as default browser. // chrome_exe: The chrome.exe path to register as default browser.
// protocol: The protocol to register as the default handler for. // protocol: The protocol to register as the default handler for.
static bool MakeChromeDefaultProtocolClient(BrowserDistribution* dist, static bool MakeChromeDefaultProtocolClient(const base::FilePath& chrome_exe,
const base::FilePath& chrome_exe,
const base::string16& protocol); const base::string16& protocol);
// Shows and waits for the Windows 8 "How do you want to open links of this // Shows and waits for the Windows 8 "How do you want to open links of this
...@@ -502,11 +497,9 @@ class ShellUtil { ...@@ -502,11 +497,9 @@ class ShellUtil {
// handler. Also does XP-era registrations if Chrome is chosen or was already // handler. Also does XP-era registrations if Chrome is chosen or was already
// the default for |protocol|. Do not use on pre-Win8 OSes. // the default for |protocol|. Do not use on pre-Win8 OSes.
// //
// |dist| gives the type of browser distribution currently in use.
// |chrome_exe| The chrome.exe path to register as default browser. // |chrome_exe| The chrome.exe path to register as default browser.
// |protocol| is the protocol being registered. // |protocol| is the protocol being registered.
static bool ShowMakeChromeDefaultProtocolClientSystemUI( static bool ShowMakeChromeDefaultProtocolClientSystemUI(
BrowserDistribution* dist,
const base::FilePath& chrome_exe, const base::FilePath& chrome_exe,
const base::string16& protocol); const base::string16& protocol);
...@@ -535,8 +528,7 @@ class ShellUtil { ...@@ -535,8 +528,7 @@ class ShellUtil {
// (e.g. "Make Chrome Default") as it allows this method to UAC. // (e.g. "Make Chrome Default") as it allows this method to UAC.
// //
// Returns true if Chrome is successfully registered (or already registered). // Returns true if Chrome is successfully registered (or already registered).
static bool RegisterChromeBrowser(BrowserDistribution* dist, static bool RegisterChromeBrowser(const base::FilePath& chrome_exe,
const base::FilePath& chrome_exe,
const base::string16& unique_suffix, const base::string16& unique_suffix,
bool elevate_if_not_admin); bool elevate_if_not_admin);
...@@ -557,8 +549,7 @@ class ShellUtil { ...@@ -557,8 +549,7 @@ class ShellUtil {
// |protocol| The protocol to register as being capable of handling.s // |protocol| The protocol to register as being capable of handling.s
// |elevate_if_not_admin| if true will make this method try alternate methods // |elevate_if_not_admin| if true will make this method try alternate methods
// as described above. // as described above.
static bool RegisterChromeForProtocol(BrowserDistribution* dist, static bool RegisterChromeForProtocol(const base::FilePath& chrome_exe,
const base::FilePath& chrome_exe,
const base::string16& unique_suffix, const base::string16& unique_suffix,
const base::string16& protocol, const base::string16& protocol,
bool elevate_if_not_admin); bool elevate_if_not_admin);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment