| 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_SAVE_PACKAGE_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 // |directory| : Directory containing target file. | 201 // |directory| : Directory containing target file. |
| 202 // |extension| : Extension. | 202 // |extension| : Extension. |
| 203 // |max_path_len| : Maximum size allowed for |len(directory + base_name + | 203 // |max_path_len| : Maximum size allowed for |len(directory + base_name + |
| 204 // extension|. | 204 // extension|. |
| 205 // |base_name| : Variable portion. The length of this component will be | 205 // |base_name| : Variable portion. The length of this component will be |
| 206 // adjusted to fit the length constraints described at | 206 // adjusted to fit the length constraints described at |
| 207 // |max_path_len| above. | 207 // |max_path_len| above. |
| 208 // | 208 // |
| 209 // Returns true if |base_name| could be successfully adjusted to fit the | 209 // Returns true if |base_name| could be successfully adjusted to fit the |
| 210 // aforementioned constraints, or false otherwise. | 210 // aforementioned constraints, or false otherwise. |
| 211 // TODO(asanka): This funciton is wrong. |base_name| cannot be truncated | 211 // TODO(asanka): This function is wrong. |base_name| cannot be truncated |
| 212 // without knowing its encoding and truncation has to be performed on | 212 // without knowing its encoding and truncation has to be performed on |
| 213 // character boundaries. Also the implementation doesn't look up the actual | 213 // character boundaries. Also the implementation doesn't look up the actual |
| 214 // path constraints and instead uses hard coded constants. crbug.com/618737 | 214 // path constraints and instead uses hard coded constants. crbug.com/618737 |
| 215 static bool TruncateBaseNameToFitPathConstraints( | 215 static bool TruncateBaseNameToFitPathConstraints( |
| 216 const base::FilePath& directory, | 216 const base::FilePath& directory, |
| 217 const base::FilePath::StringType& extension, | 217 const base::FilePath::StringType& extension, |
| 218 uint32_t max_path_len, | 218 uint32_t max_path_len, |
| 219 base::FilePath::StringType* base_name); | 219 base::FilePath::StringType* base_name); |
| 220 | 220 |
| 221 // Create a file name based on the response from the server. | 221 // Create a file name based on the response from the server. |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 | 438 |
| 439 // Unique ID for this SavePackage. | 439 // Unique ID for this SavePackage. |
| 440 const SavePackageId unique_id_; | 440 const SavePackageId unique_id_; |
| 441 | 441 |
| 442 DISALLOW_COPY_AND_ASSIGN(SavePackage); | 442 DISALLOW_COPY_AND_ASSIGN(SavePackage); |
| 443 }; | 443 }; |
| 444 | 444 |
| 445 } // namespace content | 445 } // namespace content |
| 446 | 446 |
| 447 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ | 447 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ |
| OLD | NEW |