diff options
-rw-r--r-- | base/file_util.cc | 13 | ||||
-rw-r--r-- | base/file_util_deprecated.h | 3 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_database_unittest.cc | 4 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_host.cc | 11 |
4 files changed, 7 insertions, 24 deletions
diff --git a/base/file_util.cc b/base/file_util.cc index d2e6575..95f334e 100644 --- a/base/file_util.cc +++ b/base/file_util.cc @@ -391,25 +391,12 @@ std::wstring GetFileExtensionFromPath(const std::wstring& path) { return UTF8ToWide(extension); #endif } -bool GetFileInfo(const std::wstring& file_path, FileInfo* results) { - return GetFileInfo(FilePath::FromWStringHack(file_path), results); -} std::wstring GetFilenameFromPath(const std::wstring& path) { if (path.empty() || EndsWithSeparator(path)) return std::wstring(); return FilePath::FromWStringHack(path).BaseName().ToWStringHack(); } -bool GetFileSize(const std::wstring& file_path, int64* file_size) { - return GetFileSize(FilePath::FromWStringHack(file_path), file_size); -} -bool GetTempDir(std::wstring* path_str) { - FilePath path; - if (!GetTempDir(&path)) - return false; - *path_str = path.ToWStringHack(); - return true; -} FILE* OpenFile(const std::wstring& filename, const char* mode) { return OpenFile(FilePath::FromWStringHack(filename), mode); } diff --git a/base/file_util_deprecated.h b/base/file_util_deprecated.h index 59f8d82..9fad79c 100644 --- a/base/file_util_deprecated.h +++ b/base/file_util_deprecated.h @@ -45,9 +45,6 @@ bool Delete(const std::wstring& path, bool recursive); bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path, bool recursive); bool ReadFileToString(const std::wstring& path, std::string* contents); -bool GetTempDir(std::wstring* path); -bool GetFileSize(const std::wstring& file_path, int64* file_size); -bool GetFileInfo(const std::wstring& file_path, FileInfo* info); FILE* OpenFile(const std::string& filename, const char* mode); FILE* OpenFile(const std::wstring& filename, const char* mode); int ReadFile(const std::wstring& filename, char* data, int size); diff --git a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc index ea4a7684..c4ff493 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc @@ -1100,7 +1100,7 @@ void UpdateDatabase(const FilePath& initial_db, file_util::FileEnumerator file_enum(data_dir, false, file_util::FileEnumerator::FILES); while (true) { - std::wstring file = file_enum.Next().ToWStringHack(); + FilePath file = file_enum.Next(); if (file.empty()) break; @@ -1120,7 +1120,7 @@ void UpdateDatabase(const FilePath& initial_db, &re_key, info.chunks); CHECK(result); - info.listname = WideToASCII(file_util::GetFilenameFromPath(file)); + info.listname = WideToASCII(file.BaseName().ToWStringHack()); size_t index = info.listname.find('_'); // Get rid fo the _s or _a. info.listname.resize(index); info.listname.erase(0, 3); // Get rid of the 000 etc. diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc index 9724cd2..3cd13bd 100644 --- a/webkit/glue/plugins/plugin_host.cc +++ b/webkit/glue/plugins/plugin_host.cc @@ -438,20 +438,19 @@ static NPError PostURLNotify(NPP id, return NPERR_FILE_NOT_FOUND; std::string file_path_ascii(buf); - std::wstring file_path; + FilePath file_path; static const char kFileUrlPrefix[] = "file:"; if (StartsWithASCII(file_path_ascii, kFileUrlPrefix, false)) { GURL file_url(file_path_ascii); DCHECK(file_url.SchemeIsFile()); - FilePath path; - net::FileURLToFilePath(file_url, &path); - file_path = path.ToWStringHack(); + net::FileURLToFilePath(file_url, &file_path); } else { - file_path = base::SysNativeMBToWide(file_path_ascii); + file_path = FilePath::FromWStringHack( + base::SysNativeMBToWide(file_path_ascii)); } file_util::FileInfo post_file_info = {0}; - if (!file_util::GetFileInfo(file_path.c_str(), &post_file_info) || + if (!file_util::GetFileInfo(file_path, &post_file_info) || post_file_info.is_directory) return NPERR_FILE_NOT_FOUND; |