| Index: chrome/browser/download/download_service.cc
|
| diff --git a/chrome/browser/download/download_service.cc b/chrome/browser/download/download_service.cc
|
| index 659af4f50ad20a15bf2dea19607037eeb26bc615..6b5fcb26bfaa7bab5b1133a4a672bae07c52b400 100644
|
| --- a/chrome/browser/download/download_service.cc
|
| +++ b/chrome/browser/download/download_service.cc
|
| @@ -6,7 +6,9 @@
|
|
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/download/chrome_download_manager_delegate.h"
|
| +#include "chrome/browser/download/download_service_factory.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| +#include "chrome/browser/profiles/profile_manager.h"
|
| #include "content/browser/download/download_manager.h"
|
|
|
| DownloadService::DownloadService(Profile* profile)
|
| @@ -34,6 +36,27 @@ bool DownloadService::HasCreatedDownloadManager() {
|
| return download_manager_created_;
|
| }
|
|
|
| +int DownloadService::DownloadCount() const {
|
| + return download_manager_created_ ? manager_->in_progress_count() : 0;
|
| +}
|
| +
|
| +// static
|
| +int DownloadService::DownloadCountAllProfiles() {
|
| + 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::GetForProfile(*it)->DownloadCount();
|
| + if ((*it)->HasOffTheRecordProfile())
|
| + count += DownloadServiceFactory::GetForProfile(
|
| + (*it)->GetOffTheRecordProfile())->DownloadCount();
|
| + }
|
| +
|
| + return count;
|
| +}
|
| +
|
| void DownloadService::SetDownloadManagerDelegateForTesting(
|
| ChromeDownloadManagerDelegate* new_delegate) {
|
| // Guarantee everything is properly initialized.
|
|
|