| 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_DRIVE_FILE_SYSTEM_CORE_UTIL_H_ | 5 #ifndef COMPONENTS_DRIVE_FILE_SYSTEM_CORE_UTIL_H_ |
| 6 #define COMPONENTS_DRIVE_FILE_SYSTEM_CORE_UTIL_H_ | 6 #define COMPONENTS_DRIVE_FILE_SYSTEM_CORE_UTIL_H_ |
| 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 |
| 17 namespace util { | 17 namespace util { |
| 18 | 18 |
| 19 // "drive" diretory's local ID is fixed to this value. | 19 // "drive" diretory's local ID is fixed to this value. |
| 20 const char kDriveGrandRootLocalId[] = "<drive>"; | 20 const char kDriveGrandRootLocalId[] = "<drive>"; |
| 21 | 21 |
| 22 // "drive/other" diretory's local ID is fixed to this value. | 22 // "drive/other" diretory's local ID is fixed to this value. |
| 23 const char kDriveOtherDirLocalId[] = "<other>"; | 23 const char kDriveOtherDirLocalId[] = "<other>"; |
| 24 | 24 |
| 25 // "drive/team_drives" diretory's local ID is fixed to this value. | 25 // "drive/team_drives" diretory's local ID is fixed to this value. |
| 26 const char kDriveTeamDrivesDirLocalId[] = "<team_drives>"; | 26 const char kDriveTeamDrivesDirLocalId[] = "<team_drives>"; |
| 27 // A virtual resource ID to identify "drive/team_drives" directory. |
| 28 const char kDriveTeamDrivesDirVirtualResourceId[] = |
| 29 "<VIRTUAL_RESOURCE_ID_TEAM_DRIVES>"; |
| 27 | 30 |
| 28 // "drive/trash" diretory's local ID is fixed to this value. | 31 // "drive/trash" diretory's local ID is fixed to this value. |
| 29 const char kDriveTrashDirLocalId[] = "<trash>"; | 32 const char kDriveTrashDirLocalId[] = "<trash>"; |
| 30 | 33 |
| 31 // The directory names used for the Google Drive file system tree. These names | 34 // The directory names used for the Google Drive file system tree. These names |
| 32 // are used in URLs for the file manager, hence user-visible. | 35 // are used in URLs for the file manager, hence user-visible. |
| 33 const char kDriveGrandRootDirName[] = "drive"; | 36 const char kDriveGrandRootDirName[] = "drive"; |
| 34 const char kDriveMyDriveRootDirName[] = "root"; | 37 const char kDriveMyDriveRootDirName[] = "root"; |
| 35 const char kDriveOtherDirName[] = "other"; | 38 const char kDriveOtherDirName[] = "other"; |
| 36 const char kDriveTeamDrivesDirName[] = "team_drives"; | 39 const char kDriveTeamDrivesDirName[] = "team_drives"; |
| 37 const char kDriveTrashDirName[] = "trash"; | 40 const char kDriveTrashDirName[] = "trash"; |
| 38 | 41 |
| 39 // Returns the path of the top root of the pseudo tree. | 42 // Returns the path of the top root of the pseudo tree. |
| 40 const base::FilePath& GetDriveGrandRootPath(); | 43 const base::FilePath& GetDriveGrandRootPath(); |
| 41 | 44 |
| 42 // Returns the path of the directory representing "My Drive". | 45 // Returns the path of the directory representing "My Drive". |
| 43 const base::FilePath& GetDriveMyDriveRootPath(); | 46 const base::FilePath& GetDriveMyDriveRootPath(); |
| 44 | 47 |
| 48 // Returns the path of the directory representing "Team Drives". |
| 49 const base::FilePath& GetDriveTeamDrivesRootPath(); |
| 50 |
| 45 // Escapes a file name in Drive cache. | 51 // Escapes a file name in Drive cache. |
| 46 // Replaces percent ('%'), period ('.') and slash ('/') with %XX (hex) | 52 // Replaces percent ('%'), period ('.') and slash ('/') with %XX (hex) |
| 47 std::string EscapeCacheFileName(const std::string& filename); | 53 std::string EscapeCacheFileName(const std::string& filename); |
| 48 | 54 |
| 49 // Unescapes a file path in Drive cache. | 55 // Unescapes a file path in Drive cache. |
| 50 // This is the inverse of EscapeCacheFileName. | 56 // This is the inverse of EscapeCacheFileName. |
| 51 std::string UnescapeCacheFileName(const std::string& filename); | 57 std::string UnescapeCacheFileName(const std::string& filename); |
| 52 | 58 |
| 53 // Converts the given string to a form suitable as a file name. Specifically, | 59 // Converts the given string to a form suitable as a file name. Specifically, |
| 54 // - Normalizes in Unicode Normalization Form C. | 60 // - Normalizes in Unicode Normalization Form C. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 81 // Reads URL from a GDoc file. | 87 // Reads URL from a GDoc file. |
| 82 GURL ReadUrlFromGDocFile(const base::FilePath& file_path); | 88 GURL ReadUrlFromGDocFile(const base::FilePath& file_path); |
| 83 | 89 |
| 84 // Reads resource ID from a GDoc file. | 90 // Reads resource ID from a GDoc file. |
| 85 std::string ReadResourceIdFromGDocFile(const base::FilePath& file_path); | 91 std::string ReadResourceIdFromGDocFile(const base::FilePath& file_path); |
| 86 | 92 |
| 87 } // namespace util | 93 } // namespace util |
| 88 } // namespace drive | 94 } // namespace drive |
| 89 | 95 |
| 90 #endif // COMPONENTS_DRIVE_FILE_SYSTEM_CORE_UTIL_H_ | 96 #endif // COMPONENTS_DRIVE_FILE_SYSTEM_CORE_UTIL_H_ |
| OLD | NEW |