Index: chrome/browser/chromeos/gdata/gdata_cache.cc |
diff --git a/chrome/browser/chromeos/gdata/gdata_cache.cc b/chrome/browser/chromeos/gdata/gdata_cache.cc |
index 5c11ad95f6bbca6cfe46f627b4d3de540cbcd526..7558f7c0bcdbb1539d64d31b40e63c4d67c9d58e 100644 |
--- a/chrome/browser/chromeos/gdata/gdata_cache.cc |
+++ b/chrome/browser/chromeos/gdata/gdata_cache.cc |
@@ -228,6 +228,15 @@ void CollectExistingPinnedFile(std::vector<std::string>* resource_ids, |
resource_ids->push_back(resource_id); |
} |
+// Appends |resource_id| ID to |resource_ids| unconditionally. |
+void CollectAnyFile(std::vector<std::string>* resource_ids, |
+ const std::string& resource_id, |
+ const GDataCacheEntry& /* cache_entry */) { |
+ DCHECK(resource_ids); |
+ |
+ resource_ids->push_back(resource_id); |
+} |
+ |
// Runs callback with pointers dereferenced. |
// Used to implement SetMountedStateOnUIThread. |
void RunSetMountedStateCallback(const SetMountedStateCallback& callback, |
@@ -433,6 +442,21 @@ void GDataCache::GetResourceIdsOfExistingPinnedFilesOnUIThread( |
base::Owned(resource_ids))); |
} |
+void GDataCache::GetResourceIdsOfAllFilesOnUIThread( |
+ const GetResourceIdsCallback& callback) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ |
+ std::vector<std::string>* resource_ids = new std::vector<std::string>; |
+ blocking_task_runner_->PostTaskAndReply( |
+ FROM_HERE, |
+ base::Bind(&GDataCache::GetResourceIdsOfAllFiles, |
+ base::Unretained(this), |
+ resource_ids), |
+ base::Bind(&RunGetResourceIdsCallback, |
+ callback, |
+ base::Owned(resource_ids))); |
+} |
+ |
void GDataCache::FreeDiskSpaceIfNeededFor(int64 num_bytes, |
bool* has_enough_space) { |
AssertOnSequencedWorkerPool(); |
@@ -741,6 +765,14 @@ void GDataCache::GetResourceIdsOfExistingPinnedFiles( |
metadata_->Iterate(base::Bind(&CollectExistingPinnedFile, resource_ids)); |
} |
+void GDataCache::GetResourceIdsOfAllFiles( |
+ std::vector<std::string>* resource_ids) { |
+ AssertOnSequencedWorkerPool(); |
+ DCHECK(resource_ids); |
+ |
+ metadata_->Iterate(base::Bind(&CollectAnyFile, resource_ids)); |
+} |
+ |
void GDataCache::GetFile(const std::string& resource_id, |
const std::string& md5, |
GDataFileError* error, |