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

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

Issue 98583002: Add Drive connection status info to chrome:drive-internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 3e261d048d3448ba073fca8bf13b0776cb153009..4b03612ec820c6eb6a9412807d827e751691f0fe 100644
--- a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
@@ -226,7 +226,7 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
// Updates respective sections.
void UpdateDriveRelatedFlagsSection();
void UpdateDriveRelatedPreferencesSection();
- void UpdateAuthStatusSection(
+ void UpdateConnectionStatusSection(
drive::DriveServiceInterface* drive_service);
void UpdateAboutResourceSection(
drive::DriveServiceInterface* drive_service);
@@ -427,7 +427,7 @@ void DriveInternalsWebUIHandler::OnPageLoaded(const base::ListValue* args) {
UpdateDriveRelatedFlagsSection();
UpdateDriveRelatedPreferencesSection();
- UpdateAuthStatusSection(drive_service);
+ UpdateConnectionStatusSection(drive_service);
UpdateAboutResourceSection(drive_service);
UpdateAppListSection(drive_service);
UpdateLocalMetadataSection(debug_info_collector);
@@ -496,17 +496,37 @@ void DriveInternalsWebUIHandler::UpdateDriveRelatedPreferencesSection() {
preferences);
}
-void DriveInternalsWebUIHandler::UpdateAuthStatusSection(
+void DriveInternalsWebUIHandler::UpdateConnectionStatusSection(
drive::DriveServiceInterface* drive_service) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(drive_service);
- base::DictionaryValue auth_status;
- auth_status.SetBoolean("has-refresh-token",
- drive_service->HasRefreshToken());
- auth_status.SetBoolean("has-access-token",
- drive_service->HasAccessToken());
- web_ui()->CallJavascriptFunction("updateAuthStatus", auth_status);
+ std::string status;
+ switch (drive::util::GetDriveConnectionStatus(Profile::FromWebUI(web_ui()))) {
+ case drive::util::DRIVE_DISCONNECTED_NOSERVICE:
+ status = "no service";
+ break;
+ case drive::util::DRIVE_DISCONNECTED_NONETWORK:
+ status = "no network";
+ break;
+ case drive::util::DRIVE_DISCONNECTED_NOTREADY:
+ status = "not ready";
+ break;
+ case drive::util::DRIVE_CONNECTED_METERED:
+ status = "metered";
+ break;
+ case drive::util::DRIVE_CONNECTED:
+ status = "connected";
+ break;
+ }
+
+ base::DictionaryValue connection_status;
+ connection_status.SetString("status", status);
+ connection_status.SetBoolean("has-refresh-token",
+ drive_service->HasRefreshToken());
+ connection_status.SetBoolean("has-access-token",
+ drive_service->HasAccessToken());
+ web_ui()->CallJavascriptFunction("updateConnectionStatus", connection_status);
}
void DriveInternalsWebUIHandler::UpdateAboutResourceSection(
« 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