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

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

Issue 10823125: Drive: add a method to clear all local cache. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: review fix (comment #12) Created 8 years, 4 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 125d2ac986057a61d9d6da37a81e8ebebc0caa2b..c9eb8d449ae7550f6c7c71d32de2868a053ba45a 100644
--- a/chrome/browser/chromeos/gdata/gdata_cache.h
+++ b/chrome/browser/chromeos/gdata/gdata_cache.h
@@ -30,9 +30,10 @@ namespace gdata {
class GDataCacheEntry;
class GDataCacheMetadata;
-// Callback for SetMountedStateOnUIThread.
+// Callback for SetMountedStateOnUIThread and ClearAllOnUIThread.
typedef base::Callback<void(GDataFileError error,
- const FilePath& file_path)> SetMountedStateCallback;
+ const FilePath& file_path)>
+ ChangeCacheStateCallback;
// Callback for completion of cache operation.
typedef base::Callback<void(GDataFileError error,
@@ -229,7 +230,7 @@ class GDataCache {
// |dest_path| is the mounted path and |source_path| the unmounted path.
void SetMountedStateOnUIThread(const FilePath& file_path,
bool to_mount,
- const SetMountedStateCallback& callback);
+ const ChangeCacheStateCallback& callback);
// Modifies cache state, which involves the following:
// - moves |source_path| to |dest_path| in persistent dir, where
@@ -263,6 +264,11 @@ class GDataCache {
void RemoveOnUIThread(const std::string& resource_id,
const CacheOperationCallback& callback);
+ // Does the following:
+ // - remove all the files in the cache directory.
+ // - re-create the |metadata_| instance.
+ void ClearAllOnUIThread(const ChangeCacheStateCallback& callback);
+
// Utility method to call Initialize on UI thread.
void RequestInitializeOnUIThread();
@@ -396,6 +402,9 @@ class GDataCache {
void Remove(const std::string& resource_id,
GDataFileError* error);
+ // Used to implement ClearAllUIThread.
+ void ClearAll(GDataFileError* error);
+
// Runs callback and notifies the observers when file is pinned.
void OnPinned(GDataFileError* error,
const std::string& resource_id,
« no previous file with comments | « chrome/browser/chromeos/extensions/file_browser_event_router.cc ('k') | chrome/browser/chromeos/gdata/gdata_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698