diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-30 23:56:18 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-30 23:56:18 +0000 |
commit | b969648e443de8c767d7e2f6b34861b4a1ee3eec (patch) | |
tree | b41dea85b620d7664038e2583614745bc4be6fae /chrome/browser | |
parent | f0a94b593178cfe95dd16424cca6a0144de0d440 (diff) | |
download | chromium_src-b969648e443de8c767d7e2f6b34861b4a1ee3eec.zip chromium_src-b969648e443de8c767d7e2f6b34861b4a1ee3eec.tar.gz chromium_src-b969648e443de8c767d7e2f6b34861b4a1ee3eec.tar.bz2 |
windows: remove PathService::Get() that uses wstrings
This just required fixing the remaining callers.
BUG=24672
Review URL: http://codereview.chromium.org/5356008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67783 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser_main_win.cc | 5 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run_win.cc | 27 | ||||
-rw-r--r-- | chrome/browser/google/google_update.cc | 12 | ||||
-rw-r--r-- | chrome/browser/jumplist_win.cc | 13 | ||||
-rw-r--r-- | chrome/browser/process_singleton_win.cc | 4 | ||||
-rw-r--r-- | chrome/browser/shell_integration_win.cc | 9 |
6 files changed, 35 insertions, 35 deletions
diff --git a/chrome/browser/browser_main_win.cc b/chrome/browser/browser_main_win.cc index f4f9a59..e4b52da 100644 --- a/chrome/browser/browser_main_win.cc +++ b/chrome/browser/browser_main_win.cc @@ -178,8 +178,9 @@ int HandleIconsCommands(const CommandLine &parsed_command_line) { bool CheckMachineLevelInstall() { scoped_ptr<installer::Version> version(InstallUtil::GetChromeVersion(true)); if (version.get()) { - std::wstring exe; - PathService::Get(base::DIR_EXE, &exe); + FilePath exe_path; + PathService::Get(base::DIR_EXE, &exe_path); + std::wstring exe = exe_path.value(); std::transform(exe.begin(), exe.end(), exe.begin(), tolower); std::wstring user_exe_path = installer::GetChromeInstallPath(false); std::transform(user_exe_path.begin(), user_exe_path.end(), diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc index 35037d5..bffded1 100644 --- a/chrome/browser/first_run/first_run_win.cc +++ b/chrome/browser/first_run/first_run_win.cc @@ -68,13 +68,6 @@ bool GetNewerChromeFile(FilePath* path) { return true; } -bool GetBackupChromeFile(std::wstring* path) { - if (!PathService::Get(base::DIR_EXE, path)) - return false; - file_util::AppendToPath(path, installer_util::kChromeOldExe); - return true; -} - bool InvokeGoogleUpdateForRename() { ScopedComPtr<IProcessLauncher> ipl; if (!FAILED(ipl.CreateInstance(__uuidof(ProcessLauncherClass)))) { @@ -225,30 +218,31 @@ void FirstRun::DoDelayedInstallExtensions() { CommandLine* Upgrade::new_command_line_ = NULL; bool FirstRun::CreateChromeDesktopShortcut() { - std::wstring chrome_exe; + FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) return false; BrowserDistribution *dist = BrowserDistribution::GetDistribution(); if (!dist) return false; - return ShellUtil::CreateChromeDesktopShortcut(chrome_exe, + return ShellUtil::CreateChromeDesktopShortcut(chrome_exe.value(), dist->GetAppDescription(), ShellUtil::CURRENT_USER, false, true); // create if doesn't exist. } bool FirstRun::CreateChromeQuickLaunchShortcut() { - std::wstring chrome_exe; + FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) return false; - return ShellUtil::CreateChromeQuickLaunchShortcut(chrome_exe, + return ShellUtil::CreateChromeQuickLaunchShortcut(chrome_exe.value(), ShellUtil::CURRENT_USER, // create only for current user. true); // create if doesn't exist. } bool Upgrade::IsBrowserAlreadyRunning() { static HANDLE handle = NULL; - std::wstring exe; - PathService::Get(base::FILE_EXE, &exe); + FilePath exe_path; + PathService::Get(base::FILE_EXE, &exe_path); + std::wstring exe = exe_path.value(); std::replace(exe.begin(), exe.end(), '\\', '!'); std::transform(exe.begin(), exe.end(), exe.begin(), tolower); exe = L"Global\\" + exe; @@ -273,12 +267,13 @@ bool Upgrade::SwapNewChromeExeIfPresent() { return false; if (!file_util::PathExists(new_chrome_exe)) return false; - std::wstring curr_chrome_exe; - if (!PathService::Get(base::FILE_EXE, &curr_chrome_exe)) + FilePath cur_chrome_exe; + if (!PathService::Get(base::FILE_EXE, &cur_chrome_exe)) return false; // First try to rename exe by launching rename command ourselves. - bool user_install = InstallUtil::IsPerUserInstall(curr_chrome_exe.c_str()); + bool user_install = + InstallUtil::IsPerUserInstall(cur_chrome_exe.value().c_str()); HKEY reg_root = user_install ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE; BrowserDistribution *dist = BrowserDistribution::GetDistribution(); base::win::RegKey key; diff --git a/chrome/browser/google/google_update.cc b/chrome/browser/google/google_update.cc index cb68832..c373b59 100644 --- a/chrome/browser/google/google_update.cc +++ b/chrome/browser/google/google_update.cc @@ -7,6 +7,7 @@ #include <atlbase.h> #include <atlcom.h> +#include "base/file_path.h" #include "base/message_loop.h" #include "base/path_service.h" #include "base/scoped_comptr_win.h" @@ -226,16 +227,17 @@ bool GoogleUpdate::InitiateGoogleUpdateCheck(bool install_if_newer, Window* window, MessageLoop* main_loop) { - std::wstring chrome_exe_path; + FilePath chrome_exe_path; if (!PathService::Get(base::DIR_EXE, &chrome_exe_path)) { NOTREACHED(); return false; } + std::wstring chrome_exe = chrome_exe_path.value(); - std::transform(chrome_exe_path.begin(), chrome_exe_path.end(), - chrome_exe_path.begin(), tolower); + std::transform(chrome_exe.begin(), chrome_exe.end(), + chrome_exe.begin(), tolower); - if (!CanUpdateCurrentChrome(chrome_exe_path)) { + if (!CanUpdateCurrentChrome(chrome_exe)) { main_loop->PostTask(FROM_HERE, NewRunnableMethod(this, &GoogleUpdate::ReportResults, UPGRADE_ERROR, CANNOT_UPGRADE_CHROME_IN_THIS_DIRECTORY)); @@ -254,7 +256,7 @@ bool GoogleUpdate::InitiateGoogleUpdateCheck(bool install_if_newer, ScopedComPtr<IGoogleUpdate> on_demand; - if (InstallUtil::IsPerUserInstall(chrome_exe_path.c_str())) { + if (InstallUtil::IsPerUserInstall(chrome_exe.c_str())) { hr = on_demand.CreateInstance(CLSID_OnDemandUserAppsClass); } else { // The Update operation needs Admin privileges for writing diff --git a/chrome/browser/jumplist_win.cc b/chrome/browser/jumplist_win.cc index ddea51c..083dc80 100644 --- a/chrome/browser/jumplist_win.cc +++ b/chrome/browser/jumplist_win.cc @@ -416,7 +416,7 @@ bool UpdateJumpList(const wchar_t* app_id, return false; // Retrieve the absolute path to "chrome.exe". - std::wstring chrome_path; + FilePath chrome_path; if (!PathService::Get(base::FILE_EXE, &chrome_path)) return false; @@ -447,20 +447,21 @@ bool UpdateJumpList(const wchar_t* app_id, // This update request is applied into the JumpList when we commit this // transaction. result = UpdateCategory(destination_list, IDS_NEW_TAB_MOST_VISITED, - chrome_path, chrome_switches, most_visited_pages, - most_visited_items); + chrome_path.value(), chrome_switches, + most_visited_pages, most_visited_items); if (FAILED(result)) return false; // Update the "Recently Closed" category of the JumpList. result = UpdateCategory(destination_list, IDS_NEW_TAB_RECENTLY_CLOSED, - chrome_path, chrome_switches, recently_closed_pages, - recently_closed_items); + chrome_path.value(), chrome_switches, + recently_closed_pages, recently_closed_items); if (FAILED(result)) return false; // Update the "Tasks" category of the JumpList. - result = UpdateTaskCategory(destination_list, chrome_path, chrome_switches); + result = UpdateTaskCategory(destination_list, chrome_path.value(), + chrome_switches); if (FAILED(result)) return false; diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc index 875c6c2..35d7a0c 100644 --- a/chrome/browser/process_singleton_win.cc +++ b/chrome/browser/process_singleton_win.cc @@ -91,10 +91,10 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() { // Found another window, send our command line to it // format is "START\0<<<current directory>>>\0<<<commandline>>>". std::wstring to_send(L"START\0", 6); // want the NULL in the string. - std::wstring cur_dir; + FilePath cur_dir; if (!PathService::Get(base::DIR_CURRENT, &cur_dir)) return PROCESS_NONE; - to_send.append(cur_dir); + to_send.append(cur_dir.value()); to_send.append(L"\0", 1); // Null separator. to_send.append(GetCommandLineW()); to_send.append(L"\0", 1); // Null separator. diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc index f358ffd..044a787 100644 --- a/chrome/browser/shell_integration_win.cc +++ b/chrome/browser/shell_integration_win.cc @@ -265,7 +265,7 @@ bool MigrateChromiumShortcutsTask::GetShortcutAppId( }; bool ShellIntegration::SetAsDefaultBrowser() { - std::wstring chrome_exe; + FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { LOG(ERROR) << "Error getting app exe path"; return false; @@ -273,7 +273,7 @@ bool ShellIntegration::SetAsDefaultBrowser() { // From UI currently we only allow setting default browser for current user. if (!ShellUtil::MakeChromeDefault(ShellUtil::CURRENT_USER, - chrome_exe, true)) { + chrome_exe.value(), true)) { LOG(ERROR) << "Chrome could not be set as default browser."; return false; } @@ -285,7 +285,7 @@ bool ShellIntegration::SetAsDefaultBrowser() { ShellIntegration::DefaultBrowserState ShellIntegration::IsDefaultBrowser() { // First determine the app path. If we can't determine what that is, we have // bigger fish to fry... - std::wstring app_path; + FilePath app_path; if (!PathService::Get(base::FILE_EXE, &app_path)) { LOG(ERROR) << "Error getting app exe path"; return UNKNOWN_DEFAULT_BROWSER; @@ -330,7 +330,8 @@ ShellIntegration::DefaultBrowserState ShellIntegration::IsDefaultBrowser() { pAAR->Release(); } else { std::wstring short_app_path; - GetShortPathName(app_path.c_str(), WriteInto(&short_app_path, MAX_PATH), + GetShortPathName(app_path.value().c_str(), + WriteInto(&short_app_path, MAX_PATH), MAX_PATH); // open command for protocol associations |