Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: content/browser/download/download_file_manager.h

Issue 9426029: Test file errors in downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactored per Chris' comments Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 void RenameCompletingDownloadFile(content::DownloadId id, 137 void RenameCompletingDownloadFile(content::DownloadId id,
138 const FilePath& full_path, 138 const FilePath& full_path,
139 bool overwrite_existing_file); 139 bool overwrite_existing_file);
140 140
141 // The number of downloads currently active on the DownloadFileManager. 141 // The number of downloads currently active on the DownloadFileManager.
142 // Primarily for testing. 142 // Primarily for testing.
143 int NumberOfActiveDownloads() const { 143 int NumberOfActiveDownloads() const {
144 return downloads_.size(); 144 return downloads_.size();
145 } 145 }
146 146
147 // This is only for unit tests.
cbentzel 2012/02/28 14:51:41 Comment doesn't totally seem required given the Fo
Randy Smith (Not in Mondays) 2012/02/28 22:06:13 Agreed with Chris. (Personal opinion is that we d
ahendrickson 2012/03/01 09:17:32 Removed comment.
ahendrickson 2012/03/01 09:17:32 Done.
148 void SetFileFactoryForTesting(DownloadFileFactory* file_factory) {
cbentzel 2012/02/28 14:51:41 This should pass in a scoped_ptr argument so trans
ahendrickson 2012/03/01 09:17:32 Done.
149 download_file_factory_.reset(file_factory);
150 }
151
147 private: 152 private:
148 friend class base::RefCountedThreadSafe<DownloadFileManager>; 153 friend class base::RefCountedThreadSafe<DownloadFileManager>;
149 friend class DownloadFileManagerTest; 154 friend class DownloadFileManagerTest;
150 friend class DownloadManagerTest; 155 friend class DownloadManagerTest;
151 FRIEND_TEST_ALL_PREFIXES(DownloadManagerTest, StartDownload); 156 FRIEND_TEST_ALL_PREFIXES(DownloadManagerTest, StartDownload);
152 157
153 ~DownloadFileManager(); 158 ~DownloadFileManager();
154 159
155 // Timer helpers for updating the UI about the current progress of a download. 160 // Timer helpers for updating the UI about the current progress of a download.
156 void StartUpdateTimer(); 161 void StartUpdateTimer();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // is controlled from the FILE thread, and posts updates to the UI thread. 196 // is controlled from the FILE thread, and posts updates to the UI thread.
192 base::RepeatingTimer<DownloadFileManager> update_timer_; 197 base::RepeatingTimer<DownloadFileManager> update_timer_;
193 198
194 ResourceDispatcherHost* resource_dispatcher_host_; 199 ResourceDispatcherHost* resource_dispatcher_host_;
195 scoped_ptr<DownloadFileFactory> download_file_factory_; 200 scoped_ptr<DownloadFileFactory> download_file_factory_;
196 201
197 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); 202 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager);
198 }; 203 };
199 204
200 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ 205 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698