| 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 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
| 7 | 7 |
| 8 #include "content/browser/download/download_file.h" | 8 #include "content/browser/download/download_file.h" |
| 9 | 9 |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 namespace content { | 27 namespace content { |
| 28 class ByteStreamReader; | 28 class ByteStreamReader; |
| 29 class DownloadDestinationObserver; | 29 class DownloadDestinationObserver; |
| 30 class DownloadManager; | 30 class DownloadManager; |
| 31 struct DownloadCreateInfo; | 31 struct DownloadCreateInfo; |
| 32 | 32 |
| 33 class CONTENT_EXPORT DownloadFileImpl : public DownloadFile { | 33 class CONTENT_EXPORT DownloadFileImpl : public DownloadFile { |
| 34 public: | 34 public: |
| 35 // Takes ownership of the object pointed to by |request_handle|. | 35 // Takes ownership of the object pointed to by |request_handle|. |
| 36 // |bound_net_log| will be used for logging the download file's events. | 36 // |net_log| will be used for logging the download file's events. |
| 37 // May be constructed on any thread. All methods besides the constructor | 37 // May be constructed on any thread. All methods besides the constructor |
| 38 // (including destruction) must occur on the FILE thread. | 38 // (including destruction) must occur on the FILE thread. |
| 39 // | 39 // |
| 40 // Note that the DownloadFileImpl automatically reads from the passed in | 40 // Note that the DownloadFileImpl automatically reads from the passed in |
| 41 // stream, and sends updates and status of those reads to the | 41 // stream, and sends updates and status of those reads to the |
| 42 // DownloadDestinationObserver. | 42 // DownloadDestinationObserver. |
| 43 DownloadFileImpl(std::unique_ptr<DownloadSaveInfo> save_info, | 43 DownloadFileImpl(std::unique_ptr<DownloadSaveInfo> save_info, |
| 44 const base::FilePath& default_downloads_directory, | 44 const base::FilePath& default_downloads_directory, |
| 45 std::unique_ptr<ByteStreamReader> byte_stream, | 45 std::unique_ptr<ByteStreamReader> byte_stream, |
| 46 const net::BoundNetLog& bound_net_log, | 46 const net::NetLogWithSource& net_log, |
| 47 base::WeakPtr<DownloadDestinationObserver> observer); | 47 base::WeakPtr<DownloadDestinationObserver> observer); |
| 48 | 48 |
| 49 ~DownloadFileImpl() override; | 49 ~DownloadFileImpl() override; |
| 50 | 50 |
| 51 // DownloadFile functions. | 51 // DownloadFile functions. |
| 52 void Initialize(const InitializeCallback& callback) override; | 52 void Initialize(const InitializeCallback& callback) override; |
| 53 void RenameAndUniquify(const base::FilePath& full_path, | 53 void RenameAndUniquify(const base::FilePath& full_path, |
| 54 const RenameCompletionCallback& callback) override; | 54 const RenameCompletionCallback& callback) override; |
| 55 void RenameAndAnnotate(const base::FilePath& full_path, | 55 void RenameAndAnnotate(const base::FilePath& full_path, |
| 56 const std::string& client_guid, | 56 const std::string& client_guid, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // Rename file_ based on |parameters|. | 106 // Rename file_ based on |parameters|. |
| 107 void RenameWithRetryInternal(std::unique_ptr<RenameParameters> parameters); | 107 void RenameWithRetryInternal(std::unique_ptr<RenameParameters> parameters); |
| 108 | 108 |
| 109 // Send an update on our progress. | 109 // Send an update on our progress. |
| 110 void SendUpdate(); | 110 void SendUpdate(); |
| 111 | 111 |
| 112 // Called when there's some activity on stream_reader_ that needs to be | 112 // Called when there's some activity on stream_reader_ that needs to be |
| 113 // handled. | 113 // handled. |
| 114 void StreamActive(); | 114 void StreamActive(); |
| 115 | 115 |
| 116 net::BoundNetLog bound_net_log_; | 116 net::NetLogWithSource net_log_; |
| 117 | 117 |
| 118 // The base file instance. | 118 // The base file instance. |
| 119 BaseFile file_; | 119 BaseFile file_; |
| 120 | 120 |
| 121 // DownloadSaveInfo provided during construction. Since the DownloadFileImpl | 121 // DownloadSaveInfo provided during construction. Since the DownloadFileImpl |
| 122 // can be created on any thread, this holds the save_info_ until it can be | 122 // can be created on any thread, this holds the save_info_ until it can be |
| 123 // used to initialize file_ on the FILE thread. | 123 // used to initialize file_ on the FILE thread. |
| 124 std::unique_ptr<DownloadSaveInfo> save_info_; | 124 std::unique_ptr<DownloadSaveInfo> save_info_; |
| 125 | 125 |
| 126 // The default directory for creating the download file. | 126 // The default directory for creating the download file. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 144 base::WeakPtr<DownloadDestinationObserver> observer_; | 144 base::WeakPtr<DownloadDestinationObserver> observer_; |
| 145 | 145 |
| 146 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; | 146 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; |
| 147 | 147 |
| 148 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); | 148 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 } // namespace content | 151 } // namespace content |
| 152 | 152 |
| 153 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ | 153 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
| OLD | NEW |