| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 public: | 68 public: |
| 69 explicit DownloadFileManager(ResourceDispatcherHost* rdh); | 69 explicit DownloadFileManager(ResourceDispatcherHost* rdh); |
| 70 | 70 |
| 71 // Called on shutdown on the UI thread. | 71 // Called on shutdown on the UI thread. |
| 72 void Shutdown(); | 72 void Shutdown(); |
| 73 | 73 |
| 74 // Called on the IO thread | 74 // Called on the IO thread |
| 75 int GetNextId(); | 75 int GetNextId(); |
| 76 | 76 |
| 77 // Return the ID that matches |url| and |path|, or -1 if not found. |
| 78 int GetDownloadId(const GURL& url, const FilePath& path) const; |
| 79 |
| 77 // Called on UI thread to make DownloadFileManager start the download. | 80 // Called on UI thread to make DownloadFileManager start the download. |
| 78 void StartDownload(DownloadCreateInfo* info); | 81 void StartDownload(DownloadCreateInfo* info); |
| 79 | 82 |
| 80 // Handlers for notifications sent from the IO thread and run on the | 83 // Handlers for notifications sent from the IO thread and run on the |
| 81 // download thread. | 84 // download thread. |
| 82 void UpdateDownload(int id, DownloadBuffer* buffer); | 85 void UpdateDownload(int id, DownloadBuffer* buffer); |
| 83 void CancelDownload(int id); | 86 void CancelDownload(int id); |
| 84 void OnResponseCompleted(int id, DownloadBuffer* buffer); | 87 void OnResponseCompleted(int id, |
| 88 DownloadBuffer* buffer, |
| 89 int os_error, |
| 90 const std::string& security_info); |
| 85 | 91 |
| 86 // Called on FILE thread by DownloadManager at the beginning of its shutdown. | 92 // Called on FILE thread by DownloadManager at the beginning of its shutdown. |
| 87 void OnDownloadManagerShutdown(DownloadManager* manager); | 93 void OnDownloadManagerShutdown(DownloadManager* manager); |
| 88 | 94 |
| 89 // The DownloadManager in the UI thread has provided an intermediate | 95 // The DownloadManager in the UI thread has provided an intermediate |
| 90 // .crdownload name for the download specified by 'id'. | 96 // .crdownload name for the download specified by 'id'. |
| 91 void OnIntermediateDownloadName(int id, const FilePath& full_path, | 97 void OnIntermediateDownloadName(int id, const FilePath& full_path, |
| 92 DownloadManager* download_manager); | 98 DownloadManager* download_manager); |
| 93 | 99 |
| 94 // The download manager has provided a final name for a download. Sent from | 100 // The download manager has provided a final name for a download. Sent from |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 // Schedule periodic updates of the download progress. This timer | 144 // Schedule periodic updates of the download progress. This timer |
| 139 // is controlled from the FILE thread, and posts updates to the UI thread. | 145 // is controlled from the FILE thread, and posts updates to the UI thread. |
| 140 base::RepeatingTimer<DownloadFileManager> update_timer_; | 146 base::RepeatingTimer<DownloadFileManager> update_timer_; |
| 141 | 147 |
| 142 ResourceDispatcherHost* resource_dispatcher_host_; | 148 ResourceDispatcherHost* resource_dispatcher_host_; |
| 143 | 149 |
| 144 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); | 150 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); |
| 145 }; | 151 }; |
| 146 | 152 |
| 147 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ | 153 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ |
| OLD | NEW |