Index: chrome/browser/ui/webui/options/manage_profile_handler.cc |
diff --git a/chrome/browser/ui/webui/options/manage_profile_handler.cc b/chrome/browser/ui/webui/options/manage_profile_handler.cc |
index ac857391b06abc4e3e7c2d51b20719219140cd9d..f8760951ad7f1786c717306c28a37d45009eb7f6 100644 |
--- a/chrome/browser/ui/webui/options/manage_profile_handler.cc |
+++ b/chrome/browser/ui/webui/options/manage_profile_handler.cc |
@@ -192,6 +192,10 @@ void ManageProfileHandler::RegisterMessages() { |
base::Unretained(this))); |
web_ui()->RegisterMessageCallback("logDeleteUserDialogShown", |
base::Bind(&HandleLogDeleteUserDialogShown)); |
+ web_ui()->RegisterMessageCallback( |
+ "deleteUserDialogLoadStats", |
+ base::Bind(&ManageProfileHandler::DeleteUserDialogLoadStats, |
+ base::Unretained(this))); |
} |
void ManageProfileHandler::Uninitialize() { |
@@ -562,4 +566,40 @@ void ManageProfileHandler::RefreshGaiaPicture(const base::ListValue* args) { |
profiles::UpdateGaiaProfileInfoIfNeeded(Profile::FromWebUI(web_ui())); |
} |
+void ManageProfileHandler::DeleteUserDialogLoadStats( |
+ const base::ListValue* args) { |
+ base::FilePath* profile_path = new base::FilePath(); |
+ if (!GetProfilePathFromArgs(args, profile_path)) { |
+ delete profile_path; |
+ return; |
+ } |
+ |
+ Profile* profile = g_browser_process->profile_manager()-> |
+ GetProfileByPath(*profile_path); |
+ |
+ if (!profile) { |
+ delete profile_path; |
+ return; |
+ } |
+ |
+ profiles::GetProfileStatistics(profile, |
+ base::Bind(&ManageProfileHandler::DeleteUserDialogLoadStatsCallback, |
+ weak_factory_.GetWeakPtr(), base::Owned(profile_path)), |
+ &tracker); |
+} |
+ |
+void ManageProfileHandler::DeleteUserDialogLoadStatsCallback( |
+ const base::FilePath* profile_path, |
+ profiles::ProfileStatisticsValues result) { |
+ // Copy result into return_value. |
+ base::StringValue return_profile_path(profile_path->value()); |
+ base::DictionaryValue return_value; |
+ for (profiles::ProfileStatisticsValues::const_iterator |
+ iter = result.begin(); iter != result.end(); iter++) { |
+ return_value.SetIntegerWithoutPathExpansion(iter->first, iter->second); |
+ } |
+ web_ui()->CallJavascriptFunction("ManageProfileOverlay.updateDeleteDialog", |
+ return_profile_path, return_value); |
+} |
+ |
} // namespace options |