diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-06 20:42:30 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-06 20:42:30 +0000 |
commit | e5c2a22eb106e0fef92bbf80ac8bf2429980cc4e (patch) | |
tree | 480bf91e3cf64d69f837a2f22f8fc868bf17dfdc /chrome/browser | |
parent | 06b1d42b0ceadd4a70b7462c5c7e6adeb5a18ca4 (diff) | |
download | chromium_src-e5c2a22eb106e0fef92bbf80ac8bf2429980cc4e.zip chromium_src-e5c2a22eb106e0fef92bbf80ac8bf2429980cc4e.tar.gz chromium_src-e5c2a22eb106e0fef92bbf80ac8bf2429980cc4e.tar.bz2 |
Move WriteFile and WriteFileDescriptor from file_util to base namespace.
R=viettrungluu@chromium.org
TBR=viettrungluu
Review URL: https://codereview.chromium.org/184563006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255418 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
107 files changed, 227 insertions, 239 deletions
diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc index 327392f..7ebee0d 100644 --- a/chrome/browser/browser_shutdown.cc +++ b/chrome/browser/browser_shutdown.cc @@ -269,7 +269,7 @@ void ShutdownPostThreadsStop(bool restart_last_session) { base::Int64ToString(shutdown_delta.InMilliseconds()); int len = static_cast<int>(shutdown_ms.length()) + 1; base::FilePath shutdown_ms_file = GetShutdownMsPath(); - file_util::WriteFile(shutdown_ms_file, shutdown_ms.c_str(), len); + base::WriteFile(shutdown_ms_file, shutdown_ms.c_str(), len); } #if defined(OS_CHROMEOS) diff --git a/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc b/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc index cc56690..971550a 100644 --- a/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc +++ b/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc @@ -42,14 +42,14 @@ class BrowsingDataDatabaseHelperTest : public InProcessBrowserTest { base::FilePath db_path1 = db_tracker->GetFullDBFilePath(kTestIdentifier1, db_name); base::CreateDirectory(db_path1.DirName()); - ASSERT_EQ(0, file_util::WriteFile(db_path1, NULL, 0)); + ASSERT_EQ(0, base::WriteFile(db_path1, NULL, 0)); db_tracker->DatabaseOpened(kTestIdentifierExtension, db_name, description, 1, &size); db_tracker->DatabaseClosed(kTestIdentifierExtension, db_name); base::FilePath db_path2 = db_tracker->GetFullDBFilePath(kTestIdentifierExtension, db_name); base::CreateDirectory(db_path2.DirName()); - ASSERT_EQ(0, file_util::WriteFile(db_path2, NULL, 0)); + ASSERT_EQ(0, base::WriteFile(db_path2, NULL, 0)); std::vector<webkit_database::OriginInfo> origins; db_tracker->GetAllOriginsInfo(&origins); ASSERT_EQ(2U, origins.size()); diff --git a/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc b/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc index 564e07f9..b6a69d6 100644 --- a/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc +++ b/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc @@ -60,7 +60,7 @@ class BrowsingDataLocalStorageHelperTest : public InProcessBrowserTest { }; for (size_t i = 0; i < arraysize(kFilesToCreate); ++i) { base::FilePath file_path = storage_path.Append(kFilesToCreate[i]); - file_util::WriteFile(file_path, NULL, 0); + base::WriteFile(file_path, NULL, 0); } } diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc index 091989b..e267683 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc @@ -562,10 +562,10 @@ class RemoveLocalStorageTester { base::CreateDirectory(storage_path); // Write some files. - file_util::WriteFile(storage_path.Append(kDomStorageOrigin1), NULL, 0); - file_util::WriteFile(storage_path.Append(kDomStorageOrigin2), NULL, 0); - file_util::WriteFile(storage_path.Append(kDomStorageOrigin3), NULL, 0); - file_util::WriteFile(storage_path.Append(kDomStorageExt), NULL, 0); + base::WriteFile(storage_path.Append(kDomStorageOrigin1), NULL, 0); + base::WriteFile(storage_path.Append(kDomStorageOrigin2), NULL, 0); + base::WriteFile(storage_path.Append(kDomStorageOrigin3), NULL, 0); + base::WriteFile(storage_path.Append(kDomStorageExt), NULL, 0); // Tweak their dates. base::Time now = base::Time::Now(); diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_data.cc b/chrome/browser/chromeos/app_mode/kiosk_app_data.cc index 05a0a89..d97c75d 100644 --- a/chrome/browser/chromeos/app_mode/kiosk_app_data.cc +++ b/chrome/browser/chromeos/app_mode/kiosk_app_data.cc @@ -58,8 +58,8 @@ void SaveIconToLocalOnBlockingPool( CHECK(base::CreateDirectory(dir)); CHECK_EQ(static_cast<int>(raw_icon->size()), - file_util::WriteFile(icon_path, - raw_icon->data().c_str(), raw_icon->size())); + base::WriteFile(icon_path, + raw_icon->data().c_str(), raw_icon->size())); } // Returns true for valid kiosk app manifest. diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_update_service_browsertest.cc b/chrome/browser/chromeos/app_mode/kiosk_app_update_service_browsertest.cc index 8675103..89234a0 100644 --- a/chrome/browser/chromeos/app_mode/kiosk_app_update_service_browsertest.cc +++ b/chrome/browser/chromeos/app_mode/kiosk_app_update_service_browsertest.cc @@ -52,7 +52,7 @@ class KioskAppUpdateServiceTest : public extensions::PlatformAppBrowserTest { base::DoubleToString(uptime.InSecondsF()); const base::FilePath uptime_file = temp_dir.Append("uptime"); ASSERT_EQ(static_cast<int>(uptime_seconds.size()), - file_util::WriteFile( + base::WriteFile( uptime_file, uptime_seconds.c_str(), uptime_seconds.size())); uptime_file_override_.reset( new base::ScopedPathOverride(chromeos::FILE_UPTIME, uptime_file)); diff --git a/chrome/browser/chromeos/boot_times_loader.cc b/chrome/browser/chromeos/boot_times_loader.cc index 451c6a0..6d3c820 100644 --- a/chrome/browser/chromeos/boot_times_loader.cc +++ b/chrome/browser/chromeos/boot_times_loader.cc @@ -209,8 +209,7 @@ void BootTimesLoader::WriteTimes( } output += '\n'; - file_util::WriteFile( - log_path.Append(base_name), output.data(), output.size()); + base::WriteFile(log_path.Append(base_name), output.data(), output.size()); } void BootTimesLoader::LoginDone() { diff --git a/chrome/browser/chromeos/contacts/contact_database_unittest.cc b/chrome/browser/chromeos/contacts/contact_database_unittest.cc index 5bd26c3..8942da0 100644 --- a/chrome/browser/chromeos/contacts/contact_database_unittest.cc +++ b/chrome/browser/chromeos/contacts/contact_database_unittest.cc @@ -319,7 +319,7 @@ TEST_F(ContactDatabaseTest, DeleteWhenCorrupt) { database_path(), false, base::FileEnumerator::FILES); for (base::FilePath path = enumerator.Next(); !path.empty(); path = enumerator.Next()) { - file_util::WriteFile(path, " ", 1); + base::WriteFile(path, " ", 1); } CreateDatabase(); diff --git a/chrome/browser/chromeos/drive/file_system_util.cc b/chrome/browser/chromeos/drive/file_system_util.cc index cdc6d39..283772e 100644 --- a/chrome/browser/chromeos/drive/file_system_util.cc +++ b/chrome/browser/chromeos/drive/file_system_util.cc @@ -365,7 +365,7 @@ bool CreateGDocFile(const base::FilePath& file_path, std::string content = base::StringPrintf( "{\"url\": \"%s\", \"resource_id\": \"%s\"}", url.spec().c_str(), resource_id.c_str()); - return file_util::WriteFile(file_path, content.data(), content.size()) == + return base::WriteFile(file_path, content.data(), content.size()) == static_cast<int>(content.size()); } diff --git a/chrome/browser/chromeos/drive/file_write_watcher_unittest.cc b/chrome/browser/chromeos/drive/file_write_watcher_unittest.cc index 3bb06b1..00378bb 100644 --- a/chrome/browser/chromeos/drive/file_write_watcher_unittest.cc +++ b/chrome/browser/chromeos/drive/file_write_watcher_unittest.cc @@ -47,7 +47,7 @@ void WriteSomethingAfterStartWatch(const base::FilePath& path, EXPECT_TRUE(watch_success) << path.value(); const char kDummy[] = "hello"; - ASSERT_TRUE(file_util::WriteFile(path, kDummy, arraysize(kDummy))); + ASSERT_TRUE(base::WriteFile(path, kDummy, arraysize(kDummy))); } class FileWriteWatcherTest : public testing::Test { diff --git a/chrome/browser/chromeos/extensions/default_app_order_unittest.cc b/chrome/browser/chromeos/extensions/default_app_order_unittest.cc index e89af59..39b7aab 100644 --- a/chrome/browser/chromeos/extensions/default_app_order_unittest.cc +++ b/chrome/browser/chromeos/extensions/default_app_order_unittest.cc @@ -56,7 +56,7 @@ class DefaultAppOrderTest : public testing::Test { void CreateExternalOrderFile(const std::string& content) { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); base::FilePath external_file = temp_dir_.path().Append(kTestFile); - file_util::WriteFile(external_file, content.c_str(), content.size()); + base::WriteFile(external_file, content.c_str(), content.size()); SetExternalFile(external_file); } diff --git a/chrome/browser/chromeos/extensions/external_cache_unittest.cc b/chrome/browser/chromeos/extensions/external_cache_unittest.cc index 8f566a9..066240d 100644 --- a/chrome/browser/chromeos/extensions/external_cache_unittest.cc +++ b/chrome/browser/chromeos/extensions/external_cache_unittest.cc @@ -110,7 +110,7 @@ class ExternalCacheTest : public testing::Test, } void CreateFile(const base::FilePath& file) { - EXPECT_EQ(file_util::WriteFile(file, NULL, 0), 0); + EXPECT_EQ(base::WriteFile(file, NULL, 0), 0); } base::FilePath GetExtensionFile(const base::FilePath& dir, diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc index 23105fc..2b98284 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc +++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc @@ -72,8 +72,7 @@ bool SaveData(int key, const std::string& file_name, const std::string& data) { base::FilePath file_path = data_dir.Append(file_name); return base::PathExists(file_path) || - (file_util::WriteFile(file_path, data.c_str(), - data.size()) != -1); + (base::WriteFile(file_path, data.c_str(), data.size()) != -1); } // Gets |file_name| from directory with |key|. Return false if the directory can diff --git a/chrome/browser/chromeos/external_metrics.cc b/chrome/browser/chromeos/external_metrics.cc index e11d8e0..47a363e 100644 --- a/chrome/browser/chromeos/external_metrics.cc +++ b/chrome/browser/chromeos/external_metrics.cc @@ -90,7 +90,7 @@ void SetupProgressiveScanFieldTrial() { // Write the group to the file to be read by ChromeOS. int size = static_cast<int>(group_char.length()); - if (file_util::WriteFile(group_file_path, group_char.c_str(), size) == size) { + if (base::WriteFile(group_file_path, group_char.c_str(), size) == size) { VLOG(1) << "Configured in group '" << trial->group_name() << "' ('" << group_char << "') for " << name_of_experiment << " field trial"; diff --git a/chrome/browser/chromeos/file_manager/zip_file_creator_browsertest.cc b/chrome/browser/chromeos/file_manager/zip_file_creator_browsertest.cc index 618d5d5..e8788f5 100644 --- a/chrome/browser/chromeos/file_manager/zip_file_creator_browsertest.cc +++ b/chrome/browser/chromeos/file_manager/zip_file_creator_browsertest.cc @@ -81,9 +81,9 @@ IN_PROC_BROWSER_TEST_F(ZipFileCreatorTest, SomeFilesZip) { const int kRandomDataSize = 100000; const std::string kRandomData = base::RandBytesAsString(kRandomDataSize); base::CreateDirectory(zip_base_dir().Append(kDir1)); - file_util::WriteFile(zip_base_dir().Append(kFile1), "123", 3); - file_util::WriteFile(zip_base_dir().Append(kFile2), - kRandomData.c_str(), kRandomData.size()); + base::WriteFile(zip_base_dir().Append(kFile1), "123", 3); + base::WriteFile(zip_base_dir().Append(kFile2), + kRandomData.c_str(), kRandomData.size()); base::RunLoop run_loop; TestObserver observer(content::GetQuitTaskForRunLoop(&run_loop)); diff --git a/chrome/browser/chromeos/login/managed/locally_managed_user_creation_controller.cc b/chrome/browser/chromeos/login/managed/locally_managed_user_creation_controller.cc index c88738b..62a2de1 100644 --- a/chrome/browser/chromeos/login/managed/locally_managed_user_creation_controller.cc +++ b/chrome/browser/chromeos/login/managed/locally_managed_user_creation_controller.cc @@ -43,7 +43,7 @@ bool StoreManagedUserFiles(const std::string& token, base::CreateDirectory(base_path); } base::FilePath token_file = base_path.Append(kManagedUserTokenFilename); - int bytes = file_util::WriteFile(token_file, token.c_str(), token.length()); + int bytes = base::WriteFile(token_file, token.c_str(), token.length()); return bytes >= 0; } diff --git a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc index 0ad3bdd..dad81fc 100644 --- a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc +++ b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc @@ -97,7 +97,7 @@ class ParallelAuthenticatorTest : public testing::Test { base::FilePath out; FILE* tmp_file = base::CreateAndOpenTemporaryFile(&out); EXPECT_NE(tmp_file, static_cast<FILE*>(NULL)); - EXPECT_EQ(file_util::WriteFile(out, data, data_len), data_len); + EXPECT_EQ(base::WriteFile(out, data, data_len), data_len); EXPECT_TRUE(base::CloseFile(tmp_file)); return out; } diff --git a/chrome/browser/chromeos/login/resource_loader_browsertest.cc b/chrome/browser/chromeos/login/resource_loader_browsertest.cc index 2b91a32..668a373 100644 --- a/chrome/browser/chromeos/login/resource_loader_browsertest.cc +++ b/chrome/browser/chromeos/login/resource_loader_browsertest.cc @@ -23,7 +23,7 @@ namespace { GURL CreateResource(const std::string& content) { base::FilePath path; EXPECT_TRUE(base::CreateTemporaryFile(&path)); - EXPECT_TRUE(file_util::WriteFile(path, content.c_str(), content.size())); + EXPECT_TRUE(base::WriteFile(path, content.c_str(), content.size())); return GURL("file:///" + path.AsUTF8Unsafe()); } diff --git a/chrome/browser/chromeos/login/user_image_manager_browsertest.cc b/chrome/browser/chromeos/login/user_image_manager_browsertest.cc index df96eb6..03d3064 100644 --- a/chrome/browser/chromeos/login/user_image_manager_browsertest.cc +++ b/chrome/browser/chromeos/login/user_image_manager_browsertest.cc @@ -199,7 +199,7 @@ class UserImageManagerTest : public LoginManagerTest, scoped_refptr<base::RefCountedStaticMemory> image_data( ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( resource_id, ui::SCALE_FACTOR_100P)); - int written = file_util::WriteFile( + int written = base::WriteFile( image_path, reinterpret_cast<const char*>(image_data->front()), image_data->size()); @@ -599,7 +599,7 @@ class UserImageManagerPolicyTest : public UserImageManagerTest, std::vector<uint8> user_key_bits; ASSERT_TRUE(user_policy_.GetSigningKey()->ExportPublicKey(&user_key_bits)); ASSERT_TRUE(base::CreateDirectory(user_key_file.DirName())); - ASSERT_EQ(file_util::WriteFile( + ASSERT_EQ(base::WriteFile( user_key_file, reinterpret_cast<const char*>(user_key_bits.data()), user_key_bits.size()), diff --git a/chrome/browser/chromeos/login/user_image_manager_impl.cc b/chrome/browser/chromeos/login/user_image_manager_impl.cc index 08d0cc5..d73c123 100644 --- a/chrome/browser/chromeos/login/user_image_manager_impl.cc +++ b/chrome/browser/chromeos/login/user_image_manager_impl.cc @@ -171,9 +171,9 @@ bool SaveImage(const UserImage& user_image, const base::FilePath& image_path) { } if (!encoded_image->size() || - file_util::WriteFile(image_path, - reinterpret_cast<const char*>(&(*encoded_image)[0]), - encoded_image->size()) == -1) { + base::WriteFile(image_path, + reinterpret_cast<const char*>(&(*encoded_image)[0]), + encoded_image->size()) == -1) { LOG(ERROR) << "Failed to save image to file."; return false; } diff --git a/chrome/browser/chromeos/login/wallpaper_manager.cc b/chrome/browser/chromeos/login/wallpaper_manager.cc index 14cfbf3..f5219da 100644 --- a/chrome/browser/chromeos/login/wallpaper_manager.cc +++ b/chrome/browser/chromeos/login/wallpaper_manager.cc @@ -1321,7 +1321,7 @@ void WallpaperManager::RecordUma(User::WallpaperType type, int index) { void WallpaperManager::SaveWallpaperInternal(const base::FilePath& path, const char* data, int size) { - int written_bytes = file_util::WriteFile(path, data, size); + int written_bytes = base::WriteFile(path, data, size); DCHECK(written_bytes == size); } diff --git a/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc b/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc index ae17295..22e6a63 100644 --- a/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc +++ b/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc @@ -130,7 +130,7 @@ class WallpaperManagerBrowserTest : public InProcessBrowserTest, scoped_refptr<base::RefCountedStaticMemory> image_data( ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( resource_id, ui::SCALE_FACTOR_100P)); - int written = file_util::WriteFile( + int written = base::WriteFile( wallpaper_path, reinterpret_cast<const char*>(image_data->front()), image_data->size()); diff --git a/chrome/browser/chromeos/policy/device_policy_cros_browser_test.cc b/chrome/browser/chromeos/policy/device_policy_cros_browser_test.cc index 0318205..4797ee4 100644 --- a/chrome/browser/chromeos/policy/device_policy_cros_browser_test.cc +++ b/chrome/browser/chromeos/policy/device_policy_cros_browser_test.cc @@ -50,9 +50,9 @@ void DevicePolicyCrosTestHelper::MarkAsEnterpriseOwned() { const std::string install_attrs_blob( install_attrs_proto.SerializeAsString()); ASSERT_EQ(static_cast<int>(install_attrs_blob.size()), - file_util::WriteFile(install_attrs_file, - install_attrs_blob.c_str(), - install_attrs_blob.size())); + base::WriteFile(install_attrs_file, + install_attrs_blob.c_str(), + install_attrs_blob.size())); ASSERT_TRUE(PathService::Override(chromeos::FILE_INSTALL_ATTRIBUTES, install_attrs_file)); } @@ -62,8 +62,7 @@ void DevicePolicyCrosTestHelper::InstallOwnerKey() { std::vector<uint8> owner_key_bits; ASSERT_TRUE( device_policy()->GetSigningKey()->ExportPublicKey(&owner_key_bits)); - ASSERT_EQ( - file_util::WriteFile( + ASSERT_EQ(base::WriteFile( owner_key_file, reinterpret_cast<const char*>(vector_as_array(&owner_key_bits)), owner_key_bits.size()), diff --git a/chrome/browser/chromeos/policy/enterprise_install_attributes_unittest.cc b/chrome/browser/chromeos/policy/enterprise_install_attributes_unittest.cc index 87f093f..338735a 100644 --- a/chrome/browser/chromeos/policy/enterprise_install_attributes_unittest.cc +++ b/chrome/browser/chromeos/policy/enterprise_install_attributes_unittest.cc @@ -234,7 +234,7 @@ TEST_F(EnterpriseInstallAttributesTest, ReadCacheFile) { EnterpriseInstallAttributes::kAttrEnterpriseUser, kTestUser); const std::string blob(install_attrs_proto.SerializeAsString()); ASSERT_EQ(static_cast<int>(blob.size()), - file_util::WriteFile(GetTempPath(), blob.c_str(), blob.size())); + base::WriteFile(GetTempPath(), blob.c_str(), blob.size())); install_attributes_.ReadCacheFile(GetTempPath()); EXPECT_EQ(DEVICE_MODE_ENTERPRISE, install_attributes_.GetMode()); EXPECT_EQ(kTestDomain, install_attributes_.GetDomain()); @@ -248,7 +248,7 @@ TEST_F(EnterpriseInstallAttributesTest, ReadCacheFileForConsumerKiosk) { EnterpriseInstallAttributes::kAttrConsumerKioskEnabled, "true"); const std::string blob(install_attrs_proto.SerializeAsString()); ASSERT_EQ(static_cast<int>(blob.size()), - file_util::WriteFile(GetTempPath(), blob.c_str(), blob.size())); + base::WriteFile(GetTempPath(), blob.c_str(), blob.size())); install_attributes_.ReadCacheFile(GetTempPath()); EXPECT_EQ(DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH, install_attributes_.GetMode()); diff --git a/chrome/browser/chromeos/policy/power_policy_browsertest.cc b/chrome/browser/chromeos/policy/power_policy_browsertest.cc index 75719935..51aa2d4 100644 --- a/chrome/browser/chromeos/policy/power_policy_browsertest.cc +++ b/chrome/browser/chromeos/policy/power_policy_browsertest.cc @@ -210,7 +210,7 @@ void PowerPolicyBrowserTestBase::InstallUserKey() { std::vector<uint8> user_key_bits; ASSERT_TRUE(user_policy_.GetSigningKey()->ExportPublicKey(&user_key_bits)); ASSERT_TRUE(base::CreateDirectory(user_key_file.DirName())); - ASSERT_EQ(file_util::WriteFile( + ASSERT_EQ(base::WriteFile( user_key_file, reinterpret_cast<const char*>(user_key_bits.data()), user_key_bits.size()), diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc index 2d1f764..6ab114b 100644 --- a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc +++ b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc @@ -127,9 +127,9 @@ class UserCloudPolicyStoreChromeOSTest : public testing::Test { void StoreUserPolicyKey(const std::vector<uint8>& public_key) { ASSERT_TRUE(base::CreateDirectory(user_policy_key_file().DirName())); ASSERT_TRUE( - file_util::WriteFile(user_policy_key_file(), - reinterpret_cast<const char*>(public_key.data()), - public_key.size())); + base::WriteFile(user_policy_key_file(), + reinterpret_cast<const char*>(public_key.data()), + public_key.size())); } // Stores the current |policy_| and verifies that it is published. @@ -400,12 +400,12 @@ TEST_F(UserCloudPolicyStoreChromeOSTest, MigrationFull) { credentials.set_device_token(kLegacyToken); credentials.set_device_id(kLegacyDeviceId); ASSERT_TRUE(credentials.SerializeToString(&data)); - ASSERT_NE(-1, file_util::WriteFile(token_file(), data.c_str(), data.size())); + ASSERT_NE(-1, base::WriteFile(token_file(), data.c_str(), data.size())); em::CachedCloudPolicyResponse cached_policy; cached_policy.mutable_cloud_policy()->CopyFrom(policy_.policy()); ASSERT_TRUE(cached_policy.SerializeToString(&data)); - ASSERT_NE(-1, file_util::WriteFile(policy_file(), data.c_str(), data.size())); + ASSERT_NE(-1, base::WriteFile(policy_file(), data.c_str(), data.size())); EXPECT_CALL(observer_, OnStoreLoaded(store_.get())); ASSERT_NO_FATAL_FAILURE(PerformPolicyLoad("")); @@ -432,7 +432,7 @@ TEST_F(UserCloudPolicyStoreChromeOSTest, MigrationNoToken) { em::CachedCloudPolicyResponse cached_policy; cached_policy.mutable_cloud_policy()->CopyFrom(policy_.policy()); ASSERT_TRUE(cached_policy.SerializeToString(&data)); - ASSERT_NE(-1, file_util::WriteFile(policy_file(), data.c_str(), data.size())); + ASSERT_NE(-1, base::WriteFile(policy_file(), data.c_str(), data.size())); EXPECT_CALL(observer_, OnStoreLoaded(store_.get())); ASSERT_NO_FATAL_FAILURE(PerformPolicyLoad("")); @@ -457,7 +457,7 @@ TEST_F(UserCloudPolicyStoreChromeOSTest, MigrationNoPolicy) { credentials.set_device_token(kLegacyToken); credentials.set_device_id(kLegacyDeviceId); ASSERT_TRUE(credentials.SerializeToString(&data)); - ASSERT_NE(-1, file_util::WriteFile(token_file(), data.c_str(), data.size())); + ASSERT_NE(-1, base::WriteFile(token_file(), data.c_str(), data.size())); EXPECT_CALL(observer_, OnStoreLoaded(store_.get())); ASSERT_NO_FATAL_FAILURE(PerformPolicyLoad("")); @@ -482,7 +482,7 @@ TEST_F(UserCloudPolicyStoreChromeOSTest, MigrationAndStoreNew) { em::CachedCloudPolicyResponse cached_policy; cached_policy.mutable_cloud_policy()->CopyFrom(policy_.policy()); ASSERT_TRUE(cached_policy.SerializeToString(&data)); - ASSERT_NE(-1, file_util::WriteFile(policy_file(), data.c_str(), data.size())); + ASSERT_NE(-1, base::WriteFile(policy_file(), data.c_str(), data.size())); EXPECT_CALL(observer_, OnStoreLoaded(store_.get())); ASSERT_NO_FATAL_FAILURE(PerformPolicyLoad("")); diff --git a/chrome/browser/chromeos/policy/user_policy_disk_cache.cc b/chrome/browser/chromeos/policy/user_policy_disk_cache.cc index cab8020..7a3c6ca 100644 --- a/chrome/browser/chromeos/policy/user_policy_disk_cache.cc +++ b/chrome/browser/chromeos/policy/user_policy_disk_cache.cc @@ -131,7 +131,7 @@ void UserPolicyDiskCache::StoreOnFileThread( } int size = data.size(); - if (file_util::WriteFile(backing_file_path_, data.c_str(), size) != size) { + if (base::WriteFile(backing_file_path_, data.c_str(), size) != size) { LOG(WARNING) << "Failed to write " << backing_file_path_.value(); UMA_HISTOGRAM_ENUMERATION(policy::kMetricPolicy, kMetricPolicyStoreFailed, diff --git a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc index 7ba63e5..1da5a9b 100644 --- a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc +++ b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc @@ -246,7 +246,7 @@ TEST_F(DeviceSettingsProviderTest, StatsReportingMigration) { base::FilePath consent_file; ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &consent_file)); consent_file = consent_file.AppendASCII("Consent To Send Stats"); - ASSERT_EQ(1, file_util::WriteFile(consent_file, "0", 1)); + ASSERT_EQ(1, base::WriteFile(consent_file, "0", 1)); // This should trigger migration because the metrics policy isn't in the blob. device_settings_test_helper_.set_policy_blob(std::string()); diff --git a/chrome/browser/chromeos/settings/owner_key_util_unittest.cc b/chrome/browser/chromeos/settings/owner_key_util_unittest.cc index b009c33..c5ec00c 100644 --- a/chrome/browser/chromeos/settings/owner_key_util_unittest.cc +++ b/chrome/browser/chromeos/settings/owner_key_util_unittest.cc @@ -71,7 +71,7 @@ TEST_F(OwnerKeyUtilTest, ImportPublicKey) { std::vector<uint8> public_key(kTestKeyData, kTestKeyData + sizeof(kTestKeyData)); ASSERT_EQ(static_cast<int>(public_key.size()), - file_util::WriteFile( + base::WriteFile( key_file_, reinterpret_cast<const char*>(vector_as_array(&public_key)), public_key.size())); @@ -91,7 +91,7 @@ TEST_F(OwnerKeyUtilTest, ImportPublicKeyFailed) { // Next try empty file. This should fail and the array should be empty. from_disk.resize(10); - ASSERT_EQ(0, file_util::WriteFile(key_file_, "", 0)); + ASSERT_EQ(0, base::WriteFile(key_file_, "", 0)); EXPECT_TRUE(util_->IsPublicKeyPresent()); EXPECT_FALSE(util_->ImportPublicKey(&from_disk)); EXPECT_FALSE(from_disk.size()); diff --git a/chrome/browser/chromeos/system/automatic_reboot_manager.cc b/chrome/browser/chromeos/system/automatic_reboot_manager.cc index 5ac91e7..1e00316 100644 --- a/chrome/browser/chromeos/system/automatic_reboot_manager.cc +++ b/chrome/browser/chromeos/system/automatic_reboot_manager.cc @@ -117,9 +117,8 @@ void SaveUpdateRebootNeededUptime() { std::string update_reboot_needed_uptime = base::DoubleToString(uptime.InSecondsF()); - file_util::WriteFileDescriptor(fd, - update_reboot_needed_uptime.c_str(), - update_reboot_needed_uptime.size()); + base::WriteFileDescriptor(fd, update_reboot_needed_uptime.c_str(), + update_reboot_needed_uptime.size()); } } // namespace diff --git a/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc b/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc index b6e8ecc..f3204b6 100644 --- a/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc +++ b/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc @@ -212,9 +212,8 @@ void SaveUptimeToFile(const base::FilePath& path, const std::string uptime_seconds = base::DoubleToString(uptime.InSecondsF()); ASSERT_EQ(static_cast<int>(uptime_seconds.size()), - file_util::WriteFile(path, - uptime_seconds.c_str(), - uptime_seconds.size())); + base::WriteFile(path, uptime_seconds.c_str(), + uptime_seconds.size())); } MockTimeSingleThreadTaskRunner::MockTimeSingleThreadTaskRunner() { @@ -347,11 +346,10 @@ void AutomaticRebootManagerBasicTest::SetUp() { const base::FilePath& temp_dir = temp_dir_.path(); const base::FilePath uptime_file = temp_dir.Append("uptime"); task_runner_->SetUptimeFile(uptime_file); - ASSERT_FALSE(file_util::WriteFile(uptime_file, NULL, 0)); + ASSERT_FALSE(base::WriteFile(uptime_file, NULL, 0)); update_reboot_needed_uptime_file_ = temp_dir.Append("update_reboot_needed_uptime"); - ASSERT_FALSE(file_util::WriteFile( - update_reboot_needed_uptime_file_, NULL, 0)); + ASSERT_FALSE(base::WriteFile(update_reboot_needed_uptime_file_, NULL, 0)); ASSERT_TRUE(PathService::Override(chromeos::FILE_UPTIME, uptime_file)); ASSERT_TRUE(PathService::Override(chromeos::FILE_UPDATE_REBOOT_NEEDED_UPTIME, update_reboot_needed_uptime_file_)); diff --git a/chrome/browser/component_updater/component_unpacker.cc b/chrome/browser/component_updater/component_unpacker.cc index a8903db..4134b3e 100644 --- a/chrome/browser/component_updater/component_unpacker.cc +++ b/chrome/browser/component_updater/component_unpacker.cc @@ -240,7 +240,7 @@ void ComponentUnpacker::EndPatching(Error error, int extended_error) { void ComponentUnpacker::Install() { // Write the fingerprint to disk. if (static_cast<int>(fingerprint_.size()) != - file_util::WriteFile( + base::WriteFile( unpack_path_.Append(FILE_PATH_LITERAL("manifest.fingerprint")), fingerprint_.c_str(), fingerprint_.size())) { diff --git a/chrome/browser/component_updater/widevine_cdm_component_installer.cc b/chrome/browser/component_updater/widevine_cdm_component_installer.cc index bbfdd0f..d6195e2 100644 --- a/chrome/browser/component_updater/widevine_cdm_component_installer.cc +++ b/chrome/browser/component_updater/widevine_cdm_component_installer.cc @@ -343,7 +343,7 @@ void WidevineCdmComponentInstallerTraits::UpdateCdmAdapter( if (!base::ReadFileToString(adapter_version_path, &adapter_version) || adapter_version != chrome_version || !base::PathExists(adapter_install_path)) { - int bytes_written = file_util::WriteFile( + int bytes_written = base::WriteFile( adapter_version_path, chrome_version.data(), chrome_version.size()); if (bytes_written < 0 || static_cast<size_t>(bytes_written) != chrome_version.size()) { diff --git a/chrome/browser/devtools/devtools_file_helper.cc b/chrome/browser/devtools/devtools_file_helper.cc index 9ec7f90..f3a10b5 100644 --- a/chrome/browser/devtools/devtools_file_helper.cc +++ b/chrome/browser/devtools/devtools_file_helper.cc @@ -122,7 +122,7 @@ void WriteToFile(const base::FilePath& path, const std::string& content) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK(!path.empty()); - file_util::WriteFile(path, content.c_str(), content.length()); + base::WriteFile(path, content.c_str(), content.length()); } void AppendToFile(const base::FilePath& path, const std::string& content) { diff --git a/chrome/browser/diagnostics/diagnostics_controller_unittest.cc b/chrome/browser/diagnostics/diagnostics_controller_unittest.cc index 0a408bb..369dde6 100644 --- a/chrome/browser/diagnostics/diagnostics_controller_unittest.cc +++ b/chrome/browser/diagnostics/diagnostics_controller_unittest.cc @@ -75,7 +75,7 @@ class DiagnosticsControllerTest : public testing::Test { // Just write some random characters into the file tInvaludUsero "corrupt" // it. const char bogus_data[] = "wwZ2uNYNuyUVzFbDm3DL"; - file_util::WriteFile(path, bogus_data, arraysize(bogus_data)); + base::WriteFile(path, bogus_data, arraysize(bogus_data)); } scoped_ptr<DiagnosticsModel> model_; diff --git a/chrome/browser/download/chrome_download_manager_delegate_unittest.cc b/chrome/browser/download/chrome_download_manager_delegate_unittest.cc index 01422f1..b650fa0 100644 --- a/chrome/browser/download/chrome_download_manager_delegate_unittest.cc +++ b/chrome/browser/download/chrome_download_manager_delegate_unittest.cc @@ -386,7 +386,7 @@ TEST_F(ChromeDownloadManagerDelegateTest, CheckForFileExistence) { base::FilePath existing_path = default_download_path().AppendASCII("foo"); base::FilePath non_existent_path = default_download_path().AppendASCII("bar"); - file_util::WriteFile(existing_path, kData, kDataLength); + base::WriteFile(existing_path, kData, kDataLength); scoped_ptr<content::MockDownloadItem> download_item( CreateActiveDownloadItem(1)); diff --git a/chrome/browser/download/download_path_reservation_tracker_unittest.cc b/chrome/browser/download/download_path_reservation_tracker_unittest.cc index 5703da3..1a2728d 100644 --- a/chrome/browser/download/download_path_reservation_tracker_unittest.cc +++ b/chrome/browser/download/download_path_reservation_tracker_unittest.cc @@ -281,9 +281,9 @@ TEST_F(DownloadPathReservationTrackerTest, ConflictingFiles) { base::FilePath path1( GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo (1).txt"))); // Create a file at |path|, and a .crdownload file at |path1|. - ASSERT_EQ(0, file_util::WriteFile(path, "", 0)); + ASSERT_EQ(0, base::WriteFile(path, "", 0)); ASSERT_EQ(0, - file_util::WriteFile( + base::WriteFile( DownloadTargetDeterminer::GetCrDownloadPath(path1), "", 0)); ASSERT_TRUE(IsPathInUse(path)); @@ -647,8 +647,8 @@ TEST_F(DownloadPathReservationTrackerTest, TruncationConflict) { // "aaa...aaaaaaa.txt" (truncated path) and // "aaa...aaa (1).txt" (truncated and first uniquification try) exists. // "aaa...aaa (2).txt" should be used. - ASSERT_EQ(0, file_util::WriteFile(path0, "", 0)); - ASSERT_EQ(0, file_util::WriteFile(path1, "", 0)); + ASSERT_EQ(0, base::WriteFile(path0, "", 0)); + ASSERT_EQ(0, base::WriteFile(path1, "", 0)); base::FilePath reserved_path; bool verified = false; diff --git a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc index 55f4150..8898363 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc @@ -709,7 +709,7 @@ class HTML5FileWriter { // Create a temp file. base::FilePath temp_file; if (!base::CreateTemporaryFile(&temp_file) || - file_util::WriteFile(temp_file, data, length) != length) { + base::WriteFile(temp_file, data, length) != length) { return false; } // Invoke the fileapi to copy it into the sandboxed filesystem. @@ -1039,7 +1039,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, base::FilePath real_path = all_downloads[0]->GetTargetFilePath(); base::FilePath fake_path = all_downloads[1]->GetTargetFilePath(); - EXPECT_EQ(0, file_util::WriteFile(real_path, "", 0)); + EXPECT_EQ(0, base::WriteFile(real_path, "", 0)); ASSERT_TRUE(base::PathExists(real_path)); ASSERT_FALSE(base::PathExists(fake_path)); diff --git a/chrome/browser/extensions/api/image_writer_private/destroy_partitions_operation.cc b/chrome/browser/extensions/api/image_writer_private/destroy_partitions_operation.cc index 9c1871b..1ad6d98 100644 --- a/chrome/browser/extensions/api/image_writer_private/destroy_partitions_operation.cc +++ b/chrome/browser/extensions/api/image_writer_private/destroy_partitions_operation.cc @@ -32,7 +32,7 @@ void DestroyPartitionsOperation::StartImpl() { scoped_ptr<char[]> buffer(new char[kPartitionTableSize]); memset(buffer.get(), 0, kPartitionTableSize); - if (file_util::WriteFile(image_path_, buffer.get(), kPartitionTableSize) != + if (base::WriteFile(image_path_, buffer.get(), kPartitionTableSize) != kPartitionTableSize) { Error(error::kTempFileError); return; diff --git a/chrome/browser/extensions/api/image_writer_private/test_utils.cc b/chrome/browser/extensions/api/image_writer_private/test_utils.cc index eac159c..74cd9d2 100644 --- a/chrome/browser/extensions/api/image_writer_private/test_utils.cc +++ b/chrome/browser/extensions/api/image_writer_private/test_utils.cc @@ -167,7 +167,7 @@ bool ImageWriterUnitTestBase::FillFile(const base::FilePath& file, scoped_ptr<char[]> buffer(new char[length]); memset(buffer.get(), pattern, length); - return file_util::WriteFile(file, buffer.get(), length) == length; + return base::WriteFile(file, buffer.get(), length) == length; } } // namespace image_writer diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc b/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc index 9cbd5f4..a65d24f 100644 --- a/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc +++ b/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc @@ -359,9 +359,8 @@ class MediaGalleriesPlatformAppBrowserTest : public PlatformAppBrowserTest { &xml_contents, 0, std::string("$path2"), in_both_jpg.value()); base::FilePath album_xml = iphoto_data_root.AppendASCII("AlbumData.xml"); - ASSERT_NE(-1, file_util::WriteFile(album_xml, - xml_contents.c_str(), - xml_contents.size())); + ASSERT_NE(-1, base::WriteFile(album_xml, + xml_contents.c_str(), xml_contents.size())); } #endif // defined(OS_MACOSX) @@ -558,17 +557,17 @@ IN_PROC_BROWSER_TEST_F(MediaGalleriesPlatformAppBrowserTest, MAYBE_Scan) { dummy_data.resize(1); ASSERT_TRUE(base::CreateDirectory(scan_root.path().AppendASCII("a/b"))); ASSERT_EQ(static_cast<int>(dummy_data.size()), - file_util::WriteFile(scan_root.path().AppendASCII("a/b/c.jpg"), - dummy_data.c_str(), dummy_data.size())); + base::WriteFile(scan_root.path().AppendASCII("a/b/c.jpg"), + dummy_data.c_str(), dummy_data.size())); ASSERT_TRUE(base::CreateDirectory(scan_root.path().AppendASCII("a/d"))); dummy_data.resize(201 * 1024); // 200k is the min size for the folder finder. ASSERT_EQ(static_cast<int>(dummy_data.size()), - file_util::WriteFile(scan_root.path().AppendASCII("a/d/e.txt"), - dummy_data.c_str(), dummy_data.size())); + base::WriteFile(scan_root.path().AppendASCII("a/d/e.txt"), + dummy_data.c_str(), dummy_data.size())); ASSERT_TRUE(base::CreateDirectory(scan_root.path().AppendASCII("f"))); ASSERT_EQ(static_cast<int>(dummy_data.size()), - file_util::WriteFile(scan_root.path().AppendASCII("f/g.jpg"), - dummy_data.c_str(), dummy_data.size())); + base::WriteFile(scan_root.path().AppendASCII("f/g.jpg"), + dummy_data.c_str(), dummy_data.size())); ASSERT_TRUE(RunMediaGalleriesTest("scan")) << message_; } diff --git a/chrome/browser/extensions/api/media_galleries_private/media_galleries_watch_apitest.cc b/chrome/browser/extensions/api/media_galleries_private/media_galleries_watch_apitest.cc index 5a16da4..9564818 100644 --- a/chrome/browser/extensions/api/media_galleries_private/media_galleries_watch_apitest.cc +++ b/chrome/browser/extensions/api/media_galleries_private/media_galleries_watch_apitest.cc @@ -106,8 +106,8 @@ class MediaGalleriesPrivateGalleryWatchApiTest : public ExtensionApiTest { base::FilePath gallery_file = gallery_dir.Append(FILE_PATH_LITERAL("test1.txt")); std::string content("new content"); - int write_size = file_util::WriteFile(gallery_file, content.c_str(), - content.length()); + int write_size = base::WriteFile(gallery_file, content.c_str(), + content.length()); return (write_size == static_cast<int>(content.length())); } diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc b/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc index c182b29..a57fb74 100644 --- a/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc +++ b/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc @@ -147,7 +147,7 @@ class NativeMessagingTest : public ::testing::Test, return base::FilePath(); std::string message_with_header = FormatMessage(message); - int bytes_written = file_util::WriteFile( + int bytes_written = base::WriteFile( filename, message_with_header.data(), message_with_header.size()); if (bytes_written < 0 || (message_with_header.size() != static_cast<size_t>(bytes_written))) { diff --git a/chrome/browser/extensions/api/messaging/native_messaging_host_manifest_unittest.cc b/chrome/browser/extensions/api/messaging/native_messaging_host_manifest_unittest.cc index 841ace2..015710e 100644 --- a/chrome/browser/extensions/api/messaging/native_messaging_host_manifest_unittest.cc +++ b/chrome/browser/extensions/api/messaging/native_messaging_host_manifest_unittest.cc @@ -46,7 +46,7 @@ class NativeMessagingHostManifestTest : public ::testing::Test { } bool WriteManifest(const std::string& manifest_content) { - return file_util::WriteFile( + return base::WriteFile( manifest_path_, manifest_content.data(), manifest_content.size()); } diff --git a/chrome/browser/extensions/app_background_page_apitest.cc b/chrome/browser/extensions/app_background_page_apitest.cc index db030f0..c423a8c 100644 --- a/chrome/browser/extensions/app_background_page_apitest.cc +++ b/chrome/browser/extensions/app_background_page_apitest.cc @@ -51,9 +51,9 @@ class AppBackgroundPageApiTest : public ExtensionApiTest { return false; } base::FilePath manifest_path = app_dir_.path().AppendASCII("manifest.json"); - int bytes_written = file_util::WriteFile(manifest_path, - app_manifest.data(), - app_manifest.size()); + int bytes_written = base::WriteFile(manifest_path, + app_manifest.data(), + app_manifest.size()); if (bytes_written != static_cast<int>(app_manifest.size())) { LOG(ERROR) << "Unable to write complete manifest to file. Return code=" << bytes_written; diff --git a/chrome/browser/extensions/convert_web_app.cc b/chrome/browser/extensions/convert_web_app.cc index cb4a490..90d0446 100644 --- a/chrome/browser/extensions/convert_web_app.cc +++ b/chrome/browser/extensions/convert_web_app.cc @@ -149,7 +149,7 @@ scoped_refptr<Extension> ConvertWebAppToExtension( const char* image_data_ptr = reinterpret_cast<const char*>(&image_data[0]); int size = base::checked_cast<int>(image_data.size()); - if (file_util::WriteFile(icon_file, image_data_ptr, size) != size) { + if (base::WriteFile(icon_file, image_data_ptr, size) != size) { LOG(ERROR) << "Could not write icon file."; return NULL; } diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc index c31a399..e77e222 100644 --- a/chrome/browser/extensions/extension_creator.cc +++ b/chrome/browser/extensions/extension_creator.cc @@ -180,7 +180,7 @@ crypto::RSAPrivateKey* ExtensionCreator::GenerateKey(const base::FilePath& } if (!output_private_key_path.empty()) { - if (-1 == file_util::WriteFile(output_private_key_path, + if (-1 == base::WriteFile(output_private_key_path, pem_output.c_str(), pem_output.size())) { error_message_ = l10n_util::GetStringUTF8(IDS_EXTENSION_PRIVATE_KEY_FAILED_TO_OUTPUT); diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index d150ab0..ab5bfe9 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -2252,7 +2252,7 @@ TEST_F(ExtensionServiceTest, PackExtension) { // Try packing with an invalid manifest. std::string invalid_manifest_content = "I am not a manifest."; - ASSERT_TRUE(file_util::WriteFile( + ASSERT_TRUE(base::WriteFile( temp_dir2.path().Append(extensions::kManifestFilename), invalid_manifest_content.c_str(), invalid_manifest_content.size())); creator.reset(new ExtensionCreator()); @@ -4456,7 +4456,7 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) { base::FilePath lso_file_path = lso_dir_path.AppendASCII(origin_id) .AddExtension(FILE_PATH_LITERAL(".localstorage")); EXPECT_TRUE(base::CreateDirectory(lso_dir_path)); - EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); + EXPECT_EQ(0, base::WriteFile(lso_file_path, NULL, 0)); EXPECT_TRUE(base::PathExists(lso_file_path)); // Create indexed db. Similarly, it is enough to only simulate this by @@ -4572,7 +4572,7 @@ TEST_F(ExtensionServiceTest, ClearAppData) { base::FilePath lso_file_path = lso_dir_path.AppendASCII(origin_id) .AddExtension(FILE_PATH_LITERAL(".localstorage")); EXPECT_TRUE(base::CreateDirectory(lso_dir_path)); - EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); + EXPECT_EQ(0, base::WriteFile(lso_file_path, NULL, 0)); EXPECT_TRUE(base::PathExists(lso_file_path)); // Create indexed db. Similarly, it is enough to only simulate this by diff --git a/chrome/browser/extensions/sandboxed_unpacker.cc b/chrome/browser/extensions/sandboxed_unpacker.cc index f7625e70..618cb36 100644 --- a/chrome/browser/extensions/sandboxed_unpacker.cc +++ b/chrome/browser/extensions/sandboxed_unpacker.cc @@ -132,7 +132,7 @@ bool VerifyJunctionFreeLocation(base::FilePath* temp_dir) { // NormalizeFilePath requires a non-empty file, so write some data. // If you change the exit points of this function please make sure all // exit points delete this temp file! - if (file_util::WriteFile(temp_file, ".", 1) != 1) + if (base::WriteFile(temp_file, ".", 1) != 1) return false; base::FilePath normalized_temp_file; @@ -629,7 +629,7 @@ base::DictionaryValue* SandboxedUnpacker::RewriteManifestFile( base::FilePath manifest_path = extension_root_.Append(kManifestFilename); int size = base::checked_cast<int>(manifest_json.size()); - if (file_util::WriteFile(manifest_path, manifest_json.data(), size) != size) { + if (base::WriteFile(manifest_path, manifest_json.data(), size) != size) { // Error saving manifest.json. ReportFailure( ERROR_SAVING_MANIFEST_JSON, @@ -742,7 +742,7 @@ bool SandboxedUnpacker::RewriteImageFiles(SkBitmap* install_icon) { // so we can be sure the directory exists. const char* image_data_ptr = reinterpret_cast<const char*>(&image_data[0]); int size = base::checked_cast<int>(image_data.size()); - if (file_util::WriteFile(path, image_data_ptr, size) != size) { + if (base::WriteFile(path, image_data_ptr, size) != size) { // Error saving theme image. ReportFailure( ERROR_SAVING_THEME_IMAGE, @@ -811,7 +811,7 @@ bool SandboxedUnpacker::RewriteCatalogFiles() { // Note: we're overwriting existing files that the utility process read, // so we can be sure the directory exists. int size = base::checked_cast<int>(catalog_json.size()); - if (file_util::WriteFile(path, catalog_json.c_str(), size) != size) { + if (base::WriteFile(path, catalog_json.c_str(), size) != size) { // Error saving catalog. ReportFailure( ERROR_SAVING_CATALOG, diff --git a/chrome/browser/extensions/test_extension_dir.cc b/chrome/browser/extensions/test_extension_dir.cc index a99e5be..8da0667 100644 --- a/chrome/browser/extensions/test_extension_dir.cc +++ b/chrome/browser/extensions/test_extension_dir.cc @@ -32,7 +32,7 @@ void TestExtensionDir::WriteFile(const base::FilePath::StringType& filename, base::StringPiece contents) { EXPECT_EQ( base::checked_cast<int>(contents.size()), - file_util::WriteFile( + base::WriteFile( dir_.path().Append(filename), contents.data(), contents.size())); } diff --git a/chrome/browser/extensions/updater/local_extension_cache_unittest.cc b/chrome/browser/extensions/updater/local_extension_cache_unittest.cc index e4f4636..f232d5e 100644 --- a/chrome/browser/extensions/updater/local_extension_cache_unittest.cc +++ b/chrome/browser/extensions/updater/local_extension_cache_unittest.cc @@ -79,7 +79,7 @@ class LocalExtensionCacheTest : public testing::Test { size_t size, const base::Time& timestamp) { std::string data(size, 0); - EXPECT_EQ(file_util::WriteFile(file, data.data(), data.size()), int(size)); + EXPECT_EQ(base::WriteFile(file, data.data(), data.size()), int(size)); EXPECT_TRUE(base::TouchFile(file, timestamp, timestamp)); } diff --git a/chrome/browser/extensions/user_script_master_unittest.cc b/chrome/browser/extensions/user_script_master_unittest.cc index 585edd74..8347cbe 100644 --- a/chrome/browser/extensions/user_script_master_unittest.cc +++ b/chrome/browser/extensions/user_script_master_unittest.cc @@ -232,7 +232,7 @@ TEST_F(UserScriptMasterTest, Parse8) { TEST_F(UserScriptMasterTest, SkipBOMAtTheBeginning) { base::FilePath path = temp_dir_.path().AppendASCII("script.user.js"); const std::string content("\xEF\xBB\xBF alert('hello');"); - size_t written = file_util::WriteFile(path, content.c_str(), content.size()); + size_t written = base::WriteFile(path, content.c_str(), content.size()); ASSERT_EQ(written, content.size()); UserScript user_script; @@ -255,7 +255,7 @@ TEST_F(UserScriptMasterTest, SkipBOMAtTheBeginning) { TEST_F(UserScriptMasterTest, LeaveBOMNotAtTheBeginning) { base::FilePath path = temp_dir_.path().AppendASCII("script.user.js"); const std::string content("alert('here's a BOOM: \xEF\xBB\xBF');"); - size_t written = file_util::WriteFile(path, content.c_str(), content.size()); + size_t written = base::WriteFile(path, content.c_str(), content.size()); ASSERT_EQ(written, content.size()); UserScript user_script; diff --git a/chrome/browser/feedback/feedback_util.cc b/chrome/browser/feedback/feedback_util.cc index 2a795a5..bc3a9a2 100644 --- a/chrome/browser/feedback/feedback_util.cc +++ b/chrome/browser/feedback/feedback_util.cc @@ -254,8 +254,8 @@ bool ZipString(const base::FilePath& filename, // another temporary file to receive the zip file in. if (!base::CreateNewTempDirectory(base::FilePath::StringType(), &temp_path)) return false; - if (file_util::WriteFile(temp_path.Append(filename), - data.c_str(), data.size()) == -1) + if (base::WriteFile(temp_path.Append(filename), data.c_str(), data.size()) == + -1) return false; bool succeed = base::CreateTemporaryFile(&zip_file) && diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc index a5e826d..d89e76b 100644 --- a/chrome/browser/first_run/first_run.cc +++ b/chrome/browser/first_run/first_run.cc @@ -568,7 +568,7 @@ bool CreateSentinel() { base::FilePath first_run_sentinel; if (!internal::GetFirstRunSentinelFilePath(&first_run_sentinel)) return false; - return file_util::WriteFile(first_run_sentinel, "", 0) != -1; + return base::WriteFile(first_run_sentinel, "", 0) != -1; } // -- Platform-specific functions -- diff --git a/chrome/browser/first_run/first_run_browsertest.cc b/chrome/browser/first_run/first_run_browsertest.cc index c295df9..d1f65e7 100644 --- a/chrome/browser/first_run/first_run_browsertest.cc +++ b/chrome/browser/first_run/first_run_browsertest.cc @@ -89,8 +89,7 @@ class FirstRunMasterPrefsBrowserTestBase : public InProcessBrowserTest { ASSERT_TRUE(text_.get()); ASSERT_TRUE(base::CreateTemporaryFile(&prefs_file_)); - EXPECT_TRUE(file_util::WriteFile(prefs_file_, text_->c_str(), - text_->size())); + EXPECT_TRUE(base::WriteFile(prefs_file_, text_->c_str(), text_->size())); first_run::SetMasterPrefsPathForTesting(prefs_file_); // This invokes BrowserMain, and does the import, so must be done last. diff --git a/chrome/browser/first_run/first_run_internal_win.cc b/chrome/browser/first_run/first_run_internal_win.cc index bcc7911..2225cc8 100644 --- a/chrome/browser/first_run/first_run_internal_win.cc +++ b/chrome/browser/first_run/first_run_internal_win.cc @@ -108,7 +108,7 @@ bool WriteEULAtoTempFile(base::FilePath* eula_path) { std::string terms = l10n_util::GetStringUTF8(IDS_TERMS_HTML); return (!terms.empty() && base::CreateTemporaryFile(eula_path) && - file_util::WriteFile(*eula_path, terms.data(), terms.size()) != -1); + base::WriteFile(*eula_path, terms.data(), terms.size()) != -1); } // Creates the sentinel indicating that the EULA was required and has been @@ -119,7 +119,7 @@ bool CreateEULASentinel() { return false; return (base::CreateDirectory(eula_sentinel.DirName()) && - file_util::WriteFile(eula_sentinel, "", 0) != -1); + base::WriteFile(eula_sentinel, "", 0) != -1); } } // namespace diff --git a/chrome/browser/google/google_update_settings_posix.cc b/chrome/browser/google/google_update_settings_posix.cc index b861576..ac66192 100644 --- a/chrome/browser/google/google_update_settings_posix.cc +++ b/chrome/browser/google/google_update_settings_posix.cc @@ -48,7 +48,7 @@ bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) { !google_update::posix_guid().empty())) { const char* c_str = google_update::posix_guid().c_str(); int size = google_update::posix_guid().size(); - return file_util::WriteFile(consent_file, c_str, size) == size; + return base::WriteFile(consent_file, c_str, size) == size; } } else { google_update::posix_guid().clear(); diff --git a/chrome/browser/history/history_backend_unittest.cc b/chrome/browser/history/history_backend_unittest.cc index 9a12517..f53763f 100644 --- a/chrome/browser/history/history_backend_unittest.cc +++ b/chrome/browser/history/history_backend_unittest.cc @@ -2838,10 +2838,10 @@ TEST_F(HistoryBackendTest, DeleteFTSIndexDatabases) { // Setup dummy index database files. const char* data = "Dummy"; const size_t data_len = 5; - ASSERT_TRUE(file_util::WriteFile(db1, data, data_len)); - ASSERT_TRUE(file_util::WriteFile(db1_journal, data, data_len)); - ASSERT_TRUE(file_util::WriteFile(db1_wal, data, data_len)); - ASSERT_TRUE(file_util::WriteFile(db2_actual, data, data_len)); + ASSERT_TRUE(base::WriteFile(db1, data, data_len)); + ASSERT_TRUE(base::WriteFile(db1_journal, data, data_len)); + ASSERT_TRUE(base::WriteFile(db1_wal, data, data_len)); + ASSERT_TRUE(base::WriteFile(db2_actual, data, data_len)); #if defined(OS_POSIX) EXPECT_TRUE(base::CreateSymbolicLink(db2_actual, db2_symlink)); #endif diff --git a/chrome/browser/history/redirect_browsertest.cc b/chrome/browser/history/redirect_browsertest.cc index 0a85700..342ac0b 100644 --- a/chrome/browser/history/redirect_browsertest.cc +++ b/chrome/browser/history/redirect_browsertest.cc @@ -137,9 +137,9 @@ IN_PROC_BROWSER_TEST_F(RedirectTest, ClientEmptyReferer) { ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_directory.path(), &temp_file)); ASSERT_EQ(static_cast<int>(file_redirect_contents.size()), - file_util::WriteFile(temp_file, - file_redirect_contents.data(), - file_redirect_contents.size())); + base::WriteFile(temp_file, + file_redirect_contents.data(), + file_redirect_contents.size())); // Navigate to the file through the browser. The client redirect will appear // as two page visits in the browser. diff --git a/chrome/browser/history/url_index_private_data.cc b/chrome/browser/history/url_index_private_data.cc index 717d282..0d6718a 100644 --- a/chrome/browser/history/url_index_private_data.cc +++ b/chrome/browser/history/url_index_private_data.cc @@ -898,7 +898,7 @@ bool URLIndexPrivateData::SaveToFile(const base::FilePath& file_path) { } int size = data.size(); - if (file_util::WriteFile(file_path, data.c_str(), size) != size) { + if (base::WriteFile(file_path, data.c_str(), size) != size) { LOG(WARNING) << "Failed to write " << file_path.value(); return false; } diff --git a/chrome/browser/importer/ie_importer_browsertest_win.cc b/chrome/browser/importer/ie_importer_browsertest_win.cc index 33bf646..bd36899 100644 --- a/chrome/browser/importer/ie_importer_browsertest_win.cc +++ b/chrome/browser/importer/ie_importer_browsertest_win.cc @@ -203,7 +203,7 @@ bool CreateUrlFileWithFavicon(const base::FilePath& file, return false; // Write dummy favicon image data in NTFS alternate data stream. - return favicon_url.empty() || (file_util::WriteFile( + return favicon_url.empty() || (base::WriteFile( file.ReplaceExtension(kFaviconStreamSuffix), kDummyFaviconImageData, sizeof kDummyFaviconImageData) != -1); } @@ -498,8 +498,8 @@ IN_PROC_BROWSER_TEST_F(IEImporterBrowserTest, IEImporter) { L"http://www.links-sublink.com/")); ASSERT_TRUE(CreateUrlFile(path.AppendASCII("IEDefaultLink.url"), L"http://go.microsoft.com/fwlink/?linkid=140813")); - file_util::WriteFile(path.AppendASCII("InvalidUrlFile.url"), "x", 1); - file_util::WriteFile(path.AppendASCII("PlainTextFile.txt"), "x", 1); + base::WriteFile(path.AppendASCII("InvalidUrlFile.url"), "x", 1); + base::WriteFile(path.AppendASCII("PlainTextFile.txt"), "x", 1); const base::char16* root_links[] = { L"Links", diff --git a/chrome/browser/local_discovery/pwg_raster_converter.cc b/chrome/browser/local_discovery/pwg_raster_converter.cc index 2ea9cab..ce3e0ea 100644 --- a/chrome/browser/local_discovery/pwg_raster_converter.cc +++ b/chrome/browser/local_discovery/pwg_raster_converter.cc @@ -75,9 +75,7 @@ void FileHandlers::Init(base::RefCountedMemory* data) { } if (static_cast<int>(data->size()) != - file_util::WriteFile(GetPdfPath(), - data->front_as<char>(), - data->size())) { + base::WriteFile(GetPdfPath(), data->front_as<char>(), data->size())) { return; } diff --git a/chrome/browser/media/webrtc_log_uploader.cc b/chrome/browser/media/webrtc_log_uploader.cc index 5682c76..563cf9d 100644 --- a/chrome/browser/media/webrtc_log_uploader.cc +++ b/chrome/browser/media/webrtc_log_uploader.cc @@ -301,8 +301,8 @@ void WebRtcLogUploader::AddUploadedLogInfoToUploadListFile( contents += base::DoubleToString(time_now.ToDoubleT()) + "," + report_id + '\n'; - int written = file_util::WriteFile(upload_list_path, &contents[0], - contents.size()); + int written = + base::WriteFile(upload_list_path, &contents[0], contents.size()); DPCHECK(written == static_cast<int>(contents.size())); } diff --git a/chrome/browser/media_galleries/fileapi/iapps_finder_impl_win_browsertest.cc b/chrome/browser/media_galleries/fileapi/iapps_finder_impl_win_browsertest.cc index 903d0f7..88649a0 100644 --- a/chrome/browser/media_galleries/fileapi/iapps_finder_impl_win_browsertest.cc +++ b/chrome/browser/media_galleries/fileapi/iapps_finder_impl_win_browsertest.cc @@ -31,7 +31,7 @@ std::string EncodePath(const base::FilePath& path) { } void TouchFile(const base::FilePath& file) { - ASSERT_EQ(1, file_util::WriteFile(file, " ", 1)); + ASSERT_EQ(1, base::WriteFile(file, " ", 1)); } class ITunesFinderWinTest : public InProcessBrowserTest { @@ -63,8 +63,8 @@ class ITunesFinderWinTest : public InProcessBrowserTest { app_data_dir().AppendASCII("Apple Computer").AppendASCII("iTunes"); ASSERT_TRUE(base::CreateDirectory(pref_dir)); ASSERT_EQ(data.size(), - file_util::WriteFile(pref_dir.AppendASCII("iTunesPrefs.xml"), - data.data(), data.size())); + base::WriteFile(pref_dir.AppendASCII("iTunesPrefs.xml"), + data.data(), data.size())); } void TouchDefault() { diff --git a/chrome/browser/media_galleries/fileapi/iphoto_data_provider_browsertest.cc b/chrome/browser/media_galleries/fileapi/iphoto_data_provider_browsertest.cc index 10f1ebb..fe43d3f 100644 --- a/chrome/browser/media_galleries/fileapi/iphoto_data_provider_browsertest.cc +++ b/chrome/browser/media_galleries/fileapi/iphoto_data_provider_browsertest.cc @@ -141,7 +141,7 @@ class IPhotoDataProviderTest : public InProcessBrowserTest { void WriteLibraryInternal() { std::string xml = GetLibraryString(); ASSERT_EQ(static_cast<int>(xml.size()), - file_util::WriteFile(XmlFile(), xml.c_str(), xml.size())); + base::WriteFile(XmlFile(), xml.c_str(), xml.size())); } base::ScopedTempDir library_dir_; @@ -451,7 +451,7 @@ class IPhotoDataProviderInvalidTest : public IPhotoDataProviderTest { base::Unretained(data_provider()), base::Bind(&IPhotoDataProviderInvalidTest::CheckInvalid, base::Unretained(this)))); - EXPECT_EQ(1L, file_util::WriteFile(XmlFile(), " ", 1)); + EXPECT_EQ(1L, base::WriteFile(XmlFile(), " ", 1)); } void CheckInvalid(bool is_valid) { diff --git a/chrome/browser/media_galleries/fileapi/iphoto_file_util_unittest.cc b/chrome/browser/media_galleries/fileapi/iphoto_file_util_unittest.cc index 1ea2eda..d8dbbdf 100644 --- a/chrome/browser/media_galleries/fileapi/iphoto_file_util_unittest.cc +++ b/chrome/browser/media_galleries/fileapi/iphoto_file_util_unittest.cc @@ -168,13 +168,13 @@ class IPhotoFileUtilTest : public testing::Test { ASSERT_TRUE(fake_library_dir_.CreateUniqueTempDir()); ASSERT_EQ( 0, - file_util::WriteFile( + base::WriteFile( fake_library_dir_.path().AppendASCII("a.jpg"), NULL, 0)); ASSERT_EQ( 0, - file_util::WriteFile( + base::WriteFile( fake_library_dir_.path().AppendASCII("orig.jpg"), NULL, 0)); diff --git a/chrome/browser/media_galleries/fileapi/itunes_data_provider_browsertest.cc b/chrome/browser/media_galleries/fileapi/itunes_data_provider_browsertest.cc index e14acbf..e8a6c80 100644 --- a/chrome/browser/media_galleries/fileapi/itunes_data_provider_browsertest.cc +++ b/chrome/browser/media_galleries/fileapi/itunes_data_provider_browsertest.cc @@ -193,7 +193,7 @@ class ITunesDataProviderTest : public InProcessBrowserTest { } xml += "</dict></dict></plist>\n"; ASSERT_EQ(static_cast<int>(xml.size()), - file_util::WriteFile(XmlFile(), xml.c_str(), xml.size())); + base::WriteFile(XmlFile(), xml.c_str(), xml.size())); } base::ScopedTempDir library_dir_; @@ -343,7 +343,7 @@ class ITunesDataProviderInvalidTest : public ITunesDataProviderTest { base::Unretained(data_provider()), base::Bind(&ITunesDataProviderInvalidTest::CheckInvalid, base::Unretained(this)))); - ASSERT_EQ(1L, file_util::WriteFile(XmlFile(), " ", 1)); + ASSERT_EQ(1L, base::WriteFile(XmlFile(), " ", 1)); } void CheckInvalid(bool is_valid) { diff --git a/chrome/browser/media_galleries/fileapi/itunes_file_util_unittest.cc b/chrome/browser/media_galleries/fileapi/itunes_file_util_unittest.cc index 4209613..7ef4765 100644 --- a/chrome/browser/media_galleries/fileapi/itunes_file_util_unittest.cc +++ b/chrome/browser/media_galleries/fileapi/itunes_file_util_unittest.cc @@ -142,7 +142,7 @@ class ItunesFileUtilTest : public testing::Test { ASSERT_TRUE(fake_library_dir_.CreateUniqueTempDir()); ASSERT_EQ( 0, - file_util::WriteFile( + base::WriteFile( fake_library_dir_.path().AppendASCII(kITunesLibraryXML), NULL, 0)); @@ -284,7 +284,7 @@ TEST_F(ItunesFileUtilTest, ItunesMediaDirectoryContentsAutoAdd) { TEST_F(ItunesFileUtilTest, ItunesAutoAddDirEnumerate) { data_provider()->SetProvideAutoAddDir(true); - ASSERT_EQ(0, file_util::WriteFile( + ASSERT_EQ(0, base::WriteFile( data_provider()->auto_add_path().AppendASCII("baz.ogg"), NULL, 0)); FileSystemOperation::FileEntryList contents; @@ -306,7 +306,7 @@ TEST_F(ItunesFileUtilTest, ItunesAutoAddDirEnumerateNested) { data_provider()->auto_add_path().AppendASCII("foo").AppendASCII("bar"); ASSERT_TRUE(base::CreateDirectory(nested_dir)); ASSERT_EQ(0, - file_util::WriteFile(nested_dir.AppendASCII("baz.ogg"), NULL, 0)); + base::WriteFile(nested_dir.AppendASCII("baz.ogg"), NULL, 0)); FileSystemOperation::FileEntryList contents; FileSystemURL url = CreateURL( diff --git a/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc b/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc index cd4e89b..c2e3082 100644 --- a/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc +++ b/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc @@ -123,7 +123,7 @@ class MediaFileValidatorTest : public InProcessBrowserTest { test_file_size_ = content.size(); base::FilePath test_file = src_path.AppendASCII(filename); ASSERT_EQ(test_file_size_, - file_util::WriteFile(test_file, content.data(), test_file_size_)); + base::WriteFile(test_file, content.data(), test_file_size_)); base::FilePath dest_path = base.AppendASCII("dest_fs"); ASSERT_TRUE(base::CreateDirectory(dest_path)); diff --git a/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc b/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc index a835678..93a47c3 100644 --- a/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc +++ b/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc @@ -102,7 +102,7 @@ void PopulateDirectoryWithTestCases(const base::FilePath& dir, } else { ASSERT_TRUE(test_cases[i].content != NULL); int len = strlen(test_cases[i].content); - ASSERT_EQ(len, file_util::WriteFile(path, test_cases[i].content, len)); + ASSERT_EQ(len, base::WriteFile(path, test_cases[i].content, len)); } } } @@ -330,7 +330,7 @@ TEST_F(NativeMediaFileUtilTest, CopyDestFiltering) { base::FilePath src_path = root_path().AppendASCII("foo.jpg"); FileSystemURL src_url = CreateURL(FPL("foo.jpg")); static const char kDummyData[] = "dummy"; - ASSERT_TRUE(file_util::WriteFile(src_path, kDummyData, strlen(kDummyData))); + ASSERT_TRUE(base::WriteFile(src_path, kDummyData, strlen(kDummyData))); for (size_t i = 0; i < arraysize(kFilteringTestCases); ++i) { if (loop_count == 0 && kFilteringTestCases[i].is_directory) { @@ -441,7 +441,7 @@ TEST_F(NativeMediaFileUtilTest, MoveDestFiltering) { FileSystemURL src_url = CreateURL(FPL("foo.jpg")); static const char kDummyData[] = "dummy"; ASSERT_TRUE( - file_util::WriteFile(src_path, kDummyData, strlen(kDummyData))); + base::WriteFile(src_path, kDummyData, strlen(kDummyData))); FileSystemURL root_url = CreateURL(FPL("")); FileSystemURL url = CreateURL(kFilteringTestCases[i].path); diff --git a/chrome/browser/media_galleries/fileapi/picasa_file_util_unittest.cc b/chrome/browser/media_galleries/fileapi/picasa_file_util_unittest.cc index d3d59eb..3255ad1 100644 --- a/chrome/browser/media_galleries/fileapi/picasa_file_util_unittest.cc +++ b/chrome/browser/media_galleries/fileapi/picasa_file_util_unittest.cc @@ -49,7 +49,7 @@ base::Time::Exploded test_date_exploded = { 2013, 4, 0, 16, 0, 0, 0, 0 }; bool WriteJPEGHeader(const base::FilePath& path) { const char kJpegHeader[] = "\xFF\xD8\xFF"; // Per HTML5 specification. - return file_util::WriteFile(path, kJpegHeader, arraysize(kJpegHeader)) != -1; + return base::WriteFile(path, kJpegHeader, arraysize(kJpegHeader)) != -1; } class TestFolder { @@ -84,7 +84,7 @@ class TestFolder { for (unsigned int i = 0; i < non_image_files_; ++i) { base::FilePath path = folder_dir_.path().AppendASCII( base::StringPrintf("hello%05d.txt", i)); - if (file_util::WriteFile(path, NULL, 0) == -1) + if (base::WriteFile(path, NULL, 0) == -1) return false; } diff --git a/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm b/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm index 922410a..d4d3f17 100644 --- a/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm +++ b/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm @@ -102,8 +102,8 @@ const char kTestFileContents[] = "test"; saveAsFilename += ".jpg"; base::FilePath toBeSaved = saveDir.Append(saveAsFilename); ASSERT_EQ(static_cast<int>(strlen(kTestFileContents)), - file_util::WriteFile(toBeSaved, kTestFileContents, - strlen(kTestFileContents))); + base::WriteFile(toBeSaved, kTestFileContents, + strlen(kTestFileContents))); NSMutableDictionary* returnOptions = [NSMutableDictionary dictionaryWithDictionary:options]; diff --git a/chrome/browser/media_galleries/media_folder_finder_unittest.cc b/chrome/browser/media_galleries/media_folder_finder_unittest.cc index eadc8a6..4e7fb92 100644 --- a/chrome/browser/media_galleries/media_folder_finder_unittest.cc +++ b/chrome/browser/media_galleries/media_folder_finder_unittest.cc @@ -131,7 +131,7 @@ class MediaFolderFinderTest : public testing::Test { dummy_data.resize(filesize); int bytes_written = - file_util::WriteFile(test_file, dummy_data.c_str(), filesize); + base::WriteFile(test_file, dummy_data.c_str(), filesize); ASSERT_GE(bytes_written, 0); ASSERT_EQ(filesize, static_cast<size_t>(bytes_written)); } diff --git a/chrome/browser/nacl_host/test/mock_nacl_gdb.cc b/chrome/browser/nacl_host/test/mock_nacl_gdb.cc index 097f1f9..36ff08c 100644 --- a/chrome/browser/nacl_host/test/mock_nacl_gdb.cc +++ b/chrome/browser/nacl_host/test/mock_nacl_gdb.cc @@ -50,15 +50,15 @@ int main(int argc, char** argv) { i += 2; CHECK_LE(i, argc); std::string nacl_gdb_script(argv[i - 1]); - file_util::WriteFile(base::FilePath::FromUTF8Unsafe(nacl_gdb_script), - kPass, strlen(kPass)); + base::WriteFile(base::FilePath::FromUTF8Unsafe(nacl_gdb_script), + kPass, strlen(kPass)); continue; } // Unknown argument. NOTREACHED() << "Invalid argument " << argv[i]; } CHECK_EQ(i, argc); - file_util::WriteFile(base::FilePath::FromUTF8Unsafe(mock_nacl_gdb_file), - kPass, strlen(kPass)); + base::WriteFile(base::FilePath::FromUTF8Unsafe(mock_nacl_gdb_file), + kPass, strlen(kPass)); return 0; } diff --git a/chrome/browser/net/crl_set_fetcher.cc b/chrome/browser/net/crl_set_fetcher.cc index 6c62bcf..201faf9 100644 --- a/chrome/browser/net/crl_set_fetcher.cc +++ b/chrome/browser/net/crl_set_fetcher.cc @@ -171,7 +171,7 @@ bool CRLSetFetcher::Install(const base::DictionaryValue& manifest, return false; } int size = base::checked_cast<int>(crl_set_bytes.size()); - if (file_util::WriteFile(save_to, crl_set_bytes.data(), size) != size) { + if (base::WriteFile(save_to, crl_set_bytes.data(), size) != size) { LOG(WARNING) << "Failed to save new CRL set to disk"; // We don't return false here because we can still use this CRL set. When // we restart we might revert to an older version, then we'll @@ -187,7 +187,7 @@ bool CRLSetFetcher::Install(const base::DictionaryValue& manifest, << "->#" << new_crl_set->sequence(); const std::string new_crl_set_bytes = new_crl_set->Serialize(); int size = base::checked_cast<int>(new_crl_set_bytes.size()); - if (file_util::WriteFile(save_to, new_crl_set_bytes.data(), size) != size) { + if (base::WriteFile(save_to, new_crl_set_bytes.data(), size) != size) { LOG(WARNING) << "Failed to save new CRL set to disk"; // We don't return false here because we can still use this CRL set. When // we restart we might revert to an older version, then we'll diff --git a/chrome/browser/parsers/metadata_parser_filebase_unittest.cc b/chrome/browser/parsers/metadata_parser_filebase_unittest.cc index 312ab5a..2924128 100644 --- a/chrome/browser/parsers/metadata_parser_filebase_unittest.cc +++ b/chrome/browser/parsers/metadata_parser_filebase_unittest.cc @@ -25,8 +25,8 @@ class FileMetaDataParserTest : public testing::Test { // Create the test file. std::string content = "content"; - int write_size = file_util::WriteFile(test_file_, content.c_str(), - content.length()); + int write_size = base::WriteFile(test_file_, content.c_str(), + content.length()); ASSERT_EQ(static_cast<int>(content.length()), write_size); } diff --git a/chrome/browser/policy/cloud/cloud_policy_browsertest.cc b/chrome/browser/policy/cloud/cloud_policy_browsertest.cc index 4c24434..16f4c20 100644 --- a/chrome/browser/policy/cloud/cloud_policy_browsertest.cc +++ b/chrome/browser/policy/cloud/cloud_policy_browsertest.cc @@ -246,8 +246,8 @@ class CloudPolicyTest : public InProcessBrowserTest, } void SetServerPolicy(const std::string& policy) { - int result = file_util::WriteFile(policy_file_path(), policy.data(), - policy.size()); + int result = base::WriteFile(policy_file_path(), policy.data(), + policy.size()); ASSERT_EQ(static_cast<int>(policy.size()), result); } diff --git a/chrome/browser/policy/test/local_policy_test_server.cc b/chrome/browser/policy/test/local_policy_test_server.cc index cca478e..99b843b 100644 --- a/chrome/browser/policy/test/local_policy_test_server.cc +++ b/chrome/browser/policy/test/local_policy_test_server.cc @@ -96,7 +96,7 @@ bool LocalPolicyTestServer::SetSigningKeyAndSignature( return false; policy_key_ = server_data_dir_.path().Append(kSigningKeyFileName); - int bytes_written = file_util::WriteFile( + int bytes_written = base::WriteFile( policy_key_, reinterpret_cast<const char*>(vector_as_array(&signing_key_bits)), signing_key_bits.size()); @@ -107,7 +107,7 @@ bool LocalPolicyTestServer::SetSigningKeyAndSignature( // Write the signature data. base::FilePath signature_file = server_data_dir_.path().Append( kSigningKeySignatureFileName); - bytes_written = file_util::WriteFile( + bytes_written = base::WriteFile( signature_file, signature.c_str(), signature.size()); @@ -145,7 +145,7 @@ bool LocalPolicyTestServer::UpdatePolicy(const std::string& type, base::FilePath policy_file = server_data_dir_.path().AppendASCII( base::StringPrintf("policy_%s.bin", selector.c_str())); - return file_util::WriteFile(policy_file, policy.c_str(), policy.size()) == + return base::WriteFile(policy_file, policy.c_str(), policy.size()) == static_cast<int>(policy.size()); } @@ -158,7 +158,7 @@ bool LocalPolicyTestServer::UpdatePolicyData(const std::string& type, base::FilePath data_file = server_data_dir_.path().AppendASCII( base::StringPrintf("policy_%s.data", selector.c_str())); - return file_util::WriteFile(data_file, data.c_str(), data.size()) == + return base::WriteFile(data_file, data.c_str(), data.size()) == static_cast<int>(data.size()); } @@ -249,7 +249,7 @@ bool LocalPolicyTestServer::GenerateAdditionalArguments( base::JSONWriter::Write(&clients_, &json); base::FilePath client_state_file = server_data_dir_.path().Append(kClientStateFileName); - if (file_util::WriteFile(client_state_file, json.c_str(), json.size()) != + if (base::WriteFile(client_state_file, json.c_str(), json.size()) != static_cast<int>(json.size())) { return false; } diff --git a/chrome/browser/profile_resetter/automatic_profile_resetter_mementos.cc b/chrome/browser/profile_resetter/automatic_profile_resetter_mementos.cc index 6bb94e2..101155b 100644 --- a/chrome/browser/profile_resetter/automatic_profile_resetter_mementos.cc +++ b/chrome/browser/profile_resetter/automatic_profile_resetter_mementos.cc @@ -120,7 +120,7 @@ void FileHostedPromptMemento::StoreValueOnFileThread( const base::FilePath& memento_file_path, const std::string& value) { int retval = - file_util::WriteFile(memento_file_path, value.c_str(), value.size()); + base::WriteFile(memento_file_path, value.c_str(), value.size()); DCHECK_EQ(retval, (int)value.size()); } diff --git a/chrome/browser/profiles/profile_browsertest.cc b/chrome/browser/profiles/profile_browsertest.cc index affbc3a..fde3caf 100644 --- a/chrome/browser/profiles/profile_browsertest.cc +++ b/chrome/browser/profiles/profile_browsertest.cc @@ -38,7 +38,7 @@ void CreatePrefsFileInDirectory(const base::FilePath& directory_path) { ASSERT_TRUE(file != base::kInvalidPlatformFileValue); ASSERT_TRUE(base::ClosePlatformFile(file)); std::string data("{}"); - ASSERT_TRUE(file_util::WriteFile(pref_path, data.c_str(), data.size())); + ASSERT_TRUE(base::WriteFile(pref_path, data.c_str(), data.size())); } void CheckChromeVersion(Profile *profile, bool is_new) { diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index 52acc0c..6b1932f 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -217,8 +217,8 @@ void EnsureReadmeFile(const base::FilePath& base) { std::string product_name = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME); std::string readme_text = base::StringPrintf( kReadmeText, product_name.c_str(), product_name.c_str()); - if (file_util::WriteFile( - readme_path, readme_text.data(), readme_text.size()) == -1) { + if (base::WriteFile(readme_path, readme_text.data(), readme_text.size()) == + -1) { LOG(ERROR) << "Could not create README file."; } } diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc index b06aaaf..8055c96 100644 --- a/chrome/browser/profiles/profile_info_cache.cc +++ b/chrome/browser/profiles/profile_info_cache.cc @@ -135,9 +135,8 @@ void SaveBitmap(ImageData* data, return; } - if (file_util::WriteFile(image_path, - reinterpret_cast<char*>(&(*data)[0]), - data->size()) == -1) { + if (base::WriteFile(image_path, reinterpret_cast<char*>(&(*data)[0]), + data->size()) == -1) { LOG(ERROR) << "Failed to save image to file."; return; } diff --git a/chrome/browser/safe_browsing/download_feedback_service_unittest.cc b/chrome/browser/safe_browsing/download_feedback_service_unittest.cc index 808c798..e1520bd 100644 --- a/chrome/browser/safe_browsing/download_feedback_service_unittest.cc +++ b/chrome/browser/safe_browsing/download_feedback_service_unittest.cc @@ -150,7 +150,7 @@ class DownloadFeedbackServiceTest : public testing::Test { base::FilePath upload_file_path( temp_dir_.path().AppendASCII("test file " + base::IntToString(n))); const std::string upload_file_data = "data"; - int wrote = file_util::WriteFile( + int wrote = base::WriteFile( upload_file_path, upload_file_data.data(), upload_file_data.size()); EXPECT_EQ(static_cast<int>(upload_file_data.size()), wrote); return upload_file_path; diff --git a/chrome/browser/safe_browsing/download_feedback_unittest.cc b/chrome/browser/safe_browsing/download_feedback_unittest.cc index 6f42ff7..460c5ae 100644 --- a/chrome/browser/safe_browsing/download_feedback_unittest.cc +++ b/chrome/browser/safe_browsing/download_feedback_unittest.cc @@ -119,8 +119,8 @@ class DownloadFeedbackTest : public testing::Test { upload_file_path_ = temp_dir_.path().AppendASCII("test file"); upload_file_data_ = "data"; ASSERT_EQ(static_cast<int>(upload_file_data_.size()), - file_util::WriteFile(upload_file_path_, upload_file_data_.data(), - upload_file_data_.size())); + base::WriteFile(upload_file_path_, upload_file_data_.data(), + upload_file_data_.size())); TwoPhaseUploader::RegisterFactory(&two_phase_uploader_factory_); } diff --git a/chrome/browser/safe_browsing/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection_service_unittest.cc index 34bcf1a..ee82e27 100644 --- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc @@ -710,7 +710,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadZip) { base::ScopedTempDir zip_source_dir; ASSERT_TRUE(zip_source_dir.CreateUniqueTempDir()); std::string file_contents = "dummy file"; - ASSERT_EQ(static_cast<int>(file_contents.size()), file_util::WriteFile( + ASSERT_EQ(static_cast<int>(file_contents.size()), base::WriteFile( zip_source_dir.path().Append(FILE_PATH_LITERAL("file.txt")), file_contents.data(), file_contents.size())); ASSERT_TRUE(zip::Zip(zip_source_dir.path(), a_tmp, false)); @@ -725,7 +725,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadZip) { Mock::VerifyAndClearExpectations(signature_util_.get()); // Now check with an executable in the zip file as well. - ASSERT_EQ(static_cast<int>(file_contents.size()), file_util::WriteFile( + ASSERT_EQ(static_cast<int>(file_contents.size()), base::WriteFile( zip_source_dir.path().Append(FILE_PATH_LITERAL("file.exe")), file_contents.data(), file_contents.size())); ASSERT_TRUE(zip::Zip(zip_source_dir.path(), a_tmp, false)); @@ -787,7 +787,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadCorruptZip) { EXPECT_CALL(item, GetRemoteAddress()).WillRepeatedly(Return("")); std::string file_contents = "corrupt zip file"; - ASSERT_EQ(static_cast<int>(file_contents.size()), file_util::WriteFile( + ASSERT_EQ(static_cast<int>(file_contents.size()), base::WriteFile( a_tmp, file_contents.data(), file_contents.size())); download_service_->CheckClientDownload( diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc index f19a375d..771a183 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc @@ -103,9 +103,9 @@ std::string CreateShortcutIcon(const gfx::ImageFamily& icon_images, << width << "."; continue; } - int bytes_written = file_util::WriteFile(temp_file_path, - png_data->front_as<char>(), - png_data->size()); + int bytes_written = base::WriteFile(temp_file_path, + png_data->front_as<char>(), + png_data->size()); if (bytes_written != static_cast<int>(png_data->size())) return std::string(); @@ -155,8 +155,8 @@ bool CreateShortcutOnDesktop(const base::FilePath& shortcut_filename, return false; } - ssize_t bytes_written = file_util::WriteFileDescriptor(fd, contents.data(), - contents.length()); + ssize_t bytes_written = base::WriteFileDescriptor(fd, contents.data(), + contents.length()); if (IGNORE_EINTR(close(fd)) < 0) PLOG(ERROR) << "close"; @@ -196,9 +196,9 @@ bool CreateShortcutInApplicationsMenu(const base::FilePath& shortcut_filename, if (!directory_filename.empty()) { temp_directory_path = temp_dir.path().Append(directory_filename); - int bytes_written = file_util::WriteFile(temp_directory_path, - directory_contents.data(), - directory_contents.length()); + int bytes_written = base::WriteFile(temp_directory_path, + directory_contents.data(), + directory_contents.length()); if (bytes_written != static_cast<int>(directory_contents.length())) return false; @@ -206,8 +206,8 @@ bool CreateShortcutInApplicationsMenu(const base::FilePath& shortcut_filename, base::FilePath temp_file_path = temp_dir.path().Append(shortcut_filename); - int bytes_written = file_util::WriteFile(temp_file_path, contents.data(), - contents.length()); + int bytes_written = base::WriteFile(temp_file_path, contents.data(), + contents.length()); if (bytes_written != static_cast<int>(contents.length())) return false; diff --git a/chrome/browser/shell_integration_linux_unittest.cc b/chrome/browser/shell_integration_linux_unittest.cc index 4c47e56..adf4378 100644 --- a/chrome/browser/shell_integration_linux_unittest.cc +++ b/chrome/browser/shell_integration_linux_unittest.cc @@ -186,7 +186,7 @@ TEST(ShellIntegrationTest, GetExistingShortcutLocations) { MockEnvironment env; ASSERT_TRUE(base::CreateDirectory(desktop_path)); - ASSERT_FALSE(file_util::WriteFile( + ASSERT_FALSE(base::WriteFile( desktop_path.AppendASCII(kTemplateFilename), "", 0)); ShellIntegration::ShortcutLocations result = @@ -209,7 +209,7 @@ TEST(ShellIntegrationTest, GetExistingShortcutLocations) { MockEnvironment env; env.Set("XDG_DATA_HOME", temp_dir.path().value()); ASSERT_TRUE(base::CreateDirectory(apps_path)); - ASSERT_FALSE(file_util::WriteFile( + ASSERT_FALSE(base::WriteFile( apps_path.AppendASCII(kTemplateFilename), "", 0)); ShellIntegration::ShortcutLocations result = @@ -232,7 +232,7 @@ TEST(ShellIntegrationTest, GetExistingShortcutLocations) { MockEnvironment env; env.Set("XDG_DATA_HOME", temp_dir.path().value()); ASSERT_TRUE(base::CreateDirectory(apps_path)); - ASSERT_TRUE(file_util::WriteFile( + ASSERT_TRUE(base::WriteFile( apps_path.AppendASCII(kTemplateFilename), kNoDisplayDesktopFile, strlen(kNoDisplayDesktopFile))); ShellIntegration::ShortcutLocations result = @@ -258,12 +258,12 @@ TEST(ShellIntegrationTest, GetExistingShortcutLocations) { MockEnvironment env; ASSERT_TRUE(base::CreateDirectory(desktop_path)); - ASSERT_FALSE(file_util::WriteFile( + ASSERT_FALSE(base::WriteFile( desktop_path.AppendASCII(kTemplateFilename), "", 0)); env.Set("XDG_DATA_HOME", temp_dir2.path().value()); ASSERT_TRUE(base::CreateDirectory(apps_path)); - ASSERT_FALSE(file_util::WriteFile( + ASSERT_FALSE(base::WriteFile( apps_path.AppendASCII(kTemplateFilename), "", 0)); ShellIntegration::ShortcutLocations result = @@ -294,12 +294,12 @@ TEST(ShellIntegrationTest, GetExistingShortcutContents) { MockEnvironment env; env.Set("XDG_DATA_HOME", temp_dir.path().value()); // Create a file in a non-applications directory. This should be ignored. - ASSERT_TRUE(file_util::WriteFile( + ASSERT_TRUE(base::WriteFile( temp_dir.path().AppendASCII(kTemplateFilename), kTestData2, strlen(kTestData2))); ASSERT_TRUE(base::CreateDirectory( temp_dir.path().AppendASCII("applications"))); - ASSERT_TRUE(file_util::WriteFile( + ASSERT_TRUE(base::WriteFile( temp_dir.path().AppendASCII("applications") .AppendASCII(kTemplateFilename), kTestData1, strlen(kTestData1))); @@ -319,7 +319,7 @@ TEST(ShellIntegrationTest, GetExistingShortcutContents) { env.Set("HOME", temp_dir.path().value()); ASSERT_TRUE(base::CreateDirectory( temp_dir.path().AppendASCII(".local/share/applications"))); - ASSERT_TRUE(file_util::WriteFile( + ASSERT_TRUE(base::WriteFile( temp_dir.path().AppendASCII(".local/share/applications") .AppendASCII(kTemplateFilename), kTestData1, strlen(kTestData1))); @@ -339,7 +339,7 @@ TEST(ShellIntegrationTest, GetExistingShortcutContents) { env.Set("XDG_DATA_DIRS", temp_dir.path().value()); ASSERT_TRUE(base::CreateDirectory( temp_dir.path().AppendASCII("applications"))); - ASSERT_TRUE(file_util::WriteFile( + ASSERT_TRUE(base::WriteFile( temp_dir.path().AppendASCII("applications") .AppendASCII(kTemplateFilename), kTestData2, strlen(kTestData2))); @@ -361,13 +361,13 @@ TEST(ShellIntegrationTest, GetExistingShortcutContents) { env.Set("XDG_DATA_DIRS", temp_dir1.path().value() + ":" + temp_dir2.path().value()); // Create a file in a non-applications directory. This should be ignored. - ASSERT_TRUE(file_util::WriteFile( + ASSERT_TRUE(base::WriteFile( temp_dir1.path().AppendASCII(kTemplateFilename), kTestData1, strlen(kTestData1))); // Only create a findable desktop file in the second path. ASSERT_TRUE(base::CreateDirectory( temp_dir2.path().AppendASCII("applications"))); - ASSERT_TRUE(file_util::WriteFile( + ASSERT_TRUE(base::WriteFile( temp_dir2.path().AppendASCII("applications") .AppendASCII(kTemplateFilename), kTestData2, strlen(kTestData2))); @@ -399,14 +399,14 @@ TEST(ShellIntegrationTest, GetExistingProfileShortcutFilenames) { base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); ASSERT_EQ(0, - file_util::WriteFile( + base::WriteFile( temp_dir.path().AppendASCII(kApp1Filename), "", 0)); ASSERT_EQ(0, - file_util::WriteFile( + base::WriteFile( temp_dir.path().AppendASCII(kApp2Filename), "", 0)); // This file should not be returned in the results. ASSERT_EQ(0, - file_util::WriteFile( + base::WriteFile( temp_dir.path().AppendASCII(kUnrelatedAppFilename), "", 0)); std::vector<base::FilePath> paths = ShellIntegrationLinux::GetExistingProfileShortcutFilenames( diff --git a/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc b/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc index 9323be7..1011242 100644 --- a/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc +++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc @@ -226,7 +226,7 @@ TEST_F(SpellcheckCustomDictionaryTest, LegacyEmptyDictionaryShouldBeConverted) { profile_.GetPath().Append(chrome::kCustomDictionaryFileName); std::string content; - file_util::WriteFile(path, content.c_str(), content.length()); + base::WriteFile(path, content.c_str(), content.length()); WordList loaded_custom_words = LoadDictionaryFile(path); EXPECT_TRUE(loaded_custom_words.empty()); } @@ -239,7 +239,7 @@ TEST_F(SpellcheckCustomDictionaryTest, profile_.GetPath().Append(chrome::kCustomDictionaryFileName); std::string content = "foo\nbar\nfoo\n"; - file_util::WriteFile(path, content.c_str(), content.length()); + base::WriteFile(path, content.c_str(), content.length()); WordList loaded_custom_words = LoadDictionaryFile(path); WordList expected; expected.push_back("bar"); @@ -257,7 +257,7 @@ TEST_F(SpellcheckCustomDictionaryTest, std::string content = "foo\n foo bar \n\n \nbar\n" "01234567890123456789012345678901234567890123456789" "01234567890123456789012345678901234567890123456789"; - file_util::WriteFile(path, content.c_str(), content.length()); + base::WriteFile(path, content.c_str(), content.length()); WordList loaded_custom_words = LoadDictionaryFile(path); WordList expected; expected.push_back("bar"); @@ -274,7 +274,7 @@ TEST_F(SpellcheckCustomDictionaryTest, CorruptedWriteShouldBeRecovered) { profile_.GetPath().Append(chrome::kCustomDictionaryFileName); std::string content = "foo\nbar"; - file_util::WriteFile(path, content.c_str(), content.length()); + base::WriteFile(path, content.c_str(), content.length()); WordList loaded_custom_words = LoadDictionaryFile(path); WordList expected; expected.push_back("bar"); @@ -287,7 +287,7 @@ TEST_F(SpellcheckCustomDictionaryTest, CorruptedWriteShouldBeRecovered) { content.clear(); base::ReadFileToString(path, &content); content.append("corruption"); - file_util::WriteFile(path, content.c_str(), content.length()); + base::WriteFile(path, content.c_str(), content.length()); loaded_custom_words = LoadDictionaryFile(path); EXPECT_EQ(expected, loaded_custom_words); } diff --git a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc index 6cc0fa2..003477d 100644 --- a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc +++ b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc @@ -133,7 +133,7 @@ bool SaveDictionaryData(scoped_ptr<std::string> data, DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); size_t bytes_written = - file_util::WriteFile(path, data->data(), data->length()); + base::WriteFile(path, data->data(), data->length()); if (bytes_written != data->length()) { bool success = false; #if defined(OS_WIN) @@ -142,7 +142,7 @@ bool SaveDictionaryData(scoped_ptr<std::string> data, base::FilePath fallback_file_path = dict_dir.Append(path.BaseName()); bytes_written = - file_util::WriteFile(fallback_file_path, data->data(), data->length()); + base::WriteFile(fallback_file_path, data->data(), data->length()); if (bytes_written == data->length()) success = true; #endif diff --git a/chrome/browser/spellchecker/spellcheck_service_browsertest.cc b/chrome/browser/spellchecker/spellcheck_service_browsertest.cc index 3d82910..ab49c94 100644 --- a/chrome/browser/spellchecker/spellcheck_service_browsertest.cc +++ b/chrome/browser/spellchecker/spellcheck_service_browsertest.cc @@ -50,7 +50,7 @@ IN_PROC_BROWSER_TEST_F(SpellcheckServiceBrowserTest, DeleteCorruptedBDICT) { base::FilePath bdict_path = chrome::spellcheck_common::GetVersionedFileName("en-US", dict_dir); - size_t actual = file_util::WriteFile(bdict_path, + size_t actual = base::WriteFile(bdict_path, reinterpret_cast<const char*>(kCorruptedBDICT), arraysize(kCorruptedBDICT)); EXPECT_EQ(arraysize(kCorruptedBDICT), actual); diff --git a/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc b/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc index 2154721..483d53b 100644 --- a/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc +++ b/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc @@ -697,7 +697,7 @@ TEST_F(SyncBackendHostTest, TestStartupWithOldSyncData) { profile_->GetPath().AppendASCII("Sync Data"); base::FilePath sync_file = temp_directory.AppendASCII("SyncData.sqlite3"); ASSERT_TRUE(base::CreateDirectory(temp_directory)); - ASSERT_NE(-1, file_util::WriteFile(sync_file, nonsense, strlen(nonsense))); + ASSERT_NE(-1, base::WriteFile(sync_file, nonsense, strlen(nonsense))); InitializeBackend(true); diff --git a/chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc b/chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc index 76d5d5a..b234bbf 100644 --- a/chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc +++ b/chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc @@ -344,7 +344,7 @@ base::FilePath FakeDriveServiceHelper::WriteToTempFile( base::FilePath temp_file; EXPECT_TRUE(base::CreateTemporaryFileInDir(temp_dir_, &temp_file)); EXPECT_EQ(static_cast<int>(content.size()), - file_util::WriteFile(temp_file, content.data(), content.size())); + base::WriteFile(temp_file, content.data(), content.size())); return temp_file; } diff --git a/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc b/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc index 8c8a02e..a532037 100644 --- a/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc +++ b/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc @@ -801,11 +801,11 @@ TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForAddOrUpdate) { const base::FilePath kFilePath2(temp_dir.path().Append(FPL("file2"))); ASSERT_EQ(static_cast<int>(arraysize(kTestFileData1) - 1), - file_util::WriteFile(kFilePath1, kTestFileData1, - arraysize(kTestFileData1) - 1)); + base::WriteFile(kFilePath1, kTestFileData1, + arraysize(kTestFileData1) - 1)); ASSERT_EQ(static_cast<int>(arraysize(kTestFileData2) - 1), - file_util::WriteFile(kFilePath2, kTestFileData2, - arraysize(kTestFileData2) - 1)); + base::WriteFile(kFilePath2, kTestFileData2, + arraysize(kTestFileData2) - 1)); // Record the usage. int64 usage = -1, new_usage = -1; @@ -932,8 +932,8 @@ TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForAddOrUpdate_NoParent) { // Prepare a temporary file which represents remote file data. const base::FilePath kFilePath(temp_dir.path().Append(FPL("file"))); ASSERT_EQ(static_cast<int>(arraysize(kTestFileData) - 1), - file_util::WriteFile(kFilePath, kTestFileData, - arraysize(kTestFileData) - 1)); + base::WriteFile(kFilePath, kTestFileData, + arraysize(kTestFileData) - 1)); // Calling ApplyChange's with kFilePath should create // kFile along with kDir. diff --git a/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc b/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc index d68ddae..7bfe283 100644 --- a/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc +++ b/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc @@ -218,7 +218,7 @@ TEST_F(LocalFileSyncServiceTest, RemoteSyncStepsSimple) { base::FilePath local_path; ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &local_path)); ASSERT_EQ(kTestFileDataSize, - file_util::WriteFile(local_path, kTestFileData, kTestFileDataSize)); + base::WriteFile(local_path, kTestFileData, kTestFileDataSize)); // Run PrepareForProcessRemoteChange for kFile. SyncFileMetadata expected_metadata; diff --git a/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc b/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc index 51f9dd7..0415698 100644 --- a/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc +++ b/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc @@ -355,7 +355,7 @@ TEST_F(SyncableFileOperationRunnerTest, CopyInForeignFile) { base::FilePath temp_path; ASSERT_TRUE(CreateTempFile(&temp_path)); ASSERT_EQ(static_cast<int>(kTestData.size()), - file_util::WriteFile( + base::WriteFile( temp_path, kTestData.data(), kTestData.size())); sync_status()->StartSyncing(URL(kFile)); diff --git a/chrome/browser/task_profiler/task_profiler_data_serializer.cc b/chrome/browser/task_profiler/task_profiler_data_serializer.cc index 8dc34f5..b52cc25 100644 --- a/chrome/browser/task_profiler/task_profiler_data_serializer.cc +++ b/chrome/browser/task_profiler/task_profiler_data_serializer.cc @@ -164,7 +164,7 @@ bool TaskProfilerDataSerializer::WriteToFile(const base::FilePath& path) { serializer.Serialize(*root); int data_size = static_cast<int>(output.size()); - return data_size == file_util::WriteFile(path, output.data(), data_size); + return data_size == base::WriteFile(path, output.data(), data_size); } } // namespace task_profiler diff --git a/chrome/browser/ui/app_list/search/history_data_store_unittest.cc b/chrome/browser/ui/app_list/search/history_data_store_unittest.cc index 3d71554..a831b30 100644 --- a/chrome/browser/ui/app_list/search/history_data_store_unittest.cc +++ b/chrome/browser/ui/app_list/search/history_data_store_unittest.cc @@ -72,7 +72,7 @@ class HistoryDataStoreTest : public testing::Test { void WriteDataFile(const std::string& file_name, const std::string& data) { - file_util::WriteFile( + base::WriteFile( temp_dir_.path().AppendASCII(file_name), data.c_str(), data.size()); } diff --git a/chrome/browser/ui/ash/screenshot_taker.cc b/chrome/browser/ui/ash/screenshot_taker.cc index e0fecd4..4c5f72d 100644 --- a/chrome/browser/ui/ash/screenshot_taker.cc +++ b/chrome/browser/ui/ash/screenshot_taker.cc @@ -192,7 +192,7 @@ void SaveScreenshotInternal(const ShowNotificationCallback& callback, DCHECK(!local_path.empty()); ScreenshotTakerObserver::Result result = ScreenshotTakerObserver::SCREENSHOT_SUCCESS; - if (static_cast<size_t>(file_util::WriteFile( + if (static_cast<size_t>(base::WriteFile( local_path, reinterpret_cast<char*>(&(png_data->data()[0])), png_data->size())) != png_data->size()) { diff --git a/chrome/browser/ui/certificate_dialogs.cc b/chrome/browser/ui/certificate_dialogs.cc index cb32713..0712dd7 100644 --- a/chrome/browser/ui/certificate_dialogs.cc +++ b/chrome/browser/ui/certificate_dialogs.cc @@ -25,7 +25,7 @@ using content::WebContents; namespace { void WriterCallback(const base::FilePath& path, const std::string& data) { - int bytes_written = file_util::WriteFile(path, data.data(), data.size()); + int bytes_written = base::WriteFile(path, data.data(), data.size()); if (bytes_written != static_cast<ssize_t>(data.size())) { LOG(ERROR) << "Writing " << path.value() << " (" << data.size() << "B) returned " << bytes_written; diff --git a/chrome/browser/ui/libgtk2ui/app_indicator_icon.cc b/chrome/browser/ui/libgtk2ui/app_indicator_icon.cc index 097a8fc..1586288 100644 --- a/chrome/browser/ui/libgtk2ui/app_indicator_icon.cc +++ b/chrome/browser/ui/libgtk2ui/app_indicator_icon.cc @@ -144,9 +144,8 @@ base::FilePath CreateTempImageFile(gfx::ImageSkia* image_ptr, new_file_path = temp_dir.Append(id + base::StringPrintf("_%d.png", icon_change_count)); int bytes_written = - file_util::WriteFile(new_file_path, - png_data->front_as<char>(), - png_data->size()); + base::WriteFile(new_file_path, + png_data->front_as<char>(), png_data->size()); if (bytes_written != static_cast<int>(png_data->size())) return base::FilePath(); diff --git a/chrome/browser/ui/metro_pin_tab_helper_win.cc b/chrome/browser/ui/metro_pin_tab_helper_win.cc index 10736d9..15a47e2 100644 --- a/chrome/browser/ui/metro_pin_tab_helper_win.cc +++ b/chrome/browser/ui/metro_pin_tab_helper_win.cc @@ -108,9 +108,9 @@ bool CreateSiteSpecificLogo(const SkBitmap& bitmap, return false; *logo_path = logo_dir.Append(tile_id).ReplaceExtension(L".png"); - return file_util::WriteFile(*logo_path, - reinterpret_cast<char*>(&logo_png[0]), - logo_png.size()) > 0; + return base::WriteFile(*logo_path, + reinterpret_cast<char*>(&logo_png[0]), + logo_png.size()) > 0; } // Get the path to the backup logo. If the backup logo already exists in diff --git a/chrome/browser/ui/network_profile_bubble.cc b/chrome/browser/ui/network_profile_bubble.cc index 7e3d385..b611d59b 100644 --- a/chrome/browser/ui/network_profile_bubble.cc +++ b/chrome/browser/ui/network_profile_bubble.cc @@ -127,7 +127,7 @@ void NetworkProfileBubble::CheckNetworkProfile( // Try to create some non-empty temp file in the profile dir and use // it to check if there is a reparse-point free path to it. if (base::CreateTemporaryFileInDir(profile_folder, &temp_file) && - (file_util::WriteFile(temp_file, ".", 1) == 1)) { + (base::WriteFile(temp_file, ".", 1) == 1)) { base::FilePath normalized_temp_file; if (!base::NormalizeFilePath(temp_file, &normalized_temp_file)) profile_on_network = true; diff --git a/chrome/browser/ui/pdf/pdf_browsertest.cc b/chrome/browser/ui/pdf/pdf_browsertest.cc index aeb9683..cceea4b 100644 --- a/chrome/browser/ui/pdf/pdf_browsertest.cc +++ b/chrome/browser/ui/pdf/pdf_browsertest.cc @@ -186,7 +186,7 @@ class PDFBrowserTest : public InProcessBrowserTest, std::vector<unsigned char> png_data; gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &png_data); if (base::CreateTemporaryFile(&snapshot_filename_)) { - file_util::WriteFile(snapshot_filename_, + base::WriteFile(snapshot_filename_, reinterpret_cast<char*>(&png_data[0]), png_data.size()); } } diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc index 703e136..b9400c2 100644 --- a/chrome/browser/ui/startup/startup_browser_creator.cc +++ b/chrome/browser/ui/startup/startup_browser_creator.cc @@ -240,8 +240,8 @@ void DumpBrowserHistograms(const base::FilePath& output_file) { base::ThreadRestrictions::AssertIOAllowed(); std::string output_string(base::StatisticsRecorder::ToJSON(std::string())); - file_util::WriteFile(output_file, output_string.data(), - static_cast<int>(output_string.size())); + base::WriteFile(output_file, output_string.data(), + static_cast<int>(output_string.size())); } } // namespace diff --git a/chrome/browser/ui/webui/options/certificate_manager_handler.cc b/chrome/browser/ui/webui/options/certificate_manager_handler.cc index 4034c70..2b7481a 100644 --- a/chrome/browser/ui/webui/options/certificate_manager_handler.cc +++ b/chrome/browser/ui/webui/options/certificate_manager_handler.cc @@ -282,7 +282,7 @@ void FileAccessProvider::DoWrite(const base::FilePath& path, const std::string& data, int* saved_errno, int* bytes_written) { - *bytes_written = file_util::WriteFile(path, data.data(), data.size()); + *bytes_written = base::WriteFile(path, data.data(), data.size()); *saved_errno = *bytes_written >= 0 ? 0 : errno; } diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm index fb576d4..ba8e4f6 100644 --- a/chrome/browser/web_applications/web_app_mac.mm +++ b/chrome/browser/web_applications/web_app_mac.mm @@ -145,7 +145,7 @@ base::FilePath GetWritableApplicationsDirectory() { // Create a zero-byte ".localized" file to inherit localizations from OSX // for folders that have special meaning. - file_util::WriteFile(path.Append(".localized"), NULL, 0); + base::WriteFile(path.Append(".localized"), NULL, 0); } return base::PathIsWritable(path) ? path : base::FilePath(); } diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc index dc7a7ef..1cf4800 100644 --- a/chrome/browser/web_applications/web_app_win.cc +++ b/chrome/browser/web_applications/web_app_win.cc @@ -64,9 +64,9 @@ bool SaveIconWithCheckSum(const base::FilePath& icon_file, GetImageCheckSum(image, &digest); base::FilePath cheksum_file(icon_file.ReplaceExtension(kIconChecksumFileExt)); - return file_util::WriteFile(cheksum_file, - reinterpret_cast<const char*>(&digest), - sizeof(digest)) == sizeof(digest); + return base::WriteFile(cheksum_file, + reinterpret_cast<const char*>(&digest), + sizeof(digest)) == sizeof(digest); } // Returns true if |icon_file| is missing or different from |image|. |