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

Unified Diff: chrome/browser/ui/webui/chromeos/drive_internals_ui.cc

Issue 59083013: Add 'Clear local data and reload' button in chrome:drive-internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments (#2). Created 7 years, 1 month 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
« no previous file with comments | « chrome/browser/resources/chromeos/drive_internals.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
diff --git a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
index cd009b09df0f59d3bed3954c0cbb08bfafc6c313..8e110c43163e6e16cab9f26a12c0169c86139f8a 100644
--- a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
@@ -286,11 +286,15 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
// Called when the page requests periodic update.
void OnPeriodicUpdate(const base::ListValue* args);
+ // Called when the corresponding button on the page is pressed.
void ClearAccessToken(const base::ListValue* args);
void ClearRefreshToken(const base::ListValue* args);
-
+ void ReloadDriveFileSystem(const base::ListValue* args);
void ListFileEntries(const base::ListValue* args);
+ // Called after file system reload for ReloadDriveFileSystem is done.
+ void ReloadFinished(bool success);
+
// The last event sent to the JavaScript side.
int last_sent_event_id_;
@@ -370,6 +374,10 @@ void DriveInternalsWebUIHandler::RegisterMessages() {
base::Bind(&DriveInternalsWebUIHandler::ClearRefreshToken,
weak_ptr_factory_.GetWeakPtr()));
web_ui()->RegisterMessageCallback(
+ "reloadDriveFileSystem",
+ base::Bind(&DriveInternalsWebUIHandler::ReloadDriveFileSystem,
+ weak_ptr_factory_.GetWeakPtr()));
+ web_ui()->RegisterMessageCallback(
"listFileEntries",
base::Bind(&DriveInternalsWebUIHandler::ListFileEntries,
weak_ptr_factory_.GetWeakPtr()));
@@ -559,6 +567,26 @@ void DriveInternalsWebUIHandler::ClearRefreshToken(
drive_service->ClearRefreshToken();
}
+void DriveInternalsWebUIHandler::ReloadDriveFileSystem(
+ const base::ListValue* args) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ drive::DriveIntegrationService* integration_service =
+ GetIntegrationService();
+ if (integration_service) {
+ integration_service->ClearCacheAndRemountFileSystem(
+ base::Bind(&DriveInternalsWebUIHandler::ReloadFinished,
+ weak_ptr_factory_.GetWeakPtr()));
+ }
+}
+
+void DriveInternalsWebUIHandler::ReloadFinished(bool success) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ web_ui()->CallJavascriptFunction("updateReloadStatus",
+ base::FundamentalValue(success));
+}
+
void DriveInternalsWebUIHandler::ListFileEntries(const base::ListValue* args) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
« no previous file with comments | « chrome/browser/resources/chromeos/drive_internals.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698