Update broken references to image assets
[chromium-blink-merge.git] / chrome / browser / download / download_service.cc
blob1ca08a8746c37a5d752c6048cf1b3d48fc2dd28a
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.
5 #include "chrome/browser/download/download_service.h"
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"
12 DownloadService::DownloadService() {
15 DownloadService::~DownloadService() {}
17 // static
18 int DownloadService::NonMaliciousDownloadCountAllProfiles() {
19 std::vector<Profile*> profiles(
20 g_browser_process->profile_manager()->GetLoadedProfiles());
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();
32 return count;
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();