| 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()
|
|
|