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

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

Issue 10827292: Propagate the result of AmountOfFreeSpace to JS and show it in chrome://drive-internals. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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/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 8a875624819598cf3791447dbaafcaa4189d0218..3a82a31e97533068883d9a360bea6dbc48c44432 100644
--- a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
@@ -9,6 +9,8 @@
#include "base/format_macros.h"
#include "base/stringprintf.h"
#include "base/memory/weak_ptr.h"
+#include "base/path_service.h"
+#include "base/sys_info.h"
#include "chrome/browser/chromeos/gdata/gdata.pb.h"
#include "chrome/browser/chromeos/gdata/gdata_auth_service.h"
#include "chrome/browser/chromeos/gdata/gdata_cache.h"
@@ -215,6 +217,20 @@ void DriveInternalsWebUIHandler::OnPageLoaded(const base::ListValue* args) {
documents_service->HasAccessToken());
web_ui()->CallJavascriptFunction("updateAuthStatus", auth_status);
+ // Propagate the amount of local free space in bytes.
+ FilePath path;
+ int64 free_space = -1;
+ if (PathService::Get(base::DIR_HOME, &path)) {
+ free_space = base::SysInfo::AmountOfFreeDiskSpace(path);
satorux1 2012/08/13 07:26:20 I think we shouldn't do this on UI thread. We shou
Haruki Sato 2012/08/17 05:46:34 Done. and moved the code to have more cleaner stru
+ } else {
+ LOG(ERROR) << "Home directory not found";
+ }
+ base::DictionaryValue local_storage_summary;
+ local_storage_summary.SetDouble("free_space", free_space);
+ web_ui()->CallJavascriptFunction(
+ "updateLocalStorageUsage", local_storage_summary);
+
+
// Start updating the GCache contents section.
Profile* profile = Profile::FromWebUI(web_ui());
const FilePath root_path =

Powered by Google App Engine
This is Rietveld 408576698