Chromium Code Reviews| 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 browser context in Chrome. | 8 // active browser context in Chrome. |
| 9 // | 9 // |
| 10 // Download observers: | 10 // Download observers: |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 #include "base/gtest_prod_util.h" | 39 #include "base/gtest_prod_util.h" |
| 40 #include "base/hash_tables.h" | 40 #include "base/hash_tables.h" |
| 41 #include "base/memory/ref_counted.h" | 41 #include "base/memory/ref_counted.h" |
| 42 #include "base/memory/scoped_ptr.h" | 42 #include "base/memory/scoped_ptr.h" |
| 43 #include "base/memory/weak_ptr.h" | 43 #include "base/memory/weak_ptr.h" |
| 44 #include "base/observer_list.h" | 44 #include "base/observer_list.h" |
| 45 #include "base/synchronization/lock.h" | 45 #include "base/synchronization/lock.h" |
| 46 #include "base/time.h" | 46 #include "base/time.h" |
| 47 #include "content/browser/browser_thread.h" | 47 #include "content/browser/browser_thread.h" |
| 48 #include "content/browser/download/download_item.h" | 48 #include "content/browser/download/download_item.h" |
| 49 #include "content/browser/download/download_query.h" | |
| 49 #include "content/browser/download/download_request_handle.h" | 50 #include "content/browser/download/download_request_handle.h" |
| 50 #include "content/browser/download/download_status_updater_delegate.h" | 51 #include "content/browser/download/download_status_updater_delegate.h" |
| 51 #include "content/common/content_export.h" | 52 #include "content/common/content_export.h" |
| 52 #include "net/base/net_errors.h" | 53 #include "net/base/net_errors.h" |
| 53 | 54 |
| 54 class DownloadFileManager; | 55 class DownloadFileManager; |
| 55 class DownloadManagerDelegate; | 56 class DownloadManagerDelegate; |
| 56 class DownloadStatusUpdater; | 57 class DownloadStatusUpdater; |
| 57 class GURL; | 58 class GURL; |
| 58 class ResourceDispatcherHost; | 59 class ResourceDispatcherHost; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 | 100 |
| 100 typedef std::vector<DownloadItem*> DownloadVector; | 101 typedef std::vector<DownloadItem*> DownloadVector; |
| 101 | 102 |
| 102 // Return all temporary downloads that reside in the specified directory. | 103 // Return all temporary downloads that reside in the specified directory. |
| 103 void GetTemporaryDownloads(const FilePath& dir_path, DownloadVector* result); | 104 void GetTemporaryDownloads(const FilePath& dir_path, DownloadVector* result); |
| 104 | 105 |
| 105 // Return all non-temporary downloads in the specified directory that are | 106 // Return all non-temporary downloads in the specified directory that are |
| 106 // are in progress or have completed. | 107 // are in progress or have completed. |
| 107 void GetAllDownloads(const FilePath& dir_path, DownloadVector* result); | 108 void GetAllDownloads(const FilePath& dir_path, DownloadVector* result); |
| 108 | 109 |
| 110 // If |results| or |json_results| is non-NULL, fill it/them with DownloadItems | |
| 111 // matching |query|. If |error_msg| is non-NULL, set it to an error message if | |
| 112 // |query| was mal-formed. | |
|
Randy Smith (Not in Mondays)
2011/10/10 18:09:42
This interface makes me uncomfortable for two reas
benjhayden
2011/10/13 14:07:34
Done.
| |
| 113 bool Search(const download_util::DownloadQuery& query, | |
| 114 std::string* error_msg, | |
| 115 DownloadVector* results, | |
| 116 base::ListValue* json_results) const; | |
| 117 | |
| 109 // Returns all non-temporary downloads matching |query|. Empty query matches | 118 // Returns all non-temporary downloads matching |query|. Empty query matches |
| 110 // everything. | 119 // everything. |
| 111 void SearchDownloads(const string16& query, DownloadVector* result); | 120 void SearchDownloads(const string16& query, DownloadVector* result); |
| 112 | 121 |
| 113 // Returns the next download id in a DownloadId and increments the counter. | 122 // Returns the next download id in a DownloadId and increments the counter. |
| 114 // May be called on any thread. The incremented counter is not persisted, but | 123 // May be called on any thread. The incremented counter is not persisted, but |
| 115 // the base counter for this accessor is initialized from the largest id | 124 // the base counter for this accessor is initialized from the largest id |
| 116 // actually saved to the download history database. | 125 // actually saved to the download history database. |
| 117 DownloadId GetNextId(); | 126 DownloadId GetNextId(); |
| 118 | 127 |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 427 DownloadManagerDelegate* delegate_; | 436 DownloadManagerDelegate* delegate_; |
| 428 | 437 |
| 429 // TODO(rdsmith): Remove when http://crbug.com/84508 is fixed. | 438 // TODO(rdsmith): Remove when http://crbug.com/84508 is fixed. |
| 430 // For debugging only. | 439 // For debugging only. |
| 431 int64 largest_db_handle_in_history_; | 440 int64 largest_db_handle_in_history_; |
| 432 | 441 |
| 433 DISALLOW_COPY_AND_ASSIGN(DownloadManager); | 442 DISALLOW_COPY_AND_ASSIGN(DownloadManager); |
| 434 }; | 443 }; |
| 435 | 444 |
| 436 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 445 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
| OLD | NEW |