Make USB permissions work in the new permission message system
[chromium-blink-merge.git] / net / disk_cache / cache_util.h
blobc4baa2d6110f4200817f014090508dd49b4ebe3e
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_DISK_CACHE_CACHE_UTIL_H_
6 #define NET_DISK_CACHE_CACHE_UTIL_H_
8 #include "base/basictypes.h"
9 #include "net/base/net_export.h"
10 #include "net/disk_cache/disk_cache.h"
12 namespace base {
13 class FilePath;
16 namespace disk_cache {
18 // Moves the cache files from the given path to another location.
19 // Fails if the destination exists already, or if it doesn't have
20 // permission for the operation. This is basically a rename operation
21 // for the cache directory. Returns true if successful. On ChromeOS,
22 // this moves the cache contents, and leaves the empty cache
23 // directory.
24 NET_EXPORT_PRIVATE bool MoveCache(const base::FilePath& from_path,
25 const base::FilePath& to_path);
27 // Deletes the cache files stored on |path|, and optionally also attempts to
28 // delete the folder itself.
29 NET_EXPORT_PRIVATE void DeleteCache(const base::FilePath& path,
30 bool remove_folder);
32 // Deletes a cache file.
33 NET_EXPORT_PRIVATE bool DeleteCacheFile(const base::FilePath& name);
35 // Renames cache directory synchronously and fires off a background cleanup
36 // task. Used by cache creator itself or by backends for self-restart on error.
37 bool DelayedCacheCleanup(const base::FilePath& full_path);
39 // Returns the preferred max cache size given the available disk space.
40 NET_EXPORT_PRIVATE int PreferredCacheSize(int64 available);
42 // The default cache size should not ideally be exposed, but the blockfile
43 // backend uses it for reasons that include testing.
44 NET_EXPORT_PRIVATE extern const int kDefaultCacheSize;
46 } // namespace disk_cache
48 #endif // NET_DISK_CACHE_CACHE_UTIL_H_