| Index: chrome/browser/download/download_manager.h
|
| diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h
|
| index 2ba619d788ec36c0ada491ab1a966df879e6fda0..39d718315577d0797be677634137209eec631934 100644
|
| --- a/chrome/browser/download/download_manager.h
|
| +++ b/chrome/browser/download/download_manager.h
|
| @@ -52,12 +52,16 @@ class DownloadHistory;
|
| class DownloadPrefs;
|
| class DownloadStatusUpdater;
|
| class GURL;
|
| +class ListValue;
|
| class Profile;
|
| class ResourceDispatcherHost;
|
| class TabContents;
|
| struct DownloadCreateInfo;
|
| struct DownloadHistoryInfo;
|
| struct DownloadSaveInfo;
|
| +namespace download_util {
|
| +class DownloadQuery;
|
| +} // namespace download_util
|
|
|
| // Browser's download manager: manages all downloads and destination view.
|
| class DownloadManager
|
| @@ -106,6 +110,11 @@ class DownloadManager
|
| void GetCurrentDownloads(const FilePath& dir_path,
|
| std::vector<DownloadItem*>* result);
|
|
|
| + bool Search(const download_util::DownloadQuery& query,
|
| + std::vector<DownloadItem*>* results = NULL,
|
| + std::string* error_msg = NULL,
|
| + ListValue* json_results = NULL) const;
|
| +
|
| // Returns all non-temporary downloads matching |query|. Empty query matches
|
| // everything.
|
| void SearchDownloads(const string16& query,
|
| @@ -198,7 +207,7 @@ class DownloadManager
|
|
|
| // The number of in progress (including paused) downloads.
|
| int in_progress_count() const {
|
| - return static_cast<int>(in_progress_.size());
|
| + return static_cast<int>(downloads_.size());
|
| }
|
|
|
| Profile* profile() { return profile_; }
|
| @@ -351,53 +360,16 @@ class DownloadManager
|
| // containers; no-op if NDEBUG.
|
| void AssertContainersConsistent() const;
|
|
|
| - // |downloads_| is the owning set for all downloads known to the
|
| - // DownloadManager. This includes downloads started by the user in
|
| - // this session, downloads initialized from the history system, and
|
| - // "save page as" downloads. All other DownloadItem containers in
|
| - // the DownloadManager are maps; they do not own the DownloadItems.
|
| - // Note that this is the only place (with any functional implications;
|
| - // see save_page_as_downloads_ below) that "save page as" downloads are
|
| - // kept, as the DownloadManager's only job is to hold onto those
|
| - // until destruction.
|
| - //
|
| - // |history_downloads_| is map of all downloads in this profile. The key
|
| - // is the handle returned by the history system, which is unique
|
| - // across sessions.
|
| - //
|
| - // |active_downloads_| is a map of all downloads that are currently being
|
| - // processed. The key is the ID assigned by the ResourceDispatcherHost,
|
| - // which is unique for the current session.
|
| - //
|
| - // |in_progress_| is a map of all downloads that are in progress and that have
|
| - // not yet received a valid history handle. The key is the ID assigned by the
|
| - // ResourceDispatcherHost, which is unique for the current session.
|
| - //
|
| - // |save_page_as_downloads_| (if defined) is a collection of all the
|
| - // downloads the "save page as" system has given to us to hold onto
|
| - // until we are destroyed. It is only used for debugging.
|
| - //
|
| - // When a download is created through a user action, the corresponding
|
| - // DownloadItem* is placed in |active_downloads_| and remains there until the
|
| - // download is in a terminal state (COMPLETE or CANCELLED). It is also
|
| - // placed in |in_progress_| and remains there until it has received a
|
| - // valid handle from the history system. Once it has a valid handle, the
|
| - // DownloadItem* is placed in the |history_downloads_| map. When the
|
| - // download reaches a terminal state, it is removed from |in_progress_|.
|
| - // Downloads from past sessions read from a persisted state from the
|
| - // history system are placed directly into |history_downloads_| since
|
| - // they have valid handles in the history system.
|
| typedef std::set<DownloadItem*> DownloadSet;
|
| typedef base::hash_map<int64, DownloadItem*> DownloadMap;
|
|
|
| - DownloadSet downloads_;
|
| - DownloadMap history_downloads_;
|
| - DownloadMap in_progress_;
|
| - DownloadMap active_downloads_;
|
| #if !defined(NDEBUG)
|
| DownloadSet save_page_as_downloads_;
|
| #endif
|
|
|
| + // Map from id to DownloadItem. Owns the DownloadItem.
|
| + DownloadMap downloads_;
|
| +
|
| // True if the download manager has been initialized and requires a shutdown.
|
| bool shutdown_needed_;
|
|
|
|
|