| 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_BASE_FILE_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 const GURL& source_url, | 33 const GURL& source_url, |
| 34 const GURL& referrer_url, | 34 const GURL& referrer_url, |
| 35 int64 received_bytes, | 35 int64 received_bytes, |
| 36 bool calculate_hash, | 36 bool calculate_hash, |
| 37 const std::string& hash_state, | 37 const std::string& hash_state, |
| 38 const linked_ptr<net::FileStream>& file_stream, | 38 const linked_ptr<net::FileStream>& file_stream, |
| 39 const net::BoundNetLog& bound_net_log); | 39 const net::BoundNetLog& bound_net_log); |
| 40 virtual ~BaseFile(); | 40 virtual ~BaseFile(); |
| 41 | 41 |
| 42 // Returns net::OK on success, or a network error code on failure. | 42 // Returns net::OK on success, or a network error code on failure. |
| 43 net::Error Initialize(); | 43 // |default_directory| specifies the directory to create the temporary file in |
| 44 // if |full_path()| is empty. If |default_directory| and |full_path()| are |
| 45 // empty, then a temporary file will be created in the default download |
| 46 // location as determined by ContentBrowserClient. |
| 47 net::Error Initialize(const FilePath& default_directory); |
| 44 | 48 |
| 45 // Write a new chunk of data to the file. | 49 // Write a new chunk of data to the file. |
| 46 // Returns net::OK on success (all bytes written to the file), | 50 // Returns net::OK on success (all bytes written to the file), |
| 47 // or a network error code on failure. | 51 // or a network error code on failure. |
| 48 net::Error AppendDataToFile(const char* data, size_t data_len); | 52 net::Error AppendDataToFile(const char* data, size_t data_len); |
| 49 | 53 |
| 50 // Rename the download file. | 54 // Rename the download file. |
| 51 // Returns net::OK on success, or a network error code on failure. | 55 // Returns net::OK on success, or a network error code on failure. |
| 52 virtual net::Error Rename(const FilePath& full_path); | 56 virtual net::Error Rename(const FilePath& full_path); |
| 53 | 57 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // Indicates that this class no longer owns the associated file, and so | 139 // Indicates that this class no longer owns the associated file, and so |
| 136 // won't delete it on destruction. | 140 // won't delete it on destruction. |
| 137 bool detached_; | 141 bool detached_; |
| 138 | 142 |
| 139 net::BoundNetLog bound_net_log_; | 143 net::BoundNetLog bound_net_log_; |
| 140 | 144 |
| 141 DISALLOW_COPY_AND_ASSIGN(BaseFile); | 145 DISALLOW_COPY_AND_ASSIGN(BaseFile); |
| 142 }; | 146 }; |
| 143 | 147 |
| 144 #endif // CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ | 148 #endif // CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ |
| OLD | NEW |