diff options
75 files changed, 350 insertions, 316 deletions
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 @@ TEST_F(FilePathTest, NormalizePathSeparators) { } #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 @@ bool IsFilenameLegal(const string16& file_name) { 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 @@ void ReplaceIllegalCharactersInPath(FilePath::StringType* file_name, } } -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 @@ bool LocaleAwareCompareFilenames(const FilePath& a, const FilePath& b) { #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 @@ namespace { // 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 @@ bool ReturnsValidPath(int dir_type) { // 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 @@ TEST_F(PathServiceTest, Override) { 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 @@ TEST_F(PathServiceTest, OverrideMultiple) { 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 @@ TEST_F(PathServiceTest, RemoveOverride) { // 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 @@ class FileThreadDeserializer 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 @@ class FileThreadDeserializer } // 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 @@ class FileThreadDeserializer 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 @@ class FileThreadDeserializer } 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 @@ class FileThreadDeserializer // 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 @@ void FileThreadDeserializer::HandleErrors( // 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 @@ void FileThreadDeserializer::HandleErrors( } // 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 @@ scoped_refptr<base::SequencedTaskRunner> JsonPrefStore::GetTaskRunnerForFile( 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..175ef2c5 100644 --- a/base/prefs/json_pref_store_unittest.cc +++ b/base/prefs/json_pref_store_unittest.cc @@ -55,14 +55,14 @@ class JsonPrefStoreTest : public testing::Test { // 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_F(JsonPrefStoreTest, NonExistentFile) { // 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 @@ TEST_F(JsonPrefStoreTest, InvalidFile) { // 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 @@ TEST_F(JsonPrefStoreTest, InvalidFile) { // 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 @@ void RunBasicJsonPrefStoreTest(JsonPrefStore* pref_store, 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 @@ TEST_F(JsonPrefStoreTest, Basic) { 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 @@ TEST_F(JsonPrefStoreTest, BasicAsync) { 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 @@ TEST_F(JsonPrefStoreTest, BasicAsync) { // 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, AsyncNonExistingFile) { } 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 @@ TEST_F(JsonPrefStoreTest, NeedsEmptyValue) { 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 @@ bool PrefMemberBase::Internal::IsOnCorrectThread() const { } 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 @@ void PrefMemberBase::Internal::MoveToThread( 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 @@ void PrefMember<bool>::UpdatePref(const bool& value) { } 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 @@ void PrefMember<int>::UpdatePref(const int& value) { } 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 @@ void PrefMember<double>::UpdatePref(const double& value) { } 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 @@ void PrefMember<std::string>::UpdatePref(const std::string& value) { } 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 @@ void PrefMember<std::vector<std::string> >::UpdatePref( 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 @@ class BASE_PREFS_EXPORT PrefMemberBase : public PrefObserver { // 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 @@ BASE_PREFS_EXPORT void PrefMember<std::string>::UpdatePref( 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 @@ BASE_PREFS_EXPORT void PrefMember<std::vector<std::string> >::UpdatePref( 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 @@ ScopedPathOverride::ScopedPathOverride(int key) : key_(key) { 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_mac.cc b/base/test/test_file_util_mac.cc index 7145e51..b52b39c 100644 --- a/base/test/test_file_util_mac.cc +++ b/base/test/test_file_util_mac.cc @@ -11,7 +11,7 @@ namespace file_util { -bool EvictFileFromSystemCache(const FilePath& file) { +bool EvictFileFromSystemCache(const base::FilePath& file) { // There aren't any really direct ways to purge a file from the UBC. From // talking with Amit Singh, the safest is to mmap the file with MAP_FILE (the // default) + MAP_SHARED, then do an msync to invalidate the memory. The next diff --git a/base/test/test_file_util_posix.cc b/base/test/test_file_util_posix.cc index 5ebf3353..f538bc1 100644 --- a/base/test/test_file_util_posix.cc +++ b/base/test/test_file_util_posix.cc @@ -22,7 +22,7 @@ namespace file_util { 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 @@ bool DenyFilePermission(const FilePath& path, mode_t permission) { // 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 @@ void* GetPermissionInfo(const FilePath& path, size_t* length) { // |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 @@ bool RestorePermissionInfo(const FilePath& path, void* info, size_t length) { } // 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 @@ bool CopyRecursiveDirNoCache(const FilePath& source_dir, } // 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 @@ bool CopyRecursiveDirNoCache(const FilePath& source_dir, // 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 @@ bool CopyRecursiveDirNoCache(const FilePath& source_dir, 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 @@ bool CopyRecursiveDirNoCache(const FilePath& source_dir, } #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_file_util_win.cc b/base/test/test_file_util_win.cc index daaa414..9b234e3 100644 --- a/base/test/test_file_util_win.cc +++ b/base/test/test_file_util_win.cc @@ -29,7 +29,7 @@ struct PermissionInfo { }; // Deny |permission| on the file |path|, for the current user. -bool DenyFilePermission(const FilePath& path, DWORD permission) { +bool DenyFilePermission(const base::FilePath& path, DWORD permission) { PACL old_dacl; PSECURITY_DESCRIPTOR security_descriptor; if (GetNamedSecurityInfo(const_cast<wchar_t*>(path.value().c_str()), @@ -67,7 +67,7 @@ bool DenyFilePermission(const FilePath& path, DWORD permission) { // 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 != NULL); *length = 0; PACL dacl = NULL; @@ -93,7 +93,8 @@ void* GetPermissionInfo(const FilePath& path, size_t* length) { // |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) return false; @@ -112,7 +113,7 @@ bool RestorePermissionInfo(const FilePath& path, void* info, size_t length) { } // namespace -bool DieFileDie(const FilePath& file, bool recurse) { +bool DieFileDie(const base::FilePath& file, bool recurse) { // It turns out that to not induce flakiness a long timeout is needed. const int kIterations = 25; const base::TimeDelta kTimeout = base::TimeDelta::FromSeconds(10) / @@ -132,7 +133,7 @@ bool DieFileDie(const FilePath& file, bool recurse) { return false; } -bool EvictFileFromSystemCache(const FilePath& file) { +bool EvictFileFromSystemCache(const base::FilePath& file) { // Request exclusive access to the file and overwrite it with no buffering. base::win::ScopedHandle file_handle( CreateFile(file.value().c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, @@ -217,8 +218,8 @@ bool EvictFileFromSystemCache(const FilePath& file) { // Like CopyFileNoCache but recursively copies all files and subdirectories // in the given input directory to the output directory. -bool CopyRecursiveDirNoCache(const FilePath& source_dir, - const FilePath& dest_dir) { +bool CopyRecursiveDirNoCache(const base::FilePath& source_dir, + const base::FilePath& dest_dir) { // Try to create the directory if it doesn't already exist. if (!CreateDirectory(dest_dir)) { if (GetLastError() != ERROR_ALREADY_EXISTS) @@ -227,7 +228,7 @@ bool CopyRecursiveDirNoCache(const FilePath& source_dir, std::vector<std::wstring> files_copied; - FilePath src(source_dir.AppendASCII("*")); + base::FilePath src(source_dir.AppendASCII("*")); WIN32_FIND_DATA fd; HANDLE fh = FindFirstFile(src.value().c_str(), &fd); @@ -239,8 +240,8 @@ bool CopyRecursiveDirNoCache(const FilePath& source_dir, if (cur_file == L"." || cur_file == L"..") continue; // Skip these special entries. - FilePath cur_source_path = source_dir.Append(cur_file); - FilePath cur_dest_path = dest_dir.Append(cur_file); + base::FilePath cur_source_path = source_dir.Append(cur_file); + base::FilePath cur_dest_path = dest_dir.Append(cur_file); if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { // Recursively copy a subdirectory. We stripped "." and ".." already. @@ -270,7 +271,7 @@ bool CopyRecursiveDirNoCache(const FilePath& source_dir, // Checks if the volume supports Alternate Data Streams. This is required for // the Zone Identifier implementation. -bool VolumeSupportsADS(const FilePath& path) { +bool VolumeSupportsADS(const base::FilePath& path) { wchar_t drive[MAX_PATH] = {0}; wcscpy_s(drive, MAX_PATH, path.value().c_str()); @@ -290,8 +291,8 @@ bool VolumeSupportsADS(const FilePath& path) { // Return whether the ZoneIdentifier is correctly set to "Internet" (3) // Only returns a valid result when called from same process as the // one that (was supposed to have) set the zone identifier. -bool HasInternetZoneIdentifier(const FilePath& full_path) { - FilePath zone_path(full_path.value() + L":Zone.Identifier"); +bool HasInternetZoneIdentifier(const base::FilePath& full_path) { + base::FilePath zone_path(full_path.value() + L":Zone.Identifier"); std::string zone_path_contents; if (!file_util::ReadFileToString(zone_path, &zone_path_contents)) return false; @@ -313,22 +314,22 @@ bool HasInternetZoneIdentifier(const FilePath& full_path) { } } -std::wstring FilePathAsWString(const FilePath& path) { +std::wstring FilePathAsWString(const base::FilePath& path) { return path.value(); } -FilePath WStringAsFilePath(const std::wstring& path) { - return FilePath(path); +base::FilePath WStringAsFilePath(const std::wstring& path) { + return base::FilePath(path); } -bool MakeFileUnreadable(const FilePath& path) { +bool MakeFileUnreadable(const base::FilePath& path) { return DenyFilePermission(path, GENERIC_READ); } -bool MakeFileUnwritable(const FilePath& path) { +bool MakeFileUnwritable(const base::FilePath& path) { return DenyFilePermission(path, GENERIC_WRITE); } -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_shortcut_win.cc b/base/test/test_shortcut_win.cc index 8339172..1a0d280 100644 --- a/base/test/test_shortcut_win.cc +++ b/base/test/test_shortcut_win.cc @@ -23,8 +23,8 @@ namespace { // Validates |actual_path|'s LongPathName case-insensitively matches // |expected_path|'s LongPathName. -void ValidatePathsAreEqual(const FilePath& expected_path, - const FilePath& actual_path) { +void ValidatePathsAreEqual(const base::FilePath& expected_path, + const base::FilePath& actual_path) { wchar_t long_expected_path_chars[MAX_PATH] = {0}; wchar_t long_actual_path_chars[MAX_PATH] = {0}; @@ -43,8 +43,8 @@ void ValidatePathsAreEqual(const FilePath& expected_path, actual_path.value().c_str(), long_actual_path_chars, MAX_PATH)) << "Failed to get LongPathName of " << actual_path.value(); - FilePath long_expected_path(long_expected_path_chars); - FilePath long_actual_path(long_actual_path_chars); + base::FilePath long_expected_path(long_expected_path_chars); + base::FilePath long_actual_path(long_actual_path_chars); EXPECT_FALSE(long_expected_path.empty()); EXPECT_FALSE(long_actual_path.empty()); @@ -53,7 +53,7 @@ void ValidatePathsAreEqual(const FilePath& expected_path, } // namespace -void ValidateShortcut(const FilePath& shortcut_path, +void ValidateShortcut(const base::FilePath& shortcut_path, const ShortcutProperties& properties) { ScopedComPtr<IShellLink> i_shell_link; ScopedComPtr<IPersistFile> i_persist_file; @@ -87,13 +87,14 @@ void ValidateShortcut(const FilePath& shortcut_path, if (properties.options & ShortcutProperties::PROPERTIES_TARGET) { EXPECT_TRUE(SUCCEEDED( i_shell_link->GetPath(read_target, MAX_PATH, NULL, SLGP_SHORTPATH))); - ValidatePathsAreEqual(properties.target, FilePath(read_target)); + ValidatePathsAreEqual(properties.target, base::FilePath(read_target)); } if (properties.options & ShortcutProperties::PROPERTIES_WORKING_DIR) { EXPECT_TRUE(SUCCEEDED( i_shell_link->GetWorkingDirectory(read_working_dir, MAX_PATH))); - ValidatePathsAreEqual(properties.working_dir, FilePath(read_working_dir)); + ValidatePathsAreEqual(properties.working_dir, + base::FilePath(read_working_dir)); } if (properties.options & ShortcutProperties::PROPERTIES_ARGUMENTS) { @@ -111,7 +112,7 @@ void ValidateShortcut(const FilePath& shortcut_path, if (properties.options & ShortcutProperties::PROPERTIES_ICON) { EXPECT_TRUE(SUCCEEDED( i_shell_link->GetIconLocation(read_icon, MAX_PATH, &read_icon_index))); - ValidatePathsAreEqual(properties.icon, FilePath(read_icon)); + ValidatePathsAreEqual(properties.icon, base::FilePath(read_icon)); EXPECT_EQ(properties.icon_index, read_icon_index); } 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 @@ void TestSuite::Initialize() { 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 @@ base::MessagePump* CreateMessagePumpForUIStub() { }; // 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 @@ bool GetTestProviderPath(int key, FilePath* result) { } 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); diff --git a/chrome/browser/extensions/activity_database_unittest.cc b/chrome/browser/extensions/activity_database_unittest.cc index d7b3c4b..db0906a 100644 --- a/chrome/browser/extensions/activity_database_unittest.cc +++ b/chrome/browser/extensions/activity_database_unittest.cc @@ -81,7 +81,7 @@ TEST(ActivityDatabaseTest, RecordAPIAction) { // Check that blocked actions are recorded in the db. TEST(ActivityDatabaseTest, RecordBlockedAction) { base::ScopedTempDir temp_dir; - FilePath db_file; + base::FilePath db_file; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); db_file = temp_dir.path().AppendASCII("ActivityRecord.db"); file_util::Delete(db_file, false); diff --git a/chrome/browser/extensions/api/managed_mode_private/managed_mode_apitest.cc b/chrome/browser/extensions/api/managed_mode_private/managed_mode_apitest.cc index 638a88a..f7c6e0a 100644 --- a/chrome/browser/extensions/api/managed_mode_private/managed_mode_apitest.cc +++ b/chrome/browser/extensions/api/managed_mode_private/managed_mode_apitest.cc @@ -24,7 +24,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ManagedModeOnChange) { // We can't just call RunComponentExtension() like above, because we need to // fire the event while the page is waiting. - FilePath extension_path = + base::FilePath extension_path = test_data_dir_.AppendASCII("managed_mode/on_change"); const extensions::Extension* extension = LoadExtensionAsComponent(extension_path); diff --git a/chrome/browser/extensions/api/media_galleries_private/media_galleries_eject_apitest.cc b/chrome/browser/extensions/api/media_galleries_private/media_galleries_eject_apitest.cc index 90a9030..6efb8ce 100644 --- a/chrome/browser/extensions/api/media_galleries_private/media_galleries_eject_apitest.cc +++ b/chrome/browser/extensions/api/media_galleries_private/media_galleries_eject_apitest.cc @@ -42,7 +42,7 @@ const char kEjectFailListenerOk[] = "eject_no_such_device"; const char kDeviceId[] = "testDeviceId"; const char kDeviceName[] = "foobar"; -FilePath::CharType kDevicePath[] = FILE_PATH_LITERAL("/qux"); +base::FilePath::CharType kDevicePath[] = FILE_PATH_LITERAL("/qux"); } // namespace diff --git a/chrome/browser/google_apis/drive_api_service.cc b/chrome/browser/google_apis/drive_api_service.cc index 9649c50..097fa99 100644 --- a/chrome/browser/google_apis/drive_api_service.cc +++ b/chrome/browser/google_apis/drive_api_service.cc @@ -448,7 +448,7 @@ void DriveAPIService::RemoveResourceFromDirectory( } void DriveAPIService::InitiateUploadNewFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& parent_upload_url, @@ -462,7 +462,7 @@ void DriveAPIService::InitiateUploadNewFile( } void DriveAPIService::InitiateUploadExistingFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& upload_url, diff --git a/chrome/browser/google_apis/drive_api_service.h b/chrome/browser/google_apis/drive_api_service.h index 83135ca..daf258e 100644 --- a/chrome/browser/google_apis/drive_api_service.h +++ b/chrome/browser/google_apis/drive_api_service.h @@ -105,14 +105,14 @@ class DriveAPIService : public DriveServiceInterface, const std::string& directory_name, const GetResourceEntryCallback& callback) OVERRIDE; virtual void InitiateUploadNewFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& parent_upload_url, const std::string& title, const InitiateUploadCallback& callback) OVERRIDE; virtual void InitiateUploadExistingFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& upload_url, diff --git a/chrome/browser/google_apis/drive_service_interface.h b/chrome/browser/google_apis/drive_service_interface.h index 5bc42d3..2e066cb 100644 --- a/chrome/browser/google_apis/drive_service_interface.h +++ b/chrome/browser/google_apis/drive_service_interface.h @@ -238,7 +238,7 @@ class DriveServiceInterface { // |callback| must not be null. // TODO(hidehiko): Replace |parent_upload_url| by resource id. virtual void InitiateUploadNewFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& parent_upload_url, @@ -251,7 +251,7 @@ class DriveServiceInterface { // |callback| must not be null. // TODO(hidehiko): Replace |upload_url| by resource id. virtual void InitiateUploadExistingFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& upload_url, diff --git a/chrome/browser/google_apis/drive_uploader.cc b/chrome/browser/google_apis/drive_uploader.cc index 0195e08..a68af98 100644 --- a/chrome/browser/google_apis/drive_uploader.cc +++ b/chrome/browser/google_apis/drive_uploader.cc @@ -45,8 +45,8 @@ namespace google_apis { struct DriveUploader::UploadFileInfo { UploadFileInfo(scoped_refptr<base::SequencedTaskRunner> task_runner, UploadMode upload_mode, - const FilePath& drive_path, - const FilePath& local_path, + const base::FilePath& drive_path, + const base::FilePath& local_path, const std::string& content_type, const UploadCompletionCallback& callback) : upload_mode(upload_mode), diff --git a/chrome/browser/google_apis/drive_uploader_unittest.cc b/chrome/browser/google_apis/drive_uploader_unittest.cc index 2737c4c..d9ef196 100644 --- a/chrome/browser/google_apis/drive_uploader_unittest.cc +++ b/chrome/browser/google_apis/drive_uploader_unittest.cc @@ -68,7 +68,7 @@ class MockDriveServiceWithUploadExpectation : public DummyDriveService { // DriveServiceInterface overrides. // Handles a request for obtaining an upload location URL. virtual void InitiateUploadNewFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& parent_upload_url, @@ -87,7 +87,7 @@ class MockDriveServiceWithUploadExpectation : public DummyDriveService { } virtual void InitiateUploadExistingFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& upload_url, @@ -171,7 +171,7 @@ class MockDriveServiceWithUploadExpectation : public DummyDriveService { class MockDriveServiceNoConnectionAtInitiate : public DummyDriveService { // Returns error. virtual void InitiateUploadNewFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& parent_upload_url, @@ -182,7 +182,7 @@ class MockDriveServiceNoConnectionAtInitiate : public DummyDriveService { } virtual void InitiateUploadExistingFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& upload_url, @@ -203,7 +203,7 @@ class MockDriveServiceNoConnectionAtInitiate : public DummyDriveService { class MockDriveServiceNoConnectionAtResume : public DummyDriveService { // Succeeds and returns an upload location URL. virtual void InitiateUploadNewFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& parent_upload_url, @@ -214,7 +214,7 @@ class MockDriveServiceNoConnectionAtResume : public DummyDriveService { } virtual void InitiateUploadExistingFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& upload_url, diff --git a/chrome/browser/google_apis/dummy_drive_service.cc b/chrome/browser/google_apis/dummy_drive_service.cc index 118a2c2..25e9820 100644 --- a/chrome/browser/google_apis/dummy_drive_service.cc +++ b/chrome/browser/google_apis/dummy_drive_service.cc @@ -93,7 +93,7 @@ void DummyDriveService::AddNewDirectory( const GetResourceEntryCallback& callback) {} void DummyDriveService::InitiateUploadNewFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& parent_upload_url, @@ -101,7 +101,7 @@ void DummyDriveService::InitiateUploadNewFile( const InitiateUploadCallback& callback) {} void DummyDriveService::InitiateUploadExistingFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& upload_url, diff --git a/chrome/browser/google_apis/dummy_drive_service.h b/chrome/browser/google_apis/dummy_drive_service.h index 76ad431..ccf5b77 100644 --- a/chrome/browser/google_apis/dummy_drive_service.h +++ b/chrome/browser/google_apis/dummy_drive_service.h @@ -71,14 +71,14 @@ class DummyDriveService : public DriveServiceInterface { const std::string& directory_name, const GetResourceEntryCallback& callback) OVERRIDE; virtual void InitiateUploadNewFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& parent_upload_url, const std::string& title, const InitiateUploadCallback& callback) OVERRIDE; virtual void InitiateUploadExistingFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& upload_url, diff --git a/chrome/browser/google_apis/fake_drive_service.cc b/chrome/browser/google_apis/fake_drive_service.cc index cecd495..a7b670c 100644 --- a/chrome/browser/google_apis/fake_drive_service.cc +++ b/chrome/browser/google_apis/fake_drive_service.cc @@ -778,7 +778,7 @@ void FakeDriveService::AddNewDirectory( } void FakeDriveService::InitiateUploadNewFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& parent_upload_url, @@ -880,7 +880,7 @@ void FakeDriveService::InitiateUploadNewFile( } void FakeDriveService::InitiateUploadExistingFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& upload_url, diff --git a/chrome/browser/google_apis/fake_drive_service.h b/chrome/browser/google_apis/fake_drive_service.h index 678ce48..ce427d6 100644 --- a/chrome/browser/google_apis/fake_drive_service.h +++ b/chrome/browser/google_apis/fake_drive_service.h @@ -120,14 +120,14 @@ class FakeDriveService : public DriveServiceInterface { const std::string& directory_name, const GetResourceEntryCallback& callback) OVERRIDE; virtual void InitiateUploadNewFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& parent_upload_url, const std::string& title, const InitiateUploadCallback& callback) OVERRIDE; virtual void InitiateUploadExistingFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& upload_url, diff --git a/chrome/browser/google_apis/gdata_wapi_service.cc b/chrome/browser/google_apis/gdata_wapi_service.cc index f772243..6af3313 100644 --- a/chrome/browser/google_apis/gdata_wapi_service.cc +++ b/chrome/browser/google_apis/gdata_wapi_service.cc @@ -409,7 +409,7 @@ void GDataWapiService::RemoveResourceFromDirectory( } void GDataWapiService::InitiateUploadNewFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& parent_upload_url, @@ -435,7 +435,7 @@ void GDataWapiService::InitiateUploadNewFile( } void GDataWapiService::InitiateUploadExistingFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& upload_url, diff --git a/chrome/browser/google_apis/gdata_wapi_service.h b/chrome/browser/google_apis/gdata_wapi_service.h index 0a1102c..f2d59a8 100644 --- a/chrome/browser/google_apis/gdata_wapi_service.h +++ b/chrome/browser/google_apis/gdata_wapi_service.h @@ -108,14 +108,14 @@ class GDataWapiService : public DriveServiceInterface, const std::string& directory_name, const GetResourceEntryCallback& callback) OVERRIDE; virtual void InitiateUploadNewFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& parent_upload_url, const std::string& title, const InitiateUploadCallback& callback) OVERRIDE; virtual void InitiateUploadExistingFile( - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& upload_url, diff --git a/chrome/browser/google_apis/mock_drive_service.h b/chrome/browser/google_apis/mock_drive_service.h index 39ec535..843a05a 100644 --- a/chrome/browser/google_apis/mock_drive_service.h +++ b/chrome/browser/google_apis/mock_drive_service.h @@ -81,14 +81,14 @@ class MockDriveService : public DriveServiceInterface { const DownloadActionCallback& donwload_action_callback, const GetContentCallback& get_content_callback)); MOCK_METHOD6(InitiateUploadNewFile, - void(const FilePath& drive_file_path, + void(const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& parent_upload_url, const std::string& title, const InitiateUploadCallback& callback)); MOCK_METHOD6(InitiateUploadExistingFile, - void(const FilePath& drive_file_path, + void(const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& upload_url, diff --git a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc index 20d8d3d..1a29c5e 100644 --- a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc +++ b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc @@ -49,7 +49,7 @@ struct DictionaryFile { } // The desired location of the dictionary file, whether or not it exists. - FilePath path; + base::FilePath path; // The file descriptor/handle for the dictionary file. base::PlatformFile descriptor; @@ -73,7 +73,7 @@ scoped_ptr<DictionaryFile> InitializeDictionaryLocation( // Initialize the BDICT path. Initialization should be in the FILE thread // because it checks if there is a "Dictionaries" directory and create it. - FilePath dict_dir; + base::FilePath dict_dir; PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir); file->path = chrome::spellcheck_common::GetVersionedFileName( language, dict_dir); @@ -83,7 +83,7 @@ scoped_ptr<DictionaryFile> InitializeDictionaryLocation( // rather than downloading anew. base::FilePath user_dir; PathService::Get(chrome::DIR_USER_DATA, &user_dir); - FilePath fallback = user_dir.Append(file->path.BaseName()); + base::FilePath fallback = user_dir.Append(file->path.BaseName()); if (!file_util::PathExists(file->path) && file_util::PathExists(fallback)) file->path = fallback; #endif @@ -113,7 +113,8 @@ scoped_ptr<DictionaryFile> InitializeDictionaryLocation( // Saves |data| to file at |path|. Returns true on successful save, otherwise // returns false. -bool SaveDictionaryData(scoped_ptr<std::string> data, const FilePath& path) { +bool SaveDictionaryData(scoped_ptr<std::string> data, + const base::FilePath& path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); size_t bytes_written = diff --git a/chrome/browser/system_monitor/removable_storage_notifications_unittest.cc b/chrome/browser/system_monitor/removable_storage_notifications_unittest.cc index 527fd94..bb0cad6 100644 --- a/chrome/browser/system_monitor/removable_storage_notifications_unittest.cc +++ b/chrome/browser/system_monitor/removable_storage_notifications_unittest.cc @@ -24,7 +24,7 @@ class TestStorageNotifications : public RemovableStorageNotifications { return false; } virtual uint64 GetStorageSize( - const FilePath::StringType& location) const OVERRIDE { + const base::FilePath::StringType& location) const OVERRIDE { return 0; } diff --git a/chrome/browser/system_monitor/test_removable_storage_notifications.cc b/chrome/browser/system_monitor/test_removable_storage_notifications.cc index c499ae2..f9bdf1f 100644 --- a/chrome/browser/system_monitor/test_removable_storage_notifications.cc +++ b/chrome/browser/system_monitor/test_removable_storage_notifications.cc @@ -25,7 +25,7 @@ bool TestRemovableStorageNotifications::GetDeviceInfoForPath( } uint64 TestRemovableStorageNotifications::GetStorageSize( - const FilePath::StringType& location) const { + const base::FilePath::StringType& location) const { return 0; } @@ -41,7 +41,7 @@ bool TestRemovableStorageNotifications::GetMTPStorageInfoFromDeviceId( void TestRemovableStorageNotifications::ProcessAttach( const std::string& id, const string16& name, - const FilePath::StringType& location) { + const base::FilePath::StringType& location) { receiver()->ProcessAttach(id, name, location); } diff --git a/chrome/browser/system_monitor/test_removable_storage_notifications.h b/chrome/browser/system_monitor/test_removable_storage_notifications.h index 34e1692..43fdc0b 100644 --- a/chrome/browser/system_monitor/test_removable_storage_notifications.h +++ b/chrome/browser/system_monitor/test_removable_storage_notifications.h @@ -40,7 +40,7 @@ class TestRemovableStorageNotifications // get rid of ProcessAttach/ProcessDetach here. void ProcessAttach(const std::string& id, const string16& name, - const FilePath::StringType& location); + const base::FilePath::StringType& location); void ProcessDetach(const std::string& id); diff --git a/chrome/test/webdriver/commands/chrome_commands.cc b/chrome/test/webdriver/commands/chrome_commands.cc index 87b7542..1b470aa 100644 --- a/chrome/test/webdriver/commands/chrome_commands.cc +++ b/chrome/test/webdriver/commands/chrome_commands.cc @@ -74,7 +74,7 @@ void ExtensionsCommand::ExecuteGet(Response* const response) { } void ExtensionsCommand::ExecutePost(Response* const response) { - FilePath::StringType path_string; + base::FilePath::StringType path_string; if (!GetStringParameter("path", &path_string)) { response->SetError(new Error(kBadRequest, "'path' missing or invalid")); return; @@ -82,7 +82,7 @@ void ExtensionsCommand::ExecutePost(Response* const response) { std::string extension_id; Error* error = session_->InstallExtension( - FilePath(path_string), &extension_id); + base::FilePath(path_string), &extension_id); if (error) { response->SetError(error); return; diff --git a/content/browser/child_process_security_policy_unittest.cc b/content/browser/child_process_security_policy_unittest.cc index da56188..d9a4446 100644 --- a/content/browser/child_process_security_policy_unittest.cc +++ b/content/browser/child_process_security_policy_unittest.cc @@ -364,7 +364,7 @@ TEST_F(ChildProcessSecurityPolicyTest, FilePermissions) { base::FilePath child_traversal2 = base::FilePath( TEST_PATH("/home/joe/file/../otherfile")); base::FilePath evil_traversal1 = - FilePath(TEST_PATH("/home/joe/../../etc/passwd")); + base::FilePath(TEST_PATH("/home/joe/../../etc/passwd")); base::FilePath evil_traversal2 = base::FilePath( TEST_PATH("/home/joe/./.././../etc/passwd")); base::FilePath self_traversal = diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index 06aab48..af3ac78 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc @@ -385,10 +385,11 @@ uint32 SavePackage::GetMaxPathLengthForDirectory( // part for making sure the length of specified file path is less than // specified maximum length of file path. Return false if the function can // not get a safe pure file name, otherwise it returns true. -bool SavePackage::GetSafePureFileName(const FilePath& dir_path, - const FilePath::StringType& file_name_ext, - uint32 max_file_path_len, - FilePath::StringType* pure_file_name) { +bool SavePackage::GetSafePureFileName( + const base::FilePath& dir_path, + const base::FilePath::StringType& file_name_ext, + uint32 max_file_path_len, + base::FilePath::StringType* pure_file_name) { DCHECK(!pure_file_name->empty()); int available_length = static_cast<int>(max_file_path_len - dir_path.value().length() - @@ -416,16 +417,16 @@ bool SavePackage::GetSafePureFileName(const FilePath& dir_path, bool SavePackage::GenerateFileName(const std::string& disposition, const GURL& url, bool need_html_ext, - FilePath::StringType* generated_name) { + base::FilePath::StringType* generated_name) { // TODO(jungshik): Figure out the referrer charset when having one // makes sense and pass it to GenerateFileName. - FilePath file_path = net::GenerateFileName(url, disposition, "", "", "", - kDefaultSaveName); + base::FilePath file_path = net::GenerateFileName(url, disposition, "", "", "", + kDefaultSaveName); DCHECK(!file_path.empty()); - FilePath::StringType pure_file_name = + base::FilePath::StringType pure_file_name = file_path.RemoveExtension().BaseName().value(); - FilePath::StringType file_name_ext = file_path.Extension(); + base::FilePath::StringType file_name_ext = file_path.Extension(); // If it is HTML resource, use ".htm{l,}" as its extension. if (need_html_ext) { @@ -441,7 +442,7 @@ bool SavePackage::GenerateFileName(const std::string& disposition, max_path, &pure_file_name)) return false; - FilePath::StringType file_name = pure_file_name + file_name_ext; + base::FilePath::StringType file_name = pure_file_name + file_name_ext; // Check whether we already have same name in a case insensitive manner. FileNameSet::const_iterator iter = file_name_set_.find(file_name); @@ -450,8 +451,9 @@ bool SavePackage::GenerateFileName(const std::string& disposition, } else { // Found same name, increase the ordinal number for the file name. pure_file_name = - FilePath(*iter).RemoveExtension().BaseName().value(); - FilePath::StringType base_file_name = StripOrdinalNumber(pure_file_name); + base::FilePath(*iter).RemoveExtension().BaseName().value(); + base::FilePath::StringType base_file_name = + StripOrdinalNumber(pure_file_name); // We need to make sure the length of base file name plus maximum ordinal // number path will be less than or equal to kMaxFilePathLength. @@ -473,17 +475,17 @@ bool SavePackage::GenerateFileName(const std::string& disposition, if (ordinal_number > (kMaxFileOrdinalNumber - 1)) { // Use a random file from temporary file. - FilePath temp_file; + base::FilePath temp_file; file_util::CreateTemporaryFile(&temp_file); file_name = temp_file.RemoveExtension().BaseName().value(); // Get safe pure file name. if (!GetSafePureFileName(saved_main_directory_path_, - FilePath::StringType(), + base::FilePath::StringType(), max_path, &file_name)) return false; } else { for (int i = ordinal_number; i < kMaxFileOrdinalNumber; ++i) { - FilePath::StringType new_name = base_file_name + + base::FilePath::StringType new_name = base_file_name + StringPrintf(FILE_PATH_LITERAL("(%d)"), i) + file_name_ext; if (file_name_set_.find(new_name) == file_name_set_.end()) { // Resolved name conflict. @@ -525,7 +527,7 @@ void SavePackage::StartSave(const SaveFileCreateInfo* info) { // save directory, or prompting the user. DCHECK(!save_item->has_final_name()); if (info->url != page_url_) { - FilePath::StringType generated_name; + base::FilePath::StringType generated_name; // For HTML resource file, make sure it will have .htm as extension name, // otherwise, when you open the saved page in Chrome again, download // file manager will treat it as downloadable resource, and download it @@ -556,7 +558,8 @@ void SavePackage::StartSave(const SaveFileCreateInfo* info) { // Now we get final name retrieved from GenerateFileName, we will use it // rename the SaveItem. - FilePath final_name = saved_main_directory_path_.Append(generated_name); + base::FilePath final_name = + saved_main_directory_path_.Append(generated_name); save_item->Rename(final_name); } else { // It is the main HTML file, use the name chosen by the user. @@ -692,9 +695,9 @@ void SavePackage::CheckFinish() { if (in_process_count() || finished_) return; - FilePath dir = (save_type_ == SAVE_PAGE_TYPE_AS_COMPLETE_HTML && - saved_success_items_.size() > 1) ? - saved_main_directory_path_ : FilePath(); + base::FilePath dir = (save_type_ == SAVE_PAGE_TYPE_AS_COMPLETE_HTML && + saved_success_items_.size() > 1) ? + saved_main_directory_path_ : base::FilePath(); // This vector contains the final names of all the successfully saved files // along with their save ids. It will be passed to SaveFileManager to do the @@ -972,7 +975,7 @@ void SavePackage::GetSerializedHtmlDataForCurrentPageWithLocalLinks() { if (wait_state_ != HTML_DATA) return; std::vector<GURL> saved_links; - std::vector<FilePath> saved_file_paths; + std::vector<base::FilePath> saved_file_paths; int successful_started_items_count = 0; // Collect all saved items which have local storage. @@ -1003,7 +1006,7 @@ void SavePackage::GetSerializedHtmlDataForCurrentPageWithLocalLinks() { } // Get the relative directory name. - FilePath relative_dir_name = saved_main_directory_path_.BaseName(); + base::FilePath relative_dir_name = saved_main_directory_path_.BaseName(); Send(new ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks( routing_id(), saved_links, saved_file_paths, relative_dir_name)); @@ -1154,12 +1157,12 @@ void SavePackage::OnReceivedSavableResourceLinksForCurrentPage( } } -FilePath SavePackage::GetSuggestedNameForSaveAs( +base::FilePath SavePackage::GetSuggestedNameForSaveAs( bool can_save_as_complete, const std::string& contents_mime_type, const std::string& accept_langs) { - FilePath name_with_proper_ext = - FilePath::FromWStringHack(UTF16ToWideHack(title_)); + base::FilePath name_with_proper_ext = + base::FilePath::FromWStringHack(UTF16ToWideHack(title_)); // If the page's title matches its URL, use the URL. Try to use the last path // component or if there is none, the domain as the file name. @@ -1187,7 +1190,8 @@ FilePath SavePackage::GetSuggestedNameForSaveAs( } else { url_path = "dataurl"; } - name_with_proper_ext = FilePath::FromWStringHack(UTF8ToWide(url_path)); + name_with_proper_ext = + base::FilePath::FromWStringHack(UTF8ToWide(url_path)); } // Ask user for getting final saving name. @@ -1197,48 +1201,48 @@ FilePath SavePackage::GetSuggestedNameForSaveAs( if (can_save_as_complete) name_with_proper_ext = EnsureHtmlExtension(name_with_proper_ext); - FilePath::StringType file_name = name_with_proper_ext.value(); + base::FilePath::StringType file_name = name_with_proper_ext.value(); file_util::ReplaceIllegalCharactersInPath(&file_name, ' '); - return FilePath(file_name); + return base::FilePath(file_name); } -FilePath SavePackage::EnsureHtmlExtension(const FilePath& name) { +base::FilePath SavePackage::EnsureHtmlExtension(const base::FilePath& name) { // If the file name doesn't have an extension suitable for HTML files, // append one. - FilePath::StringType ext = name.Extension(); + base::FilePath::StringType ext = name.Extension(); if (!ext.empty()) ext.erase(ext.begin()); // Erase preceding '.'. std::string mime_type; if (!net::GetMimeTypeFromExtension(ext, &mime_type) || !CanSaveAsComplete(mime_type)) { - return FilePath(name.value() + FILE_PATH_LITERAL(".") + - kDefaultHtmlExtension); + return base::FilePath(name.value() + FILE_PATH_LITERAL(".") + + kDefaultHtmlExtension); } return name; } -FilePath SavePackage::EnsureMimeExtension(const FilePath& name, +base::FilePath SavePackage::EnsureMimeExtension(const base::FilePath& name, const std::string& contents_mime_type) { // Start extension at 1 to skip over period if non-empty. - FilePath::StringType ext = name.Extension().length() ? + base::FilePath::StringType ext = name.Extension().length() ? name.Extension().substr(1) : name.Extension(); - FilePath::StringType suggested_extension = + base::FilePath::StringType suggested_extension = ExtensionForMimeType(contents_mime_type); std::string mime_type; if (!suggested_extension.empty() && !net::GetMimeTypeFromExtension(ext, &mime_type)) { // Extension is absent or needs to be updated. - return FilePath(name.value() + FILE_PATH_LITERAL(".") + + return base::FilePath(name.value() + FILE_PATH_LITERAL(".") + suggested_extension); } return name; } -const FilePath::CharType* SavePackage::ExtensionForMimeType( +const base::FilePath::CharType* SavePackage::ExtensionForMimeType( const std::string& contents_mime_type) { static const struct { - const FilePath::CharType *mime_type; - const FilePath::CharType *suggested_extension; + const base::FilePath::CharType *mime_type; + const base::FilePath::CharType *suggested_extension; } extensions[] = { { FILE_PATH_LITERAL("text/html"), kDefaultHtmlExtension }, { FILE_PATH_LITERAL("text/xml"), FILE_PATH_LITERAL("xml") }, @@ -1247,9 +1251,9 @@ const FilePath::CharType* SavePackage::ExtensionForMimeType( { FILE_PATH_LITERAL("text/css"), FILE_PATH_LITERAL("css") }, }; #if defined(OS_POSIX) - FilePath::StringType mime_type(contents_mime_type); + base::FilePath::StringType mime_type(contents_mime_type); #elif defined(OS_WIN) - FilePath::StringType mime_type(UTF8ToWide(contents_mime_type)); + base::FilePath::StringType mime_type(UTF8ToWide(contents_mime_type)); #endif // OS_WIN for (uint32 i = 0; i < ARRAYSIZE_UNSAFE(extensions); ++i) { if (mime_type == extensions[i].mime_type) @@ -1265,7 +1269,7 @@ WebContents* SavePackage::web_contents() const { void SavePackage::GetSaveInfo() { // Can't use web_contents_ in the file thread, so get the data that we need // before calling to it. - FilePath website_save_dir, download_save_dir; + base::FilePath website_save_dir, download_save_dir; bool skip_dir_check; DCHECK(download_manager_); if (download_manager_->GetDelegate()) { @@ -1286,12 +1290,12 @@ void SavePackage::GetSaveInfo() { } void SavePackage::CreateDirectoryOnFileThread( - const FilePath& website_save_dir, - const FilePath& download_save_dir, + const base::FilePath& website_save_dir, + const base::FilePath& download_save_dir, bool skip_dir_check, const std::string& mime_type, const std::string& accept_langs) { - FilePath save_dir; + base::FilePath save_dir; // If the default html/websites save folder doesn't exist... // We skip the directory check for gdata directories on ChromeOS. if (!skip_dir_check && !file_util::DirectoryExists(website_save_dir)) { @@ -1307,11 +1311,11 @@ void SavePackage::CreateDirectoryOnFileThread( } bool can_save_as_complete = CanSaveAsComplete(mime_type); - FilePath suggested_filename = GetSuggestedNameForSaveAs( + base::FilePath suggested_filename = GetSuggestedNameForSaveAs( can_save_as_complete, mime_type, accept_langs); - FilePath::StringType pure_file_name = + base::FilePath::StringType pure_file_name = suggested_filename.RemoveExtension().BaseName().value(); - FilePath::StringType file_name_ext = suggested_filename.Extension(); + base::FilePath::StringType file_name_ext = suggested_filename.Extension(); // Need to make sure the suggested file name is not too long. uint32 max_path = GetMaxPathLengthForDirectory(save_dir); @@ -1332,7 +1336,7 @@ void SavePackage::CreateDirectoryOnFileThread( can_save_as_complete)); } -void SavePackage::ContinueGetSaveInfo(const FilePath& suggested_path, +void SavePackage::ContinueGetSaveInfo(const base::FilePath& suggested_path, bool can_save_as_complete) { // The WebContents which owns this SavePackage may have disappeared during @@ -1341,7 +1345,7 @@ void SavePackage::ContinueGetSaveInfo(const FilePath& suggested_path, if (!web_contents() || !download_manager_->GetDelegate()) return; - FilePath::StringType default_extension; + base::FilePath::StringType default_extension; if (can_save_as_complete) default_extension = kDefaultHtmlExtension; @@ -1354,7 +1358,7 @@ void SavePackage::ContinueGetSaveInfo(const FilePath& suggested_path, } void SavePackage::OnPathPicked( - const FilePath& final_name, + const base::FilePath& final_name, SavePageType type, const SavePackageDownloadCreatedCallback& download_created_callback) { // Ensure the filename is safe. diff --git a/media/base/test_data_util.cc b/media/base/test_data_util.cc index e84fdaf..9c62c57 100644 --- a/media/base/test_data_util.cc +++ b/media/base/test_data_util.cc @@ -11,7 +11,7 @@ namespace media { -FilePath GetTestDataFilePath(const std::string& name) { +base::FilePath GetTestDataFilePath(const std::string& name) { base::FilePath file_path; CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &file_path)); diff --git a/media/base/test_data_util.h b/media/base/test_data_util.h index 062bbda..477026f 100644 --- a/media/base/test_data_util.h +++ b/media/base/test_data_util.h @@ -17,7 +17,7 @@ namespace media { class DecoderBuffer; // Returns a file path for a file in the media/test/data directory. -FilePath GetTestDataFilePath(const std::string& name); +base::FilePath GetTestDataFilePath(const std::string& name); // Reads a test file from media/test/data directory and stores it in // a DecoderBuffer. Use DecoderBuffer vs DataBuffer to ensure no matter diff --git a/media/filters/file_data_source_unittest.cc b/media/filters/file_data_source_unittest.cc index a840995..782a0db 100644 --- a/media/filters/file_data_source_unittest.cc +++ b/media/filters/file_data_source_unittest.cc @@ -34,7 +34,7 @@ class ReadCBHandler { // FilePath class are unicode, and the pipeline wants char strings. Convert // the string to UTF8 under Windows. For Mac and Linux, file paths are already // chars so just return the string from the base::FilePath. -FilePath TestFileURL() { +base::FilePath TestFileURL() { base::FilePath data_dir; EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir)); data_dir = data_dir.Append(FILE_PATH_LITERAL("media")) diff --git a/net/tools/gdig/gdig.cc b/net/tools/gdig/gdig.cc index a388d18..cb394a5 100644 --- a/net/tools/gdig/gdig.cc +++ b/net/tools/gdig/gdig.cc @@ -114,7 +114,7 @@ typedef std::vector<ReplayLogEntry> ReplayLog; // resolution and is in milliseconds. domain_name is the name to be resolved. // // The file should be sorted by timestamp in ascending time. -bool LoadReplayLog(const FilePath& file_path, ReplayLog* replay_log) { +bool LoadReplayLog(const base::FilePath& file_path, ReplayLog* replay_log) { std::string original_replay_log_contents; if (!file_util::ReadFileToString(file_path, &original_replay_log_contents)) { fprintf(stderr, "Unable to open replay file %s\n", @@ -329,7 +329,7 @@ bool GDig::ParseCommandLine(int argc, const char* argv[]) { } if (parsed_command_line.HasSwitch("replay_file")) { - FilePath replay_path = + base::FilePath replay_path = parsed_command_line.GetSwitchValuePath("replay_file"); if (!LoadReplayLog(replay_path, &replay_log_)) return false; diff --git a/ppapi/proxy/flash_file_resource.cc b/ppapi/proxy/flash_file_resource.cc index ac9e555..cd13a6d 100644 --- a/ppapi/proxy/flash_file_resource.cc +++ b/ppapi/proxy/flash_file_resource.cc @@ -60,9 +60,9 @@ int32_t FlashFileResource::RenameFile(PP_Instance /*instance*/, const char* path_from, const char* path_to) { PepperFilePath pepper_from(PepperFilePath::DOMAIN_MODULE_LOCAL, - FilePath::FromUTF8Unsafe(path_from)); + base::FilePath::FromUTF8Unsafe(path_from)); PepperFilePath pepper_to(PepperFilePath::DOMAIN_MODULE_LOCAL, - FilePath::FromUTF8Unsafe(path_to)); + base::FilePath::FromUTF8Unsafe(path_to)); int32_t error = SyncCall<IPC::Message>( BROWSER, PpapiHostMsg_FlashFile_RenameFile(pepper_from, pepper_to)); @@ -74,7 +74,7 @@ int32_t FlashFileResource::DeleteFileOrDir(PP_Instance /*instance*/, const char* path, PP_Bool recursive) { PepperFilePath pepper_path(PepperFilePath::DOMAIN_MODULE_LOCAL, - FilePath::FromUTF8Unsafe(path)); + base::FilePath::FromUTF8Unsafe(path)); int32_t error = SyncCall<IPC::Message>( BROWSER, PpapiHostMsg_FlashFile_DeleteFileOrDir(pepper_path, @@ -86,7 +86,7 @@ int32_t FlashFileResource::DeleteFileOrDir(PP_Instance /*instance*/, int32_t FlashFileResource::CreateDir(PP_Instance /*instance*/, const char* path) { PepperFilePath pepper_path(PepperFilePath::DOMAIN_MODULE_LOCAL, - FilePath::FromUTF8Unsafe(path)); + base::FilePath::FromUTF8Unsafe(path)); int32_t error = SyncCall<IPC::Message>(BROWSER, PpapiHostMsg_FlashFile_CreateDir(pepper_path)); @@ -105,7 +105,7 @@ int32_t FlashFileResource::GetDirContents(PP_Instance /*instance*/, PP_DirContents_Dev** contents) { ppapi::DirContents entries; PepperFilePath pepper_path(PepperFilePath::DOMAIN_MODULE_LOCAL, - FilePath::FromUTF8Unsafe(path)); + base::FilePath::FromUTF8Unsafe(path)); int32_t error = SyncCall<PpapiPluginMsg_FlashFile_GetDirContentsReply>( BROWSER, PpapiHostMsg_FlashFile_GetDirContents(pepper_path), &entries); @@ -182,7 +182,7 @@ int32_t FlashFileResource::OpenFileHelper(const std::string& path, !file) return PP_ERROR_BADARGUMENT; - PepperFilePath pepper_path(domain_type, FilePath::FromUTF8Unsafe(path)); + PepperFilePath pepper_path(domain_type, base::FilePath::FromUTF8Unsafe(path)); IPC::Message unused; ResourceMessageReplyParams reply_params; @@ -207,7 +207,7 @@ int32_t FlashFileResource::QueryFileHelper(const std::string& path, return PP_ERROR_BADARGUMENT; base::PlatformFileInfo file_info; - PepperFilePath pepper_path(domain_type, FilePath::FromUTF8Unsafe(path)); + PepperFilePath pepper_path(domain_type, base::FilePath::FromUTF8Unsafe(path)); int32_t error = SyncCall<PpapiPluginMsg_FlashFile_QueryFileReply>(BROWSER, PpapiHostMsg_FlashFile_QueryFile(pepper_path), &file_info); diff --git a/ppapi/shared_impl/file_path.cc b/ppapi/shared_impl/file_path.cc index 1502d89..d05b1b3 100644 --- a/ppapi/shared_impl/file_path.cc +++ b/ppapi/shared_impl/file_path.cc @@ -11,7 +11,7 @@ PepperFilePath::PepperFilePath() path_() { } -PepperFilePath::PepperFilePath(Domain domain, const FilePath& path) +PepperFilePath::PepperFilePath(Domain domain, const base::FilePath& path) : domain_(domain), path_(path) { // TODO(viettrungluu): Should we DCHECK() some things here? diff --git a/printing/backend/print_backend_cups.cc b/printing/backend/print_backend_cups.cc index bd51130..267c2d9 100644 --- a/printing/backend/print_backend_cups.cc +++ b/printing/backend/print_backend_cups.cc @@ -327,7 +327,7 @@ int PrintBackendCUPS::GetDests(cups_dest_t** dests) { } } -FilePath PrintBackendCUPS::GetPPD(const char* name) { +base::FilePath PrintBackendCUPS::GetPPD(const char* name) { // cupsGetPPD returns a filename stored in a static buffer in CUPS. // Protect this code with lock. CR_DEFINE_STATIC_LOCAL(base::Lock, ppd_lock, ()); diff --git a/remoting/base/resources.cc b/remoting/base/resources.cc index a43e328..e10659d3 100644 --- a/remoting/base/resources.cc +++ b/remoting/base/resources.cc @@ -18,7 +18,7 @@ const char kCommonResourcesFileName[] = "chrome_remote_desktop.pak"; // Loads chromoting resources. bool LoadResources(const std::string& pref_locale) { - FilePath path; + base::FilePath path; if (!PathService::Get(base::DIR_MODULE, &path)) return false; diff --git a/remoting/protocol/authenticator_test_base.cc b/remoting/protocol/authenticator_test_base.cc index 03da2c7..1845098 100644 --- a/remoting/protocol/authenticator_test_base.cc +++ b/remoting/protocol/authenticator_test_base.cc @@ -43,12 +43,12 @@ AuthenticatorTestBase::AuthenticatorTestBase() {} AuthenticatorTestBase::~AuthenticatorTestBase() {} void AuthenticatorTestBase::SetUp() { - FilePath certs_dir(net::GetTestCertsDirectory()); + base::FilePath certs_dir(net::GetTestCertsDirectory()); - FilePath cert_path = certs_dir.AppendASCII("unittest.selfsigned.der"); + base::FilePath cert_path = certs_dir.AppendASCII("unittest.selfsigned.der"); ASSERT_TRUE(file_util::ReadFileToString(cert_path, &host_cert_)); - FilePath key_path = certs_dir.AppendASCII("unittest.key.bin"); + base::FilePath key_path = certs_dir.AppendASCII("unittest.key.bin"); std::string key_string; ASSERT_TRUE(file_util::ReadFileToString(key_path, &key_string)); std::vector<uint8> key_vector( diff --git a/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc b/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc index f291bdd..fb93480 100644 --- a/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc +++ b/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc @@ -53,12 +53,12 @@ class SslHmacChannelAuthenticatorTest : public testing::Test { protected: virtual void SetUp() OVERRIDE { - FilePath certs_dir(net::GetTestCertsDirectory()); + base::FilePath certs_dir(net::GetTestCertsDirectory()); - FilePath cert_path = certs_dir.AppendASCII("unittest.selfsigned.der"); + base::FilePath cert_path = certs_dir.AppendASCII("unittest.selfsigned.der"); ASSERT_TRUE(file_util::ReadFileToString(cert_path, &host_cert_)); - FilePath key_path = certs_dir.AppendASCII("unittest.key.bin"); + base::FilePath key_path = certs_dir.AppendASCII("unittest.key.bin"); std::string key_string; ASSERT_TRUE(file_util::ReadFileToString(key_path, &key_string)); std::vector<uint8> key_vector( diff --git a/third_party/leveldatabase/env_chromium.cc b/third_party/leveldatabase/env_chromium.cc index 76bbd3a..7651c9c 100644 --- a/third_party/leveldatabase/env_chromium.cc +++ b/third_party/leveldatabase/env_chromium.cc @@ -74,15 +74,15 @@ FILE* fopen_internal(const char* fname, const char* mode) { #endif } -::FilePath CreateFilePath(const std::string& file_path) { +base::FilePath CreateFilePath(const std::string& file_path) { #if defined(OS_WIN) - return FilePath(UTF8ToUTF16(file_path)); + return base::FilePath(UTF8ToUTF16(file_path)); #else - return FilePath(file_path); + return base::FilePath(file_path); #endif } -std::string FilePathToString(const ::FilePath& file_path) { +std::string FilePathToString(const base::FilePath& file_path) { #if defined(OS_WIN) return UTF16ToUTF8(file_path.value()); #else @@ -92,7 +92,7 @@ std::string FilePathToString(const ::FilePath& file_path) { bool sync_parent(const std::string& fname) { #if !defined(OS_WIN) - FilePath parent_dir = CreateFilePath(fname).DirName(); + base::FilePath parent_dir = CreateFilePath(fname).DirName(); int parent_fd = HANDLE_EINTR(open(FilePathToString(parent_dir).c_str(), O_RDONLY)); if (parent_fd < 0) return false; @@ -140,7 +140,7 @@ namespace { class Thread; -static const ::FilePath::CharType kLevelDBTestDirectoryPrefix[] +static const base::FilePath::CharType kLevelDBTestDirectoryPrefix[] = FILE_PATH_LITERAL("leveldb-test-"); const char* PlatformFileErrorString(const ::base::PlatformFileError& error) { @@ -381,7 +381,7 @@ class ChromiumEnv : public Env, public UMALogger { result->clear(); ::file_util::FileEnumerator iter( CreateFilePath(dir), false, ::file_util::FileEnumerator::FILES); - ::FilePath current = iter.Next(); + base::FilePath current = iter.Next(); while (!current.empty()) { result->push_back(FilePathToString(current.BaseName())); current = iter.Next(); @@ -436,7 +436,7 @@ class ChromiumEnv : public Env, public UMALogger { virtual Status RenameFile(const std::string& src, const std::string& dst) { Status result; - FilePath src_file_path = CreateFilePath(src); + base::FilePath src_file_path = CreateFilePath(src); if (!::file_util::PathExists(src_file_path)) return result; if (!::file_util::ReplaceFile(src_file_path, CreateFilePath(dst))) { @@ -560,7 +560,7 @@ class ChromiumEnv : public Env, public UMALogger { reinterpret_cast<ChromiumEnv*>(arg)->BGThread(); } - FilePath test_directory_; + base::FilePath test_directory_; size_t page_size_; ::base::Lock mu_; diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc index 2325507..3c03ee8 100644 --- a/ui/base/resource/resource_bundle.cc +++ b/ui/base/resource/resource_bundle.cc @@ -207,8 +207,8 @@ void ResourceBundle::AddDataPackFromFile(base::PlatformFile file, } #if !defined(OS_MACOSX) -FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, - bool test_file_exists) { +base::FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, + bool test_file_exists) { if (app_locale.empty()) return base::FilePath(); diff --git a/ui/base/resource/resource_bundle.h b/ui/base/resource/resource_bundle.h index 7b83628..b7613ae 100644 --- a/ui/base/resource/resource_bundle.h +++ b/ui/base/resource/resource_bundle.h @@ -249,7 +249,7 @@ class UI_EXPORT ResourceBundle { // Used on Android to load the local file in the browser process and pass it // to the sandboxed renderer process. base::FilePath GetLocaleFilePath(const std::string& app_locale, - bool test_file_exists); + bool test_file_exists); // Returns the maximum scale factor currently loaded. // Returns SCALE_FACTOR_100P if no resource is loaded. diff --git a/ui/base/resource/resource_bundle_aurax11.cc b/ui/base/resource/resource_bundle_aurax11.cc index 389c87e6..4bc7ee6 100644 --- a/ui/base/resource/resource_bundle_aurax11.cc +++ b/ui/base/resource/resource_bundle_aurax11.cc @@ -16,7 +16,7 @@ namespace { -FilePath GetResourcesPakFilePath(const std::string& pak_name) { +base::FilePath GetResourcesPakFilePath(const std::string& pak_name) { base::FilePath path; if (PathService::Get(base::DIR_MODULE, &path)) return path.AppendASCII(pak_name.c_str()); diff --git a/ui/base/resource/resource_bundle_gtk.cc b/ui/base/resource/resource_bundle_gtk.cc index 44c3ebc..4d16b61 100644 --- a/ui/base/resource/resource_bundle_gtk.cc +++ b/ui/base/resource/resource_bundle_gtk.cc @@ -53,7 +53,7 @@ GdkPixbuf* LoadPixbuf(base::RefCountedStaticMemory* data, bool rtl_enabled) { } } -FilePath GetResourcesPakFilePath(const std::string& pak_name) { +base::FilePath GetResourcesPakFilePath(const std::string& pak_name) { base::FilePath path; if (PathService::Get(base::DIR_MODULE, &path)) return path.AppendASCII(pak_name.c_str()); diff --git a/ui/base/resource/resource_bundle_ios.mm b/ui/base/resource/resource_bundle_ios.mm index 0717161..925e702 100644 --- a/ui/base/resource/resource_bundle_ios.mm +++ b/ui/base/resource/resource_bundle_ios.mm @@ -23,7 +23,7 @@ namespace ui { namespace { -FilePath GetResourcesPakFilePath(NSString* name, NSString* mac_locale) { +base::FilePath GetResourcesPakFilePath(NSString* name, NSString* mac_locale) { NSString *resource_path; if ([mac_locale length]) { resource_path = [base::mac::FrameworkBundle() pathForResource:name @@ -58,8 +58,8 @@ void ResourceBundle::LoadCommonResources() { } } -FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, - bool test_file_exists) { +base::FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, + bool test_file_exists) { NSString* mac_locale = base::SysUTF8ToNSString(app_locale); // iOS uses "_" instead of "-", so swap to get a iOS-style value. diff --git a/ui/base/resource/resource_bundle_mac.mm b/ui/base/resource/resource_bundle_mac.mm index fd9a2cb..39c52d9 100644 --- a/ui/base/resource/resource_bundle_mac.mm +++ b/ui/base/resource/resource_bundle_mac.mm @@ -22,7 +22,7 @@ namespace ui { namespace { -FilePath GetResourcesPakFilePath(NSString* name, NSString* mac_locale) { +base::FilePath GetResourcesPakFilePath(NSString* name, NSString* mac_locale) { NSString *resource_path; // Some of the helper processes need to be able to fetch resources // (chrome_main.cc: SubprocessNeedsResourceBundle()). Fetch the same locale @@ -66,8 +66,8 @@ void ResourceBundle::LoadCommonResources() { } } -FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, - bool test_file_exists) { +base::FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, + bool test_file_exists) { NSString* mac_locale = base::SysUTF8ToNSString(app_locale); // Mac OS X uses "_" instead of "-", so swap to get a Mac-style value. diff --git a/ui/base/resource/resource_bundle_win.cc b/ui/base/resource/resource_bundle_win.cc index aad1ef1..a98bbaf 100644 --- a/ui/base/resource/resource_bundle_win.cc +++ b/ui/base/resource/resource_bundle_win.cc @@ -24,7 +24,7 @@ HINSTANCE GetCurrentResourceDLL() { return GetModuleHandle(NULL); } -FilePath GetResourcesPakFilePath(const std::string& pak_name) { +base::FilePath GetResourcesPakFilePath(const std::string& pak_name) { base::FilePath path; if (PathService::Get(base::DIR_MODULE, &path)) return path.AppendASCII(pak_name.c_str()); diff --git a/ui/shell_dialogs/gtk/select_file_dialog_impl.cc b/ui/shell_dialogs/gtk/select_file_dialog_impl.cc index 05f5113..caea53a 100644 --- a/ui/shell_dialogs/gtk/select_file_dialog_impl.cc +++ b/ui/shell_dialogs/gtk/select_file_dialog_impl.cc @@ -25,8 +25,8 @@ UseKdeFileDialogStatus use_kde_ = UNKNOWN; namespace ui { -FilePath* SelectFileDialogImpl::last_saved_path_ = NULL; -FilePath* SelectFileDialogImpl::last_opened_path_ = NULL; +base::FilePath* SelectFileDialogImpl::last_saved_path_ = NULL; +base::FilePath* SelectFileDialogImpl::last_opened_path_ = NULL; // static SelectFileDialog* CreateLinuxSelectFileDialog( diff --git a/webkit/blob/blob_storage_controller_unittest.cc b/webkit/blob/blob_storage_controller_unittest.cc index ecd112b..9290f6a 100644 --- a/webkit/blob/blob_storage_controller_unittest.cc +++ b/webkit/blob/blob_storage_controller_unittest.cc @@ -21,22 +21,23 @@ TEST(BlobStorageControllerTest, RegisterBlobUrl) { scoped_refptr<BlobData> blob_data1(new BlobData()); blob_data1->AppendData("Data1"); blob_data1->AppendData("Data2"); - blob_data1->AppendFile(FilePath(FILE_PATH_LITERAL("File1.txt")), + blob_data1->AppendFile(base::FilePath(FILE_PATH_LITERAL("File1.txt")), 10, 1024, time1); scoped_refptr<BlobData> blob_data2(new BlobData()); blob_data2->AppendData("Data3"); blob_data2->AppendBlob(GURL("blob://url_1"), 8, 100); - blob_data2->AppendFile(FilePath(FILE_PATH_LITERAL("File2.txt")), + blob_data2->AppendFile(base::FilePath(FILE_PATH_LITERAL("File2.txt")), 0, 20, time2); scoped_refptr<BlobData> canonicalized_blob_data2(new BlobData()); canonicalized_blob_data2->AppendData("Data3"); canonicalized_blob_data2->AppendData("a2___", 2); - canonicalized_blob_data2->AppendFile(FilePath(FILE_PATH_LITERAL("File1.txt")), + canonicalized_blob_data2->AppendFile( + base::FilePath(FILE_PATH_LITERAL("File1.txt")), 10, 98, time1); - canonicalized_blob_data2->AppendFile(FilePath(FILE_PATH_LITERAL("File2.txt")), - 0, 20, time2); + canonicalized_blob_data2->AppendFile( + base::FilePath(FILE_PATH_LITERAL("File2.txt")), 0, 20, time2); BlobStorageController blob_storage_controller; diff --git a/webkit/database/database_quota_client_unittest.cc b/webkit/database/database_quota_client_unittest.cc index 286347c..541f1e0 100644 --- a/webkit/database/database_quota_client_unittest.cc +++ b/webkit/database/database_quota_client_unittest.cc @@ -27,7 +27,7 @@ static const quota::StorageType kPerm = quota::kStorageTypePersistent; class MockDatabaseTracker : public DatabaseTracker { public: MockDatabaseTracker() - : DatabaseTracker(FilePath(), false, NULL, NULL, NULL), + : DatabaseTracker(base::FilePath(), false, NULL, NULL, NULL), delete_called_count_(0), async_delete_(false) {} diff --git a/webkit/fileapi/file_system_util.cc b/webkit/fileapi/file_system_util.cc index 24513d8..0960d0cb 100644 --- a/webkit/fileapi/file_system_util.cc +++ b/webkit/fileapi/file_system_util.cc @@ -25,8 +25,8 @@ const char kIsolatedDir[] = "/isolated"; const char kExternalDir[] = "/external"; const char kTestDir[] = "/test"; -const FilePath::CharType VirtualPath::kRoot[] = FILE_PATH_LITERAL("/"); -const FilePath::CharType VirtualPath::kSeparator = FILE_PATH_LITERAL('/'); +const base::FilePath::CharType VirtualPath::kRoot[] = FILE_PATH_LITERAL("/"); +const base::FilePath::CharType VirtualPath::kSeparator = FILE_PATH_LITERAL('/'); // TODO(ericu): Consider removing support for '\', even on Windows, if possible. // There's a lot of test code that will need reworking, and we may have trouble @@ -73,20 +73,21 @@ void VirtualPath::GetComponents( std::vector<base::FilePath::StringType>(ret_val.rbegin(), ret_val.rend()); } -FilePath::StringType VirtualPath::GetNormalizedFilePath(const FilePath& path) { - FilePath::StringType normalized_path = path.value(); - const size_t num_separators = FilePath::StringType( - FilePath::kSeparators).length(); +base::FilePath::StringType VirtualPath::GetNormalizedFilePath( + const base::FilePath& path) { + base::FilePath::StringType normalized_path = path.value(); + const size_t num_separators = base::FilePath::StringType( + base::FilePath::kSeparators).length(); for (size_t i = 1; i < num_separators; ++i) { std::replace(normalized_path.begin(), normalized_path.end(), - FilePath::kSeparators[i], kSeparator); + base::FilePath::kSeparators[i], kSeparator); } return (IsAbsolute(normalized_path)) ? - normalized_path : FilePath::StringType(kRoot) + normalized_path; + normalized_path : base::FilePath::StringType(kRoot) + normalized_path; } -bool VirtualPath::IsAbsolute(const FilePath::StringType& path) { +bool VirtualPath::IsAbsolute(const base::FilePath::StringType& path) { return path.find(kRoot) == 0; } diff --git a/webkit/fileapi/file_system_util.h b/webkit/fileapi/file_system_util.h index ffefe57..60ac4c0 100644 --- a/webkit/fileapi/file_system_util.h +++ b/webkit/fileapi/file_system_util.h @@ -27,11 +27,11 @@ extern const char kTestDir[]; class WEBKIT_STORAGE_EXPORT VirtualPath { public: - static const FilePath::CharType kRoot[]; - static const FilePath::CharType kSeparator; + static const base::FilePath::CharType kRoot[]; + static const base::FilePath::CharType kSeparator; // Use this instead of base::FilePath::BaseName when operating on virtual - // paths. base::FilePath::BaseName will get confused by ':' on Windows when it + // paths. FilePath::BaseName will get confused by ':' on Windows when it // looks like a drive letter separator; this will treat it as just another // character. static base::FilePath BaseName(const base::FilePath& virtual_path); @@ -45,10 +45,11 @@ class WEBKIT_STORAGE_EXPORT VirtualPath { // Returns a path name ensuring that it begins with kRoot and all path // separators are forward slashes /. - static FilePath::StringType GetNormalizedFilePath(const FilePath& path); + static base::FilePath::StringType GetNormalizedFilePath( + const base::FilePath& path); // Returns true if the given path begins with kRoot. - static bool IsAbsolute(const FilePath::StringType& path); + static bool IsAbsolute(const base::FilePath::StringType& path); }; // Returns the root URI of the filesystem that can be specified by a pair of diff --git a/webkit/fileapi/file_system_util_unittest.cc b/webkit/fileapi/file_system_util_unittest.cc index 3bf54fb..1b23d34 100644 --- a/webkit/fileapi/file_system_util_unittest.cc +++ b/webkit/fileapi/file_system_util_unittest.cc @@ -56,8 +56,8 @@ TEST_F(FileSystemUtilTest, VirtualPathBaseName) { TEST_F(FileSystemUtilTest, GetNormalizedFilePath) { struct test_data { - const FilePath::StringType path; - const FilePath::StringType normalized_path; + const base::FilePath::StringType path; + const base::FilePath::StringType normalized_path; } test_cases[] = { { FILE_PATH_LITERAL(""), FILE_PATH_LITERAL("/") }, { FILE_PATH_LITERAL("/"), FILE_PATH_LITERAL("/") }, @@ -65,8 +65,8 @@ TEST_F(FileSystemUtilTest, GetNormalizedFilePath) { { FILE_PATH_LITERAL("/foo/bar"), FILE_PATH_LITERAL("/foo/bar") } }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { - FilePath input = FilePath(test_cases[i].path); - FilePath::StringType normalized_path_string = + base::FilePath input = base::FilePath(test_cases[i].path); + base::FilePath::StringType normalized_path_string = VirtualPath::GetNormalizedFilePath(input); EXPECT_EQ(test_cases[i].normalized_path, normalized_path_string); } diff --git a/webkit/fileapi/isolated_file_util_unittest.cc b/webkit/fileapi/isolated_file_util_unittest.cc index faf83d7..1c67fb4 100644 --- a/webkit/fileapi/isolated_file_util_unittest.cc +++ b/webkit/fileapi/isolated_file_util_unittest.cc @@ -63,18 +63,18 @@ bool IsDirectoryEmpty(FileSystemContext* context, const FileSystemURL& url) { FileSystemURL GetEntryURL(FileSystemContext* file_system_context, const FileSystemURL& dir, - const FilePath::StringType& name) { + const base::FilePath::StringType& name) { return file_system_context->CreateCrackedFileSystemURL( dir.origin(), dir.mount_type(), dir.virtual_path().Append(name)); } -FilePath GetRelativeVirtualPath(const FileSystemURL& root, - const FileSystemURL& url) { +base::FilePath GetRelativeVirtualPath(const FileSystemURL& root, + const FileSystemURL& url) { if (root.virtual_path().empty()) return url.virtual_path(); - FilePath relative; + base::FilePath relative; const bool success = root.virtual_path().AppendRelativePath( url.virtual_path(), &relative); DCHECK(success); @@ -162,14 +162,14 @@ class IsolatedFileUtilTest : public testing::Test { return file_system_context()->CreateCrackedFileSystemURL( GURL("http://example.com"), kFileSystemTypeTemporary, - FilePath().AppendASCII("dest").Append(path)); + base::FilePath().AppendASCII("dest").Append(path)); } void VerifyFilesHaveSameContent(const FileSystemURL& url1, const FileSystemURL& url2) { // Get the file info for url1. base::PlatformFileInfo info1; - FilePath platform_path1; + base::FilePath platform_path1; ASSERT_EQ(base::PLATFORM_FILE_OK, AsyncFileTestHelper::GetMetadata( file_system_context(), url1, &info1, &platform_path1)); diff --git a/webkit/fileapi/local_file_system_cross_operation_unittest.cc b/webkit/fileapi/local_file_system_cross_operation_unittest.cc index 12c4ee4..2929b93 100644 --- a/webkit/fileapi/local_file_system_cross_operation_unittest.cc +++ b/webkit/fileapi/local_file_system_cross_operation_unittest.cc @@ -50,7 +50,7 @@ class CrossOperationTestHelper { void SetUp() { ASSERT_TRUE(base_.CreateUniqueTempDir()); - FilePath base_dir = base_.path(); + base::FilePath base_dir = base_.path(); quota_manager_ = new quota::MockQuotaManager( false /* is_incognito */, base_dir, base::MessageLoopProxy::current(), @@ -102,12 +102,12 @@ class CrossOperationTestHelper { FileSystemURL SourceURL(const std::string& path) { return file_system_context_->CreateCrackedFileSystemURL( - origin_, src_type_, FilePath::FromUTF8Unsafe(path)); + origin_, src_type_, base::FilePath::FromUTF8Unsafe(path)); } FileSystemURL DestURL(const std::string& path) { return file_system_context_->CreateCrackedFileSystemURL( - origin_, dest_type_, FilePath::FromUTF8Unsafe(path)); + origin_, dest_type_, base::FilePath::FromUTF8Unsafe(path)); } base::PlatformFileError Copy(const FileSystemURL& src, @@ -146,10 +146,11 @@ class CrossOperationTestHelper { const FileSystemURL& root, const test::TestCaseRecord* const test_cases, size_t test_case_size) { - std::map<FilePath, const test::TestCaseRecord*> test_case_map; + std::map<base::FilePath, const test::TestCaseRecord*> test_case_map; for (size_t i = 0; i < test_case_size; ++i) - test_case_map[FilePath(test_cases[i].path).NormalizePathSeparators()] = - &test_cases[i]; + test_case_map[ + base::FilePath(test_cases[i].path).NormalizePathSeparators()] = + &test_cases[i]; std::queue<FileSystemURL> directories; FileEntryList entries; @@ -163,7 +164,7 @@ class CrossOperationTestHelper { dir.origin(), dir.mount_type(), dir.virtual_path().Append(entries[i].name)); - FilePath relative; + base::FilePath relative; root.virtual_path().AppendRelativePath(url.virtual_path(), &relative); relative = relative.NormalizePathSeparators(); ASSERT_TRUE(ContainsKey(test_case_map, relative)); diff --git a/webkit/fileapi/media/device_media_async_file_util.cc b/webkit/fileapi/media/device_media_async_file_util.cc index fbd5ad1..550d5d8 100644 --- a/webkit/fileapi/media/device_media_async_file_util.cc +++ b/webkit/fileapi/media/device_media_async_file_util.cc @@ -316,7 +316,7 @@ void DeviceMediaAsyncFileUtil::OnCreateSnapshotFileError( const AsyncFileUtil::CreateSnapshotFileCallback& callback, base::PlatformFileError error) { if (!callback.is_null()) - callback.Run(error, base::PlatformFileInfo(), FilePath(), + callback.Run(error, base::PlatformFileInfo(), base::FilePath(), kSnapshotFileTemporary); } diff --git a/webkit/fileapi/native_file_util_unittest.cc b/webkit/fileapi/native_file_util_unittest.cc index e395a57..bf02f9d 100644 --- a/webkit/fileapi/native_file_util_unittest.cc +++ b/webkit/fileapi/native_file_util_unittest.cc @@ -19,20 +19,20 @@ class NativeFileUtilTest : public testing::Test { } protected: - FilePath Path() { + base::FilePath Path() { return data_dir_.path(); } - FilePath Path(const char* file_name) { + base::FilePath Path(const char* file_name) { return data_dir_.path().AppendASCII(file_name); } - bool FileExists(const FilePath& path) { + bool FileExists(const base::FilePath& path) { return file_util::PathExists(path) && !file_util::DirectoryExists(path); } - int64 GetSize(const FilePath& path) { + int64 GetSize(const base::FilePath& path) { base::PlatformFileInfo info; file_util::GetFileInfo(path, &info); return info.size; @@ -45,7 +45,7 @@ class NativeFileUtilTest : public testing::Test { }; TEST_F(NativeFileUtilTest, CreateCloseAndDeleteFile) { - FilePath file_name = Path("test_file"); + base::FilePath file_name = Path("test_file"); base::PlatformFile file_handle; bool created = false; int flags = base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_ASYNC; @@ -76,7 +76,7 @@ TEST_F(NativeFileUtilTest, CreateCloseAndDeleteFile) { } TEST_F(NativeFileUtilTest, EnsureFileExists) { - FilePath file_name = Path("foobar"); + base::FilePath file_name = Path("foobar"); bool created = false; ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::EnsureFileExists(file_name, &created)); @@ -91,7 +91,7 @@ TEST_F(NativeFileUtilTest, EnsureFileExists) { } TEST_F(NativeFileUtilTest, CreateAndDeleteDirectory) { - FilePath dir_name = Path("test_dir"); + base::FilePath dir_name = Path("test_dir"); ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::CreateDirectory(dir_name, false /* exclusive */, @@ -112,7 +112,7 @@ TEST_F(NativeFileUtilTest, CreateAndDeleteDirectory) { } TEST_F(NativeFileUtilTest, TouchFileAndGetFileInfo) { - FilePath file_name = Path("test_file"); + base::FilePath file_name = Path("test_file"); base::PlatformFileInfo native_info; ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, NativeFileUtil::GetFileInfo(file_name, &native_info)); @@ -148,11 +148,12 @@ TEST_F(NativeFileUtilTest, TouchFileAndGetFileInfo) { } TEST_F(NativeFileUtilTest, CreateFileEnumerator) { - FilePath path_1 = Path("dir1"); - FilePath path_2 = Path("file1"); - FilePath path_11 = Path("dir1").AppendASCII("file11"); - FilePath path_12 = Path("dir1").AppendASCII("dir12"); - FilePath path_121 = Path("dir1").AppendASCII("dir12").AppendASCII("file121"); + base::FilePath path_1 = Path("dir1"); + base::FilePath path_2 = Path("file1"); + base::FilePath path_11 = Path("dir1").AppendASCII("file11"); + base::FilePath path_12 = Path("dir1").AppendASCII("dir12"); + base::FilePath path_121 = + Path("dir1").AppendASCII("dir12").AppendASCII("file121"); ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::CreateDirectory(path_1, false, false)); bool created = false; @@ -168,10 +169,10 @@ TEST_F(NativeFileUtilTest, CreateFileEnumerator) { { scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> enumerator = NativeFileUtil::CreateFileEnumerator(Path(), false); - std::set<FilePath> set; + std::set<base::FilePath> set; set.insert(path_1); set.insert(path_2); - for (FilePath path = enumerator->Next(); !path.empty(); + for (base::FilePath path = enumerator->Next(); !path.empty(); path = enumerator->Next()) EXPECT_EQ(1U, set.erase(path)); EXPECT_TRUE(set.empty()); @@ -180,13 +181,13 @@ TEST_F(NativeFileUtilTest, CreateFileEnumerator) { { scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> enumerator = NativeFileUtil::CreateFileEnumerator(Path(), true); - std::set<FilePath> set; + std::set<base::FilePath> set; set.insert(path_1); set.insert(path_2); set.insert(path_11); set.insert(path_12); set.insert(path_121); - for (FilePath path = enumerator->Next(); !path.empty(); + for (base::FilePath path = enumerator->Next(); !path.empty(); path = enumerator->Next()) EXPECT_EQ(1U, set.erase(path)); EXPECT_TRUE(set.empty()); @@ -194,7 +195,7 @@ TEST_F(NativeFileUtilTest, CreateFileEnumerator) { } TEST_F(NativeFileUtilTest, Truncate) { - FilePath file_name = Path("truncated"); + base::FilePath file_name = Path("truncated"); bool created = false; ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::EnsureFileExists(file_name, &created)); @@ -208,9 +209,9 @@ TEST_F(NativeFileUtilTest, Truncate) { } TEST_F(NativeFileUtilTest, CopyFile) { - FilePath from_file = Path("fromfile"); - FilePath to_file1 = Path("tofile1"); - FilePath to_file2 = Path("tofile2"); + base::FilePath from_file = Path("fromfile"); + base::FilePath to_file1 = Path("tofile1"); + base::FilePath to_file2 = Path("tofile2"); bool created = false; ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::EnsureFileExists(from_file, &created)); @@ -235,11 +236,11 @@ TEST_F(NativeFileUtilTest, CopyFile) { EXPECT_TRUE(FileExists(to_file2)); EXPECT_EQ(1020, GetSize(to_file2)); - FilePath dir = Path("dir"); + base::FilePath dir = Path("dir"); ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::CreateDirectory(dir, false, false)); ASSERT_TRUE(file_util::DirectoryExists(dir)); - FilePath to_dir_file = dir.AppendASCII("file"); + base::FilePath to_dir_file = dir.AppendASCII("file"); ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::CopyOrMoveFile(from_file, to_dir_file, true)); EXPECT_TRUE(FileExists(to_dir_file)); @@ -270,8 +271,8 @@ TEST_F(NativeFileUtilTest, CopyFile) { } TEST_F(NativeFileUtilTest, MoveFile) { - FilePath from_file = Path("fromfile"); - FilePath to_file = Path("tofile"); + base::FilePath from_file = Path("fromfile"); + base::FilePath to_file = Path("tofile"); bool created = false; ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::EnsureFileExists(from_file, &created)); @@ -294,11 +295,11 @@ TEST_F(NativeFileUtilTest, MoveFile) { ASSERT_TRUE(FileExists(from_file)); ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::Truncate(from_file, 1020)); - FilePath dir = Path("dir"); + base::FilePath dir = Path("dir"); ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::CreateDirectory(dir, false, false)); ASSERT_TRUE(file_util::DirectoryExists(dir)); - FilePath to_dir_file = dir.AppendASCII("file"); + base::FilePath to_dir_file = dir.AppendASCII("file"); ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::CopyOrMoveFile(from_file, to_dir_file, false)); EXPECT_FALSE(FileExists(from_file)); diff --git a/webkit/fileapi/obfuscated_file_util_unittest.cc b/webkit/fileapi/obfuscated_file_util_unittest.cc index 946932c..8bb8e91 100644 --- a/webkit/fileapi/obfuscated_file_util_unittest.cc +++ b/webkit/fileapi/obfuscated_file_util_unittest.cc @@ -90,7 +90,7 @@ const OriginEnumerationTestRecord kOriginEnumerationTestRecords[] = { }; FileSystemURL FileSystemURLAppend( - const FileSystemURL& url, const FilePath::StringType& child) { + const FileSystemURL& url, const base::FilePath::StringType& child) { return FileSystemURL::CreateForTest( url.origin(), url.mount_type(), url.virtual_path().Append(child)); } @@ -100,7 +100,7 @@ FileSystemURL FileSystemURLAppendUTF8( return FileSystemURL::CreateForTest( url.origin(), url.mount_type(), - url.virtual_path().Append(FilePath::FromUTF8Unsafe(child))); + url.virtual_path().Append(base::FilePath::FromUTF8Unsafe(child))); } FileSystemURL FileSystemURLDirName(const FileSystemURL& url) { diff --git a/webkit/plugins/npapi/plugin_instance.h b/webkit/plugins/npapi/plugin_instance.h index 0858e97..f7c825e 100644 --- a/webkit/plugins/npapi/plugin_instance.h +++ b/webkit/plugins/npapi/plugin_instance.h @@ -319,7 +319,7 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { // List of files created for the current plugin instance. File names are // added to the list every time the NPP_StreamAsFile function is called. - std::vector<FilePath> files_created_; + std::vector<base::FilePath> files_created_; // Next unusued timer id. uint32 next_timer_id_; diff --git a/webkit/plugins/npapi/plugin_lib_unittest.cc b/webkit/plugins/npapi/plugin_lib_unittest.cc index a21e1f6..5d6c803 100644 --- a/webkit/plugins/npapi/plugin_lib_unittest.cc +++ b/webkit/plugins/npapi/plugin_lib_unittest.cc @@ -27,7 +27,7 @@ class PluginLibTest : public PluginLib { TEST(PluginLibLoading, UnloadAllPlugins) { // For the creation of the g_loaded_libs global variable. ASSERT_EQ(static_cast<PluginLibTest*>(NULL), - PluginLibTest::CreatePluginLib(FilePath())); + PluginLibTest::CreatePluginLib(base::FilePath())); // Try with a single plugin lib. scoped_refptr<PluginLibTest> plugin_lib1(new PluginLibTest()); @@ -35,7 +35,7 @@ TEST(PluginLibLoading, UnloadAllPlugins) { // Need to create it again, it should have been destroyed above. ASSERT_EQ(static_cast<PluginLibTest*>(NULL), - PluginLibTest::CreatePluginLib(FilePath())); + PluginLibTest::CreatePluginLib(base::FilePath())); // Try with two plugin libs. plugin_lib1 = new PluginLibTest(); @@ -44,7 +44,7 @@ TEST(PluginLibLoading, UnloadAllPlugins) { // Need to create it again, it should have been destroyed above. ASSERT_EQ(static_cast<PluginLibTest*>(NULL), - PluginLibTest::CreatePluginLib(FilePath())); + PluginLibTest::CreatePluginLib(base::FilePath())); // Now try to manually Unload one and then UnloadAll. plugin_lib1 = new PluginLibTest(); @@ -54,7 +54,7 @@ TEST(PluginLibLoading, UnloadAllPlugins) { // Need to create it again, it should have been destroyed above. ASSERT_EQ(static_cast<PluginLibTest*>(NULL), - PluginLibTest::CreatePluginLib(FilePath())); + PluginLibTest::CreatePluginLib(base::FilePath())); // Now try to manually Unload the only one and then UnloadAll. plugin_lib1 = new PluginLibTest(); diff --git a/webkit/tools/test_shell/simple_dom_storage_system.cc b/webkit/tools/test_shell/simple_dom_storage_system.cc index bd98ddb..f75933c 100644 --- a/webkit/tools/test_shell/simple_dom_storage_system.cc +++ b/webkit/tools/test_shell/simple_dom_storage_system.cc @@ -194,7 +194,8 @@ SimpleDomStorageSystem* SimpleDomStorageSystem::g_instance_; SimpleDomStorageSystem::SimpleDomStorageSystem() : weak_factory_(this), - context_(new DomStorageContext(FilePath(), FilePath(), NULL, NULL)), + context_(new DomStorageContext(base::FilePath(), base::FilePath(), + NULL, NULL)), host_(new DomStorageHost(context_)), area_being_processed_(NULL), next_connection_id_(1) { |