OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_FILESYSTEM_UTIL_H_ | 5 #ifndef COMPONENTS_FILESYSTEM_UTIL_H_ |
6 #define COMPONENTS_FILESYSTEM_UTIL_H_ | 6 #define COMPONENTS_FILESYSTEM_UTIL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
11 #include "components/filesystem/public/interfaces/types.mojom.h" | 11 #include "components/filesystem/public/interfaces/types.mojom.h" |
12 | 12 |
13 namespace mojo { | |
14 class String; | |
15 } | |
16 | |
17 namespace filesystem { | 13 namespace filesystem { |
18 | 14 |
19 // Validation functions (typically used to check arguments; they return | 15 // Validation functions (typically used to check arguments; they return |
20 // |ERROR_OK| if valid, else the standard/recommended error for the validation | 16 // |ERROR_OK| if valid, else the standard/recommended error for the validation |
21 // error): | 17 // error): |
22 | 18 |
23 // Checks if |path| is (looks like) a valid (relative) path. (On failure, | 19 // Checks if |path| is (looks like) a valid (relative) path. (On failure, |
24 // returns |ERROR_INVALID_ARGUMENT| if |path| is not UTF-8, or | 20 // returns |ERROR_INVALID_ARGUMENT| if |path| is not UTF-8, or |
25 // |ERROR_PERMISSION_DENIED| if it is not relative.) | 21 // |ERROR_PERMISSION_DENIED| if it is not relative.) |
26 mojom::FileError IsPathValid(const std::string& path); | 22 mojom::FileError IsPathValid(const std::string& path); |
(...skipping 17 matching lines...) Expand all Loading... |
44 mojom::FileInformationPtr MakeFileInformation(const base::File::Info& info); | 40 mojom::FileInformationPtr MakeFileInformation(const base::File::Info& info); |
45 | 41 |
46 // Creates an absolute file path and ensures that we don't try to traverse up. | 42 // Creates an absolute file path and ensures that we don't try to traverse up. |
47 mojom::FileError ValidatePath(const std::string& raw_path, | 43 mojom::FileError ValidatePath(const std::string& raw_path, |
48 const base::FilePath& filesystem_base, | 44 const base::FilePath& filesystem_base, |
49 base::FilePath* out); | 45 base::FilePath* out); |
50 | 46 |
51 } // namespace filesystem | 47 } // namespace filesystem |
52 | 48 |
53 #endif // COMPONENTS_FILESYSTEM_UTIL_H_ | 49 #endif // COMPONENTS_FILESYSTEM_UTIL_H_ |
OLD | NEW |