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 CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UTIL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UTIL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UTIL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_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 "chrome/browser/chromeos/drive/file_errors.h" | 11 #include "chrome/browser/chromeos/drive/file_errors.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
14 class Profile; | 14 class Profile; |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class FilePath; | 17 class FilePath; |
18 } | 18 } |
19 | 19 |
20 namespace fileapi { | 20 namespace fileapi { |
21 class FileSystemURL; | 21 class FileSystemURL; |
22 } | 22 } |
23 | 23 |
24 namespace drive { | 24 namespace drive { |
25 | 25 |
| 26 class DriveAppRegistry; |
| 27 class DriveServiceInterface; |
26 class FileSystemInterface; | 28 class FileSystemInterface; |
27 class ResourceEntry; | 29 class ResourceEntry; |
28 | 30 |
29 namespace util { | 31 namespace util { |
30 | 32 |
31 // Path constants. | 33 // Path constants. |
32 | 34 |
33 // Name of the directory used to store metadata. | 35 // Name of the directory used to store metadata. |
34 const base::FilePath::CharType kMetadataDirectory[] = FILE_PATH_LITERAL("meta"); | 36 const base::FilePath::CharType kMetadataDirectory[] = FILE_PATH_LITERAL("meta"); |
35 | 37 |
(...skipping 28 matching lines...) Expand all Loading... |
64 | 66 |
65 // Returns the path of the top root of the pseudo tree. | 67 // Returns the path of the top root of the pseudo tree. |
66 const base::FilePath& GetDriveGrandRootPath(); | 68 const base::FilePath& GetDriveGrandRootPath(); |
67 | 69 |
68 // Returns the path of the directory representing "My Drive". | 70 // Returns the path of the directory representing "My Drive". |
69 const base::FilePath& GetDriveMyDriveRootPath(); | 71 const base::FilePath& GetDriveMyDriveRootPath(); |
70 | 72 |
71 // Returns the Drive mount point path, which looks like "/special/drive". | 73 // Returns the Drive mount point path, which looks like "/special/drive". |
72 const base::FilePath& GetDriveMountPointPath(); | 74 const base::FilePath& GetDriveMountPointPath(); |
73 | 75 |
| 76 // Returns the FileSystem for the |profile|. If not available (not mounted |
| 77 // or disabled), returns NULL. |
| 78 FileSystemInterface* GetFileSystemByProfile(Profile* profile); |
| 79 |
74 // Returns a FileSystemInterface instance for the |profile_id|, or NULL | 80 // Returns a FileSystemInterface instance for the |profile_id|, or NULL |
75 // if the Profile for |profile_id| is destructed or Drive File System is | 81 // if the Profile for |profile_id| is destructed or Drive File System is |
76 // disabled for the profile. | 82 // disabled for the profile. |
77 // Note: |profile_id| should be the pointer of the Profile instance if it is | 83 // Note: |profile_id| should be the pointer of the Profile instance if it is |
78 // alive. Considering timing issues due to task posting across threads, | 84 // alive. Considering timing issues due to task posting across threads, |
79 // this function can accept a dangling pointer as |profile_id| (and will return | 85 // this function can accept a dangling pointer as |profile_id| (and will return |
80 // NULL for such a case). | 86 // NULL for such a case). |
81 // This function must be called on UI thread. | 87 // This function must be called on UI thread. |
82 FileSystemInterface* GetFileSystemByProfileId(void* profile_id); | 88 FileSystemInterface* GetFileSystemByProfileId(void* profile_id); |
83 | 89 |
| 90 // Returns the DriveAppRegistry for the |profile|. If not available (not |
| 91 // mounted or disabled), returns NULL. |
| 92 DriveAppRegistry* GetDriveAppRegistryByProfile(Profile* profile); |
| 93 |
| 94 // Returns the DriveService for the |profile|. If not available (not mounted |
| 95 // or disabled), returns NULL. |
| 96 DriveServiceInterface* GetDriveServiceByProfile(Profile* profile); |
| 97 |
84 // Checks if the resource ID is a special one, which is effective only in our | 98 // Checks if the resource ID is a special one, which is effective only in our |
85 // implementation and is not supposed to be sent to the server. | 99 // implementation and is not supposed to be sent to the server. |
86 bool IsSpecialResourceId(const std::string& resource_id); | 100 bool IsSpecialResourceId(const std::string& resource_id); |
87 | 101 |
88 // Returns a ResourceEntry for "/drive/root" directory. | 102 // Returns a ResourceEntry for "/drive/root" directory. |
89 ResourceEntry CreateMyDriveRootEntry(const std::string& root_resource_id); | 103 ResourceEntry CreateMyDriveRootEntry(const std::string& root_resource_id); |
90 | 104 |
91 // Returns the Drive mount path as string. | 105 // Returns the Drive mount path as string. |
92 const std::string& GetDriveMountPointPathAsString(); | 106 const std::string& GetDriveMountPointPathAsString(); |
93 | 107 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // or an empty string if an error is found. | 221 // or an empty string if an error is found. |
208 std::string GetMd5Digest(const base::FilePath& file_path); | 222 std::string GetMd5Digest(const base::FilePath& file_path); |
209 | 223 |
210 // Returns true if Drive is enabled for the given Profile. | 224 // Returns true if Drive is enabled for the given Profile. |
211 bool IsDriveEnabledForProfile(Profile* profile); | 225 bool IsDriveEnabledForProfile(Profile* profile); |
212 | 226 |
213 } // namespace util | 227 } // namespace util |
214 } // namespace drive | 228 } // namespace drive |
215 | 229 |
216 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UTIL_H_ | 230 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UTIL_H_ |
OLD | NEW |