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

Unified Diff: chrome/browser/download/download_service.cc

Issue 26938003: Don't prompt to save malicious downloads on exit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed unit test compile error Created 7 years, 2 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/download/download_service.cc
diff --git a/chrome/browser/download/download_service.cc b/chrome/browser/download/download_service.cc
index bb75459fb55504643bbf55575fedfc6a179d689b..552c809b38fbfbf376f00587925ea3008c93eccb 100644
--- a/chrome/browser/download/download_service.cc
+++ b/chrome/browser/download/download_service.cc
@@ -94,6 +94,13 @@ int DownloadService::DownloadCount() const {
return BrowserContext::GetDownloadManager(profile_)->InProgressCount();
}
+int DownloadService::NonDangerousDownloadCount() const {
+ if (!download_manager_created_)
+ return 0;
+ return BrowserContext::GetDownloadManager(profile_)->
+ NonDangerousInProgressCount();
+}
+
// static
int DownloadService::DownloadCountAllProfiles() {
std::vector<Profile*> profiles(
@@ -111,6 +118,24 @@ int DownloadService::DownloadCountAllProfiles() {
return count;
}
+// static
+int DownloadService::NonDangerousDownloadCountAllProfiles() {
+ std::vector<Profile*> profiles(
+ g_browser_process->profile_manager()->GetLoadedProfiles());
+
+ int count = 0;
+ for (std::vector<Profile*>::iterator it = profiles.begin();
+ it < profiles.end(); ++it) {
+ count += DownloadServiceFactory::GetForBrowserContext(*it)->
+ NonDangerousDownloadCount();
+ if ((*it)->HasOffTheRecordProfile())
+ count += DownloadServiceFactory::GetForBrowserContext(
+ (*it)->GetOffTheRecordProfile())->NonDangerousDownloadCount();
+ }
+
+ return count;
+}
+
void DownloadService::SetDownloadManagerDelegateForTesting(
ChromeDownloadManagerDelegate* new_delegate) {
// Set the new delegate first so that if BrowserContext::GetDownloadManager()

Powered by Google App Engine
This is Rietveld 408576698