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

Unified 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: Fix reviews and remove back the DCHECK in AddBackDrivemountPoint(). Created 8 years, 5 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_system_service.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_system_service.cc b/chrome/browser/chromeos/gdata/gdata_system_service.cc
index cdf10bf572e98391cd9ebc0e212f36965206f5d5..72727dbb5e0f149f33cab5bec47599f9d6acb341 100644
--- a/chrome/browser/chromeos/gdata/gdata_system_service.cc
+++ b/chrome/browser/chromeos/gdata/gdata_system_service.cc
@@ -39,7 +39,8 @@ const std::string* g_test_cache_root = NULL;
GDataSystemService::GDataSystemService(Profile* profile)
: profile_(profile),
- cache_(NULL) {
+ cache_(NULL),
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
base::SequencedWorkerPool* blocking_pool = BrowserThread::GetBlockingPool();
blocking_task_runner_ = blocking_pool->GetSequencedTaskRunner(
@@ -103,6 +104,24 @@ void GDataSystemService::Shutdown() {
documents_service_.reset();
}
+void GDataSystemService::ClearCache() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ RemoveDriveMountPoint();
+ docs_service()->CancelAll();
+ cache_->ClearAllOnUIThread(
+ base::Bind(&GDataSystemService::AddBackDriveMountPoint,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void GDataSystemService::AddBackDriveMountPoint(
+ GDataFileError error, const FilePath& file_path) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ // TODO(yoshiki): Notify to user when |error| != GDATA_FILE_OK.
satorux1 2012/08/02 01:03:21 Hmm, would it be difficult to do this now?
yoshiki 2012/08/02 07:12:11 We need to think how to notify the failure to JS-s
+ AddDriveMountPoint();
+}
+
void GDataSystemService::AddDriveMountPoint() {
if (!gdata::util::IsGDataAvailable(profile_))
return;

Powered by Google App Engine
This is Rietveld 408576698