OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/download/download_manager_impl.h" | 5 #include "content/browser/download/download_manager_impl.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
666 int DownloadManagerImpl::InProgressCount() const { | 666 int DownloadManagerImpl::InProgressCount() const { |
667 int count = 0; | 667 int count = 0; |
668 for (DownloadMap::const_iterator it = downloads_.begin(); | 668 for (DownloadMap::const_iterator it = downloads_.begin(); |
669 it != downloads_.end(); ++it) { | 669 it != downloads_.end(); ++it) { |
670 if (it->second->GetState() == DownloadItem::IN_PROGRESS) | 670 if (it->second->GetState() == DownloadItem::IN_PROGRESS) |
671 ++count; | 671 ++count; |
672 } | 672 } |
673 return count; | 673 return count; |
674 } | 674 } |
675 | 675 |
676 int DownloadManagerImpl::NonMaliciousInProgressCount() const { | |
677 int count = 0; | |
678 for (DownloadMap::const_iterator it = downloads_.begin(); | |
679 it != downloads_.end(); ++it) { | |
680 if (it->second->GetState() == DownloadItem::IN_PROGRESS && | |
681 it->second->GetDangerType() != DOWNLOAD_DANGER_TYPE_DANGEROUS_URL && | |
felt
2013/10/18 01:50:54
pkasting: changed to this, to address your concern
| |
682 it->second->GetDangerType() != DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT && | |
683 it->second->GetDangerType() != DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST) { | |
684 ++count; | |
685 } | |
686 } | |
687 return count; | |
688 } | |
689 | |
676 DownloadItem* DownloadManagerImpl::GetDownload(uint32 download_id) { | 690 DownloadItem* DownloadManagerImpl::GetDownload(uint32 download_id) { |
677 return ContainsKey(downloads_, download_id) ? downloads_[download_id] : NULL; | 691 return ContainsKey(downloads_, download_id) ? downloads_[download_id] : NULL; |
678 } | 692 } |
679 | 693 |
680 void DownloadManagerImpl::GetAllDownloads(DownloadVector* downloads) { | 694 void DownloadManagerImpl::GetAllDownloads(DownloadVector* downloads) { |
681 for (DownloadMap::iterator it = downloads_.begin(); | 695 for (DownloadMap::iterator it = downloads_.begin(); |
682 it != downloads_.end(); ++it) { | 696 it != downloads_.end(); ++it) { |
683 downloads->push_back(it->second); | 697 downloads->push_back(it->second); |
684 } | 698 } |
685 } | 699 } |
(...skipping 12 matching lines...) Expand all Loading... | |
698 if (delegate_) | 712 if (delegate_) |
699 delegate_->OpenDownload(download); | 713 delegate_->OpenDownload(download); |
700 } | 714 } |
701 | 715 |
702 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { | 716 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { |
703 if (delegate_) | 717 if (delegate_) |
704 delegate_->ShowDownloadInShell(download); | 718 delegate_->ShowDownloadInShell(download); |
705 } | 719 } |
706 | 720 |
707 } // namespace content | 721 } // namespace content |
OLD | NEW |