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 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 int64_t received_bytes, | 101 int64_t received_bytes, |
102 int64_t total_bytes, | 102 int64_t total_bytes, |
103 const std::string& hash, | 103 const std::string& hash, |
104 content::DownloadItem::DownloadState state, | 104 content::DownloadItem::DownloadState state, |
105 DownloadDangerType danger_type, | 105 DownloadDangerType danger_type, |
106 DownloadInterruptReason interrupt_reason, | 106 DownloadInterruptReason interrupt_reason, |
107 bool opened, | 107 bool opened, |
108 base::Time last_access_time, | 108 base::Time last_access_time, |
109 bool transient, | 109 bool transient, |
110 const std::vector<DownloadItem::ReceivedSlice>& received_slices) override; | 110 const std::vector<DownloadItem::ReceivedSlice>& received_slices) override; |
| 111 void PostInitialization() override; |
| 112 bool IsManagerInitialized() const override; |
111 int InProgressCount() const override; | 113 int InProgressCount() const override; |
112 int NonMaliciousInProgressCount() const override; | 114 int NonMaliciousInProgressCount() const override; |
113 BrowserContext* GetBrowserContext() const override; | 115 BrowserContext* GetBrowserContext() const override; |
114 void CheckForHistoryFilesRemoval() override; | 116 void CheckForHistoryFilesRemoval() override; |
115 DownloadItem* GetDownload(uint32_t id) override; | 117 DownloadItem* GetDownload(uint32_t id) override; |
116 DownloadItem* GetDownloadByGuid(const std::string& guid) override; | 118 DownloadItem* GetDownloadByGuid(const std::string& guid) override; |
117 | 119 |
118 // UrlDownloader::Delegate implementation. | 120 // UrlDownloader::Delegate implementation. |
119 void OnUrlDownloaderStarted( | 121 void OnUrlDownloaderStarted( |
120 std::unique_ptr<DownloadCreateInfo> download_create_info, | 122 std::unique_ptr<DownloadCreateInfo> download_create_info, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 222 |
221 // Same as the above, but maps from GUID to download item. Note that the | 223 // Same as the above, but maps from GUID to download item. Note that the |
222 // container is case sensitive. Hence the key needs to be normalized to | 224 // container is case sensitive. Hence the key needs to be normalized to |
223 // upper-case when inserting new elements here. Fortunately for us, | 225 // upper-case when inserting new elements here. Fortunately for us, |
224 // DownloadItemImpl already normalizes the string GUID. | 226 // DownloadItemImpl already normalizes the string GUID. |
225 DownloadGuidMap downloads_by_guid_; | 227 DownloadGuidMap downloads_by_guid_; |
226 | 228 |
227 // True if the download manager has been initialized and requires a shutdown. | 229 // True if the download manager has been initialized and requires a shutdown. |
228 bool shutdown_needed_; | 230 bool shutdown_needed_; |
229 | 231 |
| 232 // True if the download manager has been initialized and loaded all the data. |
| 233 bool initialized_; |
| 234 |
230 // Observers that want to be notified of changes to the set of downloads. | 235 // Observers that want to be notified of changes to the set of downloads. |
231 base::ObserverList<Observer> observers_; | 236 base::ObserverList<Observer> observers_; |
232 | 237 |
233 // The current active browser context. | 238 // The current active browser context. |
234 BrowserContext* browser_context_; | 239 BrowserContext* browser_context_; |
235 | 240 |
236 // Allows an embedder to control behavior. Guaranteed to outlive this object. | 241 // Allows an embedder to control behavior. Guaranteed to outlive this object. |
237 DownloadManagerDelegate* delegate_; | 242 DownloadManagerDelegate* delegate_; |
238 | 243 |
239 net::NetLog* net_log_; | 244 net::NetLog* net_log_; |
240 | 245 |
241 std::vector<std::unique_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread>> | 246 std::vector<std::unique_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread>> |
242 url_downloaders_; | 247 url_downloaders_; |
243 | 248 |
244 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_; | 249 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_; |
245 | 250 |
246 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); | 251 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); |
247 }; | 252 }; |
248 | 253 |
249 } // namespace content | 254 } // namespace content |
250 | 255 |
251 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 256 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
OLD | NEW |