OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 profile in Chrome. | 8 // active profile in Chrome. |
9 // | 9 // |
10 // Download observers: | 10 // Download observers: |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 bool visited_referrer_before); | 254 bool visited_referrer_before); |
255 | 255 |
256 // Callback function after download file hash is checked with safebrowsing | 256 // Callback function after download file hash is checked with safebrowsing |
257 // service. | 257 // service. |
258 void CheckDownloadHashDone(int32 download_id, bool is_dangerous_hash); | 258 void CheckDownloadHashDone(int32 download_id, bool is_dangerous_hash); |
259 | 259 |
260 // Assert the named download item is on the correct queues | 260 // Assert the named download item is on the correct queues |
261 // in the DownloadManager. For debugging. | 261 // in the DownloadManager. For debugging. |
262 void AssertQueueStateConsistent(DownloadItem* download); | 262 void AssertQueueStateConsistent(DownloadItem* download); |
263 | 263 |
| 264 // Get the download item from the history map. Useful after the item has |
| 265 // been removed from the active map, or was retrieved from the history DB. |
| 266 DownloadItem* GetDownloadItem(int id); |
| 267 |
264 private: | 268 private: |
265 // For testing. | 269 // For testing. |
266 friend class DownloadManagerTest; | 270 friend class DownloadManagerTest; |
267 friend class MockDownloadManager; | 271 friend class MockDownloadManager; |
268 | 272 |
269 // This class is used to let an incognito DownloadManager observe changes to | 273 // This class is used to let an incognito DownloadManager observe changes to |
270 // a normal DownloadManager, to propagate ModelChanged() calls from the parent | 274 // a normal DownloadManager, to propagate ModelChanged() calls from the parent |
271 // DownloadManager to the observers of the incognito DownloadManager. | 275 // DownloadManager to the observers of the incognito DownloadManager. |
272 class OtherDownloadManagerObserver : public Observer { | 276 class OtherDownloadManagerObserver : public Observer { |
273 public: | 277 public: |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 336 |
333 // An error occurred in the download. | 337 // An error occurred in the download. |
334 void OnDownloadError(int32 download_id, int64 size, int os_error); | 338 void OnDownloadError(int32 download_id, int64 size, int os_error); |
335 | 339 |
336 // Updates the app icon about the overall download progress. | 340 // Updates the app icon about the overall download progress. |
337 void UpdateAppIcon(); | 341 void UpdateAppIcon(); |
338 | 342 |
339 // Inform observers that the model has changed. | 343 // Inform observers that the model has changed. |
340 void NotifyModelChanged(); | 344 void NotifyModelChanged(); |
341 | 345 |
342 // Get the download item from the history map. Useful after the item has | |
343 // been removed from the active map, or was retrieved from the history DB. | |
344 DownloadItem* GetDownloadItem(int id); | |
345 | |
346 // Get the download item from the active map. Useful when the item is not | 346 // Get the download item from the active map. Useful when the item is not |
347 // yet in the history map. | 347 // yet in the history map. |
348 DownloadItem* GetActiveDownloadItem(int id); | 348 DownloadItem* GetActiveDownloadItem(int id); |
349 | 349 |
350 // Debugging routine to confirm relationship between below | 350 // Debugging routine to confirm relationship between below |
351 // containers; no-op if NDEBUG. | 351 // containers; no-op if NDEBUG. |
352 void AssertContainersConsistent() const; | 352 void AssertContainersConsistent() const; |
353 | 353 |
354 // |downloads_| is the owning set for all downloads known to the | 354 // |downloads_| is the owning set for all downloads known to the |
355 // DownloadManager. This includes downloads started by the user in | 355 // DownloadManager. This includes downloads started by the user in |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 // The "Save As" dialog box used to ask the user where a file should be | 424 // The "Save As" dialog box used to ask the user where a file should be |
425 // saved. | 425 // saved. |
426 scoped_refptr<SelectFileDialog> select_file_dialog_; | 426 scoped_refptr<SelectFileDialog> select_file_dialog_; |
427 | 427 |
428 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; | 428 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; |
429 | 429 |
430 DISALLOW_COPY_AND_ASSIGN(DownloadManager); | 430 DISALLOW_COPY_AND_ASSIGN(DownloadManager); |
431 }; | 431 }; |
432 | 432 |
433 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 433 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
OLD | NEW |