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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // doing large amounts of work in OnDownloadCreated(). TODO(<whoever>): | 77 // doing large amounts of work in OnDownloadCreated(). TODO(<whoever>): |
78 // When we've fully specified the possible states of the DownloadItem in | 78 // When we've fully specified the possible states of the DownloadItem in |
79 // download_item.h, we should remove the caveat above. | 79 // download_item.h, we should remove the caveat above. |
80 virtual void OnDownloadCreated( | 80 virtual void OnDownloadCreated( |
81 DownloadManager* manager, DownloadItem* item) {} | 81 DownloadManager* manager, DownloadItem* item) {} |
82 | 82 |
83 // A SavePackage has successfully finished. | 83 // A SavePackage has successfully finished. |
84 virtual void OnSavePackageSuccessfullyFinished( | 84 virtual void OnSavePackageSuccessfullyFinished( |
85 DownloadManager* manager, DownloadItem* item) {} | 85 DownloadManager* manager, DownloadItem* item) {} |
86 | 86 |
| 87 // Called when the download manager has finished loading the data. |
| 88 virtual void OnManagerInitialized() {} |
| 89 |
87 // Called when the DownloadManager is being destroyed to prevent Observers | 90 // Called when the DownloadManager is being destroyed to prevent Observers |
88 // from calling back to a stale pointer. | 91 // from calling back to a stale pointer. |
89 virtual void ManagerGoingDown(DownloadManager* manager) {} | 92 virtual void ManagerGoingDown(DownloadManager* manager) {} |
90 | 93 |
91 protected: | 94 protected: |
92 virtual ~Observer() {} | 95 virtual ~Observer() {} |
93 }; | 96 }; |
94 | 97 |
95 typedef std::vector<DownloadItem*> DownloadVector; | 98 typedef std::vector<DownloadItem*> DownloadVector; |
96 | 99 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 int64_t total_bytes, | 151 int64_t total_bytes, |
149 const std::string& hash, | 152 const std::string& hash, |
150 DownloadItem::DownloadState state, | 153 DownloadItem::DownloadState state, |
151 DownloadDangerType danger_type, | 154 DownloadDangerType danger_type, |
152 DownloadInterruptReason interrupt_reason, | 155 DownloadInterruptReason interrupt_reason, |
153 bool opened, | 156 bool opened, |
154 base::Time last_access_time, | 157 base::Time last_access_time, |
155 bool transient, | 158 bool transient, |
156 const std::vector<DownloadItem::ReceivedSlice>& received_slices) = 0; | 159 const std::vector<DownloadItem::ReceivedSlice>& received_slices) = 0; |
157 | 160 |
| 161 // Called when download manager has loaded all the data. |
| 162 virtual void PostInitialization() = 0; |
| 163 |
| 164 // Returns if the manager has been initialized and loaded all the data. |
| 165 virtual bool IsManagerInitialized() const = 0; |
| 166 |
158 // The number of in progress (including paused) downloads. | 167 // The number of in progress (including paused) downloads. |
159 // Performance note: this loops over all items. If profiling finds that this | 168 // Performance note: this loops over all items. If profiling finds that this |
160 // is too slow, use an AllDownloadItemNotifier to count in-progress items. | 169 // is too slow, use an AllDownloadItemNotifier to count in-progress items. |
161 virtual int InProgressCount() const = 0; | 170 virtual int InProgressCount() const = 0; |
162 | 171 |
163 // The number of in progress (including paused) downloads. | 172 // The number of in progress (including paused) downloads. |
164 // Performance note: this loops over all items. If profiling finds that this | 173 // Performance note: this loops over all items. If profiling finds that this |
165 // is too slow, use an AllDownloadItemNotifier to count in-progress items. | 174 // is too slow, use an AllDownloadItemNotifier to count in-progress items. |
166 // This excludes downloads that are marked as malicious. | 175 // This excludes downloads that are marked as malicious. |
167 virtual int NonMaliciousInProgressCount() const = 0; | 176 virtual int NonMaliciousInProgressCount() const = 0; |
(...skipping 12 matching lines...) Expand all Loading... |
180 // if you need to keep track of a specific download. (http://crbug.com/593020) | 189 // if you need to keep track of a specific download. (http://crbug.com/593020) |
181 virtual DownloadItem* GetDownload(uint32_t id) = 0; | 190 virtual DownloadItem* GetDownload(uint32_t id) = 0; |
182 | 191 |
183 // Get the download item for |guid|. | 192 // Get the download item for |guid|. |
184 virtual DownloadItem* GetDownloadByGuid(const std::string& guid) = 0; | 193 virtual DownloadItem* GetDownloadByGuid(const std::string& guid) = 0; |
185 }; | 194 }; |
186 | 195 |
187 } // namespace content | 196 } // namespace content |
188 | 197 |
189 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ | 198 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ |
OLD | NEW |