Chromium Code Reviews| 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 4e615dfd12ad6dd509bfc2eba54b4ab790a5bb46..a8995b029f173ab58b0f9a59634aea18e9ccf58e 100644 |
| --- a/chrome/browser/chromeos/gdata/gdata_cache.h |
| +++ b/chrome/browser/chromeos/gdata/gdata_cache.h |
| @@ -122,9 +122,9 @@ class GDataCache { |
| CacheEntry(const std::string& md5, |
| CacheSubDirectoryType sub_dir_type, |
| int cache_state) |
| - : md5(md5), |
| - sub_dir_type(sub_dir_type), |
| - cache_state(cache_state) { |
| + : md5(md5), |
| + sub_dir_type(sub_dir_type), |
| + cache_state(cache_state) { |
| } |
| bool IsPresent() const { return IsCachePresent(cache_state); } |
| @@ -140,6 +140,16 @@ class GDataCache { |
| int cache_state; |
| }; |
| + // Callback for GetCacheEntryOnUIThread. |
| + // |success| indicates if the operation was successful. |
| + // |cache_entry| is the obtained cache entry. |
| + // |
| + // TODO(satorux): Unlike other callback types, this has to be defined |
| + // inside GDataCache as CacheEntry is inside GDataCache. We should get them |
| + // outside of GDataCache. |
|
hshi1
2012/06/28 22:11:21
Maybe gdata_params.h is a good place to define cal
satorux1
2012/06/28 22:41:17
Well, I plan to get rid of gdata_params.h. Callbac
|
| + typedef base::Callback<void(bool success, const CacheEntry& cache_entry)> |
| + GetCacheEntryCallback; |
| + |
| static bool IsCachePresent(int cache_state) { |
| return cache_state & CACHE_STATE_PRESENT; |
| } |
| @@ -205,6 +215,15 @@ class GDataCache { |
| // Must be called on UI thread. |
| void RemoveObserver(Observer* observer); |
| + // Gets the cache entry by the given resource ID and MD5. |
| + // See also GetCacheEntry(). |
| + // |
| + // Must be called on UI thread. |callback| is run on UI thread. |
| + void GetCacheEntryOnUIThread( |
| + const std::string& resource_id, |
| + const std::string& md5, |
| + const GetCacheEntryCallback& callback); |
| + |
| // Gets the resource IDs of pinned-but-not-fetched files and |
| // dirty-but-not-uploaded files. |
| // |
| @@ -418,6 +437,12 @@ class GDataCache { |
| const std::string& md5, |
| const CacheOperationCallback& callback); |
| + // Helper function to implement GetCacheEntryOnUIThread(). |
| + void GetCacheEntryHelper(const std::string& resource_id, |
| + const std::string& md5, |
| + bool* success, |
| + GDataCache::CacheEntry* cache_entry); |
| + |
| // The root directory of the cache (i.e. <user_profile_dir>/GCache/v1). |
| const FilePath cache_root_path_; |
| // Paths for all subdirectories of GCache, one for each |