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 18 matching lines...) Expand all Loading... |
29 #pragma once | 29 #pragma once |
30 | 30 |
31 #include <map> | 31 #include <map> |
32 #include <set> | 32 #include <set> |
33 #include <string> | 33 #include <string> |
34 #include <vector> | 34 #include <vector> |
35 | 35 |
36 #include "base/basictypes.h" | 36 #include "base/basictypes.h" |
37 #include "base/file_path.h" | 37 #include "base/file_path.h" |
38 #include "base/gtest_prod_util.h" | 38 #include "base/gtest_prod_util.h" |
| 39 #include "base/hash_tables.h" |
39 #include "base/memory/ref_counted.h" | 40 #include "base/memory/ref_counted.h" |
40 #include "base/memory/scoped_ptr.h" | 41 #include "base/memory/scoped_ptr.h" |
41 #include "base/memory/weak_ptr.h" | 42 #include "base/memory/weak_ptr.h" |
42 #include "base/observer_list.h" | 43 #include "base/observer_list.h" |
43 #include "base/time.h" | 44 #include "base/time.h" |
44 #include "chrome/browser/download/download_item.h" | 45 #include "chrome/browser/download/download_item.h" |
45 #include "chrome/browser/download/download_request_handle.h" | 46 #include "chrome/browser/download/download_request_handle.h" |
46 #include "chrome/browser/download/download_status_updater_delegate.h" | 47 #include "chrome/browser/download/download_status_updater_delegate.h" |
47 #include "chrome/browser/ui/shell_dialogs.h" | 48 #include "chrome/browser/ui/shell_dialogs.h" |
48 #include "content/browser/browser_thread.h" | 49 #include "content/browser/browser_thread.h" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 void NotifyModelChanged(); | 345 void NotifyModelChanged(); |
345 | 346 |
346 // Get the download item from the active map. Useful when the item is not | 347 // Get the download item from the active map. Useful when the item is not |
347 // yet in the history map. | 348 // yet in the history map. |
348 DownloadItem* GetActiveDownloadItem(int id); | 349 DownloadItem* GetActiveDownloadItem(int id); |
349 | 350 |
350 // Debugging routine to confirm relationship between below | 351 // Debugging routine to confirm relationship between below |
351 // containers; no-op if NDEBUG. | 352 // containers; no-op if NDEBUG. |
352 void AssertContainersConsistent() const; | 353 void AssertContainersConsistent() const; |
353 | 354 |
| 355 // Add a DownloadItem to history_downloads_. |
| 356 void AddDownloadItemToHistory(DownloadItem* item, int64 db_handle); |
| 357 |
354 // |downloads_| is the owning set for all downloads known to the | 358 // |downloads_| is the owning set for all downloads known to the |
355 // DownloadManager. This includes downloads started by the user in | 359 // DownloadManager. This includes downloads started by the user in |
356 // this session, downloads initialized from the history system, and | 360 // this session, downloads initialized from the history system, and |
357 // "save page as" downloads. All other DownloadItem containers in | 361 // "save page as" downloads. All other DownloadItem containers in |
358 // the DownloadManager are maps; they do not own the DownloadItems. | 362 // the DownloadManager are maps; they do not own the DownloadItems. |
359 // Note that this is the only place (with any functional implications; | 363 // Note that this is the only place (with any functional implications; |
360 // see save_page_as_downloads_ below) that "save page as" downloads are | 364 // see save_page_as_downloads_ below) that "save page as" downloads are |
361 // kept, as the DownloadManager's only job is to hold onto those | 365 // kept, as the DownloadManager's only job is to hold onto those |
362 // until destruction. | 366 // until destruction. |
363 // | 367 // |
(...skipping 60 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 | 428 // The "Save As" dialog box used to ask the user where a file should be |
425 // saved. | 429 // saved. |
426 scoped_refptr<SelectFileDialog> select_file_dialog_; | 430 scoped_refptr<SelectFileDialog> select_file_dialog_; |
427 | 431 |
428 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; | 432 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; |
429 | 433 |
430 DISALLOW_COPY_AND_ASSIGN(DownloadManager); | 434 DISALLOW_COPY_AND_ASSIGN(DownloadManager); |
431 }; | 435 }; |
432 | 436 |
433 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 437 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
OLD | NEW |