| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/download/download_service.h" | |
| 6 | |
| 7 #include "chrome/browser/browser_process.h" | |
| 8 #include "chrome/browser/download/download_service_factory.h" | |
| 9 #include "chrome/browser/profiles/profile.h" | |
| 10 #include "chrome/browser/profiles/profile_manager.h" | |
| 11 | |
| 12 DownloadService::DownloadService() { | |
| 13 } | |
| 14 | |
| 15 DownloadService::~DownloadService() {} | |
| 16 | |
| 17 // static | |
| 18 int DownloadService::NonMaliciousDownloadCountAllProfiles() { | |
| 19 std::vector<Profile*> profiles( | |
| 20 g_browser_process->profile_manager()->GetLoadedProfiles()); | |
| 21 | |
| 22 int count = 0; | |
| 23 for (std::vector<Profile*>::iterator it = profiles.begin(); | |
| 24 it < profiles.end(); ++it) { | |
| 25 count += DownloadServiceFactory::GetForBrowserContext(*it)-> | |
| 26 NonMaliciousDownloadCount(); | |
| 27 if ((*it)->HasOffTheRecordProfile()) | |
| 28 count += DownloadServiceFactory::GetForBrowserContext( | |
| 29 (*it)->GetOffTheRecordProfile())->NonMaliciousDownloadCount(); | |
| 30 } | |
| 31 | |
| 32 return count; | |
| 33 } | |
| 34 | |
| 35 // static | |
| 36 void DownloadService::CancelAllDownloads() { | |
| 37 std::vector<Profile*> profiles( | |
| 38 g_browser_process->profile_manager()->GetLoadedProfiles()); | |
| 39 for (std::vector<Profile*>::iterator it = profiles.begin(); | |
| 40 it < profiles.end(); | |
| 41 ++it) { | |
| 42 DownloadService* service = | |
| 43 DownloadServiceFactory::GetForBrowserContext(*it); | |
| 44 service->CancelDownloads(); | |
| 45 } | |
| 46 } | |
| 47 | |
| OLD | NEW |