summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util/shell_util.cc
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-14 20:30:45 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-14 20:30:45 +0000
commitfc8edf5c2a5af722cbfe4c1605b5c0de4c17ae9b (patch)
treec89f45ac847d97edae1ca0fafd391c31e86f2d65 /chrome/installer/util/shell_util.cc
parent8a340e008c9ddf072d1deea25af7c142db7f8b50 (diff)
downloadchromium_src-fc8edf5c2a5af722cbfe4c1605b5c0de4c17ae9b.zip
chromium_src-fc8edf5c2a5af722cbfe4c1605b5c0de4c17ae9b.tar.gz
chromium_src-fc8edf5c2a5af722cbfe4c1605b5c0de4c17ae9b.tar.bz2
CommandLine: remove wstring-based program() accessor
This was already removed on non-Windows, so this change modifies the remaining Windows-specific usage. In a few places I converted use of wstring paths into FilePath, but in general for Windows-specific code I don't think it's too important to use FilePath everywhere, because it is equivalent on Windows and the current code already works. BUG=23581 Review URL: http://codereview.chromium.org/3817001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62637 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util/shell_util.cc')
-rw-r--r--chrome/installer/util/shell_util.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index f8c3b27..b3cf02b 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -298,18 +298,20 @@ bool IsChromeRegistered(const std::wstring& chrome_exe,
// we capture and return.
bool ElevateAndRegisterChrome(const std::wstring& chrome_exe,
const std::wstring& suffix) {
- std::wstring exe_path(file_util::GetDirectoryFromPath(chrome_exe));
- file_util::AppendToPath(&exe_path, installer_util::kSetupExe);
- if (!file_util::PathExists(FilePath::FromWStringHack(exe_path))) {
+ FilePath exe_path =
+ FilePath::FromWStringHack(chrome_exe).DirName()
+ .Append(installer_util::kSetupExe);
+ if (!file_util::PathExists(exe_path)) {
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
HKEY reg_root = InstallUtil::IsPerUserInstall(chrome_exe.c_str()) ?
HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
RegKey key(reg_root, dist->GetUninstallRegPath().c_str(), KEY_READ);
- key.ReadValue(installer_util::kUninstallStringField, &exe_path);
- CommandLine command_line = CommandLine::FromString(exe_path);
- exe_path = command_line.program();
+ std::wstring uninstall_string;
+ key.ReadValue(installer_util::kUninstallStringField, &uninstall_string);
+ CommandLine command_line = CommandLine::FromString(uninstall_string);
+ exe_path = command_line.GetProgram();
}
- if (file_util::PathExists(FilePath::FromWStringHack(exe_path))) {
+ if (file_util::PathExists(exe_path)) {
std::wstring params(L"--");
params.append(
ASCIIToWide(installer_util::switches::kRegisterChromeBrowser));
@@ -328,7 +330,7 @@ bool ElevateAndRegisterChrome(const std::wstring& chrome_exe,
}
DWORD ret_val = 0;
- InstallUtil::ExecuteExeAsAdmin(exe_path, params, &ret_val);
+ InstallUtil::ExecuteExeAsAdmin(exe_path.value(), params, &ret_val);
if (ret_val == 0)
return true;
}