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

Unified Diff: chrome/browser/chromeos/gdata/gdata_cache.h

Issue 10545084: Move chromeos::GDataFileSystem::GetCacheDirectoryPath and GetCacheFilePath implementation to GDataC… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/gdata/gdata_cache.h
diff --git a/chrome/browser/chromeos/gdata/gdata_cache.h b/chrome/browser/chromeos/gdata/gdata_cache.h
index b9c2a014646f8c6f1d0bcb0acb1887365510d076..6f5e866eb8399c2980c203ad09585974c894e14d 100644
--- a/chrome/browser/chromeos/gdata/gdata_cache.h
+++ b/chrome/browser/chromeos/gdata/gdata_cache.h
@@ -9,6 +9,7 @@
#include <map>
#include <string>
+#include "base/file_path.h"
#include "base/memory/scoped_ptr.h"
namespace gdata {
@@ -42,6 +43,15 @@ class GDataCache {
CACHE_STATE_MOUNTED = 0x1 << 3,
};
+ // Enum defining origin of a cached file.
+ enum CachedFileOrigin {
+ CACHED_FILE_FROM_SERVER = 0,
+ CACHED_FILE_LOCALLY_MODIFIED,
+ CACHED_FILE_MOUNTED,
+ };
+
+ static const char kMountedArchiveFileExtension[];
+
// Structure to store information of an existing cache file.
struct CacheEntry {
CacheEntry(const std::string& md5,
@@ -107,15 +117,28 @@ class GDataCache {
virtual ~GDataCache();
+ // Returns the sub-directory under gdata cache directory for the given sub
+ // directory type. Example: <user_profile_dir>/GCache/v1/tmp
+ FilePath GetCacheDirectoryPath(CacheSubDirectoryType sub_dir_type) const;
satorux1 2012/06/08 15:10:54 The class used to be a pure interface class where
+
+ // Returns absolute path of the file if it were cached or to be cached.
+ FilePath GetCacheFilePath(const std::string& resource_id,
+ const std::string& md5,
+ CacheSubDirectoryType sub_dir_type,
+ CachedFileOrigin file_orign) const;
+
+ // TODO(hashimoto): Remove this method when crbug.com/131756 is fixed.
+ const std::vector<FilePath>& cache_paths() const { return cache_paths_; }
+
// Sets |cache_map_| data member to formal parameter |new_cache_map|.
virtual void SetCacheMap(const CacheMap& new_cache_map) = 0;
// Updates cache map with entry corresponding to |resource_id|.
// Creates new entry if it doesn't exist, otherwise update the entry.
virtual void UpdateCache(const std::string& resource_id,
- const std::string& md5,
- CacheSubDirectoryType subdir,
- int cache_state) = 0;
+ const std::string& md5,
+ CacheSubDirectoryType subdir,
+ int cache_state) = 0;
// Removes entry corresponding to |resource_id| from cache map.
virtual void RemoveFromCache(const std::string& resource_id) = 0;
@@ -132,12 +155,17 @@ class GDataCache {
virtual void RemoveTemporaryFiles() = 0;
// Factory methods for GDataCache.
- static scoped_ptr<GDataCache> CreateGDataCache();
+ static scoped_ptr<GDataCache> CreateGDataCache(
+ const FilePath& cache_root_path);
protected:
- GDataCache();
+ explicit GDataCache(const FilePath& cache_root_path);
private:
+ // Paths for all subdirectories of GCache, one for each
+ // GDataCache::CacheSubDirectoryType enum.
+ std::vector<FilePath> cache_paths_;
+
DISALLOW_COPY_AND_ASSIGN(GDataCache);
};
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698