| 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 // The DownloadManager object manages the process of downloading, including | 5 // The DownloadManager object manages the process of downloading, including |
| 6 // updates to the history system and providing the information for displaying | 6 // updates to the history system and providing the information for displaying |
| 7 // the downloads view in the Destinations tab. There is one DownloadManager per | 7 // the downloads view in the Destinations tab. There is one DownloadManager per |
| 8 // active browser context in Chrome. | 8 // active browser context in Chrome. |
| 9 // | 9 // |
| 10 // Download observers: | 10 // Download observers: |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 // Add all download items to |downloads|, no matter the type or state, without | 104 // Add all download items to |downloads|, no matter the type or state, without |
| 105 // clearing |downloads| first. | 105 // clearing |downloads| first. |
| 106 virtual void GetAllDownloads(DownloadVector* downloads) = 0; | 106 virtual void GetAllDownloads(DownloadVector* downloads) = 0; |
| 107 | 107 |
| 108 // Called by a download source (Currently DownloadResourceHandler) | 108 // Called by a download source (Currently DownloadResourceHandler) |
| 109 // to initiate the non-source portions of a download. | 109 // to initiate the non-source portions of a download. |
| 110 // Returns the id assigned to the download. If the DownloadCreateInfo | 110 // Returns the id assigned to the download. If the DownloadCreateInfo |
| 111 // specifies an id, that id will be used. | 111 // specifies an id, that id will be used. |
| 112 virtual void StartDownload( | 112 virtual void StartDownload( |
| 113 scoped_ptr<DownloadCreateInfo> info, | 113 std::unique_ptr<DownloadCreateInfo> info, |
| 114 scoped_ptr<ByteStreamReader> stream, | 114 std::unique_ptr<ByteStreamReader> stream, |
| 115 const DownloadUrlParameters::OnStartedCallback& on_started) = 0; | 115 const DownloadUrlParameters::OnStartedCallback& on_started) = 0; |
| 116 | 116 |
| 117 // Remove downloads whose URLs match the |url_filter| and are within | 117 // Remove downloads whose URLs match the |url_filter| and are within |
| 118 // the given time constraints - after remove_begin (inclusive) and before | 118 // the given time constraints - after remove_begin (inclusive) and before |
| 119 // remove_end (exclusive). You may pass in null Time values to do an unbounded | 119 // remove_end (exclusive). You may pass in null Time values to do an unbounded |
| 120 // delete in either direction. | 120 // delete in either direction. |
| 121 virtual int RemoveDownloadsByURLAndTime( | 121 virtual int RemoveDownloadsByURLAndTime( |
| 122 const base::Callback<bool(const GURL&)>& url_filter, | 122 const base::Callback<bool(const GURL&)>& url_filter, |
| 123 base::Time remove_begin, | 123 base::Time remove_begin, |
| 124 base::Time remove_end) = 0; | 124 base::Time remove_end) = 0; |
| 125 | 125 |
| 126 // Remove all downloads will delete all downloads. The number of downloads | 126 // Remove all downloads will delete all downloads. The number of downloads |
| 127 // deleted is returned back to the caller. | 127 // deleted is returned back to the caller. |
| 128 virtual int RemoveAllDownloads() = 0; | 128 virtual int RemoveAllDownloads() = 0; |
| 129 | 129 |
| 130 // See DownloadUrlParameters for details about controlling the download. | 130 // See DownloadUrlParameters for details about controlling the download. |
| 131 virtual void DownloadUrl(scoped_ptr<DownloadUrlParameters> parameters) = 0; | 131 virtual void DownloadUrl( |
| 132 std::unique_ptr<DownloadUrlParameters> parameters) = 0; |
| 132 | 133 |
| 133 // Allow objects to observe the download creation process. | 134 // Allow objects to observe the download creation process. |
| 134 virtual void AddObserver(Observer* observer) = 0; | 135 virtual void AddObserver(Observer* observer) = 0; |
| 135 | 136 |
| 136 // Remove a download observer from ourself. | 137 // Remove a download observer from ourself. |
| 137 virtual void RemoveObserver(Observer* observer) = 0; | 138 virtual void RemoveObserver(Observer* observer) = 0; |
| 138 | 139 |
| 139 // Called by the embedder, after creating the download manager, to let it know | 140 // Called by the embedder, after creating the download manager, to let it know |
| 140 // about downloads from previous runs of the browser. | 141 // about downloads from previous runs of the browser. |
| 141 virtual DownloadItem* CreateDownloadItem( | 142 virtual DownloadItem* CreateDownloadItem( |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 // if you need to keep track of a specific download. (http://crbug.com/593020) | 185 // if you need to keep track of a specific download. (http://crbug.com/593020) |
| 185 virtual DownloadItem* GetDownload(uint32_t id) = 0; | 186 virtual DownloadItem* GetDownload(uint32_t id) = 0; |
| 186 | 187 |
| 187 // Get the download item for |guid|. | 188 // Get the download item for |guid|. |
| 188 virtual DownloadItem* GetDownloadByGuid(const std::string& guid) = 0; | 189 virtual DownloadItem* GetDownloadByGuid(const std::string& guid) = 0; |
| 189 }; | 190 }; |
| 190 | 191 |
| 191 } // namespace content | 192 } // namespace content |
| 192 | 193 |
| 193 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ | 194 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ |
| OLD | NEW |