Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: net/disk_cache/cache_util_posix.cc

Issue 261045: Start migrating the disk cache to using FilePath. (Closed)
Patch Set: rebase Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/disk_cache/cache_util.h ('k') | net/disk_cache/cache_util_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/disk_cache/cache_util.h" 5 #include "net/disk_cache/cache_util.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 10
11 namespace disk_cache { 11 namespace disk_cache {
12 12
13 bool MoveCache(const std::wstring& from_path, const std::wstring& to_path) { 13 bool MoveCache(const FilePath& from_path, const FilePath& to_path) {
14 // Just use the version from base. 14 // Just use the version from base.
15 return file_util::Move(from_path.c_str(), to_path.c_str()); 15 return file_util::Move(from_path, to_path);
16 } 16 }
17 17
18 void DeleteCache(const std::wstring& path, bool remove_folder) { 18 void DeleteCache(const FilePath& path, bool remove_folder) {
19 file_util::FileEnumerator iter(FilePath::FromWStringHack(path), 19 file_util::FileEnumerator iter(path,
20 /* recursive */ false, 20 /* recursive */ false,
21 file_util::FileEnumerator::FILES); 21 file_util::FileEnumerator::FILES);
22 for (FilePath file = iter.Next(); !file.value().empty(); file = iter.Next()) { 22 for (FilePath file = iter.Next(); !file.value().empty(); file = iter.Next()) {
23 if (!file_util::Delete(file, /* recursive */ false)) 23 if (!file_util::Delete(file, /* recursive */ false))
24 NOTREACHED(); 24 NOTREACHED();
25 } 25 }
26 26
27 if (remove_folder) { 27 if (remove_folder) {
28 if (!file_util::Delete(path, /* recursive */ false)) 28 if (!file_util::Delete(path, /* recursive */ false))
29 NOTREACHED(); 29 NOTREACHED();
30 } 30 }
31 } 31 }
32 32
33 bool DeleteCacheFile(const std::wstring& name) { 33 bool DeleteCacheFile(const FilePath& name) {
34 return file_util::Delete(name, false); 34 return file_util::Delete(name, false);
35 } 35 }
36 36
37 void DeleteCache(const std::wstring& path, bool remove_folder) {
38 DeleteCache(FilePath::FromWStringHack(path), remove_folder);
39 }
40
41 bool DeleteCacheFile(const std::wstring& name) {
42 return DeleteCacheFile(FilePath::FromWStringHack(name));
43 }
44
37 } // namespace disk_cache 45 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/cache_util.h ('k') | net/disk_cache/cache_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698