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( |