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 DownloadFileManager owns a set of DownloadFile objects, each of which | 5 // The DownloadFileManager owns a set of DownloadFile objects, each of which |
6 // represent one in progress download and performs the disk IO for that | 6 // represent one in progress download and performs the disk IO for that |
7 // download. The DownloadFileManager itself is a singleton object owned by the | 7 // download. The DownloadFileManager itself is a singleton object owned by the |
8 // ResourceDispatcherHost. | 8 // ResourceDispatcherHost. |
9 // | 9 // |
10 // The DownloadFileManager uses the file_thread for performing file write | 10 // The DownloadFileManager uses the file_thread for performing file write |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 void RenameCompletingDownloadFile(DownloadId id, | 120 void RenameCompletingDownloadFile(DownloadId id, |
121 const FilePath& full_path, | 121 const FilePath& full_path, |
122 bool overwrite_existing_file); | 122 bool overwrite_existing_file); |
123 | 123 |
124 // The number of downloads currently active on the DownloadFileManager. | 124 // The number of downloads currently active on the DownloadFileManager. |
125 // Primarily for testing. | 125 // Primarily for testing. |
126 int NumberOfActiveDownloads() const { | 126 int NumberOfActiveDownloads() const { |
127 return downloads_.size(); | 127 return downloads_.size(); |
128 } | 128 } |
129 | 129 |
130 protected: | |
131 // Creates a new DownloadFile. | |
132 // Used only for testing, to create a MockDownloadFile instead. | |
133 DownloadFile* NewDownloadFile( | |
134 DownloadCreateInfo* info, | |
135 const DownloadRequestHandle& request_handle, | |
136 DownloadManager* download_manager); | |
Randy Smith (Not in Mondays)
2011/11/10 21:58:43
I don't think that this is used in this CL? I don
ahendrickson
2011/11/13 00:50:21
Done.
| |
137 | |
130 private: | 138 private: |
131 friend class base::RefCountedThreadSafe<DownloadFileManager>; | 139 friend class base::RefCountedThreadSafe<DownloadFileManager>; |
132 friend class DownloadManagerTest; | 140 friend class DownloadManagerTest; |
133 FRIEND_TEST_ALL_PREFIXES(DownloadManagerTest, StartDownload); | 141 FRIEND_TEST_ALL_PREFIXES(DownloadManagerTest, StartDownload); |
134 | 142 |
135 ~DownloadFileManager(); | 143 ~DownloadFileManager(); |
136 | 144 |
137 // Timer helpers for updating the UI about the current progress of a download. | 145 // Timer helpers for updating the UI about the current progress of a download. |
138 void StartUpdateTimer(); | 146 void StartUpdateTimer(); |
139 void StopUpdateTimer(); | 147 void StopUpdateTimer(); |
(...skipping 29 matching lines...) Expand all Loading... | |
169 // Schedule periodic updates of the download progress. This timer | 177 // Schedule periodic updates of the download progress. This timer |
170 // is controlled from the FILE thread, and posts updates to the UI thread. | 178 // is controlled from the FILE thread, and posts updates to the UI thread. |
171 base::RepeatingTimer<DownloadFileManager> update_timer_; | 179 base::RepeatingTimer<DownloadFileManager> update_timer_; |
172 | 180 |
173 ResourceDispatcherHost* resource_dispatcher_host_; | 181 ResourceDispatcherHost* resource_dispatcher_host_; |
174 | 182 |
175 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); | 183 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); |
176 }; | 184 }; |
177 | 185 |
178 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ | 186 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ |
OLD | NEW |