| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 class CONTENT_EXPORT DownloadFileManager | 70 class CONTENT_EXPORT DownloadFileManager |
| 71 : public base::RefCountedThreadSafe<DownloadFileManager> { | 71 : public base::RefCountedThreadSafe<DownloadFileManager> { |
| 72 public: | 72 public: |
| 73 class DownloadFileFactory { | 73 class DownloadFileFactory { |
| 74 public: | 74 public: |
| 75 virtual ~DownloadFileFactory() {} | 75 virtual ~DownloadFileFactory() {} |
| 76 | 76 |
| 77 virtual content::DownloadFile* CreateFile( | 77 virtual content::DownloadFile* CreateFile( |
| 78 DownloadCreateInfo* info, | 78 DownloadCreateInfo* info, |
| 79 const DownloadRequestHandle& request_handle, | 79 const DownloadRequestHandle& request_handle, |
| 80 content::DownloadManager* download_manager) = 0; | 80 content::DownloadManager* download_manager, |
| 81 bool calculate_hash) = 0; |
| 81 }; | 82 }; |
| 82 | 83 |
| 83 // Takes ownership of the factory. | 84 // Takes ownership of the factory. |
| 84 // Passing in a NULL for |factory| will cause a default | 85 // Passing in a NULL for |factory| will cause a default |
| 85 // |DownloadFileFactory| to be used. | 86 // |DownloadFileFactory| to be used. |
| 86 DownloadFileManager(ResourceDispatcherHost* rdh, | 87 DownloadFileManager(ResourceDispatcherHost* rdh, |
| 87 DownloadFileFactory* factory); | 88 DownloadFileFactory* factory); |
| 88 | 89 |
| 89 // Called on shutdown on the UI thread. | 90 // Called on shutdown on the UI thread. |
| 90 void Shutdown(); | 91 void Shutdown(); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // is controlled from the FILE thread, and posts updates to the UI thread. | 180 // is controlled from the FILE thread, and posts updates to the UI thread. |
| 180 base::RepeatingTimer<DownloadFileManager> update_timer_; | 181 base::RepeatingTimer<DownloadFileManager> update_timer_; |
| 181 | 182 |
| 182 ResourceDispatcherHost* resource_dispatcher_host_; | 183 ResourceDispatcherHost* resource_dispatcher_host_; |
| 183 scoped_ptr<DownloadFileFactory> download_file_factory_; | 184 scoped_ptr<DownloadFileFactory> download_file_factory_; |
| 184 | 185 |
| 185 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); | 186 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); |
| 186 }; | 187 }; |
| 187 | 188 |
| 188 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ | 189 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ |
| OLD | NEW |