summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-24 03:49:01 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-24 03:49:01 +0000
commit08729cc56a5177d795ada1723ea1bf70557df0ee (patch)
treea056473e78c206403b53489913559cf92b3736bc /chrome
parent0556cfbcf7cb03445a628d6b71a9536f762cc3c3 (diff)
downloadchromium_src-08729cc56a5177d795ada1723ea1bf70557df0ee.zip
chromium_src-08729cc56a5177d795ada1723ea1bf70557df0ee.tar.gz
chromium_src-08729cc56a5177d795ada1723ea1bf70557df0ee.tar.bz2
Use FilePath::DirName instead of the deprecated file_util::GetDirectoryFromPath.
BUG=24672 TEST=compiles Review URL: http://codereview.chromium.org/2110021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48014 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/user_data_manager.cc10
-rw-r--r--chrome/browser/web_applications/web_app.cc8
-rw-r--r--chrome/installer/setup/uninstall.cc21
3 files changed, 20 insertions, 19 deletions
diff --git a/chrome/browser/user_data_manager.cc b/chrome/browser/user_data_manager.cc
index 25bd366..b299ffa 100644
--- a/chrome/browser/user_data_manager.cc
+++ b/chrome/browser/user_data_manager.cc
@@ -258,16 +258,16 @@ bool UserDataManager::CreateShortcutForProfileInFolder(
const FilePath& folder,
const std::wstring& profile_name) const {
#if defined(OS_WIN)
- std::wstring exe_path;
+ FilePath exe_path;
if (!PathService::Get(base::FILE_EXE, &exe_path))
return false;
// Working directory.
- std::wstring exe_folder = file_util::GetDirectoryFromPath(exe_path);
+ FilePath exe_folder = exe_path.DirName();
// Command and arguments.
std::wstring cmd;
- cmd = StringPrintf(L"\"%ls\"", exe_path.c_str());
+ cmd = StringPrintf(L"\"%ls\"", exe_path.value().c_str());
std::wstring user_data_dir = GetUserDataFolderForProfile(profile_name);
std::wstring args = CommandLine::PrefixedSwitchStringWithValue(
switches::kUserDataDir,
@@ -288,10 +288,10 @@ bool UserDataManager::CreateShortcutForProfileInFolder(
return file_util::CreateShortcutLink(
cmd.c_str(),
shortcut_path.value().c_str(),
- exe_folder.c_str(),
+ exe_folder.value().c_str(),
args.c_str(),
NULL,
- exe_path.c_str(),
+ exe_path.value().c_str(),
0,
ShellIntegration::GetChromiumAppId(profile_path).c_str());
#else
diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc
index 0674c0d..d84ad67 100644
--- a/chrome/browser/web_applications/web_app.cc
+++ b/chrome/browser/web_applications/web_app.cc
@@ -355,14 +355,14 @@ bool CreateShortcutTask::CreateShortcut() {
return false;
}
- std::wstring chrome_exe;
+ FilePath chrome_exe;
if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
NOTREACHED();
return false;
}
// Working directory.
- std::wstring chrome_folder = file_util::GetDirectoryFromPath(chrome_exe);
+ FilePath chrome_folder = chrome_exe.DirName();
std::string switches =
ShellIntegration::GetCommandLineArgumentsCommon(shortcut_info_.url,
@@ -393,9 +393,9 @@ bool CreateShortcutTask::CreateShortcut() {
download_util::AppendNumberToPath(&shortcut_file, unique_number);
}
- success &= file_util::CreateShortcutLink(chrome_exe.c_str(),
+ success &= file_util::CreateShortcutLink(chrome_exe.value().c_str(),
shortcut_file.value().c_str(),
- chrome_folder.c_str(),
+ chrome_folder.value().c_str(),
wide_switchs.c_str(),
shortcut_info_.description.c_str(),
icon_file.value().c_str(),
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index 79ccdbe..4338cb6 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -139,20 +139,21 @@ bool ScheduleParentAndGrandparentForDeletion(const FilePath& path) {
}
// Deletes empty parent & empty grandparent dir of given path.
-bool DeleteEmptyParentDir(const std::wstring& path) {
+bool DeleteEmptyParentDir(const FilePath& path) {
bool ret = true;
- std::wstring parent_dir = file_util::GetDirectoryFromPath(path);
- if (!parent_dir.empty() && file_util::IsDirectoryEmpty(parent_dir)) {
+ FilePath parent_dir = path.DirName();
+ if (!parent_dir.empty() && file_util::IsDirectoryEmpty(parent_dir.value())) {
if (!file_util::Delete(parent_dir, true)) {
ret = false;
- LOG(ERROR) << "Failed to delete folder: " << parent_dir;
+ LOG(ERROR) << "Failed to delete folder: " << parent_dir.value();
}
- parent_dir = file_util::GetDirectoryFromPath(parent_dir);
- if (!parent_dir.empty() && file_util::IsDirectoryEmpty(parent_dir)) {
+ parent_dir = parent_dir.DirName();
+ if (!parent_dir.empty() &&
+ file_util::IsDirectoryEmpty(parent_dir.value())) {
if (!file_util::Delete(parent_dir, true)) {
ret = false;
- LOG(ERROR) << "Failed to delete folder: " << parent_dir;
+ LOG(ERROR) << "Failed to delete folder: " << parent_dir.value();
}
}
}
@@ -257,7 +258,7 @@ DeleteResult DeleteFilesAndFolders(const std::wstring& exe_path,
if (result == DELETE_REQUIRES_REBOOT) {
ScheduleParentAndGrandparentForDeletion(user_local_state);
} else {
- DeleteEmptyParentDir(user_local_state.value());
+ DeleteEmptyParentDir(user_local_state);
}
}
@@ -269,7 +270,7 @@ DeleteResult DeleteFilesAndFolders(const std::wstring& exe_path,
} else {
// Now check and delete if the parent directories are empty
// For example Google\Chrome or Chromium
- DeleteEmptyParentDir(install_path);
+ DeleteEmptyParentDir(FilePath(install_path));
}
return result;
}