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

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

Issue 10692154: gdata: Remove IsCache/SetCache/ClearCache* functions from GDataCache (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
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 217de686ce2b25550f654878f17e7bf1a5a4bd14..9984062a00150164310e63f5b15b8170608584f6 100644
--- a/chrome/browser/chromeos/gdata/gdata_cache.h
+++ b/chrome/browser/chromeos/gdata/gdata_cache.h
@@ -129,11 +129,42 @@ class GDataCache {
cache_state(cache_state) {
}
- bool IsPresent() const { return IsCachePresent(cache_state); }
- bool IsPinned() const { return IsCachePinned(cache_state); }
- bool IsDirty() const { return IsCacheDirty(cache_state); }
- bool IsMounted() const { return IsCacheMounted(cache_state); }
- bool IsPersistent() const { return IsCachePersistent(cache_state); }
+ // Returns true if the file is present locally.
+ bool IsPresent() const { return cache_state & CACHE_STATE_PRESENT; }
+
+ // Returns true if the file is pinned (i.e. available offline).
+ bool IsPinned() const { return cache_state & CACHE_STATE_PINNED; }
+
+ // Returns true if the file is dirty (i.e. modified locally).
+ bool IsDirty() const { return cache_state & CACHE_STATE_DIRTY; }
+
+ // Returns true if the file is a mounted archive file.
+ bool IsMounted() const { return cache_state & CACHE_STATE_MOUNTED; }
+
+ // Returns true if the file is in the persistent directory.
+ bool IsPersistent() const { return cache_state & CACHE_STATE_PERSISTENT; }
+
+ // Setters for the states describe above.
+ void SetPresent(bool value) {
+ cache_state = (value ? cache_state |= CACHE_STATE_PRESENT :
+ cache_state &= ~CACHE_STATE_PRESENT);
+ }
+ void SetPinned(bool value) {
+ cache_state = (value ? cache_state |= CACHE_STATE_PINNED :
+ cache_state &= ~CACHE_STATE_PINNED);
+ }
+ void SetDirty(bool value) {
+ cache_state = (value ? cache_state |= CACHE_STATE_DIRTY :
+ cache_state &= ~CACHE_STATE_DIRTY);
+ }
+ void SetMounted(bool value) {
+ cache_state = (value ? cache_state |= CACHE_STATE_MOUNTED :
+ cache_state &= ~CACHE_STATE_MOUNTED);
+ }
+ void SetPersistent(bool value) {
+ cache_state = (value ? cache_state |= CACHE_STATE_PERSISTENT :
+ cache_state &= ~CACHE_STATE_PERSISTENT);
+ }
// Returns the type of the sub directory where the cache file is stored.
CacheSubDirectoryType GetSubDirectoryType() const {
@@ -158,52 +189,6 @@ class GDataCache {
typedef base::Callback<void(bool success, const CacheEntry& cache_entry)>
GetCacheEntryCallback;
- static bool IsCachePresent(int cache_state) {
- return cache_state & CACHE_STATE_PRESENT;
- }
- static bool IsCachePinned(int cache_state) {
- return cache_state & CACHE_STATE_PINNED;
- }
- static bool IsCacheDirty(int cache_state) {
- return cache_state & CACHE_STATE_DIRTY;
- }
- static bool IsCacheMounted(int cache_state) {
- return cache_state & CACHE_STATE_MOUNTED;
- }
- static bool IsCachePersistent(int cache_state) {
- return cache_state & CACHE_STATE_PERSISTENT;
- }
- static int SetCachePresent(int cache_state) {
- return cache_state |= CACHE_STATE_PRESENT;
- }
- static int SetCachePinned(int cache_state) {
- return cache_state |= CACHE_STATE_PINNED;
- }
- static int SetCacheDirty(int cache_state) {
- return cache_state |= CACHE_STATE_DIRTY;
- }
- static int SetCacheMounted(int cache_state) {
- return cache_state |= CACHE_STATE_MOUNTED;
- }
- static int SetCachePersistent(int cache_state) {
- return cache_state |= CACHE_STATE_PERSISTENT;
- }
- static int ClearCachePresent(int cache_state) {
- return cache_state &= ~CACHE_STATE_PRESENT;
- }
- static int ClearCachePinned(int cache_state) {
- return cache_state &= ~CACHE_STATE_PINNED;
- }
- static int ClearCacheDirty(int cache_state) {
- return cache_state &= ~CACHE_STATE_DIRTY;
- }
- static int ClearCacheMounted(int cache_state) {
- return cache_state &= ~CACHE_STATE_MOUNTED;
- }
- static int ClearCachePersistent(int cache_state) {
- return cache_state &= ~CACHE_STATE_PERSISTENT;
- }
-
// Returns the sub-directory under gdata cache directory for the given sub
// directory type. Example: <user_profile_dir>/GCache/v1/tmp
//
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_cache.cc » ('j') | chrome/browser/chromeos/gdata/gdata_cache.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698