| OLD | NEW |
| 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 // ResourceDispatcherHostImpl. | 8 // ResourceDispatcherHostImpl. |
| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "content/public/browser/download_id.h" | 53 #include "content/public/browser/download_id.h" |
| 54 #include "content/public/browser/download_interrupt_reasons.h" | 54 #include "content/public/browser/download_interrupt_reasons.h" |
| 55 #include "net/base/net_errors.h" | 55 #include "net/base/net_errors.h" |
| 56 #include "ui/gfx/native_widget_types.h" | 56 #include "ui/gfx/native_widget_types.h" |
| 57 | 57 |
| 58 struct DownloadCreateInfo; | 58 struct DownloadCreateInfo; |
| 59 class DownloadRequestHandle; | 59 class DownloadRequestHandle; |
| 60 class FilePath; | 60 class FilePath; |
| 61 | 61 |
| 62 namespace content { | 62 namespace content { |
| 63 class DownloadBuffer; | |
| 64 class DownloadFile; | 63 class DownloadFile; |
| 65 class DownloadManager; | 64 class DownloadManager; |
| 66 } | 65 } |
| 67 | 66 |
| 68 namespace net { | 67 namespace net { |
| 69 class BoundNetLog; | 68 class BoundNetLog; |
| 70 } | 69 } |
| 71 | 70 |
| 72 // Manages all in progress downloads. | 71 // Manages all in progress downloads. |
| 73 class CONTENT_EXPORT DownloadFileManager | 72 class CONTENT_EXPORT DownloadFileManager |
| (...skipping 16 matching lines...) Expand all Loading... |
| 90 // |DownloadFileFactory| to be used. | 89 // |DownloadFileFactory| to be used. |
| 91 explicit DownloadFileManager(DownloadFileFactory* factory); | 90 explicit DownloadFileManager(DownloadFileFactory* factory); |
| 92 | 91 |
| 93 // Called on shutdown on the UI thread. | 92 // Called on shutdown on the UI thread. |
| 94 void Shutdown(); | 93 void Shutdown(); |
| 95 | 94 |
| 96 // Called on UI thread to make DownloadFileManager start the download. | 95 // Called on UI thread to make DownloadFileManager start the download. |
| 97 void StartDownload(DownloadCreateInfo* info, | 96 void StartDownload(DownloadCreateInfo* info, |
| 98 const DownloadRequestHandle& request_handle); | 97 const DownloadRequestHandle& request_handle); |
| 99 | 98 |
| 100 // Handlers for notifications sent from the IO thread and run on the | |
| 101 // FILE thread. | |
| 102 void UpdateDownload(content::DownloadId global_id, | |
| 103 content::DownloadBuffer* buffer); | |
| 104 | |
| 105 // |reason| is the reason for interruption, if one occurs. | |
| 106 // |security_info| contains SSL information (cert_id, cert_status, | |
| 107 // security_bits, ssl_connection_status), which can be used to | |
| 108 // fine-tune the error message. It is empty if the transaction | |
| 109 // was not performed securely. | |
| 110 void OnResponseCompleted(content::DownloadId global_id, | |
| 111 content::DownloadInterruptReason reason, | |
| 112 const std::string& security_info); | |
| 113 | |
| 114 // Handlers for notifications sent from the UI thread and run on the | 99 // Handlers for notifications sent from the UI thread and run on the |
| 115 // FILE thread. These are both terminal actions with respect to the | 100 // FILE thread. These are both terminal actions with respect to the |
| 116 // download file, as far as the DownloadFileManager is concerned -- if | 101 // download file, as far as the DownloadFileManager is concerned -- if |
| 117 // anything happens to the download file after they are called, it will | 102 // anything happens to the download file after they are called, it will |
| 118 // be ignored. | 103 // be ignored. |
| 119 void CancelDownload(content::DownloadId id); | 104 void CancelDownload(content::DownloadId id); |
| 120 void CompleteDownload(content::DownloadId id); | 105 void CompleteDownload(content::DownloadId id); |
| 121 | 106 |
| 122 // Called on FILE thread by DownloadManager at the beginning of its shutdown. | 107 // Called on FILE thread by DownloadManager at the beginning of its shutdown. |
| 123 void OnDownloadManagerShutdown(content::DownloadManager* manager); | 108 void OnDownloadManagerShutdown(content::DownloadManager* manager); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 // Schedule periodic updates of the download progress. This timer | 181 // Schedule periodic updates of the download progress. This timer |
| 197 // is controlled from the FILE thread, and posts updates to the UI thread. | 182 // is controlled from the FILE thread, and posts updates to the UI thread. |
| 198 scoped_ptr<base::RepeatingTimer<DownloadFileManager> > update_timer_; | 183 scoped_ptr<base::RepeatingTimer<DownloadFileManager> > update_timer_; |
| 199 | 184 |
| 200 scoped_ptr<DownloadFileFactory> download_file_factory_; | 185 scoped_ptr<DownloadFileFactory> download_file_factory_; |
| 201 | 186 |
| 202 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); | 187 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); |
| 203 }; | 188 }; |
| 204 | 189 |
| 205 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ | 190 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ |
| OLD | NEW |