drive: Remove FileCacheObserver
FileSystem::Pin()/Unpin() calls SyncClient methods directly
BUG=247274
TEST=unit_tests
Review URL: https://chromiumcodereview.appspot.com/16318004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205803 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/chromeos/drive/sync_client.cc b/chrome/browser/chromeos/drive/sync_client.cc
index 42064d8..aa29172 100644
--- a/chrome/browser/chromeos/drive/sync_client.cc
+++ b/chrome/browser/chromeos/drive/sync_client.cc
@@ -78,15 +78,10 @@
delay_(base::TimeDelta::FromSeconds(kDelaySeconds)),
weak_ptr_factory_(this) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(cache);
-
- cache_->AddObserver(this);
}
SyncClient::~SyncClient() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- cache_->RemoveObserver(this);
}
void SyncClient::StartProcessingBacklog() {
@@ -110,40 +105,19 @@
base::Bind(&base::DoNothing));
}
-std::vector<std::string> SyncClient::GetResourceIdsForTesting(
- SyncType sync_type) const {
- switch (sync_type) {
- case FETCH:
- return std::vector<std::string>(fetch_list_.begin(), fetch_list_.end());
- case UPLOAD:
- return std::vector<std::string>(upload_list_.begin(), upload_list_.end());
- }
- NOTREACHED();
- return std::vector<std::string>();
-}
-
-void SyncClient::OnCachePinned(const std::string& resource_id,
- const std::string& md5) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- AddTaskToQueue(FETCH, resource_id);
-}
-
-void SyncClient::OnCacheUnpinned(const std::string& resource_id,
- const std::string& md5) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- // Remove the resource_id if it's in the queue. This can happen if the
- // user cancels pinning before the file is fetched.
- pending_fetch_list_.erase(resource_id);
-}
-
void SyncClient::AddFetchTask(const std::string& resource_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
AddTaskToQueue(FETCH, resource_id);
}
+void SyncClient::RemoveFetchTask(const std::string& resource_id) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ // TODO(kinaba): Cancel tasks in JobScheduler as well. crbug.com/248856
+ pending_fetch_list_.erase(resource_id);
+}
+
void SyncClient::AddUploadTask(const std::string& resource_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));