diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-12 17:14:59 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-12 17:14:59 +0000 |
commit | cfaa1f2938c346d4801b895e7181f5de7d3755e6 (patch) | |
tree | 934967a90f94c5d50939929dd6ab38ad5dceed3e /net/disk_cache/cache_util_win.cc | |
parent | 1ee19742db740fb60ed78266039f65c93c85c836 (diff) | |
download | chromium_src-cfaa1f2938c346d4801b895e7181f5de7d3755e6.zip chromium_src-cfaa1f2938c346d4801b895e7181f5de7d3755e6.tar.gz chromium_src-cfaa1f2938c346d4801b895e7181f5de7d3755e6.tar.bz2 |
Start migrating the disk cache to using FilePath.
This converts BackendImpl to using FilePath.
BUG=24444
Review URL: http://codereview.chromium.org/261045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28711 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/cache_util_win.cc')
-rw-r--r-- | net/disk_cache/cache_util_win.cc | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/net/disk_cache/cache_util_win.cc b/net/disk_cache/cache_util_win.cc index 3a99836..46bffe8 100644 --- a/net/disk_cache/cache_util_win.cc +++ b/net/disk_cache/cache_util_win.cc @@ -39,26 +39,34 @@ void DeleteFiles(const wchar_t* path, const wchar_t* search_name) { namespace disk_cache { -bool MoveCache(const std::wstring& from_path, const std::wstring& to_path) { +bool MoveCache(const FilePath& from_path, const FilePath& to_path) { // I don't want to use the shell version of move because if something goes // wrong, that version will attempt to move file by file and fail at the end. - if (!MoveFileEx(from_path.c_str(), to_path.c_str(), 0)) { + if (!MoveFileEx(from_path.value().c_str(), to_path.value().c_str(), 0)) { LOG(ERROR) << "Unable to move the cache: " << GetLastError(); return false; } return true; } -void DeleteCache(const std::wstring& path, bool remove_folder) { - DeleteFiles(path.c_str(), L"*"); +void DeleteCache(const FilePath& path, bool remove_folder) { + DeleteFiles(path.value().c_str(), L"*"); if (remove_folder) - RemoveDirectory(path.c_str()); + RemoveDirectory(path.value().c_str()); } -bool DeleteCacheFile(const std::wstring& name) { +bool DeleteCacheFile(const FilePath& name) { // We do a simple delete, without ever falling back to SHFileOperation, as the // version from base does. - return DeleteFile(name.c_str()) ? true : false; + return DeleteFile(name.value().c_str()) ? true : false; +} + +void DeleteCache(const std::wstring& path, bool remove_folder) { + DeleteCache(FilePath::FromWStringHack(path), remove_folder); +} + +bool DeleteCacheFile(const std::wstring& name) { + return DeleteCacheFile(FilePath::FromWStringHack(name)); } } // namespace disk_cache |