| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/download/download_service.h" | 5 #include "chrome/browser/download/download_service.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 8 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 9 #include "chrome/browser/download/download_service_factory.h" | 9 #include "chrome/browser/download/download_service_factory.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 download_manager_created_ = true; | 44 download_manager_created_ = true; |
| 45 } | 45 } |
| 46 return manager_.get(); | 46 return manager_.get(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool DownloadService::HasCreatedDownloadManager() { | 49 bool DownloadService::HasCreatedDownloadManager() { |
| 50 return download_manager_created_; | 50 return download_manager_created_; |
| 51 } | 51 } |
| 52 | 52 |
| 53 int DownloadService::DownloadCount() const { | 53 int DownloadService::DownloadCount() const { |
| 54 return download_manager_created_ ? manager_->in_progress_count() : 0; | 54 return download_manager_created_ ? manager_->InProgressCount() : 0; |
| 55 } | 55 } |
| 56 | 56 |
| 57 // static | 57 // static |
| 58 int DownloadService::DownloadCountAllProfiles() { | 58 int DownloadService::DownloadCountAllProfiles() { |
| 59 std::vector<Profile*> profiles( | 59 std::vector<Profile*> profiles( |
| 60 g_browser_process->profile_manager()->GetLoadedProfiles()); | 60 g_browser_process->profile_manager()->GetLoadedProfiles()); |
| 61 | 61 |
| 62 int count = 0; | 62 int count = 0; |
| 63 for (std::vector<Profile*>::iterator it = profiles.begin(); | 63 for (std::vector<Profile*>::iterator it = profiles.begin(); |
| 64 it < profiles.end(); ++it) { | 64 it < profiles.end(); ++it) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 91 // Resetting here will guarantee that any attempts to get the | 91 // Resetting here will guarantee that any attempts to get the |
| 92 // DownloadManager after shutdown will return null. | 92 // DownloadManager after shutdown will return null. |
| 93 // | 93 // |
| 94 // TODO(rdsmith): Figure out how to guarantee when the last reference | 94 // TODO(rdsmith): Figure out how to guarantee when the last reference |
| 95 // will be released and make DownloadManager not RefCountedThreadSafe<>. | 95 // will be released and make DownloadManager not RefCountedThreadSafe<>. |
| 96 manager_.release(); | 96 manager_.release(); |
| 97 } | 97 } |
| 98 if (manager_delegate_.get()) | 98 if (manager_delegate_.get()) |
| 99 manager_delegate_.release(); | 99 manager_delegate_.release(); |
| 100 } | 100 } |
| OLD | NEW |