| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 // Allow objects to observe the download creation process. | 135 // Allow objects to observe the download creation process. |
| 136 virtual void AddObserver(Observer* observer) = 0; | 136 virtual void AddObserver(Observer* observer) = 0; |
| 137 | 137 |
| 138 // Remove a download observer from ourself. | 138 // Remove a download observer from ourself. |
| 139 virtual void RemoveObserver(Observer* observer) = 0; | 139 virtual void RemoveObserver(Observer* observer) = 0; |
| 140 | 140 |
| 141 // Called by the embedder, after creating the download manager, to let it know | 141 // Called by the embedder, after creating the download manager, to let it know |
| 142 // about downloads from previous runs of the browser. | 142 // about downloads from previous runs of the browser. |
| 143 virtual DownloadItem* CreateDownloadItem( | 143 virtual DownloadItem* CreateDownloadItem( |
| 144 const FilePath& path, | 144 const FilePath& current_path, |
| 145 const GURL& url, | 145 const FilePath& target_path, |
| 146 const std::vector<GURL>& url_chain, |
| 146 const GURL& referrer_url, | 147 const GURL& referrer_url, |
| 147 const base::Time& start_time, | 148 const base::Time& start_time, |
| 148 const base::Time& end_time, | 149 const base::Time& end_time, |
| 149 int64 received_bytes, | 150 int64 received_bytes, |
| 150 int64 total_bytes, | 151 int64 total_bytes, |
| 151 DownloadItem::DownloadState state, | 152 DownloadItem::DownloadState state, |
| 153 DownloadInterruptReason interrupt_reason, |
| 152 bool opened) = 0; | 154 bool opened) = 0; |
| 153 | 155 |
| 154 // The number of in progress (including paused) downloads. | 156 // The number of in progress (including paused) downloads. |
| 155 // Performance note: this loops over all items. If profiling finds that this | 157 // Performance note: this loops over all items. If profiling finds that this |
| 156 // is too slow, use an AllDownloadItemNotifier to count in-progress items. | 158 // is too slow, use an AllDownloadItemNotifier to count in-progress items. |
| 157 virtual int InProgressCount() const = 0; | 159 virtual int InProgressCount() const = 0; |
| 158 | 160 |
| 159 virtual BrowserContext* GetBrowserContext() const = 0; | 161 virtual BrowserContext* GetBrowserContext() const = 0; |
| 160 | 162 |
| 161 // Checks whether downloaded files still exist. Updates state of downloads | 163 // Checks whether downloaded files still exist. Updates state of downloads |
| 162 // that refer to removed files. The check runs in the background and may | 164 // that refer to removed files. The check runs in the background and may |
| 163 // finish asynchronously after this method returns. | 165 // finish asynchronously after this method returns. |
| 164 virtual void CheckForHistoryFilesRemoval() = 0; | 166 virtual void CheckForHistoryFilesRemoval() = 0; |
| 165 | 167 |
| 166 // Get the download item for |id| if present, no matter what type of download | 168 // Get the download item for |id| if present, no matter what type of download |
| 167 // it is or state it's in. | 169 // it is or state it's in. |
| 168 virtual DownloadItem* GetDownload(int id) = 0; | 170 virtual DownloadItem* GetDownload(int id) = 0; |
| 169 | 171 |
| 170 protected: | 172 protected: |
| 171 virtual ~DownloadManager() {} | 173 virtual ~DownloadManager() {} |
| 172 | 174 |
| 173 private: | 175 private: |
| 174 friend class base::RefCountedThreadSafe<DownloadManager>; | 176 friend class base::RefCountedThreadSafe<DownloadManager>; |
| 175 }; | 177 }; |
| 176 | 178 |
| 177 } // namespace content | 179 } // namespace content |
| 178 | 180 |
| 179 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ | 181 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ |
| OLD | NEW |