| 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/files/file.h" | 10 #include "base/files/file.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // Returns the current (intermediate) state of the hash as a byte string. | 100 // Returns the current (intermediate) state of the hash as a byte string. |
| 101 virtual std::string GetHashState(); | 101 virtual std::string GetHashState(); |
| 102 | 102 |
| 103 // Returns true if the given hash is considered empty. An empty hash is | 103 // Returns true if the given hash is considered empty. An empty hash is |
| 104 // a string of size crypto::kSHA256Length that contains only zeros (initial | 104 // a string of size crypto::kSHA256Length that contains only zeros (initial |
| 105 // value for the hash). | 105 // value for the hash). |
| 106 static bool IsEmptyHash(const std::string& hash); | 106 static bool IsEmptyHash(const std::string& hash); |
| 107 | 107 |
| 108 virtual std::string DebugString() const; | 108 virtual std::string DebugString() const; |
| 109 | 109 |
| 110 // Sets whether the BaseFile should hide its file extension when presented in |
| 111 // the Finder (MacOSX). |
| 112 void set_hide_file_extension(bool hide_file_extension); |
| 113 |
| 110 private: | 114 private: |
| 111 friend class BaseFileTest; | 115 friend class BaseFileTest; |
| 112 FRIEND_TEST_ALL_PREFIXES(BaseFileTest, IsEmptyHash); | 116 FRIEND_TEST_ALL_PREFIXES(BaseFileTest, IsEmptyHash); |
| 113 | 117 |
| 114 // Creates and opens the file_ if it is NULL. | 118 // Creates and opens the file_ if it is NULL. |
| 115 DownloadInterruptReason Open(); | 119 DownloadInterruptReason Open(); |
| 116 | 120 |
| 117 // Closes and resets file_. | 121 // Closes and resets file_. |
| 118 void Close(); | 122 void Close(); |
| 119 | 123 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 scoped_ptr<crypto::SecureHash> secure_hash_; | 178 scoped_ptr<crypto::SecureHash> secure_hash_; |
| 175 | 179 |
| 176 unsigned char sha256_hash_[crypto::kSHA256Length]; | 180 unsigned char sha256_hash_[crypto::kSHA256Length]; |
| 177 | 181 |
| 178 // Indicates that this class no longer owns the associated file, and so | 182 // Indicates that this class no longer owns the associated file, and so |
| 179 // won't delete it on destruction. | 183 // won't delete it on destruction. |
| 180 bool detached_; | 184 bool detached_; |
| 181 | 185 |
| 182 net::BoundNetLog bound_net_log_; | 186 net::BoundNetLog bound_net_log_; |
| 183 | 187 |
| 188 bool hide_file_extension_; |
| 189 |
| 184 DISALLOW_COPY_AND_ASSIGN(BaseFile); | 190 DISALLOW_COPY_AND_ASSIGN(BaseFile); |
| 185 }; | 191 }; |
| 186 | 192 |
| 187 } // namespace content | 193 } // namespace content |
| 188 | 194 |
| 189 #endif // CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ | 195 #endif // CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ |
| OLD | NEW |