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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 class DownloadManager; | 61 class DownloadManager; |
62 class FilePath; | 62 class FilePath; |
63 class GURL; | 63 class GURL; |
64 class ResourceDispatcherHost; | 64 class ResourceDispatcherHost; |
65 | 65 |
66 namespace net { | 66 namespace net { |
67 class URLRequestContextGetter; | 67 class URLRequestContextGetter; |
68 } | 68 } |
69 | 69 |
70 // Manages all in progress downloads. | 70 // Manages all in progress downloads. |
71 class DownloadFileManager | 71 class CONTENT_EXPORT DownloadFileManager |
72 : public base::RefCountedThreadSafe<DownloadFileManager> { | 72 : public base::RefCountedThreadSafe<DownloadFileManager> { |
73 public: | 73 public: |
74 explicit DownloadFileManager(ResourceDispatcherHost* rdh); | 74 explicit DownloadFileManager(ResourceDispatcherHost* rdh); |
75 | 75 |
76 // Called on shutdown on the UI thread. | 76 // Called on shutdown on the UI thread. |
77 CONTENT_EXPORT void Shutdown(); | 77 void Shutdown(); |
78 | 78 |
79 // Called on UI thread to make DownloadFileManager start the download. | 79 // Called on UI thread to make DownloadFileManager start the download. |
80 void StartDownload(DownloadCreateInfo* info); | 80 void StartDownload(DownloadCreateInfo* info); |
81 | 81 |
82 // Handlers for notifications sent from the IO thread and run on the | 82 // Handlers for notifications sent from the IO thread and run on the |
83 // FILE thread. | 83 // FILE thread. |
84 void UpdateDownload(DownloadId global_id, DownloadBuffer* buffer); | 84 void UpdateDownload(DownloadId global_id, DownloadBuffer* buffer); |
85 // |net_error| is 0 for normal completions, and non-0 for errors. | 85 // |net_error| is 0 for normal completions, and non-0 for errors. |
86 // |security_info| contains SSL information (cert_id, cert_status, | 86 // |security_info| contains SSL information (cert_id, cert_status, |
87 // security_bits, ssl_connection_status), which can be used to | 87 // security_bits, ssl_connection_status), which can be used to |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // Schedule periodic updates of the download progress. This timer | 163 // Schedule periodic updates of the download progress. This timer |
164 // is controlled from the FILE thread, and posts updates to the UI thread. | 164 // is controlled from the FILE thread, and posts updates to the UI thread. |
165 base::RepeatingTimer<DownloadFileManager> update_timer_; | 165 base::RepeatingTimer<DownloadFileManager> update_timer_; |
166 | 166 |
167 ResourceDispatcherHost* resource_dispatcher_host_; | 167 ResourceDispatcherHost* resource_dispatcher_host_; |
168 | 168 |
169 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); | 169 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); |
170 }; | 170 }; |
171 | 171 |
172 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ | 172 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ |
OLD | NEW |