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

Unified Diff: chrome/browser/ui/webui/options/manage_profile_handler.cc

Issue 220593003: [Canceled] Show a "downloads in progress" warning in the delete profile overlay. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « chrome/browser/ui/webui/options/manage_profile_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/browser/ui/webui/options/manage_profile_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698