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 35bd5480aec37a210f30094283e3e791e4ae3793..433ba6ebb61103e4d27b493dc108f7371d067308 100644 |
--- a/chrome/browser/ui/webui/options/manage_profile_handler.cc |
+++ b/chrome/browser/ui/webui/options/manage_profile_handler.cc |
@@ -15,6 +15,8 @@ |
#include "base/values.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/chrome_notification_types.h" |
+#include "chrome/browser/download/download_service.h" |
+#include "chrome/browser/download/download_service_factory.h" |
#include "chrome/browser/profiles/gaia_info_update_service.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/profiles/profile_info_cache.h" |
@@ -101,6 +103,10 @@ void ManageProfileHandler::GetLocalizedValues( |
{ "deleteProfileTitle", IDS_PROFILES_DELETE_TITLE }, |
{ "deleteProfileOK", IDS_PROFILES_DELETE_OK_BUTTON_LABEL }, |
{ "deleteProfileMessage", IDS_PROFILES_DELETE_MESSAGE }, |
+ { "deleteProfileSingleDownloadAddendum", |
+ IDS_PROFILES_DELETE_SINGLE_DOWNLOAD_ADDENDUM }, |
+ { "deleteProfileMultipleDownloadsAddendum", |
+ IDS_PROFILES_DELETE_MULTIPLE_DOWNLOADS_ADDENDUM }, |
{ "deleteManagedProfileAddendum", IDS_PROFILES_DELETE_MANAGED_ADDENDUM }, |
{ "disconnectManagedProfileTitle", |
IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_TITLE }, |
@@ -192,6 +198,9 @@ void ManageProfileHandler::RegisterMessages() { |
web_ui()->RegisterMessageCallback("removeProfileShortcut", |
base::Bind(&ManageProfileHandler::RemoveProfileShortcut, |
base::Unretained(this))); |
+ web_ui()->RegisterMessageCallback("requestProfileInProgressDownloads", |
+ base::Bind(&ManageProfileHandler::RequestProfileInProgressDownloads, |
+ base::Unretained(this))); |
} |
void ManageProfileHandler::Uninitialize() { |
@@ -482,4 +491,23 @@ void ManageProfileHandler::RemoveProfileShortcut(const base::ListValue* args) { |
OnHasProfileShortcuts(false); |
} |
+void ManageProfileHandler::RequestProfileInProgressDownloads( |
+ const base::ListValue* args) { |
+ base::FilePath profile_file_path; |
+ if (!GetProfilePathFromArgs(args, &profile_file_path)) |
+ return; |
+ |
+ int downloads_in_progress = 0; |
+ Profile* profile = |
+ g_browser_process->profile_manager()->GetProfileByPath(profile_file_path); |
+ if (profile) { |
+ DownloadService* service = |
+ DownloadServiceFactory::GetForBrowserContext(profile); |
+ downloads_in_progress = service->NonMaliciousDownloadCount(); |
+ } |
+ base::FundamentalValue value(downloads_in_progress); |
+ web_ui()->CallJavascriptFunction("ManageProfileOverlay.receiveDownloadCount", |
+ value); |
+} |
+ |
} // namespace options |