diff options
author | grt <grt@chromium.org> | 2014-12-05 08:42:10 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-05 16:42:38 +0000 |
commit | e76ca28508f7cbc956b789d971132f7c73e33ec3 (patch) | |
tree | 5438e6c62c92b1f0c0b46ded806f4b8eb8f18103 /chrome/installer/setup | |
parent | c6616f79031316e3a2c5518df7333131d1496333 (diff) | |
download | chromium_src-e76ca28508f7cbc956b789d971132f7c73e33ec3.zip chromium_src-e76ca28508f7cbc956b789d971132f7c73e33ec3.tar.gz chromium_src-e76ca28508f7cbc956b789d971132f7c73e33ec3.tar.bz2 |
Use FilePath in favor of string16 and wchar_t* in some Windows installer code.
The changes trickle through the DLL loader as well.
BUG=24672
TBR=sky@chromium.org
Review URL: https://codereview.chromium.org/775383002
Cr-Commit-Position: refs/heads/master@{#307034}
Diffstat (limited to 'chrome/installer/setup')
-rw-r--r-- | chrome/installer/setup/install.cc | 6 | ||||
-rw-r--r-- | chrome/installer/setup/install_worker.cc | 2 | ||||
-rw-r--r-- | chrome/installer/setup/setup_main.cc | 25 | ||||
-rw-r--r-- | chrome/installer/setup/uninstall.cc | 13 | ||||
-rw-r--r-- | chrome/installer/setup/uninstall.h | 2 |
5 files changed, 22 insertions, 26 deletions
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc index 95632fa..f4c091b 100644 --- a/chrome/installer/setup/install.cc +++ b/chrome/installer/setup/install.cc @@ -469,9 +469,9 @@ void RegisterChromeOnMachine(const installer::InstallerState& installer_state, // Make Chrome the default browser if desired when possible. Otherwise, only // register it with Windows. BrowserDistribution* dist = product.distribution(); - const base::string16 chrome_exe( - installer_state.target_path().Append(installer::kChromeExe).value()); - VLOG(1) << "Registering Chrome as browser: " << chrome_exe; + const base::FilePath chrome_exe( + installer_state.target_path().Append(installer::kChromeExe)); + VLOG(1) << "Registering Chrome as browser: " << chrome_exe.value(); if (make_chrome_default && ShellUtil::CanMakeChromeDefaultUnattended()) { int level = ShellUtil::CURRENT_USER; if (installer_state.system_install()) diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc index cca3132..e76a5dd 100644 --- a/chrome/installer/setup/install_worker.cc +++ b/chrome/installer/setup/install_worker.cc @@ -752,7 +752,7 @@ void AddUninstallShortcutWorkItems(const InstallerState& installer_state, BrowserDistribution* dist = product.distribution(); base::string16 chrome_icon = ShellUtil::FormatIconLocation( - install_path.Append(dist->GetIconFilename()).value(), + install_path.Append(dist->GetIconFilename()), dist->GetIconIndex(BrowserDistribution::SHORTCUT_CHROME)); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index 86ce7a2..0acc5fc 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -872,8 +872,8 @@ bool CreateEULASentinel(BrowserDistribution* dist) { void ActivateMetroChrome() { // Check to see if we're per-user or not. Need to do this since we may // not have been invoked with --system-level even for a machine install. - wchar_t exe_path[MAX_PATH * 2] = {}; - GetModuleFileName(NULL, exe_path, arraysize(exe_path)); + base::FilePath exe_path; + PathService::Get(base::FILE_EXE, &exe_path); bool is_per_user_install = InstallUtil::IsPerUserInstall(exe_path); base::string16 app_model_id = ShellUtil::GetBrowserModelId( @@ -953,10 +953,10 @@ installer::InstallStatus RegisterDevChrome( delegate_execute_list.get()); delegate_execute_list->Do(); if (ShellUtil::CanMakeChromeDefaultUnattended()) { - ShellUtil::MakeChromeDefault( - chrome_dist, ShellUtil::CURRENT_USER, chrome_exe.value(), true); + ShellUtil::MakeChromeDefault(chrome_dist, ShellUtil::CURRENT_USER, + chrome_exe, true); } else { - ShellUtil::ShowMakeChromeDefaultSystemUI(chrome_dist, chrome_exe.value()); + ShellUtil::ShowMakeChromeDefaultSystemUI(chrome_dist, chrome_exe); } } else { LOG(ERROR) << "Path not found: " << chrome_exe.value(); @@ -1077,7 +1077,7 @@ bool HandleNonInstallCmdLineOptions(const InstallationState& original_state, // These options should only be used when setup.exe is launched with admin // rights. We do not make any user specific changes with this option. DCHECK(IsUserAnAdmin()); - base::string16 chrome_exe(cmd_line.GetSwitchValueNative( + base::FilePath chrome_exe(cmd_line.GetSwitchValuePath( installer::switches::kRegisterChromeBrowser)); base::string16 suffix; if (cmd_line.HasSwitch( @@ -1569,7 +1569,7 @@ InstallStatus InstallProductsHelper( *installer_version); int install_msg_base = IDS_INSTALL_FAILED_BASE; - base::string16 chrome_exe; + base::FilePath chrome_exe; base::string16 quoted_chrome_exe; if (install_status == SAME_VERSION_REPAIR_FAILED) { install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_BASE; @@ -1580,8 +1580,8 @@ InstallStatus InstallProductsHelper( install_msg_base = IDS_INSTALL_OS_ERROR_BASE; install_status = OS_ERROR; } else { - chrome_exe = installer_state.target_path().Append(kChromeExe).value(); - quoted_chrome_exe = L"\"" + chrome_exe + L"\""; + chrome_exe = installer_state.target_path().Append(kChromeExe); + quoted_chrome_exe = L"\"" + chrome_exe.value() + L"\""; install_msg_base = 0; } } @@ -1625,7 +1625,7 @@ InstallStatus InstallProductsHelper( const Product* chrome = installer_state.FindProduct( BrowserDistribution::CHROME_BROWSER); if (chrome != NULL) { - DCHECK_NE(chrome_exe, base::string16()); + DCHECK_NE(chrome_exe.value(), base::string16()); RemoveChromeLegacyRegistryKeys(chrome->distribution(), chrome_exe); } } @@ -1753,10 +1753,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, // extension), in which case CommandLineToArgv will not yield an argv with the // true path to the program at position 0. base::FilePath setup_exe; - if (!PathService::Get(base::FILE_EXE, &setup_exe)) { - NOTREACHED(); - return installer::OS_ERROR; - } + PathService::Get(base::FILE_EXE, &setup_exe); int exit_code = 0; if (HandleNonInstallCmdLineOptions( diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 0d8293f..0eb961a 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -1046,7 +1046,7 @@ bool DeleteChromeRegistrationKeys(const InstallerState& installer_state, } void RemoveChromeLegacyRegistryKeys(BrowserDistribution* dist, - const base::string16& chrome_exe) { + const base::FilePath& chrome_exe) { // We used to register Chrome to handle crx files, but this turned out // to be not worth the hassle. Remove these old registry entries if // they exist. See: http://codereview.chromium.org/210007 @@ -1097,8 +1097,8 @@ InstallStatus UninstallProduct(const InstallationState& original_state, const CommandLine& cmd_line) { InstallStatus status = installer::UNINSTALL_CONFIRMED; BrowserDistribution* browser_dist = product.distribution(); - const base::string16 chrome_exe( - installer_state.target_path().Append(installer::kChromeExe).value()); + const base::FilePath chrome_exe( + installer_state.target_path().Append(installer::kChromeExe)); bool is_chrome = product.is_chrome(); @@ -1173,15 +1173,14 @@ InstallStatus UninstallProduct(const InstallationState& original_state, Append(installer::kChromeExe)); VLOG(1) << "Retargeting user-generated Chrome shortcuts."; if (base::PathExists(system_chrome_path)) { - RetargetUserShortcutsWithArgs(installer_state, product, - base::FilePath(chrome_exe), + RetargetUserShortcutsWithArgs(installer_state, product, chrome_exe, system_chrome_path); } else { LOG(ERROR) << "Retarget failed: system-level Chrome not found."; } } - DeleteShortcuts(installer_state, product, base::FilePath(chrome_exe)); + DeleteShortcuts(installer_state, product, chrome_exe); } // Delete the registry keys (Uninstall key and Version key). @@ -1270,7 +1269,7 @@ InstallStatus UninstallProduct(const InstallationState& original_state, UninstallActiveSetupEntries(installer_state, product); - UninstallFirewallRules(browser_dist, base::FilePath(chrome_exe)); + UninstallFirewallRules(browser_dist, chrome_exe); RemoveBlacklistState(); diff --git a/chrome/installer/setup/uninstall.h b/chrome/installer/setup/uninstall.h index 2c9151c..58abff6 100644 --- a/chrome/installer/setup/uninstall.h +++ b/chrome/installer/setup/uninstall.h @@ -53,7 +53,7 @@ bool DeleteChromeRegistrationKeys(const InstallerState& installer_state, // longer needed. This is used during autoupdate since we don't do full // uninstalls/reinstalls to update. void RemoveChromeLegacyRegistryKeys(BrowserDistribution* dist, - const base::string16& chrome_exe); + const base::FilePath& chrome_exe); // This function uninstalls a product. Hence we came up with this awesome // name for it. |