Chromium Code Reviews| 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 fa50cc857adc8a7fdfe78b619b0a2b0b09f81066..49613af578a49ff139d3f7db2ce4223a5c0f417a 100644 |
| --- a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc |
| +++ b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc |
| @@ -18,6 +18,7 @@ |
| #include "chrome/browser/chromeos/gdata/gdata_file_system_interface.h" |
| #include "chrome/browser/chromeos/gdata/gdata_system_service.h" |
| #include "chrome/browser/chromeos/gdata/gdata_util.h" |
| +#include "chrome/browser/chromeos/gdata/operation_registry.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
| #include "chrome/common/url_constants.h" |
| @@ -196,6 +197,10 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler { |
| // Called when GetFreeDiskSpace() is complete. |
| void OnGetFreeDiskSpace(base::DictionaryValue* local_storage_summary); |
| + // Updates the summary about in-flight operations. |
| + void UpdateInFlightOperations( |
| + const gdata::DriveServiceInterface* drive_service); |
| + |
| // The number of pending ReadDirectoryByPath() calls. |
| int num_pending_reads_; |
| base::WeakPtrFactory<DriveInternalsWebUIHandler> weak_ptr_factory_; |
| @@ -233,6 +238,9 @@ void DriveInternalsWebUIHandler::OnPageLoaded(const base::ListValue* args) { |
| drive_service->HasAccessToken()); |
| web_ui()->CallJavascriptFunction("updateAuthStatus", auth_status); |
| + // Update information about in-flight operations. |
| + UpdateInFlightOperations(drive_service); |
|
satorux1
2012/08/22 20:20:02
as mentioned in .js file, I think we should update
Haruki Sato
2012/08/24 19:06:11
Done.
|
| + |
| // Start updating the GCache contents section. |
| Profile* profile = Profile::FromWebUI(web_ui()); |
| const FilePath root_path = |
| @@ -376,6 +384,36 @@ void DriveInternalsWebUIHandler::OnGetFreeDiskSpace( |
| "updateLocalStorageUsage", *local_storage_summary); |
| } |
| +void DriveInternalsWebUIHandler::UpdateInFlightOperations( |
| + const gdata::DriveServiceInterface* drive_service) { |
| + std::vector<gdata::OperationRegistry::ProgressStatus> |
| + progress_status_list = drive_service->operation_registry()-> |
| + GetProgressStatusList(); |
| + |
| + base::ListValue in_flight_operations; |
| + for (std::vector<gdata::OperationRegistry::ProgressStatus>::iterator i |
| + = progress_status_list.begin(); |
| + i != progress_status_list.end(); ++i) { |
| + base::DictionaryValue* status = new DictionaryValue; |
| + status->SetInteger("operation_id", i->operation_id); |
| + status->SetString( |
| + "operation_type", |
| + gdata::OperationRegistry::OperationTypeToString(i->operation_type)); |
| + status->SetString("file_path", i->file_path.AsUTF8Unsafe()); |
| + status->SetString( |
| + "transfer_state", |
| + gdata::OperationRegistry::OperationTransferStateToString( |
| + i->transfer_state)); |
| + status->SetString("start_time", |
| + gdata::util::FormatTimeAsStringLocaltime(i->start_time)); |
| + status->SetDouble("progress_current", i->progress_current); |
| + status->SetDouble("progress_total", i->progress_total); |
| + in_flight_operations.Append(status); |
| + } |
| + web_ui()->CallJavascriptFunction("updateInFlightOperations", |
| + in_flight_operations); |
| +} |
| + |
| } // namespace |
| DriveInternalsUI::DriveInternalsUI(content::WebUI* web_ui) |