Replace FilePath with base::FilePath.
This is im preparation for removing the 'using" in file_path.h
Review URL: https://codereview.chromium.org/12286020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@183021 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 023ad6abe4b833b9478992176b13b5a073895cdc
diff --git a/base/command_line_unittest.cc b/base/command_line_unittest.cc
index 372af37..62080d1 100644
--- a/base/command_line_unittest.cc
+++ b/base/command_line_unittest.cc
@@ -11,6 +11,8 @@
#include "base/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
+using base::FilePath;
+
// To test Windows quoting behavior, we use a string that has some backslashes
// and quotes.
// Consider the command-line argument: q\"bs1\bs2\\bs3q\\\"
diff --git a/base/file_path_unittest.cc b/base/file_path_unittest.cc
index 5a9e5cd..ba6c8a2 100644
--- a/base/file_path_unittest.cc
+++ b/base/file_path_unittest.cc
@@ -15,6 +15,8 @@
// This macro constructs strings which can contain NULs.
#define FPS(x) FilePath::StringType(FPL(x), arraysize(FPL(x)) - 1)
+namespace base {
+
struct UnaryTestData {
const FilePath::CharType* input;
const FilePath::CharType* expected;
@@ -1196,3 +1198,5 @@
}
#endif
+
+} // namespace base
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
index 612f6cf..8ae567d 100644
--- a/base/file_util_unittest.cc
+++ b/base/file_util_unittest.cc
@@ -34,6 +34,8 @@
// This macro helps avoid wrapped lines in the test structs.
#define FPL(x) FILE_PATH_LITERAL(x)
+using base::FilePath;
+
namespace {
// To test that file_util::Normalize FilePath() deals with NTFS reparse points
diff --git a/base/i18n/file_util_icu.cc b/base/i18n/file_util_icu.cc
index 0b04370..2f45efc 100644
--- a/base/i18n/file_util_icu.cc
+++ b/base/i18n/file_util_icu.cc
@@ -137,7 +137,7 @@
return IllegalCharacters::GetInstance()->containsNone(file_name);
}
-void ReplaceIllegalCharactersInPath(FilePath::StringType* file_name,
+void ReplaceIllegalCharactersInPath(base::FilePath::StringType* file_name,
char replace_char) {
DCHECK(file_name);
@@ -180,7 +180,8 @@
}
}
-bool LocaleAwareCompareFilenames(const FilePath& a, const FilePath& b) {
+bool LocaleAwareCompareFilenames(const base::FilePath& a,
+ const base::FilePath& b) {
#if defined(OS_WIN)
return LocaleAwareComparator::GetInstance()->Compare(a.value().c_str(),
b.value().c_str()) < 0;
@@ -200,13 +201,13 @@
#endif
}
-void NormalizeFileNameEncoding(FilePath* file_name) {
+void NormalizeFileNameEncoding(base::FilePath* file_name) {
#if defined(OS_CHROMEOS)
std::string normalized_str;
if (base::ConvertToUtf8AndNormalize(file_name->BaseName().value(),
base::kCodepageUTF8,
&normalized_str)) {
- *file_name = file_name->DirName().Append(FilePath(normalized_str));
+ *file_name = file_name->DirName().Append(base::FilePath(normalized_str));
}
#endif
}
diff --git a/base/path_service_unittest.cc b/base/path_service_unittest.cc
index b71f078..7c0f036 100644
--- a/base/path_service_unittest.cc
+++ b/base/path_service_unittest.cc
@@ -26,7 +26,7 @@
// Returns true if PathService::Get returns true and sets the path parameter
// to non-empty for the given PathService::DirType enumeration value.
bool ReturnsValidPath(int dir_type) {
- FilePath path;
+ base::FilePath path;
bool result = PathService::Get(dir_type, &path);
// Some paths might not exist on some platforms in which case confirming
@@ -81,7 +81,7 @@
// of Windows. Checks that the function fails and that the returned path is
// empty.
bool ReturnsInvalidPath(int dir_type) {
- FilePath path;
+ base::FilePath path;
bool result = PathService::Get(dir_type, &path);
return !result && path.empty();
}
@@ -152,13 +152,13 @@
int my_special_key = 666;
base::ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
- FilePath fake_cache_dir(temp_dir.path().AppendASCII("cache"));
+ base::FilePath fake_cache_dir(temp_dir.path().AppendASCII("cache"));
// PathService::Override should always create the path provided if it doesn't
// exist.
EXPECT_TRUE(PathService::Override(my_special_key, fake_cache_dir));
EXPECT_TRUE(file_util::PathExists(fake_cache_dir));
- FilePath fake_cache_dir2(temp_dir.path().AppendASCII("cache2"));
+ base::FilePath fake_cache_dir2(temp_dir.path().AppendASCII("cache2"));
// PathService::OverrideAndCreateIfNeeded should obey the |create| parameter.
PathService::OverrideAndCreateIfNeeded(my_special_key,
fake_cache_dir2,
@@ -175,17 +175,17 @@
int my_special_key = 666;
base::ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
- FilePath fake_cache_dir1(temp_dir.path().AppendASCII("1"));
+ base::FilePath fake_cache_dir1(temp_dir.path().AppendASCII("1"));
EXPECT_TRUE(PathService::Override(my_special_key, fake_cache_dir1));
EXPECT_TRUE(file_util::PathExists(fake_cache_dir1));
ASSERT_EQ(1, file_util::WriteFile(fake_cache_dir1.AppendASCII("t1"), ".", 1));
- FilePath fake_cache_dir2(temp_dir.path().AppendASCII("2"));
+ base::FilePath fake_cache_dir2(temp_dir.path().AppendASCII("2"));
EXPECT_TRUE(PathService::Override(my_special_key + 1, fake_cache_dir2));
EXPECT_TRUE(file_util::PathExists(fake_cache_dir2));
ASSERT_EQ(1, file_util::WriteFile(fake_cache_dir2.AppendASCII("t2"), ".", 1));
- FilePath result;
+ base::FilePath result;
EXPECT_TRUE(PathService::Get(my_special_key, &result));
// Override might have changed the path representation but our test file
// should be still there.
@@ -199,14 +199,14 @@
// clear any overrides that might have been left from other tests.
PathService::RemoveOverride(base::DIR_TEMP);
- FilePath original_user_data_dir;
+ base::FilePath original_user_data_dir;
EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &original_user_data_dir));
EXPECT_FALSE(PathService::RemoveOverride(base::DIR_TEMP));
base::ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
EXPECT_TRUE(PathService::Override(base::DIR_TEMP, temp_dir.path()));
- FilePath new_user_data_dir;
+ base::FilePath new_user_data_dir;
EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &new_user_data_dir));
EXPECT_NE(original_user_data_dir, new_user_data_dir);
diff --git a/base/perftimer.cc b/base/perftimer.cc
index 4c64c5e..94158c8 100644
--- a/base/perftimer.cc
+++ b/base/perftimer.cc
@@ -14,7 +14,7 @@
static FILE* perf_log_file = NULL;
-bool InitPerfLog(const FilePath& log_file) {
+bool InitPerfLog(const base::FilePath& log_file) {
if (perf_log_file) {
// trying to initialize twice
NOTREACHED();
diff --git a/base/platform_file_unittest.cc b/base/platform_file_unittest.cc
index 3b07c98..36ec3ee 100644
--- a/base/platform_file_unittest.cc
+++ b/base/platform_file_unittest.cc
@@ -8,6 +8,8 @@
#include "base/time.h"
#include "testing/gtest/include/gtest/gtest.h"
+using base::FilePath;
+
namespace {
// Reads from a file the given number of bytes, or until EOF is reached.
diff --git a/base/prefs/json_pref_store.cc b/base/prefs/json_pref_store.cc
index 0447975..0d3d42e 100644
--- a/base/prefs/json_pref_store.cc
+++ b/base/prefs/json_pref_store.cc
@@ -20,7 +20,7 @@
namespace {
// Some extensions we'll tack on to copies of the Preferences files.
-const FilePath::CharType* kBadExtension = FILE_PATH_LITERAL("bad");
+const base::FilePath::CharType* kBadExtension = FILE_PATH_LITERAL("bad");
// Differentiates file loading between origin thread and passed
// (aka file) thread.
@@ -36,7 +36,7 @@
origin_loop_proxy_(base::MessageLoopProxy::current()) {
}
- void Start(const FilePath& path) {
+ void Start(const base::FilePath& path) {
DCHECK(origin_loop_proxy_->BelongsToCurrentThread());
sequenced_task_runner_->PostTask(
FROM_HERE,
@@ -45,7 +45,7 @@
}
// Deserializes JSON on the sequenced task runner.
- void ReadFileAndReport(const FilePath& path) {
+ void ReadFileAndReport(const base::FilePath& path) {
DCHECK(sequenced_task_runner_->RunsTasksOnCurrentThread());
value_.reset(DoReading(path, &error_, &no_dir_));
@@ -61,7 +61,7 @@
delegate_->OnFileRead(value_.release(), error_, no_dir_);
}
- static Value* DoReading(const FilePath& path,
+ static Value* DoReading(const base::FilePath& path,
PersistentPrefStore::PrefReadError* error,
bool* no_dir) {
int error_code;
@@ -74,7 +74,7 @@
}
static void HandleErrors(const Value* value,
- const FilePath& path,
+ const base::FilePath& path,
int error_code,
const std::string& error_msg,
PersistentPrefStore::PrefReadError* error);
@@ -94,7 +94,7 @@
// static
void FileThreadDeserializer::HandleErrors(
const Value* value,
- const FilePath& path,
+ const base::FilePath& path,
int error_code,
const std::string& error_msg,
PersistentPrefStore::PrefReadError* error) {
@@ -123,7 +123,7 @@
// We keep the old file for possible support and debugging assistance
// as well as to detect if they're seeing these errors repeatedly.
// TODO(erikkay) Instead, use the last known good file.
- FilePath bad = path.ReplaceExtension(kBadExtension);
+ base::FilePath bad = path.ReplaceExtension(kBadExtension);
// If they've ever had a parse error before, put them in another bucket.
// TODO(erikkay) if we keep this error checking for very long, we may
@@ -141,7 +141,7 @@
} // namespace
scoped_refptr<base::SequencedTaskRunner> JsonPrefStore::GetTaskRunnerForFile(
- const FilePath& filename,
+ const base::FilePath& filename,
base::SequencedWorkerPool* worker_pool) {
std::string token("json_pref_store-");
token.append(filename.AsUTF8Unsafe());
@@ -150,7 +150,7 @@
base::SequencedWorkerPool::BLOCK_SHUTDOWN);
}
-JsonPrefStore::JsonPrefStore(const FilePath& filename,
+JsonPrefStore::JsonPrefStore(const base::FilePath& filename,
base::SequencedTaskRunner* sequenced_task_runner)
: path_(filename),
sequenced_task_runner_(sequenced_task_runner),
diff --git a/base/prefs/json_pref_store_unittest.cc b/base/prefs/json_pref_store_unittest.cc
index cc9912a..175ef2c 100644
--- a/base/prefs/json_pref_store_unittest.cc
+++ b/base/prefs/json_pref_store_unittest.cc
@@ -55,14 +55,14 @@
// The path to temporary directory used to contain the test operations.
base::ScopedTempDir temp_dir_;
// The path to the directory where the test data is stored.
- FilePath data_dir_;
+ base::FilePath data_dir_;
// A message loop that we can use as the file thread message loop.
MessageLoop message_loop_;
};
// Test fallback behavior for a nonexistent file.
TEST_F(JsonPrefStoreTest, NonExistentFile) {
- FilePath bogus_input_file = data_dir_.AppendASCII("read.txt");
+ base::FilePath bogus_input_file = data_dir_.AppendASCII("read.txt");
ASSERT_FALSE(file_util::PathExists(bogus_input_file));
scoped_refptr<JsonPrefStore> pref_store =
new JsonPrefStore(
@@ -74,8 +74,8 @@
// Test fallback behavior for an invalid file.
TEST_F(JsonPrefStoreTest, InvalidFile) {
- FilePath invalid_file_original = data_dir_.AppendASCII("invalid.json");
- FilePath invalid_file = temp_dir_.path().AppendASCII("invalid.json");
+ base::FilePath invalid_file_original = data_dir_.AppendASCII("invalid.json");
+ base::FilePath invalid_file = temp_dir_.path().AppendASCII("invalid.json");
ASSERT_TRUE(file_util::CopyFile(invalid_file_original, invalid_file));
scoped_refptr<JsonPrefStore> pref_store =
new JsonPrefStore(
@@ -86,7 +86,7 @@
// The file should have been moved aside.
EXPECT_FALSE(file_util::PathExists(invalid_file));
- FilePath moved_aside = temp_dir_.path().AppendASCII("invalid.bad");
+ base::FilePath moved_aside = temp_dir_.path().AppendASCII("invalid.bad");
EXPECT_TRUE(file_util::PathExists(moved_aside));
EXPECT_TRUE(file_util::TextContentsEqual(invalid_file_original,
moved_aside));
@@ -95,8 +95,8 @@
// This function is used to avoid code duplication while testing synchronous and
// asynchronous version of the JsonPrefStore loading.
void RunBasicJsonPrefStoreTest(JsonPrefStore* pref_store,
- const FilePath& output_file,
- const FilePath& golden_output_file) {
+ const base::FilePath& output_file,
+ const base::FilePath& golden_output_file) {
const char kNewWindowsInTabs[] = "tabs.new_windows_in_tabs";
const char kMaxTabs[] = "tabs.max_tabs";
const char kLongIntPref[] = "long_int.pref";
@@ -112,10 +112,10 @@
const char kSomeDirectory[] = "some_directory";
EXPECT_TRUE(pref_store->GetValue(kSomeDirectory, &actual));
- FilePath::StringType path;
+ base::FilePath::StringType path;
EXPECT_TRUE(actual->GetAsString(&path));
- EXPECT_EQ(FilePath::StringType(FILE_PATH_LITERAL("/usr/local/")), path);
- FilePath some_path(FILE_PATH_LITERAL("/usr/sbin/"));
+ EXPECT_EQ(base::FilePath::StringType(FILE_PATH_LITERAL("/usr/local/")), path);
+ base::FilePath some_path(FILE_PATH_LITERAL("/usr/sbin/"));
pref_store->SetValue(kSomeDirectory, new StringValue(some_path.value()));
EXPECT_TRUE(pref_store->GetValue(kSomeDirectory, &actual));
@@ -163,7 +163,7 @@
temp_dir_.path().AppendASCII("write.json")));
// Test that the persistent value can be loaded.
- FilePath input_file = temp_dir_.path().AppendASCII("write.json");
+ base::FilePath input_file = temp_dir_.path().AppendASCII("write.json");
ASSERT_TRUE(file_util::PathExists(input_file));
scoped_refptr<JsonPrefStore> pref_store =
new JsonPrefStore(
@@ -191,7 +191,7 @@
temp_dir_.path().AppendASCII("write.json")));
// Test that the persistent value can be loaded.
- FilePath input_file = temp_dir_.path().AppendASCII("write.json");
+ base::FilePath input_file = temp_dir_.path().AppendASCII("write.json");
ASSERT_TRUE(file_util::PathExists(input_file));
scoped_refptr<JsonPrefStore> pref_store =
new JsonPrefStore(
@@ -230,7 +230,7 @@
// Tests asynchronous reading of the file when there is no file.
TEST_F(JsonPrefStoreTest, AsyncNonExistingFile) {
- FilePath bogus_input_file = data_dir_.AppendASCII("read.txt");
+ base::FilePath bogus_input_file = data_dir_.AppendASCII("read.txt");
ASSERT_FALSE(file_util::PathExists(bogus_input_file));
scoped_refptr<JsonPrefStore> pref_store =
new JsonPrefStore(
@@ -251,7 +251,7 @@
}
TEST_F(JsonPrefStoreTest, NeedsEmptyValue) {
- FilePath pref_file = temp_dir_.path().AppendASCII("write.json");
+ base::FilePath pref_file = temp_dir_.path().AppendASCII("write.json");
ASSERT_TRUE(file_util::CopyFile(
data_dir_.AppendASCII("read.need_empty_value.json"),
@@ -292,7 +292,7 @@
RunLoop().RunUntilIdle();
// Compare to expected output.
- FilePath golden_output_file =
+ base::FilePath golden_output_file =
data_dir_.AppendASCII("write.golden.need_empty_value.json");
ASSERT_TRUE(file_util::PathExists(golden_output_file));
EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, pref_file));
diff --git a/base/prefs/public/pref_member.cc b/base/prefs/public/pref_member.cc
index 093af3a..13a0363 100644
--- a/base/prefs/public/pref_member.cc
+++ b/base/prefs/public/pref_member.cc
@@ -104,11 +104,11 @@
}
void PrefMemberBase::Internal::UpdateValue(
- Value* v,
+ base::Value* v,
bool is_managed,
bool is_user_modifiable,
const base::Closure& callback) const {
- scoped_ptr<Value> value(v);
+ scoped_ptr<base::Value> value(v);
base::ScopedClosureRunner closure_runner(callback);
if (IsOnCorrectThread()) {
bool rv = UpdateValueInternal(*value);
@@ -131,9 +131,9 @@
thread_loop_ = message_loop;
}
-bool PrefMemberVectorStringUpdate(const Value& value,
+bool PrefMemberVectorStringUpdate(const base::Value& value,
std::vector<std::string>* string_vector) {
- if (!value.IsType(Value::TYPE_LIST))
+ if (!value.IsType(base::Value::TYPE_LIST))
return false;
const ListValue* list = static_cast<const ListValue*>(&value);
@@ -158,7 +158,8 @@
}
template <>
-bool PrefMember<bool>::Internal::UpdateValueInternal(const Value& value) const {
+bool PrefMember<bool>::Internal::UpdateValueInternal(
+ const base::Value& value) const {
return value.GetAsBoolean(&value_);
}
@@ -168,7 +169,8 @@
}
template <>
-bool PrefMember<int>::Internal::UpdateValueInternal(const Value& value) const {
+bool PrefMember<int>::Internal::UpdateValueInternal(
+ const base::Value& value) const {
return value.GetAsInteger(&value_);
}
@@ -178,7 +180,7 @@
}
template <>
-bool PrefMember<double>::Internal::UpdateValueInternal(const Value& value)
+bool PrefMember<double>::Internal::UpdateValueInternal(const base::Value& value)
const {
return value.GetAsDouble(&value_);
}
@@ -189,18 +191,20 @@
}
template <>
-bool PrefMember<std::string>::Internal::UpdateValueInternal(const Value& value)
+bool PrefMember<std::string>::Internal::UpdateValueInternal(
+ const base::Value& value)
const {
return value.GetAsString(&value_);
}
template <>
-void PrefMember<FilePath>::UpdatePref(const FilePath& value) {
+void PrefMember<base::FilePath>::UpdatePref(const base::FilePath& value) {
prefs()->SetFilePath(pref_name().c_str(), value);
}
template <>
-bool PrefMember<FilePath>::Internal::UpdateValueInternal(const Value& value)
+bool PrefMember<base::FilePath>::Internal::UpdateValueInternal(
+ const base::Value& value)
const {
return base::GetValueAsFilePath(value, &value_);
}
@@ -215,6 +219,6 @@
template <>
bool PrefMember<std::vector<std::string> >::Internal::UpdateValueInternal(
- const Value& value) const {
+ const base::Value& value) const {
return subtle::PrefMemberVectorStringUpdate(value, &value_);
}
diff --git a/base/prefs/public/pref_member.h b/base/prefs/public/pref_member.h
index 4116695..7e27912 100644
--- a/base/prefs/public/pref_member.h
+++ b/base/prefs/public/pref_member.h
@@ -152,7 +152,7 @@
// This function implements StringListPrefMember::UpdateValue().
// It is exposed here for testing purposes.
bool BASE_PREFS_EXPORT PrefMemberVectorStringUpdate(
- const Value& value,
+ const base::Value& value,
std::vector<std::string>* string_vector);
} // namespace subtle
@@ -323,14 +323,16 @@
template <>
BASE_PREFS_EXPORT bool PrefMember<std::string>::Internal::UpdateValueInternal(
- const Value& value) const;
+ const base::Value& value) const;
template <>
-BASE_PREFS_EXPORT void PrefMember<FilePath>::UpdatePref(const FilePath& value);
+BASE_PREFS_EXPORT void PrefMember<base::FilePath>::UpdatePref(
+ const base::FilePath& value);
template <>
-BASE_PREFS_EXPORT bool PrefMember<FilePath>::Internal::UpdateValueInternal(
- const Value& value) const;
+BASE_PREFS_EXPORT bool
+PrefMember<base::FilePath>::Internal::UpdateValueInternal(
+ const base::Value& value) const;
template <>
BASE_PREFS_EXPORT void PrefMember<std::vector<std::string> >::UpdatePref(
@@ -339,13 +341,13 @@
template <>
BASE_PREFS_EXPORT bool
PrefMember<std::vector<std::string> >::Internal::UpdateValueInternal(
- const Value& value) const;
+ const base::Value& value) const;
typedef PrefMember<bool> BooleanPrefMember;
typedef PrefMember<int> IntegerPrefMember;
typedef PrefMember<double> DoublePrefMember;
typedef PrefMember<std::string> StringPrefMember;
-typedef PrefMember<FilePath> FilePathPrefMember;
+typedef PrefMember<base::FilePath> FilePathPrefMember;
// This preference member is expensive for large string arrays.
typedef PrefMember<std::vector<std::string> > StringListPrefMember;
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc
index 8fbad3c..0310e9c 100644
--- a/base/process_util_unittest.cc
+++ b/base/process_util_unittest.cc
@@ -47,6 +47,8 @@
#include "base/process_util_unittest_mac.h"
#endif
+using base::FilePath;
+
namespace {
#if defined(OS_WIN)
diff --git a/base/sys_info_unittest.cc b/base/sys_info_unittest.cc
index 55f9601..8153f2b 100644
--- a/base/sys_info_unittest.cc
+++ b/base/sys_info_unittest.cc
@@ -9,6 +9,7 @@
#include "testing/platform_test.h"
typedef PlatformTest SysInfoTest;
+using base::FilePath;
#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
TEST_F(SysInfoTest, MaxSharedMemorySize) {
diff --git a/base/test/scoped_path_override.cc b/base/test/scoped_path_override.cc
index bb38c7f..495ba2f 100644
--- a/base/test/scoped_path_override.cc
+++ b/base/test/scoped_path_override.cc
@@ -16,7 +16,7 @@
CHECK(result);
}
-ScopedPathOverride::ScopedPathOverride(int key, const FilePath& dir)
+ScopedPathOverride::ScopedPathOverride(int key, const base::FilePath& dir)
: key_(key) {
bool result = PathService::Override(key, dir);
CHECK(result);
diff --git a/base/test/test_file_util_linux.cc b/base/test/test_file_util_linux.cc
index 993750e..958fa81 100644
--- a/base/test/test_file_util_linux.cc
+++ b/base/test/test_file_util_linux.cc
@@ -13,7 +13,7 @@
namespace file_util {
-bool EvictFileFromSystemCache(const FilePath& file) {
+bool EvictFileFromSystemCache(const base::FilePath& file) {
int fd = open(file.value().c_str(), O_RDONLY);
if (fd < 0)
return false;
diff --git a/base/test/test_file_util_posix.cc b/base/test/test_file_util_posix.cc
index 5ebf335..f538bc1 100644
--- a/base/test/test_file_util_posix.cc
+++ b/base/test/test_file_util_posix.cc
@@ -22,7 +22,7 @@
namespace {
// Deny |permission| on the file |path|.
-bool DenyFilePermission(const FilePath& path, mode_t permission) {
+bool DenyFilePermission(const base::FilePath& path, mode_t permission) {
struct stat stat_buf;
if (stat(path.value().c_str(), &stat_buf) != 0)
return false;
@@ -35,7 +35,7 @@
// Gets a blob indicating the permission information for |path|.
// |length| is the length of the blob. Zero on failure.
// Returns the blob pointer, or NULL on failure.
-void* GetPermissionInfo(const FilePath& path, size_t* length) {
+void* GetPermissionInfo(const base::FilePath& path, size_t* length) {
DCHECK(length);
*length = 0;
@@ -55,7 +55,8 @@
// |info| is the pointer to the blob.
// |length| is the length of the blob.
// Either |info| or |length| may be NULL/0, in which case nothing happens.
-bool RestorePermissionInfo(const FilePath& path, void* info, size_t length) {
+bool RestorePermissionInfo(const base::FilePath& path,
+ void* info, size_t length) {
if (!info || (length == 0))
return false;
@@ -71,15 +72,15 @@
} // namespace
-bool DieFileDie(const FilePath& file, bool recurse) {
+bool DieFileDie(const base::FilePath& file, bool recurse) {
// There is no need to workaround Windows problems on POSIX.
// Just pass-through.
return file_util::Delete(file, recurse);
}
// Mostly a verbatim copy of CopyDirectory
-bool CopyRecursiveDirNoCache(const FilePath& source_dir,
- const FilePath& dest_dir) {
+bool CopyRecursiveDirNoCache(const base::FilePath& source_dir,
+ const base::FilePath& dest_dir) {
char top_dir[PATH_MAX];
if (base::strlcpy(top_dir, source_dir.value().c_str(),
arraysize(top_dir)) >= arraysize(top_dir)) {
@@ -87,7 +88,7 @@
}
// This function does not properly handle destinations within the source
- FilePath real_to_path = dest_dir;
+ base::FilePath real_to_path = dest_dir;
if (PathExists(real_to_path)) {
if (!AbsolutePath(&real_to_path))
return false;
@@ -107,7 +108,7 @@
// dest_dir may not exist yet, start the loop with dest_dir
FileEnumerator::FindInfo info;
- FilePath current = source_dir;
+ base::FilePath current = source_dir;
if (stat(source_dir.value().c_str(), &info.stat) < 0) {
DLOG(ERROR) << "CopyRecursiveDirNoCache() couldn't stat source directory: "
<< source_dir.value() << " errno = " << errno;
@@ -123,7 +124,7 @@
DCHECK_EQ('/', suffix[0]);
suffix.erase(0, 1);
}
- const FilePath target_path = dest_dir.Append(suffix);
+ const base::FilePath target_path = dest_dir.Append(suffix);
if (S_ISDIR(info.stat.st_mode)) {
if (mkdir(target_path.value().c_str(), info.stat.st_mode & 01777) != 0 &&
@@ -154,29 +155,29 @@
}
#if !defined(OS_LINUX) && !defined(OS_MACOSX)
-bool EvictFileFromSystemCache(const FilePath& file) {
+bool EvictFileFromSystemCache(const base::FilePath& file) {
// There doesn't seem to be a POSIX way to cool the disk cache.
NOTIMPLEMENTED();
return false;
}
#endif
-std::wstring FilePathAsWString(const FilePath& path) {
+std::wstring FilePathAsWString(const base::FilePath& path) {
return UTF8ToWide(path.value());
}
-FilePath WStringAsFilePath(const std::wstring& path) {
- return FilePath(WideToUTF8(path));
+base::FilePath WStringAsFilePath(const std::wstring& path) {
+ return base::FilePath(WideToUTF8(path));
}
-bool MakeFileUnreadable(const FilePath& path) {
+bool MakeFileUnreadable(const base::FilePath& path) {
return DenyFilePermission(path, S_IRUSR | S_IRGRP | S_IROTH);
}
-bool MakeFileUnwritable(const FilePath& path) {
+bool MakeFileUnwritable(const base::FilePath& path) {
return DenyFilePermission(path, S_IWUSR | S_IWGRP | S_IWOTH);
}
-PermissionRestorer::PermissionRestorer(const FilePath& path)
+PermissionRestorer::PermissionRestorer(const base::FilePath& path)
: path_(path), info_(NULL), length_(0) {
info_ = GetPermissionInfo(path_, &length_);
DCHECK(info_ != NULL);
diff --git a/base/test/test_suite.cc b/base/test/test_suite.cc
index c5c3368..cd7875b 100644
--- a/base/test/test_suite.cc
+++ b/base/test/test_suite.cc
@@ -210,9 +210,9 @@
InitAndroidTest();
#else
// Initialize logging.
- FilePath exe;
+ base::FilePath exe;
PathService::Get(base::FILE_EXE, &exe);
- FilePath log_filename = exe.ReplaceExtension(FILE_PATH_LITERAL("log"));
+ base::FilePath log_filename = exe.ReplaceExtension(FILE_PATH_LITERAL("log"));
logging::InitLogging(
log_filename.value().c_str(),
logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG,
diff --git a/base/test/test_support_android.cc b/base/test/test_support_android.cc
index e38a897..b87c073 100644
--- a/base/test/test_support_android.cc
+++ b/base/test/test_support_android.cc
@@ -139,7 +139,7 @@
};
// Provides the test path for DIR_MODULE and DIR_ANDROID_APP_DATA.
-bool GetTestProviderPath(int key, FilePath* result) {
+bool GetTestProviderPath(int key, base::FilePath* result) {
switch (key) {
case base::DIR_MODULE: {
return base::android::GetExternalStorageDirectory(result);
@@ -154,7 +154,7 @@
}
void InitPathProvider(int key) {
- FilePath path;
+ base::FilePath path;
// If failed to override the key, that means the way has not been registered.
if (GetTestProviderPath(key, &path) && !PathService::Override(key, path))
PathService::RegisterProvider(&GetTestProviderPath, key, key + 1);