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 CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CORE_UTIL_H_ | 5 #ifndef COMPONENTS_DRIVE_FILE_SYSTEM_CORE_UTIL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CORE_UTIL_H_ | 6 #define COMPONENTS_DRIVE_FILE_SYSTEM_CORE_UTIL_H_ |
hashimoto
2015/08/14 00:47:54
nit: How about naming this file components/drive/f
Łukasz Anforowicz
2015/08/14 17:14:45
Done.
Łukasz Anforowicz
2015/08/19 19:12:28
Actually, I need to undo this renaming, because 1)
| |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "components/drive/file_errors.h" | 12 #include "components/drive/file_errors.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 namespace drive { | 15 namespace drive { |
16 | 16 |
(...skipping 18 matching lines...) Expand all Loading... | |
35 const char kDriveMyDriveRootDirName[] = "root"; | 35 const char kDriveMyDriveRootDirName[] = "root"; |
36 const char kDriveOtherDirName[] = "other"; | 36 const char kDriveOtherDirName[] = "other"; |
37 const char kDriveTrashDirName[] = "trash"; | 37 const char kDriveTrashDirName[] = "trash"; |
38 | 38 |
39 // Returns the path of the top root of the pseudo tree. | 39 // Returns the path of the top root of the pseudo tree. |
40 const base::FilePath& GetDriveGrandRootPath(); | 40 const base::FilePath& GetDriveGrandRootPath(); |
41 | 41 |
42 // Returns the path of the directory representing "My Drive". | 42 // Returns the path of the directory representing "My Drive". |
43 const base::FilePath& GetDriveMyDriveRootPath(); | 43 const base::FilePath& GetDriveMyDriveRootPath(); |
44 | 44 |
45 // Returns the Drive mount point path, which looks like | |
46 // "/special/drive-<username_hash>", when provided with the |user_id_hash|. | |
47 base::FilePath GetDriveMountPointPathForUserIdHash(std::string user_id_hash); | |
48 | |
49 // Returns true if the given path is under the Drive mount point. | |
50 bool IsUnderDriveMountPoint(const base::FilePath& path); | |
51 | |
52 // Extracts the Drive path from the given path located under the Drive mount | |
53 // point. Returns an empty path if |path| is not under the Drive mount point. | |
54 // Examples: ExtractDrivePath("/special/drive-xxx/foo.txt") => "drive/foo.txt" | |
55 base::FilePath ExtractDrivePath(const base::FilePath& path); | |
56 | |
57 // Escapes a file name in Drive cache. | 45 // Escapes a file name in Drive cache. |
58 // Replaces percent ('%'), period ('.') and slash ('/') with %XX (hex) | 46 // Replaces percent ('%'), period ('.') and slash ('/') with %XX (hex) |
59 std::string EscapeCacheFileName(const std::string& filename); | 47 std::string EscapeCacheFileName(const std::string& filename); |
60 | 48 |
61 // Unescapes a file path in Drive cache. | 49 // Unescapes a file path in Drive cache. |
62 // This is the inverse of EscapeCacheFileName. | 50 // This is the inverse of EscapeCacheFileName. |
63 std::string UnescapeCacheFileName(const std::string& filename); | 51 std::string UnescapeCacheFileName(const std::string& filename); |
64 | 52 |
65 // Converts the given string to a form suitable as a file name. Specifically, | 53 // Converts the given string to a form suitable as a file name. Specifically, |
66 // - Normalizes in Unicode Normalization Form C. | 54 // - Normalizes in Unicode Normalization Form C. |
(...skipping 25 matching lines...) Expand all Loading... | |
92 | 80 |
93 // Reads URL from a GDoc file. | 81 // Reads URL from a GDoc file. |
94 GURL ReadUrlFromGDocFile(const base::FilePath& file_path); | 82 GURL ReadUrlFromGDocFile(const base::FilePath& file_path); |
95 | 83 |
96 // Reads resource ID from a GDoc file. | 84 // Reads resource ID from a GDoc file. |
97 std::string ReadResourceIdFromGDocFile(const base::FilePath& file_path); | 85 std::string ReadResourceIdFromGDocFile(const base::FilePath& file_path); |
98 | 86 |
99 } // namespace util | 87 } // namespace util |
100 } // namespace drive | 88 } // namespace drive |
101 | 89 |
102 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CORE_UTIL_H_ | 90 #endif // COMPONENTS_DRIVE_FILE_SYSTEM_CORE_UTIL_H_ |
OLD | NEW |