summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-13 09:18:34 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-13 09:18:34 +0000
commit6c8152e083e52454063fd717ecc0bb193b0c808d (patch)
tree17cdfdd9a455c4f6c2b0c39cf4e24616fcc106b9
parentf91a6f86d1847f2335dabf4d1757c5af662c7851 (diff)
downloadchromium_src-6c8152e083e52454063fd717ecc0bb193b0c808d.zip
chromium_src-6c8152e083e52454063fd717ecc0bb193b0c808d.tar.gz
chromium_src-6c8152e083e52454063fd717ecc0bb193b0c808d.tar.bz2
Cleanup: Remove deprecated version of file_util::AppendToPath().
BUG=24672 TEST=none Review URL: http://codereview.chromium.org/9585001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126363 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/file_util.cc11
-rw-r--r--base/file_util_deprecated.h4
-rw-r--r--base/file_util_unittest.cc16
-rw-r--r--base/test/test_file_util_win.cc5
-rw-r--r--chrome/browser/printing/printing_layout_uitest.cc24
-rw-r--r--chrome/test/mini_installer_test/installer_test_util.cc25
-rw-r--r--content/common/sandbox_policy.cc8
7 files changed, 27 insertions, 66 deletions
diff --git a/base/file_util.cc b/base/file_util.cc
index ddb0d35..bedd23d 100644
--- a/base/file_util.cc
+++ b/base/file_util.cc
@@ -383,17 +383,6 @@ bool MemoryMappedFile::MapFileToMemory(const FilePath& file_name) {
// Deprecated functions ----------------------------------------------------
#if defined(OS_WIN)
-void AppendToPath(std::wstring* path, const std::wstring& new_ending) {
- if (!path) {
- NOTREACHED();
- return; // Don't crash in this function in release builds.
- }
-
- if (!EndsWithSeparator(FilePath(*path)))
- path->push_back(FilePath::kSeparators[0]);
- path->append(new_ending);
-}
-
FILE* OpenFile(const std::wstring& filename, const char* mode) {
return OpenFile(FilePath::FromWStringHack(filename), mode);
}
diff --git a/base/file_util_deprecated.h b/base/file_util_deprecated.h
index 985ab4a..1cbec1a 100644
--- a/base/file_util_deprecated.h
+++ b/base/file_util_deprecated.h
@@ -30,10 +30,6 @@ namespace file_util {
BASE_EXPORT FILE* OpenFile(const std::string& filename, const char* mode);
BASE_EXPORT FILE* OpenFile(const std::wstring& filename, const char* mode);
-// Appends new_ending to path, adding a separator between the two if necessary.
-BASE_EXPORT void AppendToPath(std::wstring* path,
- const std::wstring& new_ending);
-
// Use version that takes a FilePath.
BASE_EXPORT int ReadFile(const std::wstring& filename, char* data, int size);
BASE_EXPORT int WriteFile(const std::wstring& filename,
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
index 63afd4b..5430a2d 100644
--- a/base/file_util_unittest.cc
+++ b/base/file_util_unittest.cc
@@ -234,22 +234,6 @@ const struct append_case {
#endif
};
-#if defined(OS_WIN)
-// This function is deprecated, but still used on Windows.
-TEST_F(FileUtilTest, AppendToPath) {
- for (unsigned int i = 0; i < arraysize(append_cases); ++i) {
- const append_case& value = append_cases[i];
- std::wstring result = value.path;
- file_util::AppendToPath(&result, value.ending);
- EXPECT_EQ(value.result, result);
- }
-
-#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
- file_util::AppendToPath(NULL, L"path"); // asserts in debug mode
-#endif
-}
-#endif // defined(OS_WIN)
-
static const struct filename_case {
const wchar_t* path;
const wchar_t* filename;
diff --git a/base/test/test_file_util_win.cc b/base/test/test_file_util_win.cc
index 70ca907..f028080 100644
--- a/base/test/test_file_util_win.cc
+++ b/base/test/test_file_util_win.cc
@@ -176,11 +176,10 @@ bool CopyRecursiveDirNoCache(const FilePath& source_dir,
std::vector<std::wstring> files_copied;
- std::wstring src(source_dir.value());
- file_util::AppendToPath(&src, L"*");
+ FilePath src(source_dir.AppendASCII("*"));
WIN32_FIND_DATA fd;
- HANDLE fh = FindFirstFile(src.c_str(), &fd);
+ HANDLE fh = FindFirstFile(src.value().c_str(), &fd);
if (fh == INVALID_HANDLE_VALUE)
return false;
diff --git a/chrome/browser/printing/printing_layout_uitest.cc b/chrome/browser/printing/printing_layout_uitest.cc
index 29c7d15..97584f1 100644
--- a/chrome/browser/printing/printing_layout_uitest.cc
+++ b/chrome/browser/printing/printing_layout_uitest.cc
@@ -60,18 +60,14 @@ class PrintingLayoutTest : public PrintingTest<UITest> {
return 100.;
}
- std::wstring verification_file(test_data_directory_.value());
- file_util::AppendToPath(&verification_file, L"printing");
- file_util::AppendToPath(&verification_file, verification_name);
- FilePath emf(verification_file + L".emf");
- FilePath png(verification_file + L".png");
+ FilePath base_path(test_data_directory_.AppendASCII("printing"));
+ FilePath emf(base_path.Append(verification_name + L".emf"));
+ FilePath png(base_path.Append(verification_name + L".png"));
+ FilePath cleartype(base_path.Append(verification_name + L"_cleartype.png"));
// Looks for Cleartype override.
- if (file_util::PathExists(
- FilePath::FromWStringHack(verification_file + L"_cleartype.png")) &&
- IsClearTypeEnabled()) {
- png = FilePath(verification_file + L"_cleartype.png");
- }
+ if (file_util::PathExists(cleartype) && IsClearTypeEnabled())
+ png = cleartype;
if (GenerateFiles()) {
// Copy the .emf and generate an .png.
@@ -92,8 +88,8 @@ class PrintingLayoutTest : public PrintingTest<UITest> {
" result size:" << test_content.size().ToString();
if (diff_emf) {
// Backup the result emf file.
- file_util::CopyFile(test_result, FilePath(
- verification_file + L"_failed.emf"));
+ FilePath failed(base_path.Append(verification_name + L"_failed.emf"));
+ file_util::CopyFile(test_result, failed);
}
// This verification is only to know that the EMF rendering stays
@@ -104,7 +100,9 @@ class PrintingLayoutTest : public PrintingTest<UITest> {
" result size:" << test_content.size().ToString();
if (diff_png) {
// Backup the rendered emf file to detect the rendering difference.
- emf_content.SaveToPng(FilePath(verification_file + L"_rendering.png"));
+ FilePath rendering(
+ base_path.Append(verification_name + L"_rendering.png"));
+ emf_content.SaveToPng(rendering);
}
return std::max(diff_png, diff_emf);
}
diff --git a/chrome/test/mini_installer_test/installer_test_util.cc b/chrome/test/mini_installer_test/installer_test_util.cc
index 4e2a7ea..ad93c54 100644
--- a/chrome/test/mini_installer_test/installer_test_util.cc
+++ b/chrome/test/mini_installer_test/installer_test_util.cc
@@ -56,28 +56,24 @@ bool DeleteInstallDirectory(bool system_level,
if (version.empty())
return false;
FilePath path;
- if (!GetInstallDirectory(system_level,
- ToBrowserDistributionType(type), &path) ||
- !file_util::PathExists(path))
+ bool has_install_dir = GetInstallDirectory(system_level,
+ ToBrowserDistributionType(type),
+ &path);
+ if (!has_install_dir || !file_util::PathExists(path))
return false;
path = path.AppendASCII(version);
- if (!file_util::Delete(path, true))
- return false;
- return true;
+ return file_util::Delete(path, true);
}
bool DeleteRegistryKey(bool system_level,
InstallationValidator::InstallationType type) {
- FilePath::StringType key(google_update::kRegPathClients);
BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution(
ToBrowserDistributionType(type));
- file_util::AppendToPath(&key, dist->GetAppGuid());
- HKEY root = HKEY_CURRENT_USER;
- if (system_level)
- root = HKEY_LOCAL_MACHINE;
- if (InstallUtil::DeleteRegistryKey(root, key))
- return true;
- return false;
+ FilePath::StringType key(google_update::kRegPathClients);
+ key.push_back(FilePath::kSeparators[0]);
+ key.append(dist->GetAppGuid());
+ HKEY root = system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
+ return InstallUtil::DeleteRegistryKey(root, key);
}
bool GetChromeInstallDirectory(bool system_level, FilePath* path) {
@@ -303,4 +299,3 @@ bool RunAndWaitForCommandToFinish(CommandLine command) {
}
} // namespace
-
diff --git a/content/common/sandbox_policy.cc b/content/common/sandbox_policy.cc
index c8caab9..954a861 100644
--- a/content/common/sandbox_policy.cc
+++ b/content/common/sandbox_policy.cc
@@ -290,11 +290,11 @@ bool AddGenericPolicy(sandbox::TargetPolicy* policy) {
if (long_path_return_value == 0 || long_path_return_value >= MAX_PATH)
return false;
- string16 debug_message(long_path_buf);
- file_util::AppendToPath(&debug_message, L"debug_message.exe");
+ FilePath debug_message(long_path_buf);
+ debug_message = debug_message.AppendASCII("debug_message.exe");
result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_PROCESS,
sandbox::TargetPolicy::PROCESS_MIN_EXEC,
- debug_message.c_str());
+ debug_message.value().c_str());
if (result != sandbox::SBOX_ALL_OK)
return false;
#endif // NDEBUG
@@ -580,7 +580,7 @@ base::ProcessHandle StartProcessWithAccess(CommandLine* cmd_line,
(base::win::OSInfo::GetInstance()->wow64_status() ==
base::win::OSInfo::WOW64_DISABLED)) {
const SIZE_T kOneGigabyte = 1 << 30;
- void *nacl_mem = VirtualAllocEx(target.hProcess,
+ void* nacl_mem = VirtualAllocEx(target.hProcess,
NULL,
kOneGigabyte,
MEM_RESERVE,