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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_system_service.cc

Issue 10823125: Drive: add a method to clear all local cache. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" 5 #include "chrome/browser/chromeos/gdata/gdata_system_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" 10 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // Shut down the member objects in the reverse order of creation. 96 // Shut down the member objects in the reverse order of creation.
97 contacts_service_.reset(); 97 contacts_service_.reset();
98 sync_client_.reset(); 98 sync_client_.reset();
99 download_observer_.reset(); 99 download_observer_.reset();
100 file_system_.reset(); 100 file_system_.reset();
101 webapps_registry_.reset(); 101 webapps_registry_.reset();
102 uploader_.reset(); 102 uploader_.reset();
103 documents_service_.reset(); 103 documents_service_.reset();
104 } 104 }
105 105
106 void GDataSystemService::ClearCacheAndResetOnUIThread() {
107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
108 RemoveDriveMountPoint();
109 docs_service()->CancelAll();
110 cache_->ClearAllOnUIThread(base::Bind(&GDataSystemService::ClearCacheAndReset,
111 base::Unretained(this)
satorux1 2012/08/01 20:50:31 please use weak_ptr.
yoshiki 2012/08/01 21:44:59 Done.
112 ));
113 }
114
115 void GDataSystemService::ClearCacheAndReset(
satorux1 2012/08/01 20:50:31 The function name doesn't seem to match with what
yoshiki 2012/08/01 21:44:59 Done.
116 GDataFileError error, const FilePath& file_path) {
satorux1 2012/08/01 20:50:31 shouldn't we check |error|?
yoshiki 2012/08/01 21:44:59 Done.
yoshiki 2012/08/01 23:07:58 I was wrong in the patchset #2 and |error| is not
117 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
118 AddDriveMountPoint();
119 }
120
106 void GDataSystemService::AddDriveMountPoint() { 121 void GDataSystemService::AddDriveMountPoint() {
107 if (!gdata::util::IsGDataAvailable(profile_)) 122 if (!gdata::util::IsGDataAvailable(profile_))
108 return; 123 return;
109 124
110 const FilePath mount_point = gdata::util::GetGDataMountPointPath(); 125 const FilePath mount_point = gdata::util::GetGDataMountPointPath();
111 fileapi::ExternalFileSystemMountPointProvider* provider = 126 fileapi::ExternalFileSystemMountPointProvider* provider =
112 BrowserContext::GetFileSystemContext(profile_)->external_provider(); 127 BrowserContext::GetFileSystemContext(profile_)->external_provider();
113 if (provider && !provider->HasMountPoint(mount_point)) { 128 if (provider && !provider->HasMountPoint(mount_point)) {
114 provider->AddRemoteMountPoint( 129 provider->AddRemoteMountPoint(
115 mount_point, 130 mount_point,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 g_test_cache_root ? FilePath(*g_test_cache_root) : 199 g_test_cache_root ? FilePath(*g_test_cache_root) :
185 GDataCache::GetCacheRootPath(profile); 200 GDataCache::GetCacheRootPath(profile);
186 delete g_test_cache_root; 201 delete g_test_cache_root;
187 g_test_cache_root = NULL; 202 g_test_cache_root = NULL;
188 203
189 service->Initialize(documents_service, cache_root); 204 service->Initialize(documents_service, cache_root);
190 return service; 205 return service;
191 } 206 }
192 207
193 } // namespace gdata 208 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698