| 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 // 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 #include <map> | 43 #include <map> |
| 44 | 44 |
| 45 #include "base/atomic_sequence_num.h" | 45 #include "base/atomic_sequence_num.h" |
| 46 #include "base/basictypes.h" | 46 #include "base/basictypes.h" |
| 47 #include "base/gtest_prod_util.h" | 47 #include "base/gtest_prod_util.h" |
| 48 #include "base/hash_tables.h" | 48 #include "base/hash_tables.h" |
| 49 #include "base/memory/ref_counted.h" | 49 #include "base/memory/ref_counted.h" |
| 50 #include "base/memory/scoped_ptr.h" | 50 #include "base/memory/scoped_ptr.h" |
| 51 #include "base/timer.h" | 51 #include "base/timer.h" |
| 52 #include "content/browser/download/interrupt_reasons.h" | |
| 53 #include "content/common/content_export.h" | 52 #include "content/common/content_export.h" |
| 54 #include "content/public/browser/download_id.h" | 53 #include "content/public/browser/download_id.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 class ResourceDispatcherHost; | 61 class ResourceDispatcherHost; |
| 62 | 62 |
| 63 namespace content { | 63 namespace content { |
| 64 class DownloadBuffer; | 64 class DownloadBuffer; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // FILE thread. | 103 // FILE thread. |
| 104 void UpdateDownload(content::DownloadId global_id, | 104 void UpdateDownload(content::DownloadId global_id, |
| 105 content::DownloadBuffer* buffer); | 105 content::DownloadBuffer* buffer); |
| 106 | 106 |
| 107 // |reason| is the reason for interruption, if one occurs. | 107 // |reason| is the reason for interruption, if one occurs. |
| 108 // |security_info| contains SSL information (cert_id, cert_status, | 108 // |security_info| contains SSL information (cert_id, cert_status, |
| 109 // security_bits, ssl_connection_status), which can be used to | 109 // security_bits, ssl_connection_status), which can be used to |
| 110 // fine-tune the error message. It is empty if the transaction | 110 // fine-tune the error message. It is empty if the transaction |
| 111 // was not performed securely. | 111 // was not performed securely. |
| 112 void OnResponseCompleted(content::DownloadId global_id, | 112 void OnResponseCompleted(content::DownloadId global_id, |
| 113 InterruptReason reason, | 113 content::DownloadInterruptReason reason, |
| 114 const std::string& security_info); | 114 const std::string& security_info); |
| 115 | 115 |
| 116 // Handlers for notifications sent from the UI thread and run on the | 116 // Handlers for notifications sent from the UI thread and run on the |
| 117 // FILE thread. These are both terminal actions with respect to the | 117 // FILE thread. These are both terminal actions with respect to the |
| 118 // download file, as far as the DownloadFileManager is concerned -- if | 118 // download file, as far as the DownloadFileManager is concerned -- if |
| 119 // anything happens to the download file after they are called, it will | 119 // anything happens to the download file after they are called, it will |
| 120 // be ignored. | 120 // be ignored. |
| 121 void CancelDownload(content::DownloadId id); | 121 void CancelDownload(content::DownloadId id); |
| 122 void CompleteDownload(content::DownloadId id); | 122 void CompleteDownload(content::DownloadId id); |
| 123 | 123 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 // is controlled from the FILE thread, and posts updates to the UI thread. | 191 // is controlled from the FILE thread, and posts updates to the UI thread. |
| 192 base::RepeatingTimer<DownloadFileManager> update_timer_; | 192 base::RepeatingTimer<DownloadFileManager> update_timer_; |
| 193 | 193 |
| 194 ResourceDispatcherHost* resource_dispatcher_host_; | 194 ResourceDispatcherHost* resource_dispatcher_host_; |
| 195 scoped_ptr<DownloadFileFactory> download_file_factory_; | 195 scoped_ptr<DownloadFileFactory> download_file_factory_; |
| 196 | 196 |
| 197 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); | 197 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ | 200 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ |
| OLD | NEW |