diff options
253 files changed, 387 insertions, 413 deletions
diff --git a/ash/desktop_background/desktop_background_controller.cc b/ash/desktop_background/desktop_background_controller.cc index 267d962..1456def 100644 --- a/ash/desktop_background/desktop_background_controller.cc +++ b/ash/desktop_background/desktop_background_controller.cc @@ -115,7 +115,7 @@ class DesktopBackgroundController::WallpaperLoader static scoped_ptr<SkBitmap> LoadSkBitmapFromJPEGFile( const base::FilePath& path) { std::string data; - if (!file_util::ReadFileToString(path, &data)) { + if (!base::ReadFileToString(path, &data)) { LOG(ERROR) << "Unable to read data from " << path.value(); return scoped_ptr<SkBitmap>(); } diff --git a/base/debug/proc_maps_linux.cc b/base/debug/proc_maps_linux.cc index 9557feb..c9afd45 100644 --- a/base/debug/proc_maps_linux.cc +++ b/base/debug/proc_maps_linux.cc @@ -24,7 +24,7 @@ namespace debug { bool ReadProcMaps(std::string* proc_maps) { FilePath proc_maps_path("/proc/self/maps"); - return file_util::ReadFileToString(proc_maps_path, proc_maps); + return ReadFileToString(proc_maps_path, proc_maps); } bool ParseProcMaps(const std::string& input, diff --git a/base/file_util.cc b/base/file_util.cc index 2623b64..e980676 100644 --- a/base/file_util.cc +++ b/base/file_util.cc @@ -130,21 +130,10 @@ bool TextContentsEqual(const FilePath& filename1, const FilePath& filename2) { return true; } -} // namespace base - -// ----------------------------------------------------------------------------- - -namespace file_util { - -using base::FileEnumerator; -using base::FilePath; -using base::kExtensionSeparator; -using base::kMaxUniqueFiles; - bool ReadFileToString(const FilePath& path, std::string* contents) { if (path.ReferencesParent()) return false; - FILE* file = OpenFile(path, "rb"); + FILE* file = file_util::OpenFile(path, "rb"); if (!file) { return false; } @@ -155,11 +144,22 @@ bool ReadFileToString(const FilePath& path, std::string* contents) { if (contents) contents->append(buf, len); } - CloseFile(file); + file_util::CloseFile(file); return true; } +} // namespace base + +// ----------------------------------------------------------------------------- + +namespace file_util { + +using base::FileEnumerator; +using base::FilePath; +using base::kExtensionSeparator; +using base::kMaxUniqueFiles; + bool IsDirectoryEmpty(const FilePath& dir_path) { FileEnumerator files(dir_path, false, FileEnumerator::FILES | FileEnumerator::DIRECTORIES); diff --git a/base/file_util.h b/base/file_util.h index 9673a61..b4150f7 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -132,19 +132,18 @@ BASE_EXPORT bool ContentsEqual(const FilePath& filename1, BASE_EXPORT bool TextContentsEqual(const FilePath& filename1, const FilePath& filename2); -} // namespace base - -// ----------------------------------------------------------------------------- - -namespace file_util { - // Read the file at |path| into |contents|, returning true on success. // This function fails if the |path| contains path traversal components ('..'). // |contents| may be NULL, in which case this function is useful for its // side effect of priming the disk cache. // Useful for unit tests. -BASE_EXPORT bool ReadFileToString(const base::FilePath& path, - std::string* contents); +BASE_EXPORT bool ReadFileToString(const FilePath& path, std::string* contents); + +} // namespace base + +// ----------------------------------------------------------------------------- + +namespace file_util { #if defined(OS_POSIX) // Read exactly |bytes| bytes from file descriptor |fd|, storing the result diff --git a/base/files/file_util_proxy_unittest.cc b/base/files/file_util_proxy_unittest.cc index 3c67075..73ac8a6 100644 --- a/base/files/file_util_proxy_unittest.cc +++ b/base/files/file_util_proxy_unittest.cc @@ -215,7 +215,7 @@ TEST_F(FileUtilProxyTest, CreateTemporary) { // Make sure the written data can be read from the returned path. std::string data; - EXPECT_TRUE(file_util::ReadFileToString(path_, &data)); + EXPECT_TRUE(ReadFileToString(path_, &data)); EXPECT_EQ("test", data); // Make sure we can & do delete the created file to prevent leaks on the bots. diff --git a/base/files/important_file_writer_unittest.cc b/base/files/important_file_writer_unittest.cc index e8f3d12..02a5f76 100644 --- a/base/files/important_file_writer_unittest.cc +++ b/base/files/important_file_writer_unittest.cc @@ -21,7 +21,7 @@ namespace { std::string GetFileContent(const FilePath& path) { std::string content; - if (!file_util::ReadFileToString(path, &content)) { + if (!ReadFileToString(path, &content)) { NOTREACHED(); } return content; diff --git a/base/json/json_file_value_serializer.cc b/base/json/json_file_value_serializer.cc index 37371e8..70d0c88 100644 --- a/base/json/json_file_value_serializer.cc +++ b/base/json/json_file_value_serializer.cc @@ -46,7 +46,7 @@ bool JSONFileValueSerializer::SerializeInternal(const base::Value& root, int JSONFileValueSerializer::ReadFileToString(std::string* json_string) { DCHECK(json_string); - if (!file_util::ReadFileToString(json_file_path_, json_string)) { + if (!base::ReadFileToString(json_file_path_, json_string)) { #if defined(OS_WIN) int error = ::GetLastError(); if (error == ERROR_SHARING_VIOLATION || error == ERROR_LOCK_VIOLATION) { diff --git a/base/json/json_file_value_serializer.h b/base/json/json_file_value_serializer.h index 4a0c334..8006373 100644 --- a/base/json/json_file_value_serializer.h +++ b/base/json/json_file_value_serializer.h @@ -77,8 +77,8 @@ class BASE_EXPORT JSONFileValueSerializer : public base::ValueSerializer { base::FilePath json_file_path_; bool allow_trailing_comma_; - // A wrapper for file_util::ReadFileToString which returns a non-zero - // JsonFileError if there were file errors. + // A wrapper for ReadFileToString which returns a non-zero JsonFileError if + // there were file errors. int ReadFileToString(std::string* json_string); DISALLOW_IMPLICIT_CONSTRUCTORS(JSONFileValueSerializer); diff --git a/base/json/json_reader_unittest.cc b/base/json/json_reader_unittest.cc index 527cb97..eceb538 100644 --- a/base/json/json_reader_unittest.cc +++ b/base/json/json_reader_unittest.cc @@ -547,7 +547,7 @@ TEST(JSONReaderTest, ReadFromFile) { ASSERT_TRUE(base::PathExists(path)); std::string input; - ASSERT_TRUE(file_util::ReadFileToString( + ASSERT_TRUE(ReadFileToString( path.Append(FILE_PATH_LITERAL("bom_feff.json")), &input)); JSONReader reader; diff --git a/base/process/internal_linux.cc b/base/process/internal_linux.cc index ee1107c..b1d1b6f 100644 --- a/base/process/internal_linux.cc +++ b/base/process/internal_linux.cc @@ -54,7 +54,7 @@ bool ReadProcFile(const FilePath& file, std::string* buffer) { // Synchronously reading files in /proc is safe. ThreadRestrictions::ScopedAllowIO allow_io; - if (!file_util::ReadFileToString(file, buffer)) { + if (!ReadFileToString(file, buffer)) { DLOG(WARNING) << "Failed to read " << file.MaybeAsASCII(); return false; } diff --git a/base/process/process_iterator_linux.cc b/base/process/process_iterator_linux.cc index 6da51ca..0587d7b 100644 --- a/base/process/process_iterator_linux.cc +++ b/base/process/process_iterator_linux.cc @@ -44,7 +44,7 @@ bool GetProcCmdline(pid_t pid, std::vector<std::string>* proc_cmd_line_args) { FilePath cmd_line_file = internal::GetProcPidDir(pid).Append("cmdline"); std::string cmd_line; - if (!file_util::ReadFileToString(cmd_line_file, &cmd_line)) + if (!ReadFileToString(cmd_line_file, &cmd_line)) return false; std::string delimiters; delimiters.push_back('\0'); diff --git a/base/process/process_linux.cc b/base/process/process_linux.cc index 93006aa..b12e994 100644 --- a/base/process/process_linux.cc +++ b/base/process/process_linux.cc @@ -70,9 +70,9 @@ bool Process::IsProcessBackgrounded() const { #if defined(OS_CHROMEOS) if (cgroups.Get().enabled) { std::string proc; - if (file_util::ReadFileToString( - base::FilePath(StringPrintf(kProcPath, process_)), - &proc)) { + if (base::ReadFileToString( + base::FilePath(StringPrintf(kProcPath, process_)), + &proc)) { std::vector<std::string> proc_parts; base::SplitString(proc, ':', &proc_parts); DCHECK(proc_parts.size() == 3); diff --git a/base/process/process_metrics_linux.cc b/base/process/process_metrics_linux.cc index c500459..0e0d012 100644 --- a/base/process/process_metrics_linux.cc +++ b/base/process/process_metrics_linux.cc @@ -34,7 +34,7 @@ enum ParsingState { // Read a file with a single number string and return the number as a uint64. static uint64 ReadFileToUint64(const base::FilePath file) { std::string file_as_string; - if (!file_util::ReadFileToString(file, &file_as_string)) + if (!ReadFileToString(file, &file_as_string)) return 0; TrimWhitespaceASCII(file_as_string, TRIM_ALL, &file_as_string); uint64 file_as_uint64 = 0; @@ -52,7 +52,7 @@ size_t ReadProcStatusAndGetFieldAsSizeT(pid_t pid, const std::string& field) { { // Synchronously reading files in /proc is safe. ThreadRestrictions::ScopedAllowIO allow_io; - if (!file_util::ReadFileToString(stat_file, &status)) + if (!ReadFileToString(stat_file, &status)) return 0; } @@ -117,7 +117,7 @@ int GetProcessCPU(pid_t pid) { std::string stat; FilePath stat_path = task_path.Append(ent->d_name).Append(internal::kStatFile); - if (file_util::ReadFileToString(stat_path, &stat)) { + if (ReadFileToString(stat_path, &stat)) { int cpu = ParseProcStatCPU(stat); if (cpu > 0) total_cpu += cpu; @@ -223,7 +223,7 @@ bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const { std::string proc_io_contents; FilePath io_file = internal::GetProcPidDir(process_).Append("io"); - if (!file_util::ReadFileToString(io_file, &proc_io_contents)) + if (!ReadFileToString(io_file, &proc_io_contents)) return false; (*io_counters).OtherOperationCount = 0; @@ -295,7 +295,7 @@ bool ProcessMetrics::GetWorkingSetKBytesTotmaps(WorkingSetKBytes *ws_usage) { FilePath totmaps_file = internal::GetProcPidDir(process_).Append("totmaps"); ThreadRestrictions::ScopedAllowIO allow_io; - bool ret = file_util::ReadFileToString(totmaps_file, &totmaps_data); + bool ret = ReadFileToString(totmaps_file, &totmaps_data); if (!ret || totmaps_data.length() == 0) return false; } @@ -347,7 +347,7 @@ bool ProcessMetrics::GetWorkingSetKBytesStatm(WorkingSetKBytes* ws_usage) FilePath statm_file = internal::GetProcPidDir(process_).Append("statm"); // Synchronously reading files in /proc is safe. ThreadRestrictions::ScopedAllowIO allow_io; - bool ret = file_util::ReadFileToString(statm_file, &statm); + bool ret = ReadFileToString(statm_file, &statm); if (!ret || statm.length() == 0) return false; } @@ -444,7 +444,7 @@ bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) { // Used memory is: total - free - buffers - caches FilePath meminfo_file("/proc/meminfo"); std::string meminfo_data; - if (!file_util::ReadFileToString(meminfo_file, &meminfo_data)) { + if (!ReadFileToString(meminfo_file, &meminfo_data)) { DLOG(WARNING) << "Failed to open " << meminfo_file.value(); return false; } @@ -499,7 +499,7 @@ bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) { std::string geminfo_data; meminfo->gem_objects = -1; meminfo->gem_size = -1; - if (file_util::ReadFileToString(geminfo_file, &geminfo_data)) { + if (ReadFileToString(geminfo_file, &geminfo_data)) { int gem_objects = -1; long long gem_size = -1; int num_res = sscanf(geminfo_data.c_str(), @@ -515,7 +515,7 @@ bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) { // Incorporate Mali graphics memory if present. FilePath mali_memory_file("/sys/devices/platform/mali.0/memory"); std::string mali_memory_data; - if (file_util::ReadFileToString(mali_memory_file, &mali_memory_data)) { + if (ReadFileToString(mali_memory_file, &mali_memory_data)) { long long mali_size = -1; int num_res = sscanf(mali_memory_data.c_str(), "%lld bytes", &mali_size); if (num_res == 1) diff --git a/base/sys_info_chromeos.cc b/base/sys_info_chromeos.cc index 1335760..4c1a7af 100644 --- a/base/sys_info_chromeos.cc +++ b/base/sys_info_chromeos.cc @@ -54,7 +54,7 @@ void SysInfo::OperatingSystemVersionNumbers(int32* major_version, FilePath path(kLinuxStandardBaseReleaseFile); std::string contents; - if (file_util::ReadFileToString(path, &contents)) { + if (ReadFileToString(path, &contents)) { g_chrome_os_version_numbers.Get().parsed = true; ParseLsbRelease(contents, &(g_chrome_os_version_numbers.Get().major_version), diff --git a/base/sys_info_linux.cc b/base/sys_info_linux.cc index 58a0aefe..acc4771 100644 --- a/base/sys_info_linux.cc +++ b/base/sys_info_linux.cc @@ -42,7 +42,7 @@ size_t SysInfo::MaxSharedMemorySize() { static bool limit_valid = false; if (!limit_valid) { std::string contents; - file_util::ReadFileToString(FilePath("/proc/sys/kernel/shmmax"), &contents); + ReadFileToString(FilePath("/proc/sys/kernel/shmmax"), &contents); DCHECK(!contents.empty()); if (!contents.empty() && contents[contents.length() - 1] == '\n') { contents.erase(contents.length() - 1); @@ -67,7 +67,7 @@ std::string SysInfo::CPUModelName() { const char kCpuModelPrefix[] = "model name"; #endif std::string contents; - file_util::ReadFileToString(FilePath("/proc/cpuinfo"), &contents); + ReadFileToString(FilePath("/proc/cpuinfo"), &contents); DCHECK(!contents.empty()); if (!contents.empty()) { std::istringstream iss(contents); diff --git a/base/test/gtest_xml_util.cc b/base/test/gtest_xml_util.cc index 524369a..a143458 100644 --- a/base/test/gtest_xml_util.cc +++ b/base/test/gtest_xml_util.cc @@ -93,7 +93,7 @@ bool ProcessGTestOutput(const base::FilePath& output_file, DCHECK(results); std::string xml_contents; - if (!file_util::ReadFileToString(output_file, &xml_contents)) + if (!ReadFileToString(output_file, &xml_contents)) return false; // Silence XML errors - otherwise they go to stderr. diff --git a/base/test/test_file_util_win.cc b/base/test/test_file_util_win.cc index 2a5a4d0..63c8da2 100644 --- a/base/test/test_file_util_win.cc +++ b/base/test/test_file_util_win.cc @@ -241,7 +241,7 @@ bool VolumeSupportsADS(const base::FilePath& path) { bool HasInternetZoneIdentifier(const base::FilePath& full_path) { base::FilePath zone_path(full_path.value() + L":Zone.Identifier"); std::string zone_path_contents; - if (!file_util::ReadFileToString(zone_path, &zone_path_contents)) + if (!base::ReadFileToString(zone_path, &zone_path_contents)) return false; std::vector<std::string> lines; diff --git a/cc/test/pixel_test_utils.cc b/cc/test/pixel_test_utils.cc index 1ef0b74..d913492 100644 --- a/cc/test/pixel_test_utils.cc +++ b/cc/test/pixel_test_utils.cc @@ -31,7 +31,7 @@ bool WritePNGFile(const SkBitmap& bitmap, const base::FilePath& file_path, bool ReadPNGFile(const base::FilePath& file_path, SkBitmap* bitmap) { DCHECK(bitmap); std::string png_data; - return file_util::ReadFileToString(file_path, &png_data) && + return base::ReadFileToString(file_path, &png_data) && gfx::PNGCodec::Decode(reinterpret_cast<unsigned char*>(&png_data[0]), png_data.length(), bitmap); diff --git a/cc/trees/layer_tree_host_perftest.cc b/cc/trees/layer_tree_host_perftest.cc index 2d934e8..ca7ffa08 100644 --- a/cc/trees/layer_tree_host_perftest.cc +++ b/cc/trees/layer_tree_host_perftest.cc @@ -115,7 +115,7 @@ class LayerTreeHostPerfTestJsonReader : public LayerTreeHostPerfTest { base::FilePath test_data_dir; ASSERT_TRUE(PathService::Get(cc::DIR_TEST_DATA, &test_data_dir)); base::FilePath json_file = test_data_dir.AppendASCII(name + ".json"); - ASSERT_TRUE(file_util::ReadFileToString(json_file, &json_)); + ASSERT_TRUE(base::ReadFileToString(json_file, &json_)); } virtual void BuildTree() OVERRIDE { diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc index 96042e4..76f9c69 100644 --- a/chrome/browser/autofill/autofill_browsertest.cc +++ b/chrome/browser/autofill/autofill_browsertest.cc @@ -199,7 +199,7 @@ class AutofillTest : public InProcessBrowserTest { base::FilePath data_file = ui_test_utils::GetTestFilePath(base::FilePath().AppendASCII("autofill"), base::FilePath().AppendASCII(filename)); - CHECK(file_util::ReadFileToString(data_file, &data)); + CHECK(base::ReadFileToString(data_file, &data)); std::vector<std::string> lines; base::SplitString(data, '\n', &lines); int parsed_profiles = 0; diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc index bfbe171..e97ccbb 100644 --- a/chrome/browser/browser_shutdown.cc +++ b/chrome/browser/browser_shutdown.cc @@ -263,7 +263,7 @@ void ReadLastShutdownFile(ShutdownType type, base::FilePath shutdown_ms_file = GetShutdownMsPath(); std::string shutdown_ms_str; int64 shutdown_ms = 0; - if (file_util::ReadFileToString(shutdown_ms_file, &shutdown_ms_str)) + if (base::ReadFileToString(shutdown_ms_file, &shutdown_ms_str)) base::StringToInt64(shutdown_ms_str, &shutdown_ms); base::DeleteFile(shutdown_ms_file, false); diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_data.cc b/chrome/browser/chromeos/app_mode/kiosk_app_data.cc index acedc21..104a367 100644 --- a/chrome/browser/chromeos/app_mode/kiosk_app_data.cc +++ b/chrome/browser/chromeos/app_mode/kiosk_app_data.cc @@ -112,7 +112,7 @@ class KioskAppData::IconLoader : public ImageDecoder::Delegate { DCHECK(task_runner_->RunsTasksOnCurrentThread()); std::string data; - if (!file_util::ReadFileToString(base::FilePath(icon_path_), &data)) { + if (!base::ReadFileToString(base::FilePath(icon_path_), &data)) { ReportResultOnBlockingPool(FAILED_TO_LOAD); return; } diff --git a/chrome/browser/chromeos/boot_times_loader.cc b/chrome/browser/chromeos/boot_times_loader.cc index 2ef50a1..2232596 100644 --- a/chrome/browser/chromeos/boot_times_loader.cc +++ b/chrome/browser/chromeos/boot_times_loader.cc @@ -261,8 +261,8 @@ BootTimesLoader::Stats BootTimesLoader::GetCurrentStats() { const base::FilePath kDiskStat(FPL("/sys/block/sda/stat")); Stats stats; base::ThreadRestrictions::ScopedAllowIO allow_io; - file_util::ReadFileToString(kProcUptime, &stats.uptime); - file_util::ReadFileToString(kDiskStat, &stats.disk); + base::ReadFileToString(kProcUptime, &stats.uptime); + base::ReadFileToString(kDiskStat, &stats.disk); return stats; } diff --git a/chrome/browser/chromeos/customization_document.cc b/chrome/browser/chromeos/customization_document.cc index a625cd4..24adaf3 100644 --- a/chrome/browser/chromeos/customization_document.cc +++ b/chrome/browser/chromeos/customization_document.cc @@ -80,7 +80,7 @@ CustomizationDocument::~CustomizationDocument() {} bool CustomizationDocument::LoadManifestFromFile( const base::FilePath& manifest_path) { std::string manifest; - if (!file_util::ReadFileToString(manifest_path, &manifest)) + if (!base::ReadFileToString(manifest_path, &manifest)) return false; return LoadManifestFromString(manifest); } @@ -280,7 +280,7 @@ void ServicesCustomizationDocument::ReadFileInBackground( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); std::string manifest; - if (file_util::ReadFileToString(file, &manifest)) { + if (base::ReadFileToString(file, &manifest)) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( base::IgnoreResult( diff --git a/chrome/browser/chromeos/drive/fake_file_system_unittest.cc b/chrome/browser/chromeos/drive/fake_file_system_unittest.cc index be15012..532d351 100644 --- a/chrome/browser/chromeos/drive/fake_file_system_unittest.cc +++ b/chrome/browser/chromeos/drive/fake_file_system_unittest.cc @@ -94,7 +94,7 @@ TEST_F(FakeFileSystemTest, GetFileContentByPath) { // Make sure the cached file's content. std::string cache_file_content; ASSERT_TRUE( - file_util::ReadFileToString(cache_file_path, &cache_file_content)); + base::ReadFileToString(cache_file_path, &cache_file_content)); EXPECT_EQ(content, cache_file_content); } diff --git a/chrome/browser/chromeos/drive/file_cache_unittest.cc b/chrome/browser/chromeos/drive/file_cache_unittest.cc index 7c7b947..205271c 100644 --- a/chrome/browser/chromeos/drive/file_cache_unittest.cc +++ b/chrome/browser/chromeos/drive/file_cache_unittest.cc @@ -918,11 +918,11 @@ TEST_F(FileCacheTest, RenameCacheFilesToNewFormat) { // Rename and verify the result. RenameCacheFilesToNewFormat(cache_.get()); std::string contents; - EXPECT_TRUE(file_util::ReadFileToString(file_directory.AppendASCII("id_koo"), + EXPECT_TRUE(base::ReadFileToString(file_directory.AppendASCII("id_koo"), &contents)); EXPECT_EQ("koo", contents); contents.clear(); - EXPECT_TRUE(file_util::ReadFileToString(file_directory.AppendASCII("id_kyu"), + EXPECT_TRUE(base::ReadFileToString(file_directory.AppendASCII("id_kyu"), &contents)); EXPECT_EQ("kyu", contents); @@ -931,11 +931,11 @@ TEST_F(FileCacheTest, RenameCacheFilesToNewFormat) { // Files with new style names are not affected. contents.clear(); - EXPECT_TRUE(file_util::ReadFileToString(file_directory.AppendASCII("id_koo"), + EXPECT_TRUE(base::ReadFileToString(file_directory.AppendASCII("id_koo"), &contents)); EXPECT_EQ("koo", contents); contents.clear(); - EXPECT_TRUE(file_util::ReadFileToString(file_directory.AppendASCII("id_kyu"), + EXPECT_TRUE(base::ReadFileToString(file_directory.AppendASCII("id_kyu"), &contents)); EXPECT_EQ("kyu", contents); } diff --git a/chrome/browser/chromeos/drive/file_system/truncate_operation_unittest.cc b/chrome/browser/chromeos/drive/file_system/truncate_operation_unittest.cc index 1897809..0109d94 100644 --- a/chrome/browser/chromeos/drive/file_system/truncate_operation_unittest.cc +++ b/chrome/browser/chromeos/drive/file_system/truncate_operation_unittest.cc @@ -114,7 +114,7 @@ TEST_F(TruncateOperationTest, Extend) { // The local file should be truncated. std::string content; - ASSERT_TRUE(file_util::ReadFileToString(local_path, &content)); + ASSERT_TRUE(base::ReadFileToString(local_path, &content)); EXPECT_EQ(file_size + 10, static_cast<int64>(content.size())); // All trailing 10 bytes should be '\0'. diff --git a/chrome/browser/chromeos/drive/file_system_unittest.cc b/chrome/browser/chromeos/drive/file_system_unittest.cc index 8a7ec26..04e5ba5 100644 --- a/chrome/browser/chromeos/drive/file_system_unittest.cc +++ b/chrome/browser/chromeos/drive/file_system_unittest.cc @@ -749,7 +749,7 @@ TEST_F(FileSystemTest, OpenAndCloseFile) { // Verify that the file contents match the expected contents. const std::string kExpectedContent = "This is some test content."; std::string cache_file_data; - EXPECT_TRUE(file_util::ReadFileToString(opened_file_path, &cache_file_data)); + EXPECT_TRUE(base::ReadFileToString(opened_file_path, &cache_file_data)); EXPECT_EQ(kExpectedContent, cache_file_data); FileCacheEntry cache_entry; diff --git a/chrome/browser/chromeos/drive/job_scheduler_unittest.cc b/chrome/browser/chromeos/drive/job_scheduler_unittest.cc index 2b06f85c..331e75f 100644 --- a/chrome/browser/chromeos/drive/job_scheduler_unittest.cc +++ b/chrome/browser/chromeos/drive/job_scheduler_unittest.cc @@ -658,7 +658,7 @@ TEST_F(JobSchedulerTest, DownloadFileCellularDisabled) { EXPECT_EQ(google_apis::HTTP_SUCCESS, download_error); std::string content; EXPECT_EQ(output_file_path, kOutputFilePath); - ASSERT_TRUE(file_util::ReadFileToString(output_file_path, &content)); + ASSERT_TRUE(base::ReadFileToString(output_file_path, &content)); EXPECT_EQ("This is some test content.", content); } @@ -711,7 +711,7 @@ TEST_F(JobSchedulerTest, DownloadFileWimaxDisabled) { EXPECT_EQ(google_apis::HTTP_SUCCESS, download_error); std::string content; EXPECT_EQ(output_file_path, kOutputFilePath); - ASSERT_TRUE(file_util::ReadFileToString(output_file_path, &content)); + ASSERT_TRUE(base::ReadFileToString(output_file_path, &content)); EXPECT_EQ("This is some test content.", content); } @@ -756,7 +756,7 @@ TEST_F(JobSchedulerTest, DownloadFileCellularEnabled) { EXPECT_EQ(google_apis::HTTP_SUCCESS, download_error); std::string content; EXPECT_EQ(output_file_path, kOutputFilePath); - ASSERT_TRUE(file_util::ReadFileToString(output_file_path, &content)); + ASSERT_TRUE(base::ReadFileToString(output_file_path, &content)); EXPECT_EQ("This is some test content.", content); } @@ -801,7 +801,7 @@ TEST_F(JobSchedulerTest, DownloadFileWimaxEnabled) { EXPECT_EQ(google_apis::HTTP_SUCCESS, download_error); std::string content; EXPECT_EQ(output_file_path, kOutputFilePath); - ASSERT_TRUE(file_util::ReadFileToString(output_file_path, &content)); + ASSERT_TRUE(base::ReadFileToString(output_file_path, &content)); EXPECT_EQ("This is some test content.", content); } diff --git a/chrome/browser/chromeos/drive/sync_client_unittest.cc b/chrome/browser/chromeos/drive/sync_client_unittest.cc index d67be23..2e41540 100644 --- a/chrome/browser/chromeos/drive/sync_client_unittest.cc +++ b/chrome/browser/chromeos/drive/sync_client_unittest.cc @@ -286,13 +286,13 @@ TEST_F(SyncClientTest, ExistingPinnedFiles) { std::string content; EXPECT_EQ(FILE_ERROR_OK, cache_->GetFile(resource_ids_["fetched"], &cache_file)); - EXPECT_TRUE(file_util::ReadFileToString(cache_file, &content)); + EXPECT_TRUE(base::ReadFileToString(cache_file, &content)); EXPECT_EQ(kRemoteContent, content); content.clear(); EXPECT_EQ(FILE_ERROR_OK, cache_->GetFile(resource_ids_["dirty"], &cache_file)); - EXPECT_TRUE(file_util::ReadFileToString(cache_file, &content)); + EXPECT_TRUE(base::ReadFileToString(cache_file, &content)); EXPECT_EQ(kLocalContent, content); } diff --git a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc index 7dae077..5fac57c 100644 --- a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc +++ b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc @@ -59,7 +59,7 @@ struct TestCase { void ExpectFileContentEquals(const base::FilePath& selected_path, const std::string& expected_contents) { std::string test_file_contents; - ASSERT_TRUE(file_util::ReadFileToString(selected_path, &test_file_contents)); + ASSERT_TRUE(base::ReadFileToString(selected_path, &test_file_contents)); EXPECT_EQ(expected_contents, test_file_contents); } diff --git a/chrome/browser/chromeos/extensions/file_manager/file_manager_browsertest.cc b/chrome/browser/chromeos/extensions/file_manager/file_manager_browsertest.cc index 618f1a1..b8a4e78 100644 --- a/chrome/browser/chromeos/extensions/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/chromeos/extensions/file_manager/file_manager_browsertest.cc @@ -250,7 +250,7 @@ class DriveTestVolume { base::FilePath source_file_path = google_apis::test_util::GetTestFilePath("chromeos/file_manager"). AppendASCII(source_file_name); - ASSERT_TRUE(file_util::ReadFileToString(source_file_path, &content_data)); + ASSERT_TRUE(base::ReadFileToString(source_file_path, &content_data)); } scoped_ptr<google_apis::ResourceEntry> resource_entry; diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc index 5fc5876..32deb31 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc +++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc @@ -99,7 +99,7 @@ bool GetData(const base::FilePath& path, std::string* data) { return false; return !base::PathExists(path) || - file_util::ReadFileToString(path, data); + base::ReadFileToString(path, data); } class WindowStateManager; @@ -386,7 +386,7 @@ void WallpaperPrivateSetWallpaperIfExistsFunction:: path = fallback_path; if (base::PathExists(path) && - file_util::ReadFileToString(path, &data)) { + base::ReadFileToString(path, &data)) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(&WallpaperPrivateSetWallpaperIfExistsFunction::StartDecode, this, data)); diff --git a/chrome/browser/chromeos/external_metrics.cc b/chrome/browser/chromeos/external_metrics.cc index 4e7dd11..98b62c4 100644 --- a/chrome/browser/chromeos/external_metrics.cc +++ b/chrome/browser/chromeos/external_metrics.cc @@ -106,7 +106,7 @@ void SetupProgressiveScanFieldTrial() { bool Is2GBParrot() { base::FilePath path("/etc/lsb-release"); std::string contents; - if (!file_util::ReadFileToString(path, &contents)) + if (!base::ReadFileToString(path, &contents)) return false; if (contents.find("CHROMEOS_RELEASE_BOARD=parrot") == std::string::npos) return false; diff --git a/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc b/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc index 2a61f89..0788b30 100644 --- a/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc +++ b/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc @@ -257,7 +257,7 @@ void ComponentExtensionIMEManagerImpl::ReadComponentExtensionsInfo( !base::PathExists(manifest_path)) continue; - if (!file_util::ReadFileToString(manifest_path, &component_ime.manifest)) + if (!base::ReadFileToString(manifest_path, &component_ime.manifest)) continue; scoped_ptr<DictionaryValue> manifest = GetManifest(component_ime.path); diff --git a/chrome/browser/chromeos/login/kiosk_browsertest.cc b/chrome/browser/chromeos/login/kiosk_browsertest.cc index c1fcf41..3c5d1f1 100644 --- a/chrome/browser/chromeos/login/kiosk_browsertest.cc +++ b/chrome/browser/chromeos/login/kiosk_browsertest.cc @@ -181,8 +181,8 @@ class KioskTest : public InProcessBrowserTest, virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { base::FilePath test_data_dir; PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); - CHECK(file_util::ReadFileToString(test_data_dir.Append(kServiceLogin), - &service_login_response_)); + CHECK(base::ReadFileToString(test_data_dir.Append(kServiceLogin), + &service_login_response_)); host_resolver()->AddRule(kWebstoreDomain, "127.0.0.1"); } diff --git a/chrome/browser/chromeos/login/managed/locally_managed_user_login_flow.cc b/chrome/browser/chromeos/login/managed/locally_managed_user_login_flow.cc index cffa7cd..380d1d6 100644 --- a/chrome/browser/chromeos/login/managed/locally_managed_user_login_flow.cc +++ b/chrome/browser/chromeos/login/managed/locally_managed_user_login_flow.cc @@ -30,7 +30,7 @@ std::string LoadSyncToken() { std::string token; base::FilePath token_file = file_util::GetHomeDir().Append(kManagedUserTokenFilename); - if (!file_util::ReadFileToString(token_file, &token)) { + if (!base::ReadFileToString(token_file, &token)) { return std::string(); } return token; diff --git a/chrome/browser/chromeos/login/oobe_browsertest.cc b/chrome/browser/chromeos/login/oobe_browsertest.cc index ea19642..f33c01b 100644 --- a/chrome/browser/chromeos/login/oobe_browsertest.cc +++ b/chrome/browser/chromeos/login/oobe_browsertest.cc @@ -145,8 +145,8 @@ class OobeTest : public InProcessBrowserTest { content_browser_client_.get()); base::FilePath test_data_dir; PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); - CHECK(file_util::ReadFileToString(test_data_dir.Append(kServiceLogin), - &service_login_response_)); + CHECK(base::ReadFileToString(test_data_dir.Append(kServiceLogin), + &service_login_response_)); } virtual void SetUpOnMainThread() OVERRIDE { diff --git a/chrome/browser/chromeos/login/screens/update_screen.cc b/chrome/browser/chromeos/login/screens/update_screen.cc index 82b79b9..4469c12 100644 --- a/chrome/browser/chromeos/login/screens/update_screen.cc +++ b/chrome/browser/chromeos/login/screens/update_screen.cc @@ -460,7 +460,7 @@ bool UpdateScreen::HasCriticalUpdate() { // Temporarily allow it until we fix http://crosbug.com/11106 base::ThreadRestrictions::ScopedAllowIO allow_io; base::FilePath update_deadline_file_path(kUpdateDeadlineFile); - if (!file_util::ReadFileToString(update_deadline_file_path, &deadline) || + if (!base::ReadFileToString(update_deadline_file_path, &deadline) || deadline.empty()) { return false; } diff --git a/chrome/browser/chromeos/login/user_image_loader.cc b/chrome/browser/chromeos/login/user_image_loader.cc index 05db624..2148180 100644 --- a/chrome/browser/chromeos/login/user_image_loader.cc +++ b/chrome/browser/chromeos/login/user_image_loader.cc @@ -71,7 +71,7 @@ void UserImageLoader::LoadImage( DCHECK(task_runner->RunsTasksOnCurrentThread()); std::string image_data; - file_util::ReadFileToString(base::FilePath(filepath), &image_data); + base::ReadFileToString(base::FilePath(filepath), &image_data); scoped_refptr<ImageDecoder> image_decoder = new ImageDecoder(this, image_data, image_codec_); diff --git a/chrome/browser/chromeos/mobile/mobile_activator.cc b/chrome/browser/chromeos/mobile/mobile_activator.cc index d0d3802..9475e6e 100644 --- a/chrome/browser/chromeos/mobile/mobile_activator.cc +++ b/chrome/browser/chromeos/mobile/mobile_activator.cc @@ -118,7 +118,7 @@ void CellularConfigDocument::SetErrorMap( bool CellularConfigDocument::LoadFromFile(const base::FilePath& config_path) { std::string config; - if (!file_util::ReadFileToString(config_path, &config)) + if (!base::ReadFileToString(config_path, &config)) return false; scoped_ptr<Value> root( diff --git a/chrome/browser/chromeos/mobile_config.cc b/chrome/browser/chromeos/mobile_config.cc index 78198f6..a0503ca 100644 --- a/chrome/browser/chromeos/mobile_config.cc +++ b/chrome/browser/chromeos/mobile_config.cc @@ -360,11 +360,11 @@ void MobileConfig::ReadConfigInBackground( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); std::string global_config; std::string local_config; - if (!file_util::ReadFileToString(global_config_file, &global_config)) { + if (!base::ReadFileToString(global_config_file, &global_config)) { VLOG(1) << "Failed to load global mobile config from: " << global_config_file.value(); } - if (!file_util::ReadFileToString(local_config_file, &local_config)) { + if (!base::ReadFileToString(local_config_file, &local_config)) { VLOG(1) << "Failed to load local mobile config from: " << local_config_file.value(); } diff --git a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc index 450f192..c125281 100644 --- a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc +++ b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc @@ -561,7 +561,7 @@ IN_PROC_BROWSER_TEST_P(TermsOfServiceTest, TermsOfServiceScreen) { base::FilePath test_dir; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); std::string terms_of_service; - ASSERT_TRUE(file_util::ReadFileToString( + ASSERT_TRUE(base::ReadFileToString( test_dir.Append(kExistentTermsOfServicePath), &terms_of_service)); EXPECT_EQ(terms_of_service, content); EXPECT_FALSE(error); diff --git a/chrome/browser/chromeos/policy/user_policy_disk_cache.cc b/chrome/browser/chromeos/policy/user_policy_disk_cache.cc index bb93e89..e9249cd 100644 --- a/chrome/browser/chromeos/policy/user_policy_disk_cache.cc +++ b/chrome/browser/chromeos/policy/user_policy_disk_cache.cc @@ -73,7 +73,7 @@ void UserPolicyDiskCache::LoadOnFileThread() { // Read the protobuf from the file. std::string data; - if (!file_util::ReadFileToString(backing_file_path_, &data)) { + if (!base::ReadFileToString(backing_file_path_, &data)) { LOG(WARNING) << "Failed to read policy data from " << backing_file_path_.value(); LoadDone(LOAD_RESULT_READ_ERROR, cached_response); diff --git a/chrome/browser/chromeos/policy/user_policy_token_loader.cc b/chrome/browser/chromeos/policy/user_policy_token_loader.cc index b20c4d2..1501e6c 100644 --- a/chrome/browser/chromeos/policy/user_policy_token_loader.cc +++ b/chrome/browser/chromeos/policy/user_policy_token_loader.cc @@ -61,7 +61,7 @@ void UserPolicyTokenLoader::LoadOnFileThread() { if (base::PathExists(cache_file_)) { std::string data; em::DeviceCredentials device_credentials; - if (file_util::ReadFileToString(cache_file_, &data) && + if (base::ReadFileToString(cache_file_, &data) && device_credentials.ParseFromArray(data.c_str(), data.size())) { device_token = device_credentials.device_token(); device_id = device_credentials.device_id(); diff --git a/chrome/browser/chromeos/swap_metrics.cc b/chrome/browser/chromeos/swap_metrics.cc index efebac3..974fcc8 100644 --- a/chrome/browser/chromeos/swap_metrics.cc +++ b/chrome/browser/chromeos/swap_metrics.cc @@ -261,7 +261,7 @@ bool SwapMetrics::Backend::GetFieldFromKernelOutput(const std::string& path, const std::string& field, int64* value) { std::string file_content; - if (!file_util::ReadFileToString(FilePath(path), &file_content)) { + if (!base::ReadFileToString(FilePath(path), &file_content)) { LOG(WARNING) << "Cannot read " << path; return false; } @@ -296,7 +296,7 @@ bool SwapMetrics::Backend::TokenizeOneLineFile(const std::string& path, std::vector<std::string>* tokens) { std::string file_content; - if (!file_util::ReadFileToString(FilePath(path), &file_content)) { + if (!base::ReadFileToString(FilePath(path), &file_content)) { LOG(WARNING) << "cannot read " << path; return false; } diff --git a/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc b/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc index 6f76b35..7aac719 100644 --- a/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc +++ b/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc @@ -478,8 +478,7 @@ void AutomaticRebootManagerBasicTest::CreateAutomaticRebootManager( bool AutomaticRebootManagerBasicTest::ReadUpdateRebootNeededUptimeFromFile( base::TimeDelta* uptime) { std::string contents; - if (!file_util::ReadFileToString(update_reboot_needed_uptime_file_, - &contents)) { + if (!base::ReadFileToString(update_reboot_needed_uptime_file_, &contents)) { return false; } double seconds; diff --git a/chrome/browser/chromeos/system/syslogs_provider.cc b/chrome/browser/chromeos/system/syslogs_provider.cc index 279d837..5a1c00e 100644 --- a/chrome/browser/chromeos/system/syslogs_provider.cc +++ b/chrome/browser/chromeos/system/syslogs_provider.cc @@ -142,8 +142,7 @@ LogDictionaryType* GetSystemLogs(base::FilePath* zip_file_name, } // Read logs from the temp file std::string data; - bool read_success = file_util::ReadFileToString(temp_filename, - &data); + bool read_success = base::ReadFileToString(temp_filename, &data); // if we were using an internal temp file, the user does not need the // logs to stay past the ReadFile call - delete the file base::DeleteFile(temp_filename, false); @@ -348,7 +347,7 @@ void SyslogsProviderImpl::ReadSyslogs( void SyslogsProviderImpl::LoadCompressedLogs(const base::FilePath& zip_file, std::string* zip_content) { DCHECK(zip_content); - if (!file_util::ReadFileToString(zip_file, zip_content)) { + if (!base::ReadFileToString(zip_file, zip_content)) { LOG(ERROR) << "Cannot read compressed logs file from " << zip_file.value().c_str(); } diff --git a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc index 7127c76..c3a3368 100644 --- a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc +++ b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc @@ -160,7 +160,7 @@ void DebugDaemonLogSource::ReadUserLogFiles( std::string value; std::string filename = it->second; base::FilePath profile_dir = last_used_profiles[i]->GetPath(); - bool read_success = file_util::ReadFileToString( + bool read_success = base::ReadFileToString( profile_dir.Append(filename), &value); if (read_success && !value.empty()) diff --git a/chrome/browser/chromeos/system_logs/lsb_release_log_source.cc b/chrome/browser/chromeos/system_logs/lsb_release_log_source.cc index e1ad87e..d6b0564 100644 --- a/chrome/browser/chromeos/system_logs/lsb_release_log_source.cc +++ b/chrome/browser/chromeos/system_logs/lsb_release_log_source.cc @@ -44,7 +44,7 @@ void LsbReleaseLogSource::ReadLSBRelease(SystemLogsResponse* response) { const base::FilePath lsb_release_file("/etc/lsb-release"); std::string lsb_data; - bool read_success = file_util::ReadFileToString(lsb_release_file, &lsb_data); + bool read_success = base::ReadFileToString(lsb_release_file, &lsb_data); // if we were using an internal temp file, the user does not need the // logs to stay past the ReadFile call - delete the file if (!read_success) { diff --git a/chrome/browser/chromeos/version_loader.cc b/chrome/browser/chromeos/version_loader.cc index 921c60b..5ee7046 100644 --- a/chrome/browser/chromeos/version_loader.cc +++ b/chrome/browser/chromeos/version_loader.cc @@ -135,7 +135,7 @@ void VersionLoader::Backend::GetVersion(VersionFormat format, std::string contents; const base::FilePath file_path(kPathVersion); - if (file_util::ReadFileToString(file_path, &contents)) { + if (base::ReadFileToString(file_path, &contents)) { *version = ParseVersion( contents, (format == VERSION_FULL) ? kFullVersionPrefix : kVersionPrefix); @@ -159,7 +159,7 @@ void VersionLoader::Backend::GetFirmware(std::string* firmware) { std::string contents; const base::FilePath file_path(kPathFirmware); - if (file_util::ReadFileToString(file_path, &contents)) { + if (base::ReadFileToString(file_path, &contents)) { *firmware = ParseFirmware(contents); } } diff --git a/chrome/browser/component_updater/default_component_installer.cc b/chrome/browser/component_updater/default_component_installer.cc index da8dac9..56bede1 100644 --- a/chrome/browser/component_updater/default_component_installer.cc +++ b/chrome/browser/component_updater/default_component_installer.cc @@ -121,8 +121,8 @@ void DefaultComponentInstaller::StartRegistration( if (found) { current_version_ = latest_version; - file_util::ReadFileToString(latest_dir.AppendASCII("manifest.fingerprint"), - ¤t_fingerprint_); + base::ReadFileToString(latest_dir.AppendASCII("manifest.fingerprint"), + ¤t_fingerprint_); } // Remove older versions of the component. None should be in use during diff --git a/chrome/browser/diagnostics/recon_diagnostics.cc b/chrome/browser/diagnostics/recon_diagnostics.cc index c59c35c7..185c9e2 100644 --- a/chrome/browser/diagnostics/recon_diagnostics.cc +++ b/chrome/browser/diagnostics/recon_diagnostics.cc @@ -203,7 +203,7 @@ class JSONTest : public DiagnosticsTest { } // Being small enough, we can process it in-memory. std::string json_data; - if (!file_util::ReadFileToString(path_, &json_data)) { + if (!base::ReadFileToString(path_, &json_data)) { RecordFailure(DIAG_RECON_UNABLE_TO_OPEN_FILE, "Could not open file. Possibly locked by another process"); return true; diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index 1bacb68..3839ca8 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -679,8 +679,7 @@ class DownloadTest : public InProcessBrowserTest { int64 origin_file_size = 0; EXPECT_TRUE(file_util::GetFileSize(origin_file, &origin_file_size)); std::string original_file_contents; - EXPECT_TRUE( - file_util::ReadFileToString(origin_file, &original_file_contents)); + EXPECT_TRUE(base::ReadFileToString(origin_file, &original_file_contents)); EXPECT_TRUE( VerifyFile(downloaded_file, original_file_contents, origin_file_size)); @@ -831,7 +830,7 @@ class DownloadTest : public InProcessBrowserTest { const int64 file_size) { std::string file_contents; - bool read = file_util::ReadFileToString(path, &file_contents); + bool read = base::ReadFileToString(path, &file_contents); EXPECT_TRUE(read) << "Failed reading file: " << path.value() << std::endl; if (!read) return false; // Couldn't read the file. @@ -1475,7 +1474,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_IncognitoRegular) { int64 origin_file_size = 0; EXPECT_TRUE(file_util::GetFileSize(origin, &origin_file_size)); std::string original_contents; - EXPECT_TRUE(file_util::ReadFileToString(origin, &original_contents)); + EXPECT_TRUE(base::ReadFileToString(origin, &original_contents)); std::vector<DownloadItem*> download_items; GetDownloads(browser(), &download_items); @@ -2846,7 +2845,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_Renaming) { "downloads/a_zip_file.zip")))); ASSERT_TRUE(base::PathExists(origin_file)); std::string origin_contents; - ASSERT_TRUE(file_util::ReadFileToString(origin_file, &origin_contents)); + ASSERT_TRUE(base::ReadFileToString(origin_file, &origin_contents)); // Download the same url several times and expect that all downloaded files // after the zero-th contain a deduplication counter. diff --git a/chrome/browser/download/save_page_browsertest.cc b/chrome/browser/download/save_page_browsertest.cc index f108f84..5f75f65 100644 --- a/chrome/browser/download/save_page_browsertest.cc +++ b/chrome/browser/download/save_page_browsertest.cc @@ -809,7 +809,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SavePageBrowserTest_NonMHTML) { base::FilePath filename = download_dir.AppendASCII("dataurl.txt"); ASSERT_TRUE(base::PathExists(filename)); std::string contents; - EXPECT_TRUE(file_util::ReadFileToString(filename, &contents)); + EXPECT_TRUE(base::ReadFileToString(filename, &contents)); EXPECT_EQ("foo", contents); } diff --git a/chrome/browser/drive/fake_drive_service.cc b/chrome/browser/drive/fake_drive_service.cc index 26cc58c..469ec40 100644 --- a/chrome/browser/drive/fake_drive_service.cc +++ b/chrome/browser/drive/fake_drive_service.cc @@ -1207,7 +1207,7 @@ CancelCallback FakeDriveService::ResumeUpload( } std::string content_data; - if (!file_util::ReadFileToString(local_file_path, &content_data)) { + if (!base::ReadFileToString(local_file_path, &content_data)) { session->uploaded_size = end_position; completion_callback.Run(GDATA_FILE_ERROR, scoped_ptr<ResourceEntry>()); return CancelCallback(); diff --git a/chrome/browser/drive/fake_drive_service_unittest.cc b/chrome/browser/drive/fake_drive_service_unittest.cc index 3c69648..f7d7fb4 100644 --- a/chrome/browser/drive/fake_drive_service_unittest.cc +++ b/chrome/browser/drive/fake_drive_service_unittest.cc @@ -903,7 +903,7 @@ TEST_F(FakeDriveServiceTest, DownloadFile_ExistingFile) { EXPECT_EQ(HTTP_SUCCESS, error); EXPECT_EQ(output_file_path, kOutputFilePath); std::string content; - ASSERT_TRUE(file_util::ReadFileToString(output_file_path, &content)); + ASSERT_TRUE(base::ReadFileToString(output_file_path, &content)); // The content is "x"s of the file size specified in root_feed.json. EXPECT_EQ("This is some test content.", content); ASSERT_TRUE(!download_progress_values.empty()); diff --git a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc index 2c81f39..d102b0f 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc @@ -2197,8 +2197,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, " \"current\": \"complete\"}}]", result_id))); std::string disk_data; - EXPECT_TRUE(file_util::ReadFileToString(item->GetTargetFilePath(), - &disk_data)); + EXPECT_TRUE(base::ReadFileToString(item->GetTargetFilePath(), &disk_data)); EXPECT_STREQ(kPayloadData, disk_data.c_str()); } 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 f92d930..b8b6df1 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 @@ -195,7 +195,7 @@ TEST_F(NativeMessagingTest, SingleSendMessageWrite) { std::string output; base::TimeTicks start_time = base::TimeTicks::Now(); while (base::TimeTicks::Now() - start_time < TestTimeouts::action_timeout()) { - ASSERT_TRUE(file_util::ReadFileToString(temp_output_file, &output)); + ASSERT_TRUE(base::ReadFileToString(temp_output_file, &output)); if (!output.empty()) break; base::PlatformThread::YieldCurrentThread(); diff --git a/chrome/browser/extensions/api/music_manager_private/device_id_linux.cc b/chrome/browser/extensions/api/music_manager_private/device_id_linux.cc index 2703bf9..a408e5b 100644 --- a/chrome/browser/extensions/api/music_manager_private/device_id_linux.cc +++ b/chrome/browser/extensions/api/music_manager_private/device_id_linux.cc @@ -17,7 +17,7 @@ void GetDBusMachineId(const extensions::api::DeviceId::IdCallback& callback) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); std::string result; - if (!file_util::ReadFileToString(base::FilePath(kDBusFilename), &result)) { + if (!base::ReadFileToString(base::FilePath(kDBusFilename), &result)) { DLOG(WARNING) << "Error reading dbus machine id file."; result = ""; } diff --git a/chrome/browser/extensions/api/push_messaging/sync_setup_helper.cc b/chrome/browser/extensions/api/push_messaging/sync_setup_helper.cc index f4dffc3..51fc4b3 100644 --- a/chrome/browser/extensions/api/push_messaging/sync_setup_helper.cc +++ b/chrome/browser/extensions/api/push_messaging/sync_setup_helper.cc @@ -50,7 +50,7 @@ bool SyncSetupHelper::InitializeSync(Profile* profile) { bool SyncSetupHelper::ReadPasswordFile(const base::FilePath& password_file) { // TODO(dcheng): Convert format of config file to JSON. std::string file_contents; - bool success = file_util::ReadFileToString(password_file, &file_contents); + bool success = base::ReadFileToString(password_file, &file_contents); EXPECT_TRUE(success) << "Password file \"" << password_file.value() << "\" does not exist."; diff --git a/chrome/browser/extensions/component_loader_unittest.cc b/chrome/browser/extensions/component_loader_unittest.cc index 4bf9f52..049a5e7 100644 --- a/chrome/browser/extensions/component_loader_unittest.cc +++ b/chrome/browser/extensions/component_loader_unittest.cc @@ -88,7 +88,7 @@ class ComponentLoaderTest : public testing::Test { .AppendASCII("1.0.0.0"); // Read in the extension manifest. - ASSERT_TRUE(file_util::ReadFileToString( + ASSERT_TRUE(base::ReadFileToString( extension_path_.Append(kManifestFilename), &manifest_contents_)); diff --git a/chrome/browser/extensions/convert_user_script.cc b/chrome/browser/extensions/convert_user_script.cc index 4d8b064..043fae2 100644 --- a/chrome/browser/extensions/convert_user_script.cc +++ b/chrome/browser/extensions/convert_user_script.cc @@ -34,7 +34,7 @@ scoped_refptr<Extension> ConvertUserScriptToExtension( const base::FilePath& user_script_path, const GURL& original_url, const base::FilePath& extensions_dir, string16* error) { std::string content; - if (!file_util::ReadFileToString(user_script_path, &content)) { + if (!base::ReadFileToString(user_script_path, &content)) { *error = ASCIIToUTF16("Could not read source file."); return NULL; } diff --git a/chrome/browser/extensions/convert_web_app_unittest.cc b/chrome/browser/extensions/convert_web_app_unittest.cc index fe081da..fcf5948 100644 --- a/chrome/browser/extensions/convert_web_app_unittest.cc +++ b/chrome/browser/extensions/convert_web_app_unittest.cc @@ -51,7 +51,7 @@ WebApplicationInfo::IconInfo GetIconInfo(const GURL& url, int size) { result.height = size; std::string icon_data; - if (!file_util::ReadFileToString(icon_file, &icon_data)) { + if (!base::ReadFileToString(icon_file, &icon_data)) { ADD_FAILURE() << "Could not read test icon."; return result; } diff --git a/chrome/browser/extensions/extension_action_icon_factory_unittest.cc b/chrome/browser/extensions/extension_action_icon_factory_unittest.cc index 39ea0d6..3eadffa 100644 --- a/chrome/browser/extensions/extension_action_icon_factory_unittest.cc +++ b/chrome/browser/extensions/extension_action_icon_factory_unittest.cc @@ -70,7 +70,7 @@ gfx::Image LoadIcon(const std::string& filename) { path = path.AppendASCII("extensions/api_test").AppendASCII(filename); std::string file_contents; - file_util::ReadFileToString(path, &file_contents); + base::ReadFileToString(path, &file_contents); const unsigned char* data = reinterpret_cast<const unsigned char*>(file_contents.data()); diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc index 2ebf2dc..5e9ec68 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc @@ -220,8 +220,7 @@ const Extension* ExtensionBrowserTest::LoadExtensionAsComponentWithManifest( profile())->extension_service(); std::string manifest; - if (!file_util::ReadFileToString(path.Append(manifest_relative_path), - &manifest)) { + if (!base::ReadFileToString(path.Append(manifest_relative_path), &manifest)) { return NULL; } diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc index 285aa5c..a50aff8 100644 --- a/chrome/browser/extensions/extension_creator.cc +++ b/chrome/browser/extensions/extension_creator.cc @@ -127,8 +127,7 @@ crypto::RSAPrivateKey* ExtensionCreator::ReadInputKey(const base::FilePath& } std::string private_key_contents; - if (!file_util::ReadFileToString(private_key_path, - &private_key_contents)) { + if (!base::ReadFileToString(private_key_path, &private_key_contents)) { error_message_ = l10n_util::GetStringUTF8(IDS_EXTENSION_PRIVATE_KEY_FAILED_TO_READ); return NULL; diff --git a/chrome/browser/extensions/extension_resource_request_policy_apitest.cc b/chrome/browser/extensions/extension_resource_request_policy_apitest.cc index 44fd689..a2647a9 100644 --- a/chrome/browser/extensions/extension_resource_request_policy_apitest.cc +++ b/chrome/browser/extensions/extension_resource_request_policy_apitest.cc @@ -88,7 +88,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, OriginPrivileges) { // A data URL. Data URLs should always be able to load chrome-extension:// // resources. std::string file_source; - ASSERT_TRUE(file_util::ReadFileToString( + ASSERT_TRUE(base::ReadFileToString( test_data_dir_.AppendASCII("extension_resource_request_policy") .AppendASCII("index.html"), &file_source)); ui_test_utils::NavigateToURL(browser(), diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 4ccc3c1..0d7d319 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -3499,7 +3499,7 @@ TEST_F(ExtensionServiceTest, ComponentExtensionWhitelisted) { .AppendASCII(good0) .AppendASCII("1.0.0.0"); std::string manifest; - ASSERT_TRUE(file_util::ReadFileToString( + ASSERT_TRUE(base::ReadFileToString( path.Append(extensions::kManifestFilename), &manifest)); service_->component_loader()->Add(manifest, path); service_->Init(); @@ -5050,7 +5050,7 @@ TEST_F(ExtensionServiceTest, ComponentExtensions) { .AppendASCII("1.0.0.0"); std::string manifest; - ASSERT_TRUE(file_util::ReadFileToString( + ASSERT_TRUE(base::ReadFileToString( path.Append(extensions::kManifestFilename), &manifest)); service_->component_loader()->Add(manifest, path); @@ -5104,7 +5104,7 @@ TEST_F(ExtensionServiceTest, DeferredSyncStartupPreInstalledComponent) { .AppendASCII(good0) .AppendASCII("1.0.0.0"); std::string manifest; - ASSERT_TRUE(file_util::ReadFileToString( + ASSERT_TRUE(base::ReadFileToString( path.Append(extensions::kManifestFilename), &manifest)); service_->component_loader()->Add(manifest, path); ASSERT_FALSE(service_->is_ready()); diff --git a/chrome/browser/extensions/gtalk_extension_browsertest.cc b/chrome/browser/extensions/gtalk_extension_browsertest.cc index 42e4ecc..694765d 100644 --- a/chrome/browser/extensions/gtalk_extension_browsertest.cc +++ b/chrome/browser/extensions/gtalk_extension_browsertest.cc @@ -69,7 +69,7 @@ class GtalkExtensionTest : public ExtensionBrowserTest { std::string ReadCurrentVersion() { std::string response; - EXPECT_TRUE(file_util::ReadFileToString( + EXPECT_TRUE(base::ReadFileToString( test_data_dir_.AppendASCII("gtalk").AppendASCII("current_version"), &response)); return response; diff --git a/chrome/browser/extensions/image_loader.cc b/chrome/browser/extensions/image_loader.cc index 439df3c2..2e2702e 100644 --- a/chrome/browser/extensions/image_loader.cc +++ b/chrome/browser/extensions/image_loader.cc @@ -83,7 +83,7 @@ void LoadImageOnBlockingPool(const ImageLoader::ImageRepresentation& image_info, // Read the file from disk. std::string file_contents; base::FilePath path = image_info.resource.GetFilePath(); - if (path.empty() || !file_util::ReadFileToString(path, &file_contents)) { + if (path.empty() || !base::ReadFileToString(path, &file_contents)) { return; } diff --git a/chrome/browser/extensions/sandboxed_unpacker.cc b/chrome/browser/extensions/sandboxed_unpacker.cc index 1a98850..460fbdc 100644 --- a/chrome/browser/extensions/sandboxed_unpacker.cc +++ b/chrome/browser/extensions/sandboxed_unpacker.cc @@ -182,7 +182,7 @@ bool ReadImagesFromFile(const base::FilePath& extension_path, base::FilePath path = extension_path.AppendASCII(kDecodedImagesFilename); std::string file_str; - if (!file_util::ReadFileToString(path, &file_str)) + if (!base::ReadFileToString(path, &file_str)) return false; IPC::Message pickle(file_str.data(), file_str.size()); @@ -198,7 +198,7 @@ bool ReadMessageCatalogsFromFile(const base::FilePath& extension_path, base::FilePath path = extension_path.AppendASCII( kDecodedMessageCatalogsFilename); std::string file_str; - if (!file_util::ReadFileToString(path, &file_str)) + if (!base::ReadFileToString(path, &file_str)) return false; IPC::Message pickle(file_str.data(), file_str.size()); diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc index 64f892b..95b8f6a 100644 --- a/chrome/browser/extensions/user_script_master.cc +++ b/chrome/browser/extensions/user_script_master.cc @@ -203,7 +203,7 @@ static bool LoadScriptContent(UserScript::File* script_file, return false; } } else { - if (!file_util::ReadFileToString(path, &content)) { + if (!base::ReadFileToString(path, &content)) { LOG(WARNING) << "Failed to load user script file: " << path.value(); return false; } diff --git a/chrome/browser/feedback/feedback_util.cc b/chrome/browser/feedback/feedback_util.cc index 2c82b2c..0bbad4a 100644 --- a/chrome/browser/feedback/feedback_util.cc +++ b/chrome/browser/feedback/feedback_util.cc @@ -415,7 +415,7 @@ bool ZipString(const std::string& logs, std::string* compressed_logs) { if (!zip::Zip(temp_path, zip_file, false)) return false; - if (!file_util::ReadFileToString(zip_file, compressed_logs)) + if (!base::ReadFileToString(zip_file, compressed_logs)) return false; return true; diff --git a/chrome/browser/google/google_update_settings_posix.cc b/chrome/browser/google/google_update_settings_posix.cc index 8942024..4a69eab 100644 --- a/chrome/browser/google/google_update_settings_posix.cc +++ b/chrome/browser/google/google_update_settings_posix.cc @@ -27,7 +27,7 @@ bool GoogleUpdateSettings::GetCollectStatsConsent() { PathService::Get(chrome::DIR_USER_DATA, &consent_file); consent_file = consent_file.Append(kConsentToSendStats); std::string tmp_guid; - bool consented = file_util::ReadFileToString(consent_file, &tmp_guid); + bool consented = base::ReadFileToString(consent_file, &tmp_guid); if (consented) google_update::posix_guid().assign(tmp_guid); return consented; diff --git a/chrome/browser/google/google_util_chromeos.cc b/chrome/browser/google/google_util_chromeos.cc index 06232e4..41f1245 100644 --- a/chrome/browser/google/google_util_chromeos.cc +++ b/chrome/browser/google/google_util_chromeos.cc @@ -28,7 +28,7 @@ const base::FilePath::CharType kRLZBrandFilePath[] = std::string ReadBrandFromFile() { std::string brand; base::FilePath brand_file_path(kRLZBrandFilePath); - if (!file_util::ReadFileToString(brand_file_path, &brand)) + if (!base::ReadFileToString(brand_file_path, &brand)) LOG(WARNING) << "Brand code file missing: " << brand_file_path.value(); TrimWhitespace(brand, TRIM_ALL, &brand); return brand; diff --git a/chrome/browser/google_apis/base_requests_server_unittest.cc b/chrome/browser/google_apis/base_requests_server_unittest.cc index c6e2065..896ad0e 100644 --- a/chrome/browser/google_apis/base_requests_server_unittest.cc +++ b/chrome/browser/google_apis/base_requests_server_unittest.cc @@ -90,7 +90,7 @@ TEST_F(BaseRequestsServerTest, DownloadFileRequest_ValidFile) { } std::string contents; - file_util::ReadFileToString(temp_file, &contents); + base::ReadFileToString(temp_file, &contents); base::DeleteFile(temp_file, false); EXPECT_EQ(HTTP_SUCCESS, result_code); @@ -100,7 +100,7 @@ TEST_F(BaseRequestsServerTest, DownloadFileRequest_ValidFile) { const base::FilePath expected_path = test_util::GetTestFilePath("gdata/testfile.txt"); std::string expected_contents; - file_util::ReadFileToString(expected_path, &expected_contents); + base::ReadFileToString(expected_path, &expected_contents); EXPECT_EQ(expected_contents, contents); } diff --git a/chrome/browser/google_apis/drive_api_requests_unittest.cc b/chrome/browser/google_apis/drive_api_requests_unittest.cc index 07bfffa..b69048a 100644 --- a/chrome/browser/google_apis/drive_api_requests_unittest.cc +++ b/chrome/browser/google_apis/drive_api_requests_unittest.cc @@ -187,8 +187,8 @@ class DriveApiRequestsTest : public testing::Test { response->set_code(net::HTTP_PRECONDITION_FAILED); std::string content; - if (file_util::ReadFileToString(expected_precondition_failed_file_path_, - &content)) { + if (base::ReadFileToString(expected_precondition_failed_file_path_, + &content)) { response->set_content(content); response->set_content_type("application/json"); } @@ -1588,7 +1588,7 @@ TEST_F(DriveApiRequestsTest, DownloadFileRequest) { } std::string contents; - file_util::ReadFileToString(temp_file, &contents); + base::ReadFileToString(temp_file, &contents); base::DeleteFile(temp_file, false); EXPECT_EQ(HTTP_SUCCESS, result_code); diff --git a/chrome/browser/google_apis/gdata_wapi_requests_unittest.cc b/chrome/browser/google_apis/gdata_wapi_requests_unittest.cc index 609eb05..08ca8e7 100644 --- a/chrome/browser/google_apis/gdata_wapi_requests_unittest.cc +++ b/chrome/browser/google_apis/gdata_wapi_requests_unittest.cc @@ -1580,7 +1580,7 @@ TEST_F(GDataWapiRequestsTest, DownloadFileRequest) { } std::string contents; - file_util::ReadFileToString(temp_file, &contents); + base::ReadFileToString(temp_file, &contents); base::DeleteFile(temp_file, false); EXPECT_EQ(HTTP_SUCCESS, result_code); diff --git a/chrome/browser/google_apis/test_util.cc b/chrome/browser/google_apis/test_util.cc index dd7a3fc..934042e 100644 --- a/chrome/browser/google_apis/test_util.cc +++ b/chrome/browser/google_apis/test_util.cc @@ -93,7 +93,7 @@ scoped_ptr<base::Value> LoadJSONFile(const std::string& relative_path) { scoped_ptr<net::test_server::BasicHttpResponse> CreateHttpResponseFromFile( const base::FilePath& file_path) { std::string content; - if (!file_util::ReadFileToString(file_path, &content)) + if (!base::ReadFileToString(file_path, &content)) return scoped_ptr<net::test_server::BasicHttpResponse>(); std::string content_type = "text/plain"; @@ -130,8 +130,7 @@ bool VerifyJsonData(const base::FilePath& expected_json_file_path, } std::string expected_content; - if (!file_util::ReadFileToString( - expected_json_file_path, &expected_content)) { + if (!base::ReadFileToString(expected_json_file_path, &expected_content)) { LOG(ERROR) << "Failed to read file: " << expected_json_file_path.value(); return false; } diff --git a/chrome/browser/history/expire_history_backend_unittest.cc b/chrome/browser/history/expire_history_backend_unittest.cc index 59852a1..9e1f6867 100644 --- a/chrome/browser/history/expire_history_backend_unittest.cc +++ b/chrome/browser/history/expire_history_backend_unittest.cc @@ -391,7 +391,7 @@ TEST_F(ExpireHistoryTest, DeleteFaviconsIfPossible) { bool ExpireHistoryTest::IsStringInFile(const base::FilePath& filename, const char* str) { std::string contents; - EXPECT_TRUE(file_util::ReadFileToString(filename, &contents)); + EXPECT_TRUE(base::ReadFileToString(filename, &contents)); return contents.find(str) != std::string::npos; } diff --git a/chrome/browser/history/history_unittest_base.cc b/chrome/browser/history/history_unittest_base.cc index 576f5cc..353a432 100644 --- a/chrome/browser/history/history_unittest_base.cc +++ b/chrome/browser/history/history_unittest_base.cc @@ -19,7 +19,7 @@ HistoryUnitTestBase::~HistoryUnitTestBase() { void HistoryUnitTestBase::ExecuteSQLScript(const base::FilePath& sql_path, const base::FilePath& db_path) { std::string sql; - ASSERT_TRUE(file_util::ReadFileToString(sql_path, &sql)); + ASSERT_TRUE(base::ReadFileToString(sql_path, &sql)); // Replace the 'last_visit_time', 'visit_time', 'time_slot' values in this // SQL with the current time. diff --git a/chrome/browser/history/url_index_private_data.cc b/chrome/browser/history/url_index_private_data.cc index 0d94e14..1438524 100644 --- a/chrome/browser/history/url_index_private_data.cc +++ b/chrome/browser/history/url_index_private_data.cc @@ -401,7 +401,7 @@ scoped_refptr<URLIndexPrivateData> URLIndexPrivateData::RestoreFromFile( std::string data; // If there is no cache file then simply give up. This will cause us to // attempt to rebuild from the history database. - if (!file_util::ReadFileToString(file_path, &data)) + if (!base::ReadFileToString(file_path, &data)) return NULL; scoped_refptr<URLIndexPrivateData> restored_data(new URLIndexPrivateData); diff --git a/chrome/browser/icon_loader_linux.cc b/chrome/browser/icon_loader_linux.cc index 4d400a9..2ee16ea 100644 --- a/chrome/browser/icon_loader_linux.cc +++ b/chrome/browser/icon_loader_linux.cc @@ -50,7 +50,7 @@ void IconLoader::ReadIcon() { if (filename.Extension() != ".svg" && filename.Extension() != ".xpm") { string icon_data; - file_util::ReadFileToString(filename, &icon_data); + base::ReadFileToString(filename, &icon_data); SkBitmap bitmap; bool success = gfx::PNGCodec::Decode( diff --git a/chrome/browser/media/webrtc_log_uploader.cc b/chrome/browser/media/webrtc_log_uploader.cc index 268afd6..0ed5f1e 100644 --- a/chrome/browser/media/webrtc_log_uploader.cc +++ b/chrome/browser/media/webrtc_log_uploader.cc @@ -227,7 +227,7 @@ void WebRtcLogUploader::AddUploadedLogInfoToUploadListFile( std::string contents; if (base::PathExists(upload_list_path_)) { - bool read_ok = file_util::ReadFileToString(upload_list_path_, &contents); + bool read_ok = base::ReadFileToString(upload_list_path_, &contents); DPCHECK(read_ok); // Limit the number of log entries to |kLogListLimitLines| - 1, to make room diff --git a/chrome/browser/media/webrtc_log_uploader_unittest.cc b/chrome/browser/media/webrtc_log_uploader_unittest.cc index 2c8ecc0..69d1b7f 100644 --- a/chrome/browser/media/webrtc_log_uploader_unittest.cc +++ b/chrome/browser/media/webrtc_log_uploader_unittest.cc @@ -23,7 +23,7 @@ class WebRtcLogUploaderTest : public testing::Test { bool VerifyNumberOfLinesAndContentsOfLastLine(int expected_lines) { std::string contents; - int read = file_util::ReadFileToString(test_list_path_, &contents); + int read = base::ReadFileToString(test_list_path_, &contents); EXPECT_GT(read, 0); if (read <= 0) return false; diff --git a/chrome/browser/media_galleries/fileapi/itunes_finder_win.cc b/chrome/browser/media_galleries/fileapi/itunes_finder_win.cc index ea02812..8a4d0aa13 100644 --- a/chrome/browser/media_galleries/fileapi/itunes_finder_win.cc +++ b/chrome/browser/media_galleries/fileapi/itunes_finder_win.cc @@ -29,7 +29,7 @@ std::string GetPrefFileData() { base::FilePath pref_file = appdata_dir.AppendASCII("Apple Computer") .AppendASCII("iTunes") .AppendASCII("iTunesPrefs.xml"); - file_util::ReadFileToString(pref_file, &xml_pref_data); + base::ReadFileToString(pref_file, &xml_pref_data); } return xml_pref_data; } 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 91901bf..3a04fcb 100644 --- a/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc +++ b/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc @@ -154,7 +154,7 @@ class MediaFileValidatorTest : public InProcessBrowserTest { const base::FilePath& source, bool expected_result) { std::string content; - ASSERT_TRUE(file_util::ReadFileToString(source, &content)); + ASSERT_TRUE(base::ReadFileToString(source, &content)); SetupOnFileThread(filename, content, expected_result); } diff --git a/chrome/browser/media_galleries/fileapi/safe_picasa_albums_indexer.cc b/chrome/browser/media_galleries/fileapi/safe_picasa_albums_indexer.cc index 57ea926..d2ee13c 100644 --- a/chrome/browser/media_galleries/fileapi/safe_picasa_albums_indexer.cc +++ b/chrome/browser/media_galleries/fileapi/safe_picasa_albums_indexer.cc @@ -67,10 +67,10 @@ void SafePicasaAlbumsIndexer::ProcessFoldersBatch() { folders_inis_.push_back(FolderINIContents()); bool ini_read = - file_util::ReadFileToString( + base::ReadFileToString( folder_path.AppendASCII(kPicasaINIFilename), &folders_inis_.back().ini_contents) || - file_util::ReadFileToString( + base::ReadFileToString( folder_path.AppendASCII(kPicasaINIFilenameLegacy), &folders_inis_.back().ini_contents); 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 5704be1..f57ef18 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 @@ -568,7 +568,7 @@ TEST_F(MTPDeviceDelegateImplMacTest, TestDownload) { DownloadFile(base::FilePath("/ic:id/filename"), temp_dir_.path().Append("target"))); std::string contents; - EXPECT_TRUE(file_util::ReadFileToString(temp_dir_.path().Append("target"), - &contents)); + EXPECT_TRUE(base::ReadFileToString(temp_dir_.path().Append("target"), + &contents)); EXPECT_EQ(kTestFileContents, contents); } diff --git a/chrome/browser/nacl_host/nacl_browser.cc b/chrome/browser/nacl_host/nacl_browser.cc index 0f461b8..7606383 100644 --- a/chrome/browser/nacl_host/nacl_browser.cc +++ b/chrome/browser/nacl_host/nacl_browser.cc @@ -86,7 +86,7 @@ bool CheckEnvVar(const char* name, bool default_value) { } void ReadCache(const base::FilePath& filename, std::string* data) { - if (!file_util::ReadFileToString(filename, data)) { + if (!base::ReadFileToString(filename, data)) { // Zero-size data used as an in-band error code. data->clear(); } diff --git a/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc b/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc index 02b4a8c..01cbb83 100644 --- a/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc +++ b/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc @@ -55,12 +55,12 @@ class NaClGdbTest : public PPAPINaClNewlibTest { RunTestViaHTTP(test_name); env->UnSetVar("MOCK_NACL_GDB"); - EXPECT_TRUE(file_util::ReadFileToString(mock_nacl_gdb_file, &content)); + EXPECT_TRUE(base::ReadFileToString(mock_nacl_gdb_file, &content)); EXPECT_STREQ("PASS", content.c_str()); EXPECT_TRUE(base::DeleteFile(mock_nacl_gdb_file, false)); content.clear(); - EXPECT_TRUE(file_util::ReadFileToString(script_, &content)); + EXPECT_TRUE(base::ReadFileToString(script_, &content)); EXPECT_STREQ("PASS", content.c_str()); EXPECT_TRUE(base::DeleteFile(script_, false)); } diff --git a/chrome/browser/net/crl_set_fetcher.cc b/chrome/browser/net/crl_set_fetcher.cc index 95fbfd3..464d0d1 100644 --- a/chrome/browser/net/crl_set_fetcher.cc +++ b/chrome/browser/net/crl_set_fetcher.cc @@ -74,7 +74,7 @@ void CRLSetFetcher::LoadFromDisk(base::FilePath path, DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); std::string crl_set_bytes; - if (!file_util::ReadFileToString(path, &crl_set_bytes)) + if (!base::ReadFileToString(path, &crl_set_bytes)) return; if (!net::CRLSet::Parse(crl_set_bytes, out_crl_set)) { @@ -153,7 +153,7 @@ bool CRLSetFetcher::Install(const base::DictionaryValue& manifest, return true; std::string crl_set_bytes; - if (!file_util::ReadFileToString(crl_set_file_path, &crl_set_bytes)) { + if (!base::ReadFileToString(crl_set_file_path, &crl_set_bytes)) { LOG(WARNING) << "Failed to find crl-set file inside CRX"; return false; } diff --git a/chrome/browser/net/firefox_proxy_settings.cc b/chrome/browser/net/firefox_proxy_settings.cc index aece777..9df1dda 100644 --- a/chrome/browser/net/firefox_proxy_settings.cc +++ b/chrome/browser/net/firefox_proxy_settings.cc @@ -69,7 +69,7 @@ bool ParsePrefFile(const base::FilePath& pref_file, DictionaryValue* prefs) { // The string that is before a pref key. const std::string kUserPrefString = "user_pref(\""; std::string contents; - if (!file_util::ReadFileToString(pref_file, &contents)) + if (!base::ReadFileToString(pref_file, &contents)) return false; std::vector<std::string> lines; diff --git a/chrome/browser/net/proxy_browsertest.cc b/chrome/browser/net/proxy_browsertest.cc index 1d84336..5897396 100644 --- a/chrome/browser/net/proxy_browsertest.cc +++ b/chrome/browser/net/proxy_browsertest.cc @@ -235,7 +235,7 @@ class DataProxyScriptBrowserTest : public InProcessBrowserTest { virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { std::string contents; // Read in kPACScript contents. - ASSERT_TRUE(file_util::ReadFileToString(ui_test_utils::GetTestFilePath( + ASSERT_TRUE(base::ReadFileToString(ui_test_utils::GetTestFilePath( base::FilePath(base::FilePath::kCurrentDirectory), base::FilePath(kPACScript)), &contents)); diff --git a/chrome/browser/net/sqlite_server_bound_cert_store_unittest.cc b/chrome/browser/net/sqlite_server_bound_cert_store_unittest.cc index 686138a..987a51b 100644 --- a/chrome/browser/net/sqlite_server_bound_cert_store_unittest.cc +++ b/chrome/browser/net/sqlite_server_bound_cert_store_unittest.cc @@ -53,8 +53,8 @@ class SQLiteServerBoundCertStoreTest : public testing::Test { "unittest.originbound.key.der"); base::FilePath cert_path = net::GetTestCertsDirectory().AppendASCII( "unittest.originbound.der"); - ASSERT_TRUE(file_util::ReadFileToString(key_path, key)); - ASSERT_TRUE(file_util::ReadFileToString(cert_path, cert)); + ASSERT_TRUE(base::ReadFileToString(key_path, key)); + ASSERT_TRUE(base::ReadFileToString(cert_path, cert)); } static base::Time GetTestCertExpirationTime() { diff --git a/chrome/browser/net/transport_security_persister.cc b/chrome/browser/net/transport_security_persister.cc index 0b3fbfe..9b803a3 100644 --- a/chrome/browser/net/transport_security_persister.cc +++ b/chrome/browser/net/transport_security_persister.cc @@ -94,7 +94,7 @@ class TransportSecurityPersister::Loader { void Load() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - state_valid_ = file_util::ReadFileToString(path_, &state_); + state_valid_ = base::ReadFileToString(path_, &state_); } void CompleteLoad() { diff --git a/chrome/browser/net/transport_security_persister_unittest.cc b/chrome/browser/net/transport_security_persister_unittest.cc index 2fdd63d..5455598 100644 --- a/chrome/browser/net/transport_security_persister_unittest.cc +++ b/chrome/browser/net/transport_security_persister_unittest.cc @@ -142,7 +142,7 @@ TEST_F(TransportSecurityPersisterTest, SerializeData3) { // Read the data back. std::string persisted; - EXPECT_TRUE(file_util::ReadFileToString(path, &persisted)); + EXPECT_TRUE(base::ReadFileToString(path, &persisted)); EXPECT_EQ(persisted, serialized); bool dirty; EXPECT_TRUE(persister_->LoadEntries(persisted, &dirty)); diff --git a/chrome/browser/page_cycler/page_cycler.cc b/chrome/browser/page_cycler/page_cycler.cc index 51e1eb8..8a0e4d0 100644 --- a/chrome/browser/page_cycler/page_cycler.cc +++ b/chrome/browser/page_cycler/page_cycler.cc @@ -92,7 +92,7 @@ void PageCycler::ReadURLsOnBackgroundThread() { std::vector<std::string> url_strings; CHECK(base::PathExists(urls_file_)) << urls_file_.value(); - file_util::ReadFileToString(urls_file_, &file_contents); + base::ReadFileToString(urls_file_, &file_contents); base::SplitStringAlongWhitespace(file_contents, &url_strings); if (!url_strings.size()) { diff --git a/chrome/browser/page_cycler/page_cycler_browsertest.cc b/chrome/browser/page_cycler/page_cycler_browsertest.cc index b2cbe0e..5e6dbef 100644 --- a/chrome/browser/page_cycler/page_cycler_browsertest.cc +++ b/chrome/browser/page_cycler/page_cycler_browsertest.cc @@ -90,8 +90,7 @@ class PageCyclerBrowserTest : public content::NotificationObserver, // Read the errors file, and generate a vector of error strings. std::vector<std::string> GetErrorsFromFile() { std::string error_file_contents; - CHECK(file_util::ReadFileToString(errors_file_, - &error_file_contents)); + CHECK(base::ReadFileToString(errors_file_, &error_file_contents)); if (error_file_contents[error_file_contents.size() - 1] == '\n') error_file_contents.resize(error_file_contents.size() - 1); diff --git a/chrome/browser/page_cycler/page_cycler_unittest.cc b/chrome/browser/page_cycler/page_cycler_unittest.cc index 2ef95fe..c82a266 100644 --- a/chrome/browser/page_cycler/page_cycler_unittest.cc +++ b/chrome/browser/page_cycler/page_cycler_unittest.cc @@ -257,10 +257,8 @@ TEST_F(PageCyclerTest, FailProvisionalLoads) { std::string errors_output; std::string errors_expected; - ASSERT_TRUE(file_util::ReadFileToString(errors_file(), - &errors_output)); - ASSERT_TRUE(file_util::ReadFileToString(errors_expected_file, - &errors_expected)); + ASSERT_TRUE(base::ReadFileToString(errors_file(), &errors_output)); + ASSERT_TRUE(base::ReadFileToString(errors_expected_file, &errors_expected)); ASSERT_EQ(errors_output, errors_expected); } @@ -320,10 +318,8 @@ TEST_F(PageCyclerTest, KillBrowserAndAbort) { std::string errors_output; std::string errors_expected; - ASSERT_TRUE(file_util::ReadFileToString(errors_file(), - &errors_output)); - ASSERT_TRUE(file_util::ReadFileToString(errors_expected_file, - &errors_expected)); + ASSERT_TRUE(base::ReadFileToString(errors_file(), &errors_output)); + ASSERT_TRUE(base::ReadFileToString(errors_expected_file, &errors_expected)); ASSERT_EQ(errors_output, errors_expected); } diff --git a/chrome/browser/policy/cloud/cloud_policy_browsertest.cc b/chrome/browser/policy/cloud/cloud_policy_browsertest.cc index d129f0a..9fc7f7b 100644 --- a/chrome/browser/policy/cloud/cloud_policy_browsertest.cc +++ b/chrome/browser/policy/cloud/cloud_policy_browsertest.cc @@ -273,8 +273,7 @@ IN_PROC_BROWSER_TEST_F(CloudPolicyTest, FetchPolicyWithRotatedKey) { // Read the initial key. std::string initial_key; - ASSERT_TRUE( - file_util::ReadFileToString(user_policy_key_file_, &initial_key)); + ASSERT_TRUE(base::ReadFileToString(user_policy_key_file_, &initial_key)); PolicyMap empty; EXPECT_TRUE(empty.Equals(policy_service->GetPolicies( @@ -295,8 +294,7 @@ IN_PROC_BROWSER_TEST_F(CloudPolicyTest, FetchPolicyWithRotatedKey) { // Verify that the key was rotated. std::string rotated_key; - ASSERT_TRUE( - file_util::ReadFileToString(user_policy_key_file_, &rotated_key)); + ASSERT_TRUE(base::ReadFileToString(user_policy_key_file_, &rotated_key)); EXPECT_NE(rotated_key, initial_key); // Another refresh using the same key won't rotate it again. @@ -308,8 +306,7 @@ IN_PROC_BROWSER_TEST_F(CloudPolicyTest, FetchPolicyWithRotatedKey) { EXPECT_TRUE(expected.Equals(policy_service->GetPolicies( PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())))); std::string current_key; - ASSERT_TRUE( - file_util::ReadFileToString(user_policy_key_file_, ¤t_key)); + ASSERT_TRUE(base::ReadFileToString(user_policy_key_file_, ¤t_key)); EXPECT_EQ(rotated_key, current_key); } #endif diff --git a/chrome/browser/policy/cloud/resource_cache.cc b/chrome/browser/policy/cloud/resource_cache.cc index edea4af..8cea6ca 100644 --- a/chrome/browser/policy/cloud/resource_cache.cc +++ b/chrome/browser/policy/cloud/resource_cache.cc @@ -94,7 +94,7 @@ bool ResourceCache::Load(const std::string& key, return false; } data->clear(); - return file_util::ReadFileToString(subkey_path, data); + return base::ReadFileToString(subkey_path, data); } void ResourceCache::LoadAllSubkeys( @@ -116,7 +116,7 @@ void ResourceCache::LoadAllSubkeys( // a base64-encoded string. if (!file_util::IsLink(path) && Base64Decode(encoded_subkey, &subkey) && - file_util::ReadFileToString(path, &data)) { + base::ReadFileToString(path, &data)) { (*contents)[subkey].swap(data); } } diff --git a/chrome/browser/policy/cloud/user_cloud_policy_store.cc b/chrome/browser/policy/cloud/user_cloud_policy_store.cc index 3fa53d5..3592b85 100644 --- a/chrome/browser/policy/cloud/user_cloud_policy_store.cc +++ b/chrome/browser/policy/cloud/user_cloud_policy_store.cc @@ -56,7 +56,7 @@ policy::PolicyLoadResult LoadPolicyFromDisk(const base::FilePath& path) { return result; } std::string data; - if (!file_util::ReadFileToString(path, &data) || + if (!base::ReadFileToString(path, &data) || !result.policy.ParseFromArray(data.c_str(), data.size())) { LOG(WARNING) << "Failed to read or parse policy data from " << path.value(); result.status = policy::LOAD_RESULT_LOAD_ERROR; diff --git a/chrome/browser/policy/policy_prefs_browsertest.cc b/chrome/browser/policy/policy_prefs_browsertest.cc index 689b40a..9d9abb4 100644 --- a/chrome/browser/policy/policy_prefs_browsertest.cc +++ b/chrome/browser/policy/policy_prefs_browsertest.cc @@ -197,7 +197,7 @@ class PolicyTestCases { base::FilePath(FILE_PATH_LITERAL("policy")), base::FilePath(FILE_PATH_LITERAL("policy_test_cases.json"))); std::string json; - if (!file_util::ReadFileToString(path, &json)) { + if (!base::ReadFileToString(path, &json)) { ADD_FAILURE(); return; } diff --git a/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc b/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc index cb64038..2248282 100644 --- a/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc +++ b/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc @@ -125,7 +125,7 @@ void CloudPrintProxyService::GetPrintersAvalibleForRegistration( switches::kCloudPrintSetupProxy)); if (!list_path.empty()) { std::string printers_json; - file_util::ReadFileToString(list_path, &printers_json); + base::ReadFileToString(list_path, &printers_json); scoped_ptr<Value> value(base::JSONReader::Read(printers_json)); base::ListValue* list = NULL; if (value && value->GetAsList(&list) && list) { diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc index 49fd150..187dac6 100644 --- a/chrome/browser/printing/print_dialog_cloud.cc +++ b/chrome/browser/printing/print_dialog_cloud.cc @@ -671,7 +671,7 @@ void CreateDialogForFileImpl(content::BrowserContext* browser_context, } else { DLOG(WARNING) << " print data file too large to reserve space"; } - if (file_util::ReadFileToString(path_to_file, &file_data)) { + if (base::ReadFileToString(path_to_file, &file_data)) { data = base::RefCountedString::TakeString(&file_data); } } diff --git a/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc b/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc index d35d820..eab1423 100644 --- a/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc +++ b/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc @@ -54,7 +54,7 @@ class TestData { PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory); base::FilePath test_file = test_data_directory.AppendASCII("printing/cloud_print_uitest.html"); - file_util::ReadFileToString(test_file, &test_data_); + base::ReadFileToString(test_file, &test_data_); } return test_data_.c_str(); } diff --git a/chrome/browser/printing/print_dialog_cloud_unittest.cc b/chrome/browser/printing/print_dialog_cloud_unittest.cc index c08ffa8..09b7b95 100644 --- a/chrome/browser/printing/print_dialog_cloud_unittest.cc +++ b/chrome/browser/printing/print_dialog_cloud_unittest.cc @@ -61,7 +61,7 @@ char* GetTestData() { static std::string sTestFileData; if (sTestFileData.empty()) { base::FilePath test_file = GetTestDataFileName(); - file_util::ReadFileToString(test_file, &sTestFileData); + base::ReadFileToString(test_file, &sTestFileData); } return &sTestFileData[0]; } diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc index 75b6ab2..7837f68 100644 --- a/chrome/browser/profiles/profile_info_cache.cc +++ b/chrome/browser/profiles/profile_info_cache.cc @@ -147,7 +147,7 @@ void ReadBitmap(const base::FilePath& image_path, *out_image = NULL; std::string image_data; - if (!file_util::ReadFileToString(image_path, &image_data)) { + if (!base::ReadFileToString(image_path, &image_data)) { LOG(ERROR) << "Failed to read PNG file from disk."; return; } diff --git a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc index 13e837d..e4802c3 100644 --- a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc +++ b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc @@ -806,7 +806,7 @@ TEST_F(ProfileShortcutManagerTest, UnbadgeProfileIconOnDeletion) { // Default profile has unbadged icon to start. std::string unbadged_icon_1; - EXPECT_TRUE(file_util::ReadFileToString(icon_path_1, &unbadged_icon_1)); + EXPECT_TRUE(base::ReadFileToString(icon_path_1, &unbadged_icon_1)); // Creating a new profile adds a badge to both the new profile icon and the // default profile icon. Since they use the same icon index, the icon files @@ -814,9 +814,9 @@ TEST_F(ProfileShortcutManagerTest, UnbadgeProfileIconOnDeletion) { CreateProfileWithShortcut(FROM_HERE, profile_2_name_, profile_2_path_); std::string badged_icon_1; - EXPECT_TRUE(file_util::ReadFileToString(icon_path_1, &badged_icon_1)); + EXPECT_TRUE(base::ReadFileToString(icon_path_1, &badged_icon_1)); std::string badged_icon_2; - EXPECT_TRUE(file_util::ReadFileToString(icon_path_2, &badged_icon_2)); + EXPECT_TRUE(base::ReadFileToString(icon_path_2, &badged_icon_2)); EXPECT_NE(badged_icon_1, unbadged_icon_1); EXPECT_EQ(badged_icon_1, badged_icon_2); @@ -827,7 +827,7 @@ TEST_F(ProfileShortcutManagerTest, UnbadgeProfileIconOnDeletion) { RunPendingTasks(); std::string unbadged_icon_2; - EXPECT_TRUE(file_util::ReadFileToString(icon_path_2, &unbadged_icon_2)); + EXPECT_TRUE(base::ReadFileToString(icon_path_2, &unbadged_icon_2)); EXPECT_EQ(unbadged_icon_1, unbadged_icon_2); } @@ -841,9 +841,9 @@ TEST_F(ProfileShortcutManagerTest, ProfileIconOnAvatarChange) { profile_info_cache_->GetIndexOfProfileWithPath(profile_1_path_); std::string badged_icon_1; - EXPECT_TRUE(file_util::ReadFileToString(icon_path_1, &badged_icon_1)); + EXPECT_TRUE(base::ReadFileToString(icon_path_1, &badged_icon_1)); std::string badged_icon_2; - EXPECT_TRUE(file_util::ReadFileToString(icon_path_2, &badged_icon_2)); + EXPECT_TRUE(base::ReadFileToString(icon_path_2, &badged_icon_2)); // Profile 1 and 2 are created with the same icon. EXPECT_EQ(badged_icon_1, badged_icon_2); @@ -853,7 +853,7 @@ TEST_F(ProfileShortcutManagerTest, ProfileIconOnAvatarChange) { RunPendingTasks(); std::string new_badged_icon_1; - EXPECT_TRUE(file_util::ReadFileToString(icon_path_1, &new_badged_icon_1)); + EXPECT_TRUE(base::ReadFileToString(icon_path_1, &new_badged_icon_1)); EXPECT_NE(new_badged_icon_1, badged_icon_1); // Ensure the new icon is not the unbadged icon. @@ -861,7 +861,7 @@ TEST_F(ProfileShortcutManagerTest, ProfileIconOnAvatarChange) { RunPendingTasks(); std::string unbadged_icon_1; - EXPECT_TRUE(file_util::ReadFileToString(icon_path_1, &unbadged_icon_1)); + EXPECT_TRUE(base::ReadFileToString(icon_path_1, &unbadged_icon_1)); EXPECT_NE(unbadged_icon_1, new_badged_icon_1); // Ensure the icon doesn't change on avatar change without 2 profiles. @@ -869,6 +869,6 @@ TEST_F(ProfileShortcutManagerTest, ProfileIconOnAvatarChange) { RunPendingTasks(); std::string unbadged_icon_1_a; - EXPECT_TRUE(file_util::ReadFileToString(icon_path_1, &unbadged_icon_1_a)); + EXPECT_TRUE(base::ReadFileToString(icon_path_1, &unbadged_icon_1_a)); EXPECT_EQ(unbadged_icon_1, unbadged_icon_1_a); } diff --git a/chrome/browser/renderer_host/pepper/device_id_fetcher.cc b/chrome/browser/renderer_host/pepper/device_id_fetcher.cc index 39380db..8c7cf5d 100644 --- a/chrome/browser/renderer_host/pepper/device_id_fetcher.cc +++ b/chrome/browser/renderer_host/pepper/device_id_fetcher.cc @@ -168,7 +168,7 @@ void DeviceIDFetcher::ComputeOnBlockingPool(const base::FilePath& profile_path, // should just return that. base::FilePath id_path = GetLegacyDeviceIDPath(profile_path); if (base::PathExists(id_path)) { - if (file_util::ReadFileToString(id_path, &id) && !id.empty()) { + if (base::ReadFileToString(id_path, &id) && !id.empty()) { RunCallbackOnIOThread(id); return; } diff --git a/chrome/browser/safe_browsing/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection_service_unittest.cc index 91cf222..9175ed1 100644 --- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc @@ -118,7 +118,7 @@ ACTION_P(TrustSignature, certificate_file) { // Add a certificate chain. Note that we add the certificate twice so that // it appears as its own issuer. std::string cert_data; - ASSERT_TRUE(file_util::ReadFileToString(certificate_file, &cert_data)); + ASSERT_TRUE(base::ReadFileToString(certificate_file, &cert_data)); ClientDownloadRequest_CertificateChain* chain = arg1->add_certificate_chain(); chain->add_element()->set_certificate(cert_data); @@ -239,8 +239,8 @@ class DownloadProtectionServiceTest : public testing::Test { scoped_refptr<net::X509Certificate> ReadTestCertificate( const std::string& filename) { std::string cert_data; - if (!file_util::ReadFileToString(testdata_path_.AppendASCII(filename), - &cert_data)) { + if (!base::ReadFileToString(testdata_path_.AppendASCII(filename), + &cert_data)) { return NULL; } net::CertificateList certs = diff --git a/chrome/browser/search_engines/template_url_parser_unittest.cc b/chrome/browser/search_engines/template_url_parser_unittest.cc index 3905a3a..b602016 100644 --- a/chrome/browser/search_engines/template_url_parser_unittest.cc +++ b/chrome/browser/search_engines/template_url_parser_unittest.cc @@ -98,7 +98,7 @@ void TemplateURLParserTest::ParseFile( ASSERT_TRUE(base::PathExists(full_path)); std::string contents; - ASSERT_TRUE(file_util::ReadFileToString(full_path, &contents)); + ASSERT_TRUE(base::ReadFileToString(full_path, &contents)); template_url_.reset(TemplateURLParser::Parse(NULL, false, contents.data(), contents.length(), filter)); } diff --git a/chrome/browser/sessions/better_session_restore_browsertest.cc b/chrome/browser/sessions/better_session_restore_browsertest.cc index 999197b..77d4bd8 100644 --- a/chrome/browser/sessions/better_session_restore_browsertest.cc +++ b/chrome/browser/sessions/better_session_restore_browsertest.cc @@ -127,7 +127,7 @@ class BetterSessionRestoreTest : public InProcessBrowserTest { it != test_files.end(); ++it) { base::FilePath path = test_file_dir.AppendASCII(*it); std::string contents; - CHECK(file_util::ReadFileToString(path, &contents)); + CHECK(base::ReadFileToString(path, &contents)); g_file_contents.Get()["/" + test_path_ + *it] = contents; net::URLRequestFilter::GetInstance()->AddUrlHandler( GURL(fake_server_address_ + test_path_ + *it), diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc index b19fd2e..8fc4cd6 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc @@ -623,7 +623,7 @@ bool GetExistingShortcutContents(base::Environment* env, VLOG(1) << "Looking for desktop file in " << path.value(); if (base::PathExists(path)) { VLOG(1) << "Found desktop file at " << path.value(); - return file_util::ReadFileToString(path, output); + return base::ReadFileToString(path, output); } } diff --git a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc index 4872b4e..29f89fc 100644 --- a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc +++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc @@ -60,7 +60,7 @@ ChecksumStatus LoadFile(const base::FilePath& file_path, WordList& words) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); words.clear(); std::string contents; - file_util::ReadFileToString(file_path, &contents); + base::ReadFileToString(file_path, &contents); size_t pos = contents.rfind(CHECKSUM_PREFIX); if (pos != std::string::npos) { std::string checksum = contents.substr(pos + strlen(CHECKSUM_PREFIX)); diff --git a/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc b/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc index 72c73d6..8fc8849 100644 --- a/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc +++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc @@ -305,7 +305,7 @@ TEST_F(SpellcheckCustomDictionaryTest, CorruptedWriteShouldBeRecovered) { change.AddWord("baz"); UpdateDictionaryFile(change, path); content.clear(); - file_util::ReadFileToString(path, &content); + base::ReadFileToString(path, &content); content.append("corruption"); file_util::WriteFile(path, content.c_str(), content.length()); loaded_custom_words = LoadDictionaryFile(path); diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc index c8226f3..9c5baca 100644 --- a/chrome/browser/ssl/ssl_browser_tests.cc +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -669,7 +669,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestWSSClientCert) { std::string pkcs12_data; base::FilePath cert_path = net::GetTestCertsDirectory().Append( FILE_PATH_LITERAL("websocket_client_cert.p12")); - EXPECT_TRUE(file_util::ReadFileToString(cert_path, &pkcs12_data)); + EXPECT_TRUE(base::ReadFileToString(cert_path, &pkcs12_data)); EXPECT_EQ(net::OK, cert_db->ImportFromPKCS12( crypt_module.get(), pkcs12_data, string16(), true, NULL)); diff --git a/chrome/browser/sxs_linux.cc b/chrome/browser/sxs_linux.cc index daf6f93..4b34260 100644 --- a/chrome/browser/sxs_linux.cc +++ b/chrome/browser/sxs_linux.cc @@ -58,7 +58,7 @@ bool DoAddChannelMarkToUserDataDir(const base::FilePath& user_data_dir) { // and legitimate that it doesn't exist, e.g. for new profile or for profile // existing before channel marks have been introduced. std::string channels_contents; - if (file_util::ReadFileToString(channels_path, &channels_contents)) + if (base::ReadFileToString(channels_path, &channels_contents)) base::SplitString(channels_contents, '\n', &user_data_dir_channels); if (std::find(user_data_dir_channels.begin(), diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc index b2d1a53..730002f 100644 --- a/chrome/browser/sync/profile_sync_service_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_unittest.cc @@ -456,7 +456,7 @@ TEST_F(ProfileSyncServiceTest, TestStartupWithOldSyncData) { // This will still exist, but the text should have changed. ASSERT_TRUE(base::PathExists(sync_file2)); std::string file2text; - ASSERT_TRUE(file_util::ReadFileToString(sync_file2, &file2text)); + ASSERT_TRUE(base::ReadFileToString(sync_file2, &file2text)); ASSERT_NE(file2text.compare(nonsense2), 0); } diff --git a/chrome/browser/sync/test/integration/bookmarks_helper.cc b/chrome/browser/sync/test/integration/bookmarks_helper.cc index d97f7b2..85e72c1 100644 --- a/chrome/browser/sync/test/integration/bookmarks_helper.cc +++ b/chrome/browser/sync/test/integration/bookmarks_helper.cc @@ -737,7 +737,7 @@ gfx::Image Create1xFaviconFromPNGFile(const std::string& path) { full_path = full_path.AppendASCII("sync").AppendASCII(path); std::string contents; - file_util::ReadFileToString(full_path, &contents); + base::ReadFileToString(full_path, &contents); return gfx::Image::CreateFrom1xPNGBytes( reinterpret_cast<const unsigned char*>(contents.data()), contents.size()); } diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc index ca447bc..a558afe 100644 --- a/chrome/browser/sync/test/integration/sync_test.cc +++ b/chrome/browser/sync/test/integration/sync_test.cc @@ -407,7 +407,7 @@ void SyncTest::ReadPasswordFile() { LOG(FATAL) << "Can't run live server test without specifying --" << switches::kPasswordFileForTest << "=<filename>"; std::string file_contents; - file_util::ReadFileToString(password_file_, &file_contents); + base::ReadFileToString(password_file_, &file_contents); ASSERT_NE(file_contents, "") << "Password file \"" << password_file_.value() << "\" does not exist."; std::vector<std::string> tokens; diff --git a/chrome/browser/sync_file_system/drive_backend/drive_file_sync_service_fake_unittest.cc b/chrome/browser/sync_file_system/drive_backend/drive_file_sync_service_fake_unittest.cc index b31f9dd1..f5c267b 100644 --- a/chrome/browser/sync_file_system/drive_backend/drive_file_sync_service_fake_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/drive_file_sync_service_fake_unittest.cc @@ -813,8 +813,7 @@ void DriveFileSyncServiceFakeTest::TestGetRemoteVersions() { ASSERT_EQ(SYNC_STATUS_OK, status); std::string downloaded_content; - EXPECT_TRUE(file_util::ReadFileToString(downloaded.path(), - &downloaded_content)); + EXPECT_TRUE(base::ReadFileToString(downloaded.path(), &downloaded_content)); EXPECT_EQ(content, downloaded_content); } 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 8e9ff62..82ae201 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 @@ -257,7 +257,7 @@ GDataErrorCode FakeDriveServiceHelper::ReadFile( if (error != google_apis::HTTP_SUCCESS) return error; - return file_util::ReadFileToString(temp_file, file_content) + return base::ReadFileToString(temp_file, file_content) ? google_apis::HTTP_SUCCESS : google_apis::GDATA_FILE_ERROR; } diff --git a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc index c038156..3a2d71d8 100644 --- a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc +++ b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc @@ -107,7 +107,7 @@ void OnCreateSnapshotFileAndVerifyData( } EXPECT_EQ(expected_data.size(), static_cast<size_t>(file_info.size)); std::string data; - const bool read_status = file_util::ReadFileToString(platform_path, &data); + const bool read_status = base::ReadFileToString(platform_path, &data); EXPECT_TRUE(read_status); EXPECT_EQ(expected_data, data); callback.Run(result); diff --git a/chrome/browser/ui/browser_focus_uitest.cc b/chrome/browser/ui/browser_focus_uitest.cc index 93790d3..fc03e9e 100644 --- a/chrome/browser/ui/browser_focus_uitest.cc +++ b/chrome/browser/ui/browser_focus_uitest.cc @@ -172,7 +172,7 @@ class TestInterstitialPage : public content::InterstitialPageDelegate { EXPECT_TRUE(r); file_path = file_path.AppendASCII("focus"); file_path = file_path.AppendASCII(kTypicalPageName); - r = file_util::ReadFileToString(file_path, &html_contents_); + r = base::ReadFileToString(file_path, &html_contents_); EXPECT_TRUE(r); interstitial_page_ = InterstitialPage::Create( tab, new_navigation, url , this); diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.mm b/chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.mm index 2f93349..0546625 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.mm @@ -58,7 +58,7 @@ gfx::Image LoadInstallPromptIcon() { .AppendASCII("icon.png"); std::string file_contents; - file_util::ReadFileToString(path, &file_contents); + base::ReadFileToString(path, &file_contents); return gfx::Image::CreateFrom1xPNGBytes( reinterpret_cast<const unsigned char*>(file_contents.c_str()), diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm index 8b87ef3..89bc47c 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm @@ -67,7 +67,7 @@ class ExtensionInstalledBubbleControllerTest : public CocoaProfileTest { path = path.AppendASCII("extensions").AppendASCII("icon1.png"); std::string file_contents; - file_util::ReadFileToString(path, &file_contents); + base::ReadFileToString(path, &file_contents); const unsigned char* data = reinterpret_cast<const unsigned char*>(file_contents.data()); diff --git a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc index c4030c8..5ea3c32 100644 --- a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc +++ b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc @@ -404,7 +404,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindLongString) { base::FilePath().AppendASCII("find_in_page"), base::FilePath().AppendASCII("LongFind.txt")); std::string query; - file_util::ReadFileToString(path, &query); + base::ReadFileToString(path, &query); std::wstring search_string = UTF8ToWide(query); EXPECT_EQ(1, FindInPageWchar(web_contents, search_string.c_str(), @@ -467,7 +467,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindWholeFileContent) { ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(path)); std::string query; - file_util::ReadFileToString(path, &query); + base::ReadFileToString(path, &query); std::wstring search_string = UTF8ToWide(query); EXPECT_EQ(1, FindInPageWchar(web_contents, search_string.c_str(), diff --git a/chrome/browser/ui/webui/about_ui.cc b/chrome/browser/ui/webui/about_ui.cc index febc1f1..cd9f7cf0 100644 --- a/chrome/browser/ui/webui/about_ui.cc +++ b/chrome/browser/ui/webui/about_ui.cc @@ -280,7 +280,7 @@ class ChromeOSTermsHandler base::FilePath oem_eula_file_path; if (net::FileURLToFilePath(GURL(customization->GetEULAPage(locale_)), &oem_eula_file_path)) { - if (!file_util::ReadFileToString(oem_eula_file_path, &contents_)) { + if (!base::ReadFileToString(oem_eula_file_path, &contents_)) { contents_.clear(); } } @@ -293,11 +293,10 @@ class ChromeOSTermsHandler void LoadEulaFileOnFileThread() { std::string file_path = base::StringPrintf(chrome::kEULAPathFormat, locale_.c_str()); - if (!file_util::ReadFileToString(base::FilePath(file_path), &contents_)) { + if (!base::ReadFileToString(base::FilePath(file_path), &contents_)) { // No EULA for given language - try en-US as default. file_path = base::StringPrintf(chrome::kEULAPathFormat, "en-US"); - if (!file_util::ReadFileToString(base::FilePath(file_path), - &contents_)) { + if (!base::ReadFileToString(base::FilePath(file_path), &contents_)) { // File with EULA not found, ResponseOnUIThread will load EULA from // resources if contents_ is empty. contents_.clear(); diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc index d102d65..8bb3373 100644 --- a/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc +++ b/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc @@ -359,7 +359,7 @@ void NetInternalsTest::MessageHandler::GetNetLogLoggerLog( net_log_logger.reset(); std::string log_contents; - ASSERT_TRUE(file_util::ReadFileToString(temp_file, &log_contents)); + ASSERT_TRUE(base::ReadFileToString(temp_file, &log_contents)); ASSERT_GT(log_contents.length(), 0u); scoped_ptr<Value> log_contents_value(new base::StringValue(log_contents)); diff --git a/chrome/browser/ui/webui/options/certificate_manager_handler.cc b/chrome/browser/ui/webui/options/certificate_manager_handler.cc index b34ff7a..8899045 100644 --- a/chrome/browser/ui/webui/options/certificate_manager_handler.cc +++ b/chrome/browser/ui/webui/options/certificate_manager_handler.cc @@ -272,7 +272,7 @@ CancelableTaskTracker::TaskId FileAccessProvider::StartWrite( void FileAccessProvider::DoRead(const base::FilePath& path, int* saved_errno, std::string* data) { - bool success = file_util::ReadFileToString(path, data); + bool success = base::ReadFileToString(path, data); *saved_errno = success ? 0 : errno; } diff --git a/chrome/browser/ui/webui/profiler_ui.cc b/chrome/browser/ui/webui/profiler_ui.cc index c3d26b4..494f628 100644 --- a/chrome/browser/ui/webui/profiler_ui.cc +++ b/chrome/browser/ui/webui/profiler_ui.cc @@ -84,7 +84,7 @@ class ProfilerWebUIDataSource : public content::URLDataSource { // Read the file synchronously and send it as the response. base::ThreadRestrictions::ScopedAllowIO allow; std::string file_contents; - if (!file_util::ReadFileToString(file_path, &file_contents)) + if (!base::ReadFileToString(file_path, &file_contents)) LOG(ERROR) << "Couldn't read file: " << file_path.value(); scoped_refptr<base::RefCountedString> response = new base::RefCountedString(); diff --git a/chrome/browser/upload_list.cc b/chrome/browser/upload_list.cc index 3f618aa..3fe0744 100644 --- a/chrome/browser/upload_list.cc +++ b/chrome/browser/upload_list.cc @@ -51,7 +51,7 @@ void UploadList::LoadUploadListAndInformDelegateOfCompletion() { void UploadList::LoadUploadList() { if (base::PathExists(upload_log_path_)) { std::string contents; - file_util::ReadFileToString(upload_log_path_, &contents); + base::ReadFileToString(upload_log_path_, &contents); std::vector<std::string> log_entries; base::SplitStringAlongWhitespace(contents, &log_entries); ParseLogEntries(log_entries); diff --git a/chrome/browser/user_style_sheet_watcher.cc b/chrome/browser/user_style_sheet_watcher.cc index a8774b5..1922445 100644 --- a/chrome/browser/user_style_sheet_watcher.cc +++ b/chrome/browser/user_style_sheet_watcher.cc @@ -122,7 +122,7 @@ void UserStyleSheetLoader::LoadStyleSheet( file_util::WriteFile(style_sheet_file, "", 0); std::string css; - bool rv = file_util::ReadFileToString(style_sheet_file, &css); + bool rv = base::ReadFileToString(style_sheet_file, &css); GURL style_sheet_url; if (rv && !css.empty()) { std::string css_base64; diff --git a/chrome/common/auto_start_linux.cc b/chrome/common/auto_start_linux.cc index 7d6c660..9051149 100644 --- a/chrome/common/auto_start_linux.cc +++ b/chrome/common/auto_start_linux.cc @@ -70,7 +70,7 @@ bool AutoStart::GetAutostartFileContents( base::FilePath autostart_directory = GetAutostartDirectory(environment.get()); base::FilePath autostart_file = autostart_directory.Append(autostart_filename); - return file_util::ReadFileToString(autostart_file, contents); + return base::ReadFileToString(autostart_file, contents); } bool AutoStart::GetAutostartFileValue(const std::string& autostart_filename, diff --git a/chrome/common/extensions/api/extension_api_unittest.cc b/chrome/common/extensions/api/extension_api_unittest.cc index 4feb34f..8fc92c8 100644 --- a/chrome/common/extensions/api/extension_api_unittest.cc +++ b/chrome/common/extensions/api/extension_api_unittest.cc @@ -132,7 +132,7 @@ TEST(ExtensionAPITest, IsPrivilegedFeatures) { .AppendASCII("privileged_api_features.json"); std::string api_features_str; - ASSERT_TRUE(file_util::ReadFileToString( + ASSERT_TRUE(base::ReadFileToString( api_features_path, &api_features_str)) << "privileged_api_features.json"; scoped_ptr<base::DictionaryValue> value(static_cast<base::DictionaryValue*>( @@ -228,7 +228,7 @@ TEST(ExtensionAPITest, APIFeatures) { .AppendASCII("api_features.json"); std::string api_features_str; - ASSERT_TRUE(file_util::ReadFileToString( + ASSERT_TRUE(base::ReadFileToString( api_features_path, &api_features_str)) << "api_features.json"; scoped_ptr<base::DictionaryValue> value(static_cast<base::DictionaryValue*>( @@ -300,7 +300,7 @@ TEST(ExtensionAPITest, IsAnyFeatureAvailableToContext) { .AppendASCII("api_features.json"); std::string api_features_str; - ASSERT_TRUE(file_util::ReadFileToString( + ASSERT_TRUE(base::ReadFileToString( api_features_path, &api_features_str)) << "api_features.json"; scoped_ptr<base::DictionaryValue> value(static_cast<base::DictionaryValue*>( @@ -774,7 +774,7 @@ TEST(ExtensionAPITest, TypesHaveNamespace) { .AppendASCII("types_have_namespace.json"); std::string manifest_str; - ASSERT_TRUE(file_util::ReadFileToString(manifest_path, &manifest_str)) + ASSERT_TRUE(base::ReadFileToString(manifest_path, &manifest_str)) << "Failed to load: " << manifest_path.value(); ExtensionAPI api; diff --git a/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc b/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc index 6e49241..28c8557 100644 --- a/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc +++ b/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc @@ -52,7 +52,7 @@ scoped_ptr<policy::PolicySchema> StorageSchemaManifestHandler::GetSchema( return scoped_ptr<policy::PolicySchema>(); } std::string content; - if (!file_util::ReadFileToString(file, &content)) { + if (!base::ReadFileToString(file, &content)) { *error = base::StringPrintf("Can't read %s", file.value().c_str()); return scoped_ptr<policy::PolicySchema>(); } diff --git a/chrome/common/extensions/extension_file_util.cc b/chrome/common/extensions/extension_file_util.cc index 82bf462..08a98c7 100644 --- a/chrome/common/extensions/extension_file_util.cc +++ b/chrome/common/extensions/extension_file_util.cc @@ -211,7 +211,7 @@ std::vector<base::FilePath> FindPrivateKeyFiles( continue; std::string key_contents; - if (!file_util::ReadFileToString(current, &key_contents)) { + if (!base::ReadFileToString(current, &key_contents)) { // If we can't read the file, assume it's not a private key. continue; } diff --git a/chrome/common/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc index f00cd3c..7f28990 100644 --- a/chrome/common/extensions/extension_unittest.cc +++ b/chrome/common/extensions/extension_unittest.cc @@ -137,7 +137,7 @@ TEST(ExtensionTest, MimeTypeSniffing) { path = path.AppendASCII("extensions").AppendASCII("good.crx"); std::string data; - ASSERT_TRUE(file_util::ReadFileToString(path, &data)); + ASSERT_TRUE(base::ReadFileToString(path, &data)); std::string result; EXPECT_TRUE(net::SniffMimeType(data.c_str(), @@ -150,7 +150,7 @@ TEST(ExtensionTest, MimeTypeSniffing) { data.clear(); result.clear(); path = path.DirName().AppendASCII("bad_magic.crx"); - ASSERT_TRUE(file_util::ReadFileToString(path, &data)); + ASSERT_TRUE(base::ReadFileToString(path, &data)); EXPECT_TRUE(net::SniffMimeType(data.c_str(), data.size(), GURL("http://www.example.com/foo.crx"), diff --git a/chrome/common/extensions/manifest_handlers/content_scripts_handler.cc b/chrome/common/extensions/manifest_handlers/content_scripts_handler.cc index 7f3377d..a0ce28e 100644 --- a/chrome/common/extensions/manifest_handlers/content_scripts_handler.cc +++ b/chrome/common/extensions/manifest_handlers/content_scripts_handler.cc @@ -297,7 +297,7 @@ static bool IsScriptValid(const base::FilePath& path, std::string* error) { std::string content; if (!base::PathExists(path) || - !file_util::ReadFileToString(path, &content)) { + !base::ReadFileToString(path, &content)) { *error = l10n_util::GetStringFUTF8( message_id, relative_path.LossyDisplayName()); diff --git a/chrome/common/importer/firefox_importer_utils.cc b/chrome/common/importer/firefox_importer_utils.cc index 44d7dbc..183df76 100644 --- a/chrome/common/importer/firefox_importer_utils.cc +++ b/chrome/common/importer/firefox_importer_utils.cc @@ -59,7 +59,7 @@ bool IsDefaultProfile(const DictionaryValue& root, base::FilePath GetFirefoxProfilePath() { base::FilePath ini_file = GetProfilesINI(); std::string content; - file_util::ReadFileToString(ini_file, &content); + base::ReadFileToString(ini_file, &content); base::DictionaryValueINIParser ini_parser; ini_parser.Parse(content); return GetFirefoxProfilePathFromDictionary(ini_parser.root()); @@ -100,7 +100,7 @@ bool GetFirefoxVersionAndPathFromProfile(const base::FilePath& profile_path, base::FilePath compatibility_file = profile_path.AppendASCII("compatibility.ini"); std::string content; - file_util::ReadFileToString(compatibility_file, &content); + base::ReadFileToString(compatibility_file, &content); ReplaceSubstringsAfterOffset(&content, 0, "\r\n", "\n"); std::vector<std::string> lines; base::SplitString(content, '\n', &lines); @@ -132,7 +132,7 @@ bool ReadPrefFile(const base::FilePath& path, std::string* content) { if (content == NULL) return false; - file_util::ReadFileToString(path, content); + base::ReadFileToString(path, content); if (content->empty()) { LOG(WARNING) << "Firefox preference file " << path.value() << " is empty."; @@ -259,7 +259,7 @@ string16 GetFirefoxImporterName(const base::FilePath& app_path) { std::string branding_name; if (base::PathExists(app_ini_file)) { std::string content; - file_util::ReadFileToString(app_ini_file, &content); + base::ReadFileToString(app_ini_file, &content); std::vector<std::string> lines; base::SplitString(content, '\n', &lines); const std::string name_attr("Name="); diff --git a/chrome/installer/setup/install_unittest.cc b/chrome/installer/setup/install_unittest.cc index 40f6ab1..5f90105 100644 --- a/chrome/installer/setup/install_unittest.cc +++ b/chrome/installer/setup/install_unittest.cc @@ -235,7 +235,7 @@ TEST_F(CreateVisualElementsManifestTest, VisualElementsManifestCreated) { ASSERT_TRUE(base::PathExists(manifest_path_)); std::string read_manifest; - ASSERT_TRUE(file_util::ReadFileToString(manifest_path_, &read_manifest)); + ASSERT_TRUE(base::ReadFileToString(manifest_path_, &read_manifest)); static const char kExpectedManifest[] = "<Application>\r\n" diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc index d345e95..0895c83 100644 --- a/chrome/installer/util/master_preferences.cc +++ b/chrome/installer/util/master_preferences.cc @@ -102,7 +102,7 @@ MasterPreferences::MasterPreferences(const base::FilePath& prefs_path) // and the remainder of this MasterPreferences object should still be // initialized as best as possible. if (base::PathExists(prefs_path) && - !file_util::ReadFileToString(prefs_path, &json_data)) { + !base::ReadFileToString(prefs_path, &json_data)) { LOG(ERROR) << "Failed to read preferences from " << prefs_path.value(); } if (InitializeFromString(json_data)) diff --git a/chrome/service/cloud_print/print_system_win.cc b/chrome/service/cloud_print/print_system_win.cc index 559a61b..e70e398b 100644 --- a/chrome/service/cloud_print/print_system_win.cc +++ b/chrome/service/cloud_print/print_system_win.cc @@ -640,7 +640,7 @@ class PrintSystemWin : public PrintSystem { return false; std::string document_data; - file_util::ReadFileToString(print_data_file_path, &document_data); + base::ReadFileToString(print_data_file_path, &document_data); ULONG doc_bytes_written = 0; if (FAILED(doc_stream->Write(document_data.c_str(), document_data.length(), diff --git a/chrome/test/base/module_system_test.cc b/chrome/test/base/module_system_test.cc index 8878a9c..d9629a7 100644 --- a/chrome/test/base/module_system_test.cc +++ b/chrome/test/base/module_system_test.cc @@ -172,7 +172,7 @@ void ModuleSystemTest::RegisterTestFile(const std::string& module_name, test_js_file_path = test_js_file_path.AppendASCII("extensions") .AppendASCII(file_name); std::string test_js; - ASSERT_TRUE(file_util::ReadFileToString(test_js_file_path, &test_js)); + ASSERT_TRUE(base::ReadFileToString(test_js_file_path, &test_js)); source_map_->RegisterModule(module_name, test_js); } diff --git a/chrome/test/base/v8_unit_test.cc b/chrome/test/base/v8_unit_test.cc index b60502cc..d2aea99 100644 --- a/chrome/test/base/v8_unit_test.cc +++ b/chrome/test/base/v8_unit_test.cc @@ -71,7 +71,7 @@ bool V8UnitTest::ExecuteJavascriptLibraries() { test_data_directory.Append(*user_libraries_iterator); } library_file = base::MakeAbsoluteFilePath(library_file); - if (!file_util::ReadFileToString(library_file, &library_content)) { + if (!base::ReadFileToString(library_file, &library_content)) { ADD_FAILURE() << library_file.value(); return false; } diff --git a/chrome/test/base/web_ui_browsertest.cc b/chrome/test/base/web_ui_browsertest.cc index add13a7..a32720c 100644 --- a/chrome/test/base/web_ui_browsertest.cc +++ b/chrome/test/base/web_ui_browsertest.cc @@ -457,15 +457,15 @@ void WebUIBrowserTest::BuildJavascriptLibraries(string16* content) { ++user_libraries_iterator) { std::string library_content; if (user_libraries_iterator->IsAbsolute()) { - ASSERT_TRUE(file_util::ReadFileToString(*user_libraries_iterator, + ASSERT_TRUE(base::ReadFileToString(*user_libraries_iterator, &library_content)) << user_libraries_iterator->value(); } else { - bool ok = file_util::ReadFileToString( + bool ok = base::ReadFileToString( gen_test_data_directory_.Append(*user_libraries_iterator), &library_content); if (!ok) { - ok = file_util::ReadFileToString( + ok = base::ReadFileToString( test_data_directory_.Append(*user_libraries_iterator), &library_content); } diff --git a/chrome/test/chromedriver/chrome_launcher.cc b/chrome/test/chromedriver/chrome_launcher.cc index 74f86c2..a2e543a 100644 --- a/chrome/test/chromedriver/chrome_launcher.cc +++ b/chrome/test/chromedriver/chrome_launcher.cc @@ -459,7 +459,7 @@ Status ProcessExtension(const std::string& extension, // Parse the manifest and set the 'key' if not already present. base::FilePath manifest_path(extension_dir.AppendASCII("manifest.json")); std::string manifest_data; - if (!file_util::ReadFileToString(manifest_path, &manifest_data)) + if (!base::ReadFileToString(manifest_path, &manifest_data)) return Status(kUnknownError, "cannot read manifest"); scoped_ptr<base::Value> manifest_value(base::JSONReader::Read(manifest_data)); base::DictionaryValue* manifest; diff --git a/chrome/test/chromedriver/chrome_launcher_unittest.cc b/chrome/test/chromedriver/chrome_launcher_unittest.cc index ad6a3ff..ff4ce71 100644 --- a/chrome/test/chromedriver/chrome_launcher_unittest.cc +++ b/chrome/test/chromedriver/chrome_launcher_unittest.cc @@ -36,7 +36,7 @@ bool AddExtensionForInstall(const std::string& relative_path, base::FilePath crx_file_path = source_root.AppendASCII( "chrome/test/data/chromedriver/" + relative_path); std::string crx_contents; - if (!file_util::ReadFileToString(crx_file_path, &crx_contents)) + if (!base::ReadFileToString(crx_file_path, &crx_contents)) return false; std::string crx_encoded; @@ -62,7 +62,7 @@ TEST(ProcessExtensions, SingleExtensionWithBgPage) { base::FilePath temp_ext_path(switches.GetSwitchValueNative("load-extension")); ASSERT_TRUE(base::PathExists(temp_ext_path)); std::string manifest_txt; - ASSERT_TRUE(file_util::ReadFileToString( + ASSERT_TRUE(base::ReadFileToString( temp_ext_path.AppendASCII("manifest.json"), &manifest_txt)); scoped_ptr<base::Value> manifest(base::JSONReader::Read(manifest_txt)); ASSERT_TRUE(manifest); @@ -153,7 +153,7 @@ TEST(PrepareUserDataDir, CustomPrefs) { base::FilePath prefs_file = temp_dir.path().AppendASCII("Default").AppendASCII("Preferences"); std::string prefs_str; - ASSERT_TRUE(file_util::ReadFileToString(prefs_file, &prefs_str)); + ASSERT_TRUE(base::ReadFileToString(prefs_file, &prefs_str)); scoped_ptr<base::Value> prefs_value(base::JSONReader::Read(prefs_str)); const base::DictionaryValue* prefs_dict = NULL; ASSERT_TRUE(prefs_value->GetAsDictionary(&prefs_dict)); @@ -162,7 +162,7 @@ TEST(PrepareUserDataDir, CustomPrefs) { base::FilePath local_state_file = temp_dir.path().AppendASCII("Local State"); std::string local_state_str; - ASSERT_TRUE(file_util::ReadFileToString(local_state_file, &local_state_str)); + ASSERT_TRUE(base::ReadFileToString(local_state_file, &local_state_str)); scoped_ptr<base::Value> local_state_value( base::JSONReader::Read(local_state_str)); const base::DictionaryValue* local_state_dict = NULL; diff --git a/chrome/test/chromedriver/session_commands_unittest.cc b/chrome/test/chromedriver/session_commands_unittest.cc index 1b6ef7b..e1a2a36 100644 --- a/chrome/test/chromedriver/session_commands_unittest.cc +++ b/chrome/test/chromedriver/session_commands_unittest.cc @@ -38,7 +38,7 @@ TEST(SessionCommandTest, FileUpload) { ASSERT_TRUE(value->GetAsString(&path)); ASSERT_TRUE(base::PathExists(base::FilePath(path))); std::string data; - ASSERT_TRUE(file_util::ReadFileToString(base::FilePath(path), &data)); + ASSERT_TRUE(base::ReadFileToString(base::FilePath(path), &data)); ASSERT_STREQ("COW\n", data.c_str()); } diff --git a/chrome/test/chromedriver/util_unittest.cc b/chrome/test/chromedriver/util_unittest.cc index a710fb5..85e469e 100644 --- a/chrome/test/chromedriver/util_unittest.cc +++ b/chrome/test/chromedriver/util_unittest.cc @@ -26,7 +26,7 @@ TEST(UnzipSoleFile, Entry) { Status status = UnzipSoleFile(temp_dir.path(), data, &file); ASSERT_EQ(kOk, status.code()) << status.message(); std::string contents; - ASSERT_TRUE(file_util::ReadFileToString(file, &contents)); + ASSERT_TRUE(base::ReadFileToString(file, &contents)); ASSERT_STREQ("COW\n", contents.c_str()); } @@ -45,6 +45,6 @@ TEST(UnzipSoleFile, Archive) { Status status = UnzipSoleFile(temp_dir.path(), data, &file); ASSERT_EQ(kOk, status.code()) << status.message(); std::string contents; - ASSERT_TRUE(file_util::ReadFileToString(file, &contents)); + ASSERT_TRUE(base::ReadFileToString(file, &contents)); ASSERT_STREQ("COW\n", contents.c_str()); } diff --git a/chrome/test/perf/dom_checker_uitest.cc b/chrome/test/perf/dom_checker_uitest.cc index 7e92b98..b1682d9 100644 --- a/chrome/test/perf/dom_checker_uitest.cc +++ b/chrome/test/perf/dom_checker_uitest.cc @@ -113,7 +113,7 @@ class DomCheckerTest : public UITest { std::string* results) { base::FilePath results_path = GetDomCheckerDir(); results_path = results_path.AppendASCII(failures_file); - return file_util::ReadFileToString(results_path, results); + return base::ReadFileToString(results_path, results); } void ParseExpectedFailures(const std::string& input, ResultsSet* output) { diff --git a/chrome/test/perf/rendering/throughput_tests.cc b/chrome/test/perf/rendering/throughput_tests.cc index b2fc892..1b510e3 100644 --- a/chrome/test/perf/rendering/throughput_tests.cc +++ b/chrome/test/perf/rendering/throughput_tests.cc @@ -158,7 +158,7 @@ class ThroughputTest : public BrowserPerfTest { flags.substr(num_pos, flags.size() - num_pos), &index)); base::FilePath filepath(flags.substr(0, colon_pos)); std::string json; - ASSERT_TRUE(file_util::ReadFileToString(filepath, &json)); + ASSERT_TRUE(base::ReadFileToString(filepath, &json)); ASSERT_TRUE(ParseFlagsFromJSON(filepath.DirName(), json, index)); } else { gurl_ = GURL(flags); diff --git a/chrome/test/perf/startup_test.cc b/chrome/test/perf/startup_test.cc index 6b3e62f..09d0eb9 100644 --- a/chrome/test/perf/startup_test.cc +++ b/chrome/test/perf/startup_test.cc @@ -117,7 +117,7 @@ class StartupTest : public UIPerfTest { // Read in preferences template. std::string pref_string; - EXPECT_TRUE(file_util::ReadFileToString(pref_template_path, &pref_string)); + EXPECT_TRUE(base::ReadFileToString(pref_template_path, &pref_string)); string16 format_string = ASCIIToUTF16(pref_string); // Make sure temp directory has the proper format for writing to prefs file. diff --git a/chrome/test/perf/tab_switching_test.cc b/chrome/test/perf/tab_switching_test.cc index 8ddfb21..55a4d08 100644 --- a/chrome/test/perf/tab_switching_test.cc +++ b/chrome/test/perf/tab_switching_test.cc @@ -113,8 +113,7 @@ class TabSwitchingUITest : public UIPerfTest { std::string contents; int max_tries = 20; do { - log_has_been_dumped = file_util::ReadFileToString(log_file_name_, - &contents); + log_has_been_dumped = base::ReadFileToString(log_file_name_, &contents); if (!log_has_been_dumped) base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); } while (!log_has_been_dumped && max_tries--); diff --git a/chrome/test/reliability/automated_ui_tests.cc b/chrome/test/reliability/automated_ui_tests.cc index 2f43c29..e59f436 100644 --- a/chrome/test/reliability/automated_ui_tests.cc +++ b/chrome/test/reliability/automated_ui_tests.cc @@ -627,7 +627,7 @@ bool AutomatedUITest::ForceCrash() { bool AutomatedUITest::InitXMLReader() { base::FilePath input_path = GetInputFilePath(); - if (!file_util::ReadFileToString(input_path, &xml_init_file_)) + if (!base::ReadFileToString(input_path, &xml_init_file_)) return false; return init_reader_.Load(xml_init_file_); } diff --git a/chrome/test/webdriver/webdriver_capabilities_parser_unittest.cc b/chrome/test/webdriver/webdriver_capabilities_parser_unittest.cc index c9c0f2e..9f79327 100644 --- a/chrome/test/webdriver/webdriver_capabilities_parser_unittest.cc +++ b/chrome/test/webdriver/webdriver_capabilities_parser_unittest.cc @@ -85,10 +85,10 @@ TEST(CapabilitiesParser, Extensions) { ASSERT_FALSE(parser.Parse()); ASSERT_EQ(2u, caps.extensions.size()); std::string contents; - ASSERT_TRUE(file_util::ReadFileToString(caps.extensions[0], &contents)); + ASSERT_TRUE(base::ReadFileToString(caps.extensions[0], &contents)); EXPECT_STREQ("Man", contents.c_str()); contents.clear(); - ASSERT_TRUE(file_util::ReadFileToString(caps.extensions[1], &contents)); + ASSERT_TRUE(base::ReadFileToString(caps.extensions[1], &contents)); EXPECT_STREQ("ManMan", contents.c_str()); } @@ -106,7 +106,7 @@ TEST(CapabilitiesParser, Profile) { base::FilePath zip = temp_dir.path().AppendASCII("data.zip"); ASSERT_TRUE(zip::Zip(folder, zip, false /* include_hidden_files */)); std::string contents; - ASSERT_TRUE(file_util::ReadFileToString(zip, &contents)); + ASSERT_TRUE(base::ReadFileToString(zip, &contents)); std::string base64; ASSERT_TRUE(base::Base64Encode(contents, &base64)); options->SetString("profile", base64); @@ -115,7 +115,7 @@ TEST(CapabilitiesParser, Profile) { CapabilitiesParser parser(&dict, temp_dir.path(), Logger(), &caps); ASSERT_FALSE(parser.Parse()); std::string new_contents; - ASSERT_TRUE(file_util::ReadFileToString( + ASSERT_TRUE(base::ReadFileToString( caps.profile.AppendASCII("data"), &new_contents)); EXPECT_STREQ("data", new_contents.c_str()); } diff --git a/chrome/test/webdriver/webdriver_logging.cc b/chrome/test/webdriver/webdriver_logging.cc index 8698ef4..fb482f5 100644 --- a/chrome/test/webdriver/webdriver_logging.cc +++ b/chrome/test/webdriver/webdriver_logging.cc @@ -166,7 +166,7 @@ void FileLog::Log(LogLevel level, const base::Time& time, bool FileLog::GetLogContents(std::string* contents) const { if (!file_.get()) return false; - return file_util::ReadFileToString(path_, contents); + return base::ReadFileToString(path_, contents); } bool FileLog::IsOpen() const { diff --git a/chrome/test/webdriver/webdriver_session.cc b/chrome/test/webdriver/webdriver_session.cc index 1c87b2b..d60c77a 100644 --- a/chrome/test/webdriver/webdriver_session.cc +++ b/chrome/test/webdriver/webdriver_session.cc @@ -1844,7 +1844,7 @@ Error* Session::GetScreenShot(std::string* png) { &error)); if (error) return error; - if (!file_util::ReadFileToString(path, png)) + if (!base::ReadFileToString(path, png)) return new Error(kUnknownError, "Could not read screenshot file"); return NULL; } diff --git a/chrome/test/webdriver/webdriver_util_unittest.cc b/chrome/test/webdriver/webdriver_util_unittest.cc index a888b01..ada282f 100644 --- a/chrome/test/webdriver/webdriver_util_unittest.cc +++ b/chrome/test/webdriver/webdriver_util_unittest.cc @@ -41,7 +41,7 @@ TEST(ZipFileTest, ZipEntryToZipArchive) { ASSERT_TRUE(UnzipSoleFile(temp_dir.path(), data, &file, &error_msg)) << error_msg; std::string contents; - ASSERT_TRUE(file_util::ReadFileToString(file, &contents)); + ASSERT_TRUE(base::ReadFileToString(file, &contents)); ASSERT_STREQ("COW\n", contents.c_str()); } diff --git a/chrome/utility/extensions/unpacker.cc b/chrome/utility/extensions/unpacker.cc index 8968549..09cb224a 100644 --- a/chrome/utility/extensions/unpacker.cc +++ b/chrome/utility/extensions/unpacker.cc @@ -46,7 +46,7 @@ SkBitmap DecodeImage(const base::FilePath& path) { // Read the file from disk. std::string file_contents; if (!base::PathExists(path) || - !file_util::ReadFileToString(path, &file_contents)) { + !base::ReadFileToString(path, &file_contents)) { return SkBitmap(); } diff --git a/chrome/utility/importer/bookmark_html_reader.cc b/chrome/utility/importer/bookmark_html_reader.cc index c70df87..d8fa9ac 100644 --- a/chrome/utility/importer/bookmark_html_reader.cc +++ b/chrome/utility/importer/bookmark_html_reader.cc @@ -93,7 +93,7 @@ void ImportBookmarksFile( std::vector<ImportedBookmarkEntry>* bookmarks, std::vector<ImportedFaviconUsage>* favicons) { std::string content; - file_util::ReadFileToString(file_path, &content); + base::ReadFileToString(file_path, &content); std::vector<std::string> lines; base::SplitString(content, '\n', &lines); diff --git a/chrome/utility/importer/firefox_importer.cc b/chrome/utility/importer/firefox_importer.cc index b1a29a0..e1474db 100644 --- a/chrome/utility/importer/firefox_importer.cc +++ b/chrome/utility/importer/firefox_importer.cc @@ -356,7 +356,7 @@ void FirefoxImporter::ImportPasswords() { file = source_path.AppendASCII("signons2.txt"); std::string content; - file_util::ReadFileToString(file, &content); + base::ReadFileToString(file, &content); decryptor.ParseSignons(content, &forms); } @@ -430,7 +430,7 @@ void FirefoxImporter::GetSearchEnginesXMLData( file = base::FilePath::FromUTF8Unsafe(engine); } std::string file_data; - file_util::ReadFileToString(file, &file_data); + base::ReadFileToString(file, &file_data); search_engine_data->push_back(file_data); } while (s.Step() && !cancelled()); } @@ -455,7 +455,7 @@ void FirefoxImporter::GetSearchEnginesXMLData( for (base::FilePath engine_path = engines.Next(); !engine_path.value().empty(); engine_path = engines.Next()) { std::string file_data; - file_util::ReadFileToString(file, &file_data); + base::ReadFileToString(file, &file_data); search_engine_data->push_back(file_data); } } diff --git a/chrome/utility/importer/ie_importer_win.cc b/chrome/utility/importer/ie_importer_win.cc index 0c7c1ea..12602ac 100644 --- a/chrome/utility/importer/ie_importer_win.cc +++ b/chrome/utility/importer/ie_importer_win.cc @@ -322,7 +322,7 @@ GURL ReadFaviconURLFromInternetShortcut(IUniformResourceLocator* url_locator) { // IE7 and above store the data. bool ReadFaviconDataFromInternetShortcut(const string16& file, std::string* data) { - return file_util::ReadFileToString( + return base::ReadFileToString( base::FilePath(file + kFaviconStreamName), data); } @@ -343,8 +343,7 @@ bool ReadFaviconDataFromCache(const GURL& favicon_url, std::string* data) { NULL, NULL, 0)) { return false; } - return file_util::ReadFileToString(base::FilePath(cache->lpszLocalFileName), - data); + return base::ReadFileToString(base::FilePath(cache->lpszLocalFileName), data); } // Reads the binary image data of favicon of an internet shortcut file |file|. diff --git a/chrome_frame/test/html_util_unittests.cc b/chrome_frame/test/html_util_unittests.cc index 5431f1e..4ec4b72 100644 --- a/chrome_frame/test/html_util_unittests.cc +++ b/chrome_frame/test/html_util_unittests.cc @@ -67,7 +67,7 @@ class HtmlUtilUnittest : public testing::Test { } std::string raw_data; - file_util::ReadFileToString(path, &raw_data); + base::ReadFileToString(path, &raw_data); // Convert to wide using the "best effort" assurance described in // string_util.h diff --git a/chrome_frame/test/navigation_test.cc b/chrome_frame/test/navigation_test.cc index 2f5ab33..fca132c 100644 --- a/chrome_frame/test/navigation_test.cc +++ b/chrome_frame/test/navigation_test.cc @@ -871,7 +871,7 @@ TEST_F(FullTabDownloadTest, CF_DownloadFileFromPost) { LaunchIENavigateAndLoop(src_url, kChromeFrameVeryLongNavigationTimeout); std::string data; - EXPECT_TRUE(file_util::ReadFileToString(temp_file_path, &data)); + EXPECT_TRUE(base::ReadFileToString(temp_file_path, &data)); EXPECT_EQ("hello", data); file_util::DieFileDie(temp_file_path, false); } diff --git a/chrome_frame/test/test_with_web_server.cc b/chrome_frame/test/test_with_web_server.cc index 68df297..2f762c3 100644 --- a/chrome_frame/test/test_with_web_server.cc +++ b/chrome_frame/test/test_with_web_server.cc @@ -58,7 +58,7 @@ std::string CreateHttpHeaders(CFInvocation invocation, std::string GetMockHttpHeaders(const base::FilePath& mock_http_headers_path) { std::string headers; - file_util::ReadFileToString(mock_http_headers_path, &headers); + base::ReadFileToString(mock_http_headers_path, &headers); return headers; } @@ -417,7 +417,7 @@ void MockWebServer::SendResponseHelper( EXPECT_FALSE(headers.empty()); - EXPECT_TRUE(file_util::ReadFileToString(file_path, &body)) + EXPECT_TRUE(base::ReadFileToString(file_path, &body)) << "Could not read file (" << WideToUTF8(file_path.value()) << ")"; if (invocation.type() == CFInvocation::META_TAG && StartsWithASCII(content_type, "text/html", false)) { diff --git a/chrome_frame/test/urlmon_moniker_unittest.cc b/chrome_frame/test/urlmon_moniker_unittest.cc index 161636f..75c9c319 100644 --- a/chrome_frame/test/urlmon_moniker_unittest.cc +++ b/chrome_frame/test/urlmon_moniker_unittest.cc @@ -32,7 +32,7 @@ class MonikerPatchTest : public testing::Test { bool ReadFileAsString(const wchar_t* file_name, std::string* file_contents) { EXPECT_TRUE(file_name); base::FilePath file_path = test_file_path_.Append(file_name); - return file_util::ReadFileToString(file_path, file_contents); + return base::ReadFileToString(file_path, file_contents); } static bool StringToStream(const std::string& data, IStream** ret) { diff --git a/chromeos/network/client_cert_resolver_unittest.cc b/chromeos/network/client_cert_resolver_unittest.cc index 12ee8e6..f275c82 100644 --- a/chromeos/network/client_cert_resolver_unittest.cc +++ b/chromeos/network/client_cert_resolver_unittest.cc @@ -104,7 +104,7 @@ class ClientCertResolverTest : public testing::Test { // Import a client cert signed by that CA. scoped_refptr<net::CryptoModule> crypt_module = cert_db->GetPrivateModule(); std::string pkcs12_data; - ASSERT_TRUE(file_util::ReadFileToString( + ASSERT_TRUE(base::ReadFileToString( net::GetTestCertsDirectory().Append("websocket_client_cert.p12"), &pkcs12_data)); diff --git a/chromeos/network/onc/onc_test_utils.cc b/chromeos/network/onc/onc_test_utils.cc index 82f4b7d..122c798 100644 --- a/chromeos/network/onc/onc_test_utils.cc +++ b/chromeos/network/onc/onc_test_utils.cc @@ -33,7 +33,7 @@ std::string ReadTestData(const std::string& filename) { return ""; } std::string result; - file_util::ReadFileToString(path, &result); + base::ReadFileToString(path, &result); return result; } diff --git a/chromeos/system/name_value_pairs_parser.cc b/chromeos/system/name_value_pairs_parser.cc index 091e1fc..31ba010 100644 --- a/chromeos/system/name_value_pairs_parser.cc +++ b/chromeos/system/name_value_pairs_parser.cc @@ -123,7 +123,7 @@ bool NameValuePairsParser::GetNameValuePairsFromFile( const std::string& eq, const std::string& delim) { std::string contents; - if (file_util::ReadFileToString(file_path, &contents)) { + if (base::ReadFileToString(file_path, &contents)) { return ParseNameValuePairs(contents, eq, delim); } else { LOG(WARNING) << "Unable to read statistics file: " << file_path.value(); diff --git a/cloud_print/gcp20/prototype/printer_state.cc b/cloud_print/gcp20/prototype/printer_state.cc index 78dbaa9..cf1891d 100644 --- a/cloud_print/gcp20/prototype/printer_state.cc +++ b/cloud_print/gcp20/prototype/printer_state.cc @@ -75,7 +75,7 @@ bool SaveToFile(const base::FilePath& path, const PrinterState& state) { bool LoadFromFile(const base::FilePath& path, PrinterState* state) { std::string json_str; - if (!file_util::ReadFileToString(path, &json_str)) { + if (!base::ReadFileToString(path, &json_str)) { LOG(ERROR) << "Cannot open file."; return false; } diff --git a/cloud_print/service/win/chrome_launcher.cc b/cloud_print/service/win/chrome_launcher.cc index 6e3366a..51501df 100644 --- a/cloud_print/service/win/chrome_launcher.cc +++ b/cloud_print/service/win/chrome_launcher.cc @@ -115,7 +115,7 @@ std::string ReadAndUpdateServiceState(const base::FilePath& directory, const std::string& proxy_id) { std::string json; base::FilePath file_path = directory.Append(chrome::kServiceStateFileName); - if (!file_util::ReadFileToString(file_path, &json)) { + if (!base::ReadFileToString(file_path, &json)) { return std::string(); } diff --git a/cloud_print/service/win/cloud_print_service.cc b/cloud_print/service/win/cloud_print_service.cc index c6254c0..058cf54 100644 --- a/cloud_print/service/win/cloud_print_service.cc +++ b/cloud_print/service/win/cloud_print_service.cc @@ -330,7 +330,7 @@ class CloudPrintServiceModule std::string contents; ServiceState service_state; - bool is_valid = file_util::ReadFileToString(file, &contents) && + bool is_valid = base::ReadFileToString(file, &contents) && service_state.FromString(contents); std::string proxy_id = service_state.proxy_id(); diff --git a/cloud_print/service/win/cloud_print_service_config.cc b/cloud_print/service/win/cloud_print_service_config.cc index bad7111..ce31e19 100644 --- a/cloud_print/service/win/cloud_print_service_config.cc +++ b/cloud_print/service/win/cloud_print_service_config.cc @@ -372,7 +372,7 @@ void SetupDialog::Install(const string16& user, const string16& password, std::string proxy_id; std::string contents; - if (file_util::ReadFileToString(file, &contents)) { + if (base::ReadFileToString(file, &contents)) { ServiceState service_state; if (service_state.FromString(contents)) proxy_id = service_state.proxy_id(); diff --git a/components/autofill/core/browser/data_driven_test.cc b/components/autofill/core/browser/data_driven_test.cc index 18f461e..3218b17 100644 --- a/components/autofill/core/browser/data_driven_test.cc +++ b/components/autofill/core/browser/data_driven_test.cc @@ -15,7 +15,7 @@ namespace { // Reads |file| into |content|, and converts Windows line-endings to Unix ones. // Returns true on success. bool ReadFile(const base::FilePath& file, std::string* content) { - if (!file_util::ReadFileToString(file, content)) + if (!base::ReadFileToString(file, content)) return false; ReplaceSubstringsAfterOffset(content, 0, "\r\n", "\n"); diff --git a/components/webdata/common/web_database_migration_unittest.cc b/components/webdata/common/web_database_migration_unittest.cc index 770e153..57ef02d 100644 --- a/components/webdata/common/web_database_migration_unittest.cc +++ b/components/webdata/common/web_database_migration_unittest.cc @@ -220,7 +220,7 @@ class WebDatabaseMigrationTest : public testing::Test { source_path = source_path.AppendASCII("web_database"); source_path = source_path.Append(file); return base::PathExists(source_path) && - file_util::ReadFileToString(source_path, contents); + base::ReadFileToString(source_path, contents); } static int VersionFromConnection(sql::Connection* connection) { diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc index 355cc32..859eaf4 100644 --- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc +++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc @@ -140,14 +140,14 @@ void DumpAccessibilityTreeTest::RunTest( printf("Testing: %s\n", html_file.MaybeAsASCII().c_str()); std::string html_contents; - file_util::ReadFileToString(html_file, &html_contents); + base::ReadFileToString(html_file, &html_contents); // Read the expected file. std::string expected_contents_raw; base::FilePath expected_file = base::FilePath(html_file.RemoveExtension().value() + AccessibilityTreeFormatter::GetExpectedFileSuffix()); - file_util::ReadFileToString(expected_file, &expected_contents_raw); + base::ReadFileToString(expected_file, &expected_contents_raw); // Tolerate Windows-style line endings (\r\n) in the expected file: // normalize by deleting all \r from the file (if any) to leave only \n. diff --git a/content/browser/devtools/devtools_http_handler_impl.cc b/content/browser/devtools/devtools_http_handler_impl.cc index c670df3..8003b8b 100644 --- a/content/browser/devtools/devtools_http_handler_impl.cc +++ b/content/browser/devtools/devtools_http_handler_impl.cc @@ -348,7 +348,7 @@ void DevToolsHttpHandlerImpl::OnHttpRequest( if (!frontend_dir.empty()) { base::FilePath path = frontend_dir.AppendASCII(filename); std::string data; - file_util::ReadFileToString(path, &data); + base::ReadFileToString(path, &data); server_->Send200(connection_id, data, mime_type); return; } diff --git a/content/browser/download/base_file_unittest.cc b/content/browser/download/base_file_unittest.cc index 826f56b..b82b0a8 100644 --- a/content/browser/download/base_file_unittest.cc +++ b/content/browser/download/base_file_unittest.cc @@ -71,7 +71,7 @@ class BaseFileTest : public testing::Test { if (!expected_data_.empty() && !expected_error_) { // Make sure the data has been properly written to disk. std::string disk_data; - EXPECT_TRUE(file_util::ReadFileToString(full_path, &disk_data)); + EXPECT_TRUE(base::ReadFileToString(full_path, &disk_data)); EXPECT_EQ(expected_data_, disk_data); } diff --git a/content/browser/download/download_browsertest.cc b/content/browser/download/download_browsertest.cc index b638cfa..767819e 100644 --- a/content/browser/download/download_browsertest.cc +++ b/content/browser/download/download_browsertest.cc @@ -600,7 +600,7 @@ class DownloadContentTest : public ContentBrowserTest { const int64 file_size) { std::string file_contents; - bool read = file_util::ReadFileToString(path, &file_contents); + bool read = base::ReadFileToString(path, &file_contents); EXPECT_TRUE(read) << "Failed reading file: " << path.value() << std::endl; if (!read) return false; // Couldn't read the file. @@ -674,7 +674,7 @@ class DownloadContentTest : public ContentBrowserTest { if (file_exists) { std::string file_contents; - EXPECT_TRUE(file_util::ReadFileToString( + EXPECT_TRUE(base::ReadFileToString( download->GetFullPath(), &file_contents)); ASSERT_EQ(static_cast<size_t>(received_bytes), file_contents.size()); diff --git a/content/browser/download/download_file_unittest.cc b/content/browser/download/download_file_unittest.cc index 49e418c..dcc0e42 100644 --- a/content/browser/download/download_file_unittest.cc +++ b/content/browser/download/download_file_unittest.cc @@ -164,8 +164,7 @@ class DownloadFileTest : public testing::Test { // Make sure the data has been properly written to disk. std::string disk_data; - EXPECT_TRUE(file_util::ReadFileToString(download_file_->FullPath(), - &disk_data)); + EXPECT_TRUE(base::ReadFileToString(download_file_->FullPath(), &disk_data)); EXPECT_EQ(expected_data_, disk_data); // Make sure the Browser and File threads outlive the DownloadFile @@ -417,7 +416,7 @@ TEST_F(DownloadFileTest, RenameFileFinal) { ASSERT_EQ(static_cast<int>(sizeof(file_data) - 1), file_util::WriteFile(path_5, file_data, sizeof(file_data) - 1)); ASSERT_TRUE(base::PathExists(path_5)); - EXPECT_TRUE(file_util::ReadFileToString(path_5, &file_contents)); + EXPECT_TRUE(base::ReadFileToString(path_5, &file_contents)); EXPECT_EQ(std::string(file_data), file_contents); EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, @@ -425,7 +424,7 @@ TEST_F(DownloadFileTest, RenameFileFinal) { EXPECT_EQ(path_5, output_path); file_contents = ""; - EXPECT_TRUE(file_util::ReadFileToString(path_5, &file_contents)); + EXPECT_TRUE(base::ReadFileToString(path_5, &file_contents)); EXPECT_NE(std::string(file_data), file_contents); DestroyDownloadFile(0); diff --git a/content/browser/gpu/gpu_pixel_browsertest.cc b/content/browser/gpu/gpu_pixel_browsertest.cc index 3eaf857..7a13747 100644 --- a/content/browser/gpu/gpu_pixel_browsertest.cc +++ b/content/browser/gpu/gpu_pixel_browsertest.cc @@ -59,7 +59,7 @@ bool ReadPNGFile(const base::FilePath& file_path, SkBitmap* bitmap) { return false; std::string png_data; - return file_util::ReadFileToString(abs_path, &png_data) && + return base::ReadFileToString(abs_path, &png_data) && gfx::PNGCodec::Decode(reinterpret_cast<unsigned char*>(&png_data[0]), png_data.length(), bitmap); diff --git a/content/browser/tracing/trace_subscriber_stdio_unittest.cc b/content/browser/tracing/trace_subscriber_stdio_unittest.cc index 0a3be3a..10e51a9 100644 --- a/content/browser/tracing/trace_subscriber_stdio_unittest.cc +++ b/content/browser/tracing/trace_subscriber_stdio_unittest.cc @@ -35,7 +35,7 @@ TEST_F(TraceSubscriberStdioTest, CanWriteArray) { } BrowserThread::GetBlockingPool()->FlushForTesting(); std::string result; - EXPECT_TRUE(file_util::ReadFileToString(trace_file, &result)); + EXPECT_TRUE(base::ReadFileToString(trace_file, &result)); EXPECT_EQ("[foo,bar]", result); } @@ -61,7 +61,7 @@ TEST_F(TraceSubscriberStdioTest, CanWritePropertyList) { } BrowserThread::GetBlockingPool()->FlushForTesting(); std::string result; - EXPECT_TRUE(file_util::ReadFileToString(trace_file, &result)); + EXPECT_TRUE(base::ReadFileToString(trace_file, &result)); EXPECT_EQ("{\"traceEvents\":[foo,bar]}", result); } @@ -90,7 +90,7 @@ TEST_F(TraceSubscriberStdioTest, CanWriteSystemDataFirst) { } BrowserThread::GetBlockingPool()->FlushForTesting(); std::string result; - EXPECT_TRUE(file_util::ReadFileToString(trace_file, &result)); + EXPECT_TRUE(base::ReadFileToString(trace_file, &result)); EXPECT_EQ( "{\"traceEvents\":[foo,bar],\"" "systemTraceEvents\":\"event1\\nev\\\"ent\\\"2\\n\"}", @@ -122,7 +122,7 @@ TEST_F(TraceSubscriberStdioTest, CanWriteSystemDataLast) { } BrowserThread::GetBlockingPool()->FlushForTesting(); std::string result; - EXPECT_TRUE(file_util::ReadFileToString(trace_file, &result)); + EXPECT_TRUE(base::ReadFileToString(trace_file, &result)); EXPECT_EQ( "{\"traceEvents\":[foo,bar],\"" "systemTraceEvents\":\"event1\\nev\\\"ent\\\"2\\n\"}", diff --git a/content/browser/tracing/tracing_ui.cc b/content/browser/tracing/tracing_ui.cc index aab652d..7793adb 100644 --- a/content/browser/tracing/tracing_ui.cc +++ b/content/browser/tracing/tracing_ui.cc @@ -225,7 +225,7 @@ void TracingMessageHandler::OnBeginRequestBufferPercentFull( // TaskProxy callback when reading is complete. void ReadTraceFileCallback(TaskProxy* proxy, const base::FilePath& path) { std::string file_contents; - if (!file_util::ReadFileToString(path, &file_contents)) + if (!base::ReadFileToString(path, &file_contents)) return; // We need to escape the file contents, because it will go into a javascript diff --git a/content/child/npapi/plugin_host.cc b/content/child/npapi/plugin_host.cc index 9b72be4..814964fd 100644 --- a/content/child/npapi/plugin_host.cc +++ b/content/child/npapi/plugin_host.cc @@ -474,7 +474,7 @@ static NPError PostURLNotify(NPP id, post_file_info.is_directory) return NPERR_FILE_NOT_FOUND; - if (!file_util::ReadFileToString(file_path, &post_file_contents)) + if (!base::ReadFileToString(file_path, &post_file_contents)) return NPERR_FILE_NOT_FOUND; buf = post_file_contents.c_str(); diff --git a/content/common/gpu/client/gl_helper_benchmark.cc b/content/common/gpu/client/gl_helper_benchmark.cc index 02bcad75e..1c5bee2 100644 --- a/content/common/gpu/client/gl_helper_benchmark.cc +++ b/content/common/gpu/client/gl_helper_benchmark.cc @@ -82,8 +82,7 @@ class GLHelperTest : public testing::Test { void LoadPngFileToSkBitmap(const base::FilePath& filename, SkBitmap* bitmap) { std::string compressed; - file_util::ReadFileToString(base::MakeAbsoluteFilePath(filename), - &compressed); + base::ReadFileToString(base::MakeAbsoluteFilePath(filename), &compressed); ASSERT_TRUE(compressed.size()); ASSERT_TRUE(gfx::PNGCodec::Decode( reinterpret_cast<const unsigned char*>(compressed.data()), diff --git a/content/common/gpu/media/video_decode_accelerator_unittest.cc b/content/common/gpu/media/video_decode_accelerator_unittest.cc index 5b3e114..8cae38a 100644 --- a/content/common/gpu/media/video_decode_accelerator_unittest.cc +++ b/content/common/gpu/media/video_decode_accelerator_unittest.cc @@ -191,7 +191,7 @@ void ParseAndReadTestVideoData(base::FilePath::StringType data, // Read in the video data. base::FilePath filepath(video_file->file_name); - CHECK(file_util::ReadFileToString(filepath, &video_file->data_str)) + CHECK(base::ReadFileToString(filepath, &video_file->data_str)) << "test_video_file: " << filepath.MaybeAsASCII(); test_video_files->push_back(video_file); @@ -204,7 +204,7 @@ void ReadGoldenThumbnailMD5s(const TestVideoFile* video_file, base::FilePath filepath(video_file->file_name); filepath = filepath.AddExtension(FILE_PATH_LITERAL(".md5")); std::string all_md5s; - file_util::ReadFileToString(filepath, &all_md5s); + base::ReadFileToString(filepath, &all_md5s); base::SplitString(all_md5s, '\n', md5_strings); // Check these are legitimate MD5s. for (std::vector<std::string>::iterator md5_string = md5_strings->begin(); diff --git a/content/common/page_state_serialization_unittest.cc b/content/common/page_state_serialization_unittest.cc index 8577c34..e899867 100644 --- a/content/common/page_state_serialization_unittest.cc +++ b/content/common/page_state_serialization_unittest.cc @@ -216,7 +216,7 @@ class PageStateSerializationTest : public testing::Test { base::StringPrintf("serialized_v%d%s.dat", version, suffix)); std::string file_contents; - if (!file_util::ReadFileToString(path, &file_contents)) { + if (!base::ReadFileToString(path, &file_contents)) { ADD_FAILURE() << "File not found: " << path.value(); return; } diff --git a/content/common/plugin_list_posix.cc b/content/common/plugin_list_posix.cc index 251fe39..3e1353be 100644 --- a/content/common/plugin_list_posix.cc +++ b/content/common/plugin_list_posix.cc @@ -115,7 +115,7 @@ bool IsBlacklistedBySha1sumAndQuirks(const base::FilePath& path) { continue; std::string file_content; - if (!file_util::ReadFileToString(path, &file_content)) + if (!base::ReadFileToString(path, &file_content)) continue; std::string sha1 = base::SHA1HashString(file_content); std::string sha1_readable; diff --git a/content/common/sandbox_mac_fontloading_unittest.mm b/content/common/sandbox_mac_fontloading_unittest.mm index 57af4de..d78f2f4 100644 --- a/content/common/sandbox_mac_fontloading_unittest.mm +++ b/content/common/sandbox_mac_fontloading_unittest.mm @@ -31,8 +31,7 @@ REGISTER_SANDBOX_TEST_CASE(FontLoadingTestCase); // Load raw font data into shared memory object. bool FontLoadingTestCase::BeforeSandboxInit() { std::string font_data; - if (!file_util::ReadFileToString(base::FilePath(test_data_.c_str()), - &font_data)) { + if (!base::ReadFileToString(base::FilePath(test_data_.c_str()), &font_data)) { LOG(ERROR) << "Failed to read font data from file (" << test_data_ << ")"; return false; } diff --git a/content/renderer/dom_serializer_browsertest.cc b/content/renderer/dom_serializer_browsertest.cc index bcc4fc6..69dfc65 100644 --- a/content/renderer/dom_serializer_browsertest.cc +++ b/content/renderer/dom_serializer_browsertest.cc @@ -820,7 +820,7 @@ IN_PROC_BROWSER_TEST_F(DomSerializerTests, SerializeXMLDocWithBuiltInEntities) { base::FilePath xml_file_path = GetTestFilePath("dom_serializer", "note.xml"); // Read original contents for later comparison. std::string original_contents; - ASSERT_TRUE(file_util::ReadFileToString(xml_file_path, &original_contents)); + ASSERT_TRUE(base::ReadFileToString(xml_file_path, &original_contents)); // Get file URL. GURL file_url = net::FilePathToFileURL(page_file_path); GURL xml_file_url = net::FilePathToFileURL(xml_file_path); @@ -840,7 +840,7 @@ IN_PROC_BROWSER_TEST_F(DomSerializerTests, SerializeHTMLDOMWithAddingMOTW) { GetTestFilePath("dom_serializer", "youtube_2.htm"); // Read original contents for later comparison . std::string original_contents; - ASSERT_TRUE(file_util::ReadFileToString(page_file_path, &original_contents)); + ASSERT_TRUE(base::ReadFileToString(page_file_path, &original_contents)); // Get file URL. GURL file_url = net::FilePathToFileURL(page_file_path); ASSERT_TRUE(file_url.SchemeIsFile()); diff --git a/content/shell/app/webkit_test_platform_support_win.cc b/content/shell/app/webkit_test_platform_support_win.cc index 14d2a0e..59156fe 100644 --- a/content/shell/app/webkit_test_platform_support_win.cc +++ b/content/shell/app/webkit_test_platform_support_win.cc @@ -35,7 +35,7 @@ bool SetupFonts() { base_path.Append(FILE_PATH_LITERAL("/AHEM____.TTF")); std::string font_buffer; - if (!file_util::ReadFileToString(font_path, &font_buffer)) { + if (!base::ReadFileToString(font_path, &font_buffer)) { std::cerr << "Failed to load font " << WideToUTF8(font_path.value()) << "\n"; return false; diff --git a/content/shell/browser/shell_message_filter.cc b/content/shell/browser/shell_message_filter.cc index c7c4cca..fcbde2f 100644 --- a/content/shell/browser/shell_message_filter.cc +++ b/content/shell/browser/shell_message_filter.cc @@ -61,7 +61,7 @@ bool ShellMessageFilter::OnMessageReceived(const IPC::Message& message, void ShellMessageFilter::OnReadFileToString(const base::FilePath& local_file, std::string* contents) { base::ThreadRestrictions::ScopedAllowIO allow_io; - file_util::ReadFileToString(local_file, contents); + base::ReadFileToString(local_file, contents); } void ShellMessageFilter::OnRegisterIsolatedFileSystem( diff --git a/content/test/image_decoder_test.cc b/content/test/image_decoder_test.cc index 8824c67..8387d4a 100644 --- a/content/test/image_decoder_test.cc +++ b/content/test/image_decoder_test.cc @@ -39,7 +39,7 @@ bool ShouldSkipFile(const base::FilePath& path, void ReadFileToVector(const base::FilePath& path, std::vector<char>* contents) { std::string raw_image_data; - file_util::ReadFileToString(path, &raw_image_data); + base::ReadFileToString(path, &raw_image_data); contents->resize(raw_image_data.size()); memcpy(&contents->at(0), raw_image_data.data(), raw_image_data.size()); } @@ -90,7 +90,7 @@ void VerifyImage(const WebKit::WebImageDecoder& decoder, // Read the MD5 sum off disk. std::string file_bytes; - file_util::ReadFileToString(md5_sum_path, &file_bytes); + base::ReadFileToString(md5_sum_path, &file_bytes); base::MD5Digest expected_digest; ASSERT_EQ(sizeof expected_digest, file_bytes.size()) << path.value(); memcpy(&expected_digest, file_bytes.data(), sizeof expected_digest); diff --git a/content/test/net/url_request_mock_http_job.cc b/content/test/net/url_request_mock_http_job.cc index 9927960..b06f6b47 100644 --- a/content/test/net/url_request_mock_http_job.cc +++ b/content/test/net/url_request_mock_http_job.cc @@ -144,7 +144,7 @@ void URLRequestMockHTTPJob::GetResponseInfoConst( base::FilePath header_file = base::FilePath(file_path_.value() + kMockHeaderFileSuffix); std::string raw_headers; - if (!file_util::ReadFileToString(header_file, &raw_headers)) + if (!base::ReadFileToString(header_file, &raw_headers)) return; // ParseRawHeaders expects \0 to end each header line. diff --git a/courgette/base_test_unittest.cc b/courgette/base_test_unittest.cc index 9565536..9a62868 100644 --- a/courgette/base_test_unittest.cc +++ b/courgette/base_test_unittest.cc @@ -22,7 +22,7 @@ std::string BaseTest::FileContents(const char* file_name) const { file_path = file_path.AppendASCII(file_name); std::string file_bytes; - EXPECT_TRUE(file_util::ReadFileToString(file_path, &file_bytes)); + EXPECT_TRUE(base::ReadFileToString(file_path, &file_bytes)); return file_bytes; } diff --git a/courgette/courgette_tool.cc b/courgette/courgette_tool.cc index 1d8b77d..3b231f8 100644 --- a/courgette/courgette_tool.cc +++ b/courgette/courgette_tool.cc @@ -53,7 +53,7 @@ std::string ReadOrFail(const base::FilePath& file_name, const char* kind) { Problem("Can't read %s file.", kind); std::string buffer; buffer.reserve(static_cast<size_t>(file_size)); - if (!file_util::ReadFileToString(file_name, &buffer)) + if (!base::ReadFileToString(file_name, &buffer)) Problem("Can't read %s file.", kind); return buffer; } diff --git a/extensions/browser/file_reader.cc b/extensions/browser/file_reader.cc index f1a5600..3ca74eb 100644 --- a/extensions/browser/file_reader.cc +++ b/extensions/browser/file_reader.cc @@ -27,6 +27,6 @@ FileReader::~FileReader() {} void FileReader::ReadFileOnBackgroundThread() { std::string data; - bool success = file_util::ReadFileToString(resource_.GetFilePath(), &data); + bool success = base::ReadFileToString(resource_.GetFilePath(), &data); origin_loop_->PostTask(FROM_HERE, base::Bind(callback_, success, data)); } diff --git a/extensions/browser/file_reader_unittest.cc b/extensions/browser/file_reader_unittest.cc index 17a466c..120ad66 100644 --- a/extensions/browser/file_reader_unittest.cc +++ b/extensions/browser/file_reader_unittest.cc @@ -61,7 +61,7 @@ void RunBasicTest(const char* filename) { path = path.AppendASCII(filename); std::string file_contents; - ASSERT_TRUE(file_util::ReadFileToString(path, &file_contents)); + ASSERT_TRUE(base::ReadFileToString(path, &file_contents)); Receiver receiver; diff --git a/gpu/config/gpu_info_collector_x11.cc b/gpu/config/gpu_info_collector_x11.cc index a19ef9c..e0374fa 100644 --- a/gpu/config/gpu_info_collector_x11.cc +++ b/gpu/config/gpu_info_collector_x11.cc @@ -48,7 +48,7 @@ std::string CollectDriverVersionATI() { if (!base::PathExists(ati_file_path)) return std::string(); std::string contents; - if (!file_util::ReadFileToString(ati_file_path, &contents)) + if (!base::ReadFileToString(ati_file_path, &contents)) return std::string(); base::StringTokenizer t(contents, "\r\n"); while (t.GetNext()) { diff --git a/gpu/config/gpu_test_expectations_parser.cc b/gpu/config/gpu_test_expectations_parser.cc index c746bed..83bb300 100644 --- a/gpu/config/gpu_test_expectations_parser.cc +++ b/gpu/config/gpu_test_expectations_parser.cc @@ -191,7 +191,7 @@ bool GPUTestExpectationsParser::LoadTestExpectations( error_messages_.clear(); std::string data; - if (!file_util::ReadFileToString(path, &data)) { + if (!base::ReadFileToString(path, &data)) { error_messages_.push_back(kErrorMessage[kErrorFileIO]); return false; } diff --git a/gpu/tools/compositor_model_bench/render_tree.cc b/gpu/tools/compositor_model_bench/render_tree.cc index 2e23186..8473a3c 100644 --- a/gpu/tools/compositor_model_bench/render_tree.cc +++ b/gpu/tools/compositor_model_bench/render_tree.cc @@ -20,7 +20,7 @@ using base::JSONReader; using base::JSONWriter; using base::Value; -using file_util::ReadFileToString; +using base::ReadFileToString; using std::string; using std::vector; diff --git a/jingle/glue/logging_unittest.cc b/jingle/glue/logging_unittest.cc index 85ac558..ba1f8594 100644 --- a/jingle/glue/logging_unittest.cc +++ b/jingle/glue/logging_unittest.cc @@ -84,7 +84,7 @@ TEST(LibjingleLogTest, DefaultConfiguration) { // Read file to string. base::FilePath file_path(log_file_name); std::string contents_of_file; - file_util::ReadFileToString(file_path, &contents_of_file); + base::ReadFileToString(file_path, &contents_of_file); // Make sure string contains the expected values. EXPECT_FALSE(ContainsString(contents_of_file, AsString(talk_base::LS_ERROR))); @@ -111,7 +111,7 @@ TEST(LibjingleLogTest, InfoConfiguration) { // Read file to string. base::FilePath file_path(log_file_name); std::string contents_of_file; - file_util::ReadFileToString(file_path, &contents_of_file); + base::ReadFileToString(file_path, &contents_of_file); // Make sure string contains the expected values. EXPECT_TRUE(ContainsString(contents_of_file, AsString(talk_base::LS_ERROR))); @@ -145,7 +145,7 @@ TEST(LibjingleLogTest, LogEverythingConfiguration) { // Read file to string. base::FilePath file_path(log_file_name); std::string contents_of_file; - file_util::ReadFileToString(file_path, &contents_of_file); + base::ReadFileToString(file_path, &contents_of_file); // Make sure string contains the expected values. EXPECT_TRUE(ContainsString(contents_of_file, AsString(talk_base::LS_ERROR))); diff --git a/net/base/file_stream_unittest.cc b/net/base/file_stream_unittest.cc index 4be58b7..a091e7a 100644 --- a/net/base/file_stream_unittest.cc +++ b/net/base/file_stream_unittest.cc @@ -1017,7 +1017,7 @@ TEST_F(FileStreamTest, Truncate) { // Read in the contents and make sure we get back what we expected. std::string read_contents; - EXPECT_TRUE(file_util::ReadFileToString(temp_file_path(), &read_contents)); + EXPECT_TRUE(base::ReadFileToString(temp_file_path(), &read_contents)); EXPECT_EQ("01230123", read_contents); } diff --git a/net/base/gzip_filter_unittest.cc b/net/base/gzip_filter_unittest.cc index be98bae..2ac4a3f 100644 --- a/net/base/gzip_filter_unittest.cc +++ b/net/base/gzip_filter_unittest.cc @@ -69,7 +69,7 @@ class GZipUnitTest : public PlatformTest { file_path = file_path.AppendASCII("google.txt"); // Read data from the file into buffer. - ASSERT_TRUE(file_util::ReadFileToString(file_path, &source_buffer_)); + ASSERT_TRUE(base::ReadFileToString(file_path, &source_buffer_)); // Encode the data with deflate deflate_encode_buffer_ = new char[kDefaultBufferSize]; diff --git a/net/base/net_log_logger_unittest.cc b/net/base/net_log_logger_unittest.cc index c4ee98a..3dd6915 100644 --- a/net/base/net_log_logger_unittest.cc +++ b/net/base/net_log_logger_unittest.cc @@ -35,7 +35,7 @@ TEST_F(NetLogLoggerTest, GeneratesValidJSONForNoEvents) { } std::string input; - ASSERT_TRUE(file_util::ReadFileToString(log_path_, &input)); + ASSERT_TRUE(base::ReadFileToString(log_path_, &input)); base::JSONReader reader; scoped_ptr<base::Value> root(reader.ReadToValue(input)); @@ -67,7 +67,7 @@ TEST_F(NetLogLoggerTest, GeneratesValidJSONWithOneEvent) { } std::string input; - ASSERT_TRUE(file_util::ReadFileToString(log_path_, &input)); + ASSERT_TRUE(base::ReadFileToString(log_path_, &input)); base::JSONReader reader; scoped_ptr<base::Value> root(reader.ReadToValue(input)); @@ -102,7 +102,7 @@ TEST_F(NetLogLoggerTest, GeneratesValidJSONWithMultipleEvents) { } std::string input; - ASSERT_TRUE(file_util::ReadFileToString(log_path_, &input)); + ASSERT_TRUE(base::ReadFileToString(log_path_, &input)); base::JSONReader reader; scoped_ptr<base::Value> root(reader.ReadToValue(input)); diff --git a/net/cert/nss_cert_database_unittest.cc b/net/cert/nss_cert_database_unittest.cc index 2e712bb..4ad1192 100644 --- a/net/cert/nss_cert_database_unittest.cc +++ b/net/cert/nss_cert_database_unittest.cc @@ -68,7 +68,7 @@ class CertDatabaseNSSTest : public testing::Test { static std::string ReadTestFile(const std::string& name) { std::string result; base::FilePath cert_path = GetTestCertsDirectory().AppendASCII(name); - EXPECT_TRUE(file_util::ReadFileToString(cert_path, &result)); + EXPECT_TRUE(base::ReadFileToString(cert_path, &result)); return result; } diff --git a/net/cert/test_root_certs.cc b/net/cert/test_root_certs.cc index 3219f1d..f495890 100644 --- a/net/cert/test_root_certs.cc +++ b/net/cert/test_root_certs.cc @@ -22,7 +22,7 @@ base::LazyInstance<TestRootCerts>::Leaky CertificateList LoadCertificates(const base::FilePath& filename) { std::string raw_cert; - if (!file_util::ReadFileToString(filename, &raw_cert)) { + if (!base::ReadFileToString(filename, &raw_cert)) { LOG(ERROR) << "Can't load certificate " << filename.value(); return CertificateList(); } diff --git a/net/dns/dns_hosts.cc b/net/dns/dns_hosts.cc index 852d35c..3edea2a 100644 --- a/net/dns/dns_hosts.cc +++ b/net/dns/dns_hosts.cc @@ -158,7 +158,7 @@ bool ParseHostsFile(const base::FilePath& path, DnsHosts* dns_hosts) { return false; std::string contents; - if (!file_util::ReadFileToString(path, &contents)) + if (!base::ReadFileToString(path, &contents)) return false; ParseHosts(contents, dns_hosts); diff --git a/net/ftp/ftp_directory_listing_parser_unittest.cc b/net/ftp/ftp_directory_listing_parser_unittest.cc index 4eaf1dd..73d19bc 100644 --- a/net/ftp/ftp_directory_listing_parser_unittest.cc +++ b/net/ftp/ftp_directory_listing_parser_unittest.cc @@ -42,8 +42,8 @@ TEST_P(FtpDirectoryListingParserTest, Parse) { SCOPED_TRACE(base::StringPrintf("Test case: %s", GetParam())); std::string test_listing; - EXPECT_TRUE(file_util::ReadFileToString(test_dir.AppendASCII(GetParam()), - &test_listing)); + EXPECT_TRUE(base::ReadFileToString(test_dir.AppendASCII(GetParam()), + &test_listing)); std::vector<FtpDirectoryListingEntry> entries; EXPECT_EQ(OK, ParseFtpDirectoryListing(test_listing, @@ -51,7 +51,7 @@ TEST_P(FtpDirectoryListingParserTest, Parse) { &entries)); std::string expected_listing; - ASSERT_TRUE(file_util::ReadFileToString( + ASSERT_TRUE(base::ReadFileToString( test_dir.AppendASCII(std::string(GetParam()) + ".expected"), &expected_listing)); diff --git a/net/ocsp/nss_ocsp_unittest.cc b/net/ocsp/nss_ocsp_unittest.cc index be29d5f..0530282 100644 --- a/net/ocsp/nss_ocsp_unittest.cc +++ b/net/ocsp/nss_ocsp_unittest.cc @@ -78,7 +78,7 @@ class NssHttpTest : public ::testing::Test { virtual void SetUp() { std::string file_contents; - ASSERT_TRUE(file_util::ReadFileToString( + ASSERT_TRUE(base::ReadFileToString( GetTestCertsDirectory().AppendASCII("aia-intermediate.der"), &file_contents)); ASSERT_FALSE(file_contents.empty()); diff --git a/net/proxy/proxy_resolver_perftest.cc b/net/proxy/proxy_resolver_perftest.cc index bb94ff0..1630d9e 100644 --- a/net/proxy/proxy_resolver_perftest.cc +++ b/net/proxy/proxy_resolver_perftest.cc @@ -163,7 +163,7 @@ class PacPerfSuiteRunner { // Try to read the file from disk. std::string file_contents; - bool ok = file_util::ReadFileToString(path, &file_contents); + bool ok = base::ReadFileToString(path, &file_contents); // If we can't load the file from disk, something is misconfigured. LOG_IF(ERROR, !ok) << "Failed to read file: " << path.value(); diff --git a/net/proxy/proxy_resolver_v8_tracing_unittest.cc b/net/proxy/proxy_resolver_v8_tracing_unittest.cc index ff3ffd4a..805a8734 100644 --- a/net/proxy/proxy_resolver_v8_tracing_unittest.cc +++ b/net/proxy/proxy_resolver_v8_tracing_unittest.cc @@ -49,7 +49,7 @@ scoped_refptr<ProxyResolverScriptData> LoadScriptData(const char* filename) { // Try to read the file from disk. std::string file_contents; - bool ok = file_util::ReadFileToString(path, &file_contents); + bool ok = base::ReadFileToString(path, &file_contents); // If we can't load the file from disk, something is misconfigured. EXPECT_TRUE(ok) << "Failed to read file: " << path.value(); diff --git a/net/proxy/proxy_resolver_v8_unittest.cc b/net/proxy/proxy_resolver_v8_unittest.cc index 67e7739..cbbedce 100644 --- a/net/proxy/proxy_resolver_v8_unittest.cc +++ b/net/proxy/proxy_resolver_v8_unittest.cc @@ -117,7 +117,7 @@ class ProxyResolverV8WithMockBindings : public ProxyResolverV8 { // Try to read the file from disk. std::string file_contents; - bool ok = file_util::ReadFileToString(path, &file_contents); + bool ok = base::ReadFileToString(path, &file_contents); // If we can't load the file from disk, something is misconfigured. if (!ok) { diff --git a/net/socket/ssl_client_socket_openssl_unittest.cc b/net/socket/ssl_client_socket_openssl_unittest.cc index 04f8999..24c0605 100644 --- a/net/socket/ssl_client_socket_openssl_unittest.cc +++ b/net/socket/ssl_client_socket_openssl_unittest.cc @@ -67,7 +67,7 @@ bool LoadPrivateKeyOpenSSL( const base::FilePath& filepath, OpenSSLClientKeyStore::ScopedEVP_PKEY* pkey) { std::string data; - if (!file_util::ReadFileToString(filepath, &data)) { + if (!base::ReadFileToString(filepath, &data)) { LOG(ERROR) << "Could not read private key file: " << filepath.value() << ": " << strerror(errno); return false; diff --git a/net/socket/ssl_server_socket_unittest.cc b/net/socket/ssl_server_socket_unittest.cc index 64c8549..e1f7f49 100644 --- a/net/socket/ssl_server_socket_unittest.cc +++ b/net/socket/ssl_server_socket_unittest.cc @@ -314,14 +314,14 @@ class SSLServerSocketTest : public PlatformTest { base::FilePath cert_path = certs_dir.AppendASCII("unittest.selfsigned.der"); std::string cert_der; - ASSERT_TRUE(file_util::ReadFileToString(cert_path, &cert_der)); + ASSERT_TRUE(base::ReadFileToString(cert_path, &cert_der)); scoped_refptr<net::X509Certificate> cert = X509Certificate::CreateFromBytes(cert_der.data(), cert_der.size()); base::FilePath key_path = certs_dir.AppendASCII("unittest.key.bin"); std::string key_string; - ASSERT_TRUE(file_util::ReadFileToString(key_path, &key_string)); + ASSERT_TRUE(base::ReadFileToString(key_path, &key_string)); std::vector<uint8> key_vector( reinterpret_cast<const uint8*>(key_string.data()), reinterpret_cast<const uint8*>(key_string.data() + diff --git a/net/socket/tcp_client_socket.cc b/net/socket/tcp_client_socket.cc index dbd2105..a91d33d 100644 --- a/net/socket/tcp_client_socket.cc +++ b/net/socket/tcp_client_socket.cc @@ -20,7 +20,7 @@ bool SystemSupportsTCPFastOpen() { static const base::FilePath::CharType kTCPFastOpenProcFilePath[] = "/proc/sys/net/ipv4/tcp_fastopen"; std::string system_enabled_tcp_fastopen; - if (!file_util::ReadFileToString( + if (!base::ReadFileToString( base::FilePath(kTCPFastOpenProcFilePath), &system_enabled_tcp_fastopen)) { return false; diff --git a/net/test/cert_test_util.cc b/net/test/cert_test_util.cc index 085a459..5ec0774 100644 --- a/net/test/cert_test_util.cc +++ b/net/test/cert_test_util.cc @@ -19,7 +19,7 @@ CertificateList CreateCertificateListFromFile( int format) { base::FilePath cert_path = certs_dir.AppendASCII(cert_file); std::string cert_data; - if (!file_util::ReadFileToString(cert_path, &cert_data)) + if (!base::ReadFileToString(cert_path, &cert_data)) return CertificateList(); return X509Certificate::CreateCertificateListFromBytes(cert_data.data(), cert_data.size(), @@ -31,7 +31,7 @@ scoped_refptr<X509Certificate> ImportCertFromFile( const std::string& cert_file) { base::FilePath cert_path = certs_dir.AppendASCII(cert_file); std::string cert_data; - if (!file_util::ReadFileToString(cert_path, &cert_data)) + if (!base::ReadFileToString(cert_path, &cert_data)) return NULL; CertificateList certs_in_file = diff --git a/net/test/embedded_test_server/embedded_test_server.cc b/net/test/embedded_test_server/embedded_test_server.cc index a54ff7e..d9196e1 100644 --- a/net/test/embedded_test_server/embedded_test_server.cc +++ b/net/test/embedded_test_server/embedded_test_server.cc @@ -59,7 +59,7 @@ scoped_ptr<HttpResponse> HandleFileRequest( base::FilePath file_path(server_root.AppendASCII(request_path)); std::string file_contents; - if (!file_util::ReadFileToString(file_path, &file_contents)) + if (!base::ReadFileToString(file_path, &file_contents)) return scoped_ptr<HttpResponse>(); base::FilePath headers_path( @@ -67,7 +67,7 @@ scoped_ptr<HttpResponse> HandleFileRequest( if (base::PathExists(headers_path)) { std::string headers_contents; - if (!file_util::ReadFileToString(headers_path, &headers_contents)) + if (!base::ReadFileToString(headers_path, &headers_contents)) return scoped_ptr<HttpResponse>(); scoped_ptr<CustomHttpResponse> http_response( diff --git a/net/test/spawned_test_server/remote_test_server.cc b/net/test/spawned_test_server/remote_test_server.cc index a3b4ef3..594c5d4 100644 --- a/net/test/spawned_test_server/remote_test_server.cc +++ b/net/test/spawned_test_server/remote_test_server.cc @@ -169,8 +169,7 @@ bool RemoteTestServer::Init(const base::FilePath& document_root) { // Parse file to extract the ports information. std::string port_info; - if (!file_util::ReadFileToString(GetTestServerPortInfoFile(), - &port_info) || + if (!base::ReadFileToString(GetTestServerPortInfoFile(), &port_info) || port_info.empty()) { return false; } diff --git a/net/tools/crl_set_dump/crl_set_dump.cc b/net/tools/crl_set_dump/crl_set_dump.cc index 19184080..6c3bb54 100644 --- a/net/tools/crl_set_dump/crl_set_dump.cc +++ b/net/tools/crl_set_dump/crl_set_dump.cc @@ -38,10 +38,10 @@ int main(int argc, char** argv) { output_filename = base::FilePath::FromUTF8Unsafe(argv[3]); std::string crl_set_bytes, delta_bytes; - if (!file_util::ReadFileToString(crl_set_filename, &crl_set_bytes)) + if (!base::ReadFileToString(crl_set_filename, &crl_set_bytes)) return 1; if (!delta_filename.empty() && - !file_util::ReadFileToString(delta_filename, &delta_bytes)) { + !base::ReadFileToString(delta_filename, &delta_bytes)) { return 1; } diff --git a/net/tools/dns_fuzz_stub/dns_fuzz_stub.cc b/net/tools/dns_fuzz_stub/dns_fuzz_stub.cc index bcdb7b7..f9caa79 100644 --- a/net/tools/dns_fuzz_stub/dns_fuzz_stub.cc +++ b/net/tools/dns_fuzz_stub/dns_fuzz_stub.cc @@ -53,7 +53,7 @@ bool ReadTestCase(const char* filename, base::FilePath filepath = base::FilePath::FromUTF8Unsafe(filename); std::string json; - if (!file_util::ReadFileToString(filepath, &json)) { + if (!base::ReadFileToString(filepath, &json)) { LOG(ERROR) << filename << ": couldn't read file."; return false; } diff --git a/net/tools/gdig/gdig.cc b/net/tools/gdig/gdig.cc index 2764ee5..54f0509 100644 --- a/net/tools/gdig/gdig.cc +++ b/net/tools/gdig/gdig.cc @@ -116,7 +116,7 @@ typedef std::vector<ReplayLogEntry> ReplayLog; // The file should be sorted by timestamp in ascending time. bool LoadReplayLog(const base::FilePath& file_path, ReplayLog* replay_log) { std::string original_replay_log_contents; - if (!file_util::ReadFileToString(file_path, &original_replay_log_contents)) { + if (!base::ReadFileToString(file_path, &original_replay_log_contents)) { fprintf(stderr, "Unable to open replay file %s\n", file_path.MaybeAsASCII().c_str()); return false; diff --git a/net/tools/quic/quic_in_memory_cache.cc b/net/tools/quic/quic_in_memory_cache.cc index b840d79..6ed7dd5 100644 --- a/net/tools/quic/quic_in_memory_cache.cc +++ b/net/tools/quic/quic_in_memory_cache.cc @@ -140,7 +140,7 @@ void QuicInMemoryCache::Initialize() { BalsaHeaders request_headers, response_headers; string file_contents; - file_util::ReadFileToString(file, &file_contents); + base::ReadFileToString(file, &file_contents); // Frame HTTP. CachingBalsaVisitor caching_visitor; diff --git a/net/tools/tld_cleanup/tld_cleanup_util.cc b/net/tools/tld_cleanup/tld_cleanup_util.cc index dfa2620..8e04b55 100644 --- a/net/tools/tld_cleanup/tld_cleanup_util.cc +++ b/net/tools/tld_cleanup/tld_cleanup_util.cc @@ -233,7 +233,7 @@ NormalizeResult NormalizeFile(const base::FilePath& in_filename, const base::FilePath& out_filename) { RuleMap rules; std::string data; - if (!file_util::ReadFileToString(in_filename, &data)) { + if (!base::ReadFileToString(in_filename, &data)) { LOG(ERROR) << "Unable to read file"; // We return success since we've already reported the error. return kSuccess; diff --git a/net/url_request/url_fetcher_impl_unittest.cc b/net/url_request/url_fetcher_impl_unittest.cc index 7cc1674..62f6272 100644 --- a/net/url_request/url_fetcher_impl_unittest.cc +++ b/net/url_request/url_fetcher_impl_unittest.cc @@ -555,7 +555,7 @@ void URLFetcherPostFileTest::CreateFetcher(const GURL& url) { void URLFetcherPostFileTest::OnURLFetchComplete(const URLFetcher* source) { std::string expected; - ASSERT_TRUE(file_util::ReadFileToString(path_, &expected)); + ASSERT_TRUE(base::ReadFileToString(path_, &expected)); ASSERT_LE(range_offset_, expected.size()); uint64 expected_size = std::min(range_length_, expected.size() - range_offset_); diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index 1cb5f6f..c1178fe 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -4250,7 +4250,7 @@ TEST_F(URLRequestTestHTTP, DeferredRedirect) { path = path.Append(FILE_PATH_LITERAL("with-headers.html")); std::string contents; - EXPECT_TRUE(file_util::ReadFileToString(path, &contents)); + EXPECT_TRUE(base::ReadFileToString(path, &contents)); EXPECT_EQ(contents, d.data_received()); } } @@ -4292,7 +4292,7 @@ TEST_F(URLRequestTestHTTP, DeferredRedirect_GetFullRequestHeaders) { path = path.Append(FILE_PATH_LITERAL("with-headers.html")); std::string contents; - EXPECT_TRUE(file_util::ReadFileToString(path, &contents)); + EXPECT_TRUE(base::ReadFileToString(path, &contents)); EXPECT_EQ(contents, d.data_received()); } } diff --git a/printing/backend/cups_helper.cc b/printing/backend/cups_helper.cc index 1c143a5..748625d 100644 --- a/printing/backend/cups_helper.cc +++ b/printing/backend/cups_helper.cc @@ -35,7 +35,7 @@ void ParseLpOptions(const base::FilePath& filepath, const std::string& printer_name, int* num_options, cups_option_t** options) { std::string content; - if (!file_util::ReadFileToString(filepath, &content)) + if (!base::ReadFileToString(filepath, &content)) return; const char kDest[] = "dest"; diff --git a/printing/backend/print_backend_cups.cc b/printing/backend/print_backend_cups.cc index 44c38bb..2eb2143 100644 --- a/printing/backend/print_backend_cups.cc +++ b/printing/backend/print_backend_cups.cc @@ -251,7 +251,7 @@ bool PrintBackendCUPS::GetPrinterCapsAndDefaults( } std::string content; - bool res = file_util::ReadFileToString(ppd_path, &content); + bool res = base::ReadFileToString(ppd_path, &content); base::DeleteFile(ppd_path, false); diff --git a/printing/emf_win_unittest.cc b/printing/emf_win_unittest.cc index 0f5e6ca..44f693e 100644 --- a/printing/emf_win_unittest.cc +++ b/printing/emf_win_unittest.cc @@ -95,7 +95,7 @@ TEST_F(EmfPrintingTest, Enumerate) { // Load any EMF with an image. Emf emf; std::string emf_data; - file_util::ReadFileToString(emf_file, &emf_data); + base::ReadFileToString(emf_file, &emf_data); ASSERT_TRUE(emf_data.size()); EXPECT_TRUE(emf.InitFromData(&emf_data[0], emf_data.size())); diff --git a/printing/image.cc b/printing/image.cc index 47ce089..b9c0010 100644 --- a/printing/image.cc +++ b/printing/image.cc @@ -21,7 +21,7 @@ Image::Image(const base::FilePath& path) : row_length_(0), ignore_alpha_(true) { std::string data; - file_util::ReadFileToString(path, &data); + base::ReadFileToString(path, &data); bool success = false; if (path.MatchesExtension(FILE_PATH_LITERAL(".png"))) { success = LoadPng(data); diff --git a/remoting/host/config_file_watcher.cc b/remoting/host/config_file_watcher.cc index 238265a..9b95ed9 100644 --- a/remoting/host/config_file_watcher.cc +++ b/remoting/host/config_file_watcher.cc @@ -180,7 +180,7 @@ void ConfigFileWatcherImpl::ReloadConfig() { DCHECK(io_task_runner_->BelongsToCurrentThread()); std::string config; - if (!file_util::ReadFileToString(config_path_, &config)) { + if (!base::ReadFileToString(config_path_, &config)) { #if defined(OS_WIN) // EACCESS may indicate a locking or sharing violation. Retry a few times // before reporting an error. diff --git a/remoting/host/json_host_config.cc b/remoting/host/json_host_config.cc index d25f4b5..0a8db7c 100644 --- a/remoting/host/json_host_config.cc +++ b/remoting/host/json_host_config.cc @@ -26,7 +26,7 @@ bool JsonHostConfig::Read() { // TODO(sergeyu): Implement better error handling here. std::string file_content; - if (!file_util::ReadFileToString(filename_, &file_content)) { + if (!base::ReadFileToString(filename_, &file_content)) { LOG(WARNING) << "Failed to read " << filename_.value(); return false; } diff --git a/remoting/protocol/authenticator_test_base.cc b/remoting/protocol/authenticator_test_base.cc index 22b1047..8311476 100644 --- a/remoting/protocol/authenticator_test_base.cc +++ b/remoting/protocol/authenticator_test_base.cc @@ -47,11 +47,11 @@ void AuthenticatorTestBase::SetUp() { base::FilePath certs_dir(net::GetTestCertsDirectory()); base::FilePath cert_path = certs_dir.AppendASCII("unittest.selfsigned.der"); - ASSERT_TRUE(file_util::ReadFileToString(cert_path, &host_cert_)); + ASSERT_TRUE(base::ReadFileToString(cert_path, &host_cert_)); base::FilePath key_path = certs_dir.AppendASCII("unittest.key.bin"); std::string key_string; - ASSERT_TRUE(file_util::ReadFileToString(key_path, &key_string)); + ASSERT_TRUE(base::ReadFileToString(key_path, &key_string)); std::string key_base64; ASSERT_TRUE(base::Base64Encode(key_string, &key_base64)); key_pair_ = RsaKeyPair::FromString(key_base64); diff --git a/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc b/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc index f93658d..abf2880 100644 --- a/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc +++ b/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc @@ -58,11 +58,11 @@ class SslHmacChannelAuthenticatorTest : public testing::Test { base::FilePath certs_dir(net::GetTestCertsDirectory()); base::FilePath cert_path = certs_dir.AppendASCII("unittest.selfsigned.der"); - ASSERT_TRUE(file_util::ReadFileToString(cert_path, &host_cert_)); + ASSERT_TRUE(base::ReadFileToString(cert_path, &host_cert_)); base::FilePath key_path = certs_dir.AppendASCII("unittest.key.bin"); std::string key_string; - ASSERT_TRUE(file_util::ReadFileToString(key_path, &key_string)); + ASSERT_TRUE(base::ReadFileToString(key_path, &key_string)); std::string key_base64; base::Base64Encode(key_string, &key_base64); key_pair_ = RsaKeyPair::FromString(key_base64); diff --git a/sandbox/win/src/handle_inheritance_test.cc b/sandbox/win/src/handle_inheritance_test.cc index 5523a6c..6dceee6 100644 --- a/sandbox/win/src/handle_inheritance_test.cc +++ b/sandbox/win/src/handle_inheritance_test.cc @@ -40,8 +40,7 @@ TEST(HandleInheritanceTests, TestStdoutInheritance) { EXPECT_TRUE(::CloseHandle(file_handle)); std::string data; - EXPECT_TRUE(file_util::ReadFileToString(base::FilePath(temp_file_name), - &data)); + EXPECT_TRUE(base::ReadFileToString(base::FilePath(temp_file_name), &data)); // Redirection uses a feature that was added in Windows Vista. if (base::win::GetVersion() >= base::win::VERSION_VISTA) { EXPECT_EQ("Example output to stdout\r\n", data); diff --git a/skia/ext/vector_canvas_unittest.cc b/skia/ext/vector_canvas_unittest.cc index a087aed..b123633 100644 --- a/skia/ext/vector_canvas_unittest.cc +++ b/skia/ext/vector_canvas_unittest.cc @@ -86,7 +86,7 @@ class Image { // Creates the image from the given filename on disk. explicit Image(const base::FilePath& filename) : ignore_alpha_(true) { std::string compressed; - file_util::ReadFileToString(filename, &compressed); + base::ReadFileToString(filename, &compressed); EXPECT_TRUE(compressed.size()); SkBitmap bitmap; @@ -335,8 +335,7 @@ void LoadPngFileToSkBitmap(const base::FilePath& filename, SkBitmap* bitmap, bool is_opaque) { std::string compressed; - file_util::ReadFileToString(base::MakeAbsoluteFilePath(filename), - &compressed); + base::ReadFileToString(base::MakeAbsoluteFilePath(filename), &compressed); ASSERT_TRUE(compressed.size()); ASSERT_TRUE(gfx::PNGCodec::Decode( diff --git a/testing/android/native_test_util.cc b/testing/android/native_test_util.cc index c0ea7b0..ff2c47e 100644 --- a/testing/android/native_test_util.cc +++ b/testing/android/native_test_util.cc @@ -31,7 +31,7 @@ void ParseArgsFromCommandLineFile( const char* path, std::vector<std::string>* args) { base::FilePath command_line(path); std::string command_line_string; - if (file_util::ReadFileToString(command_line, &command_line_string)) { + if (base::ReadFileToString(command_line, &command_line_string)) { ParseArgsFromString(command_line_string, args); } } diff --git a/third_party/zlib/google/zip_reader_unittest.cc b/third_party/zlib/google/zip_reader_unittest.cc index 4fec4643..09efd9a 100644 --- a/third_party/zlib/google/zip_reader_unittest.cc +++ b/third_party/zlib/google/zip_reader_unittest.cc @@ -217,8 +217,8 @@ TEST_F(ZipReaderTest, ExtractCurrentEntryToFilePath_RegularFile) { test_dir_.AppendASCII("quux.txt"))); // Read the output file ans compute the MD5. std::string output; - ASSERT_TRUE(file_util::ReadFileToString(test_dir_.AppendASCII("quux.txt"), - &output)); + ASSERT_TRUE(base::ReadFileToString(test_dir_.AppendASCII("quux.txt"), + &output)); const std::string md5 = base::MD5String(output); const std::string kExpectedMD5 = "d1ae4ac8a17a0e09317113ab284b57a6"; EXPECT_EQ(kExpectedMD5, md5); @@ -238,8 +238,8 @@ TEST_F(ZipReaderTest, PlatformFileExtractCurrentEntryToFilePath_RegularFile) { test_dir_.AppendASCII("quux.txt"))); // Read the output file and compute the MD5. std::string output; - ASSERT_TRUE(file_util::ReadFileToString(test_dir_.AppendASCII("quux.txt"), - &output)); + ASSERT_TRUE(base::ReadFileToString(test_dir_.AppendASCII("quux.txt"), + &output)); const std::string md5 = base::MD5String(output); const std::string kExpectedMD5 = "d1ae4ac8a17a0e09317113ab284b57a6"; EXPECT_EQ(kExpectedMD5, md5); @@ -261,8 +261,8 @@ TEST_F(ZipReaderTest, PlatformFileExtractCurrentEntryToFd_RegularFile) { ASSERT_TRUE(reader.ExtractCurrentEntryToFd(out_fd_w.platform_file())); // Read the output file and compute the MD5. std::string output; - ASSERT_TRUE(file_util::ReadFileToString(test_dir_.AppendASCII("quux.txt"), - &output)); + ASSERT_TRUE(base::ReadFileToString(test_dir_.AppendASCII("quux.txt"), + &output)); const std::string md5 = base::MD5String(output); const std::string kExpectedMD5 = "d1ae4ac8a17a0e09317113ab284b57a6"; EXPECT_EQ(kExpectedMD5, md5); @@ -293,7 +293,7 @@ TEST_F(ZipReaderTest, ExtractCurrentEntryIntoDirectory_RegularFile) { ASSERT_TRUE(base::DirectoryExists(test_dir_.AppendASCII("foo/bar"))); // And the file should be created. std::string output; - ASSERT_TRUE(file_util::ReadFileToString( + ASSERT_TRUE(base::ReadFileToString( test_dir_.AppendASCII("foo/bar/quux.txt"), &output)); const std::string md5 = base::MD5String(output); const std::string kExpectedMD5 = "d1ae4ac8a17a0e09317113ab284b57a6"; @@ -423,7 +423,7 @@ TEST_F(ZipReaderTest, OpenFromString) { test_dir_.AppendASCII("test.txt"))); std::string actual; - ASSERT_TRUE(file_util::ReadFileToString( + ASSERT_TRUE(base::ReadFileToString( test_dir_.AppendASCII("test.txt"), &actual)); EXPECT_EQ(std::string("This is a test.\n"), actual); } diff --git a/tools/android/device_stats_monitor/device_stats_monitor.cc b/tools/android/device_stats_monitor/device_stats_monitor.cc index 6388cda..ef2fee9 100644 --- a/tools/android/device_stats_monitor/device_stats_monitor.cc +++ b/tools/android/device_stats_monitor/device_stats_monitor.cc @@ -44,8 +44,8 @@ class DeviceStatsMonitor { std::string out; while (record_) { out.clear(); - CHECK(file_util::ReadFileToString(io_stats_path, &out)); - CHECK(file_util::ReadFileToString(cpu_stats_path, &out)); + CHECK(base::ReadFileToString(io_stats_path, &out)); + CHECK(base::ReadFileToString(cpu_stats_path, &out)); samples_.push_back(out); usleep(sample_interval); } diff --git a/tools/gn/command_gyp.cc b/tools/gn/command_gyp.cc index 80b23cb..736f7e1 100644 --- a/tools/gn/command_gyp.cc +++ b/tools/gn/command_gyp.cc @@ -69,7 +69,7 @@ bool SimpleNinjaParse(const std::string& data, bool FixupBuildNinja(const BuildSettings* build_settings, const base::FilePath& buildfile) { std::string contents; - if (!file_util::ReadFileToString(buildfile, &contents)) { + if (!base::ReadFileToString(buildfile, &contents)) { Err(Location(), "Could not load " + FilePathToUTF8(buildfile)) .PrintToStdout(); return false; diff --git a/tools/gn/function_read_file.cc b/tools/gn/function_read_file.cc index af8bdb1..1067d9b 100644 --- a/tools/gn/function_read_file.cc +++ b/tools/gn/function_read_file.cc @@ -60,7 +60,7 @@ Value RunReadFile(Scope* scope, // Read contents. std::string file_contents; - if (!file_util::ReadFileToString(file_path, &file_contents)) { + if (!base::ReadFileToString(file_path, &file_contents)) { *err = Err(args[0], "Could not read file.", "I resolved this to \"" + FilePathToUTF8(file_path) + "\"."); return Value(); diff --git a/tools/gn/input_file.cc b/tools/gn/input_file.cc index 231dfbc..8e29798 100644 --- a/tools/gn/input_file.cc +++ b/tools/gn/input_file.cc @@ -21,7 +21,7 @@ void InputFile::SetContents(const std::string& c) { } bool InputFile::Load(const base::FilePath& system_path) { - if (file_util::ReadFileToString(system_path, &contents_)) { + if (base::ReadFileToString(system_path, &contents_)) { contents_loaded_ = true; physical_name_ = system_path; return true; diff --git a/ui/gfx/color_profile_win.cc b/ui/gfx/color_profile_win.cc index 51b1b31..2e08a36 100644 --- a/ui/gfx/color_profile_win.cc +++ b/ui/gfx/color_profile_win.cc @@ -21,7 +21,7 @@ void ReadColorProfile(std::vector<char>* profile) { if (!res) return; std::string profileData; - if (!file_util::ReadFileToString(base::FilePath(path), &profileData)) + if (!base::ReadFileToString(base::FilePath(path), &profileData)) return; size_t length = profileData.size(); if (length > gfx::kMaxProfileLength) diff --git a/ui/gfx/icon_util_unittest.cc b/ui/gfx/icon_util_unittest.cc index b1548ce..641422a 100644 --- a/ui/gfx/icon_util_unittest.cc +++ b/ui/gfx/icon_util_unittest.cc @@ -92,7 +92,7 @@ void IconUtilTest::CheckAllIconSizes(const base::FilePath& icon_filename, // Read the file completely into memory. std::string icon_data; - ASSERT_TRUE(file_util::ReadFileToString(icon_filename, &icon_data)); + ASSERT_TRUE(base::ReadFileToString(icon_filename, &icon_data)); ASSERT_GE(icon_data.length(), sizeof(IconUtil::ICONDIR)); // Ensure that it has exactly the expected number and sizes of icons, in the diff --git a/webkit/browser/fileapi/isolated_file_util_unittest.cc b/webkit/browser/fileapi/isolated_file_util_unittest.cc index fee8ed1..dd58a87 100644 --- a/webkit/browser/fileapi/isolated_file_util_unittest.cc +++ b/webkit/browser/fileapi/isolated_file_util_unittest.cc @@ -184,8 +184,8 @@ class IsolatedFileUtilTest : public testing::Test { EXPECT_NE(platform_path1, platform_path2); std::string content1, content2; - EXPECT_TRUE(file_util::ReadFileToString(platform_path1, &content1)); - EXPECT_TRUE(file_util::ReadFileToString(platform_path2, &content2)); + EXPECT_TRUE(base::ReadFileToString(platform_path1, &content1)); + EXPECT_TRUE(base::ReadFileToString(platform_path2, &content2)); EXPECT_EQ(content1, content2); } diff --git a/webkit/browser/fileapi/local_file_stream_writer_unittest.cc b/webkit/browser/fileapi/local_file_stream_writer_unittest.cc index bed037d..96b51fa 100644 --- a/webkit/browser/fileapi/local_file_stream_writer_unittest.cc +++ b/webkit/browser/fileapi/local_file_stream_writer_unittest.cc @@ -65,7 +65,7 @@ class LocalFileStreamWriterTest : public testing::Test { std::string GetFileContent(const base::FilePath& path) { std::string content; - file_util::ReadFileToString(path, &content); + base::ReadFileToString(path, &content); return content; } diff --git a/webkit/browser/fileapi/obfuscated_file_util_unittest.cc b/webkit/browser/fileapi/obfuscated_file_util_unittest.cc index c4f409f..6e87f08 100644 --- a/webkit/browser/fileapi/obfuscated_file_util_unittest.cc +++ b/webkit/browser/fileapi/obfuscated_file_util_unittest.cc @@ -2367,7 +2367,7 @@ TEST_F(ObfuscatedFileUtilTest, MigrationBackFromIsolated) { // Check we see the same contents in the new origin directory. std::string origin_db_data; EXPECT_TRUE(base::PathExists(origin_directory.AppendASCII("dummy"))); - EXPECT_TRUE(file_util::ReadFileToString( + EXPECT_TRUE(base::ReadFileToString( origin_directory.AppendASCII("dummy"), &origin_db_data)); EXPECT_EQ(kFakeDirectoryData, origin_db_data); } diff --git a/webkit/browser/fileapi/sandbox_isolated_origin_database_unittest.cc b/webkit/browser/fileapi/sandbox_isolated_origin_database_unittest.cc index 7eeab21..aad2c7e 100644 --- a/webkit/browser/fileapi/sandbox_isolated_origin_database_unittest.cc +++ b/webkit/browser/fileapi/sandbox_isolated_origin_database_unittest.cc @@ -76,7 +76,7 @@ TEST(SandboxIsolatedOriginDatabaseTest, MigrationTest) { base::FilePath directory_db_path = dir.path().Append(path); EXPECT_TRUE(base::DirectoryExists(directory_db_path)); EXPECT_TRUE(base::PathExists(directory_db_path.AppendASCII("dummy"))); - EXPECT_TRUE(file_util::ReadFileToString( + EXPECT_TRUE(base::ReadFileToString( directory_db_path.AppendASCII("dummy"), &origin_db_data)); EXPECT_EQ(kFakeDirectoryData, origin_db_data); diff --git a/webkit/support/test_webkit_platform_support.cc b/webkit/support/test_webkit_platform_support.cc index 276a10e..ae0a7e5 100644 --- a/webkit/support/test_webkit_platform_support.cc +++ b/webkit/support/test_webkit_platform_support.cc @@ -314,7 +314,7 @@ WebKit::WebData TestWebKitPlatformSupport::readFromFile( base::FilePath file_path = base::FilePath::FromUTF16Unsafe(path); std::string buffer; - file_util::ReadFileToString(file_path, &buffer); + base::ReadFileToString(file_path, &buffer); return WebKit::WebData(buffer.data(), buffer.size()); } |