diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-21 16:38:34 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-21 16:38:34 +0000 |
commit | 8ddbd66ab581984c87b8b52465c96e349ebcfb5f (patch) | |
tree | c7c30689f478518280d8fc91f0069081ff731b14 /chrome/browser/download | |
parent | 9a93c4b8afba617a4da5ec42aabebc84383e88f9 (diff) | |
download | chromium_src-8ddbd66ab581984c87b8b52465c96e349ebcfb5f.zip chromium_src-8ddbd66ab581984c87b8b52465c96e349ebcfb5f.tar.gz chromium_src-8ddbd66ab581984c87b8b52465c96e349ebcfb5f.tar.bz2 |
Land dhg's CL 2109011
Fixing download case, adding new method to download manager to support chromeos downloads.
Original Review: http://codereview.chromium.org/2109011
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/2112012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47921 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download')
-rw-r--r-- | chrome/browser/download/download_manager.cc | 22 | ||||
-rw-r--r-- | chrome/browser/download/download_manager.h | 4 |
2 files changed, 23 insertions, 3 deletions
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index 6d79b58..fa20a30 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -506,6 +506,22 @@ void DownloadManager::GetTemporaryDownloads(Observer* observer, observer->SetDownloads(download_copy); } +void DownloadManager::GetAllDownloads(Observer* observer, + const FilePath& dir_path) { + DCHECK(observer); + + std::vector<DownloadItem*> download_copy; + + for (DownloadMap::iterator it = downloads_.begin(); + it != downloads_.end(); ++it) { + if (!it->second->is_temporary() && + (dir_path.empty() || it->second->full_path().DirName() == dir_path)) + download_copy.push_back(it->second); + } + + observer->SetDownloads(download_copy); +} + void DownloadManager::GetCurrentDownloads(Observer* observer, const FilePath& dir_path) { DCHECK(observer); @@ -1751,9 +1767,9 @@ void DownloadManager::OnSearchComplete(HistoryService::Handle handle, void DownloadManager::ShowDownloadInBrowser(const DownloadCreateInfo& info, DownloadItem* download) { - // The 'contents' may no longer exist if the user closed the tab before we get - // this start completion event. If it does, tell the origin TabContents to - // display its download shelf. + // The 'contents' may no longer exist if the user closed the tab before we + // get this start completion event. If it does, tell the origin TabContents + // to display its download shelf. TabContents* contents = tab_util::GetTabContentsByID(info.child_id, info.render_view_id); diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h index 0707711..413d92d 100644 --- a/chrome/browser/download/download_manager.h +++ b/chrome/browser/download/download_manager.h @@ -386,6 +386,10 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>, const FilePath& dir_path); // Return all non-temporary downloads in the specified directory that are + // are in progress or have finished. + void GetAllDownloads(Observer* observer, const FilePath& dir_path); + + // Return all non-temporary downloads in the specified directory that are // either in-progress or finished but still waiting for user confirmation. void GetCurrentDownloads(Observer* observer, const FilePath& dir_path); |