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

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

Issue 10698157: gdata: Make GDataCache::CacheEntry a struct (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
« 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 b18d38ae9d9adb9395fda4974484b59a1c9af5c3..22da09cd0f00f82ef7fdff9f928b792f9a0c193c 100644
--- a/chrome/browser/chromeos/gdata/gdata_cache.h
+++ b/chrome/browser/chromeos/gdata/gdata_cache.h
@@ -119,60 +119,71 @@ class GDataCache {
};
// Structure to store information of an existing cache file.
- struct CacheEntry {
- CacheEntry() : cache_state(CACHE_STATE_NONE) {}
+ class CacheEntry {
+ public:
+ CacheEntry() : cache_state_(CACHE_STATE_NONE) {}
CacheEntry(const std::string& md5,
int cache_state)
- : md5(md5),
- cache_state(cache_state) {
+ : md5_(md5),
+ cache_state_(cache_state) {
}
+ // The MD5 of the cache file. This can be "local" if the file is
+ // locally modified.
+ const std::string& md5() const { return md5_; }
+
+ // The cache state represented as a bit-field of GDataCacheState.
+ int cache_state() const { return cache_state_; }
+
+ void set_md5(const std::string& md5) { md5_ = md5; }
+ void set_cache_state(int cache_state) { cache_state_ = cache_state; }
+
// Returns true if the file is present locally.
- bool IsPresent() const { return cache_state & CACHE_STATE_PRESENT; }
+ 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; }
+ 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; }
+ 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; }
+ 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; }
+ bool IsPersistent() const { return cache_state_ & CACHE_STATE_PERSISTENT; }
// Setters for the states describe above.
void SetPresent(bool value) {
if (value)
- cache_state |= CACHE_STATE_PRESENT;
+ cache_state_ |= CACHE_STATE_PRESENT;
else
- cache_state &= ~CACHE_STATE_PRESENT;
+ cache_state_ &= ~CACHE_STATE_PRESENT;
}
void SetPinned(bool value) {
if (value)
- cache_state |= CACHE_STATE_PINNED;
+ cache_state_ |= CACHE_STATE_PINNED;
else
- cache_state &= ~CACHE_STATE_PINNED;
+ cache_state_ &= ~CACHE_STATE_PINNED;
}
void SetDirty(bool value) {
if (value)
- cache_state |= CACHE_STATE_DIRTY;
+ cache_state_ |= CACHE_STATE_DIRTY;
else
- cache_state &= ~CACHE_STATE_DIRTY;
+ cache_state_ &= ~CACHE_STATE_DIRTY;
}
void SetMounted(bool value) {
if (value)
- cache_state |= CACHE_STATE_MOUNTED;
+ cache_state_ |= CACHE_STATE_MOUNTED;
else
- cache_state &= ~CACHE_STATE_MOUNTED;
+ cache_state_ &= ~CACHE_STATE_MOUNTED;
}
void SetPersistent(bool value) {
if (value)
- cache_state |= CACHE_STATE_PERSISTENT;
+ cache_state_ |= CACHE_STATE_PERSISTENT;
else
- cache_state &= ~CACHE_STATE_PERSISTENT;
+ cache_state_ &= ~CACHE_STATE_PERSISTENT;
}
// Returns the type of the sub directory where the cache file is stored.
@@ -183,8 +194,9 @@ class GDataCache {
// For debugging purposes.
std::string ToString() const;
- std::string md5;
- int cache_state;
+ private:
+ std::string md5_;
+ int cache_state_;
};
// Callback for GetCacheEntryOnUIThread.
« 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