Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: chrome/browser/chromeos/drive/file_system_util.h

Issue 150163003: drive: Switch Drive mount path to per-profile one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 const base::FilePath::CharType kDriveTrashDirName[] = 53 const base::FilePath::CharType kDriveTrashDirName[] =
54 FILE_PATH_LITERAL("trash"); 54 FILE_PATH_LITERAL("trash");
55 55
56 // Returns the path of the top root of the pseudo tree. 56 // Returns the path of the top root of the pseudo tree.
57 const base::FilePath& GetDriveGrandRootPath(); 57 const base::FilePath& GetDriveGrandRootPath();
58 58
59 // Returns the path of the directory representing "My Drive". 59 // Returns the path of the directory representing "My Drive".
60 const base::FilePath& GetDriveMyDriveRootPath(); 60 const base::FilePath& GetDriveMyDriveRootPath();
61 61
62 // Returns the Drive mount point path, which looks like 62 // Returns the Drive mount point path, which looks like "/special/drive-<hash>".
63 // "/special/drive-<unique-id-of-profile>". 63 base::FilePath GetDriveMountPointPath(Profile* profile);
64 const base::FilePath& GetDriveMountPointPath(Profile* profile);
65 64
66 // Returns the FileSystem for the |profile|. If not available (not mounted 65 // Returns the FileSystem for the |profile|. If not available (not mounted
67 // or disabled), returns NULL. 66 // or disabled), returns NULL.
68 FileSystemInterface* GetFileSystemByProfile(Profile* profile); 67 FileSystemInterface* GetFileSystemByProfile(Profile* profile);
69 68
70 // Returns a FileSystemInterface instance for the |profile_id|, or NULL 69 // Returns a FileSystemInterface instance for the |profile_id|, or NULL
71 // if the Profile for |profile_id| is destructed or Drive File System is 70 // if the Profile for |profile_id| is destructed or Drive File System is
72 // disabled for the profile. 71 // disabled for the profile.
73 // Note: |profile_id| should be the pointer of the Profile instance if it is 72 // Note: |profile_id| should be the pointer of the Profile instance if it is
74 // alive. Considering timing issues due to task posting across threads, 73 // alive. Considering timing issues due to task posting across threads,
(...skipping 20 matching lines...) Expand all
95 void MaybeSetDriveURL(Profile* profile, const base::FilePath& path, GURL* url); 94 void MaybeSetDriveURL(Profile* profile, const base::FilePath& path, GURL* url);
96 95
97 // Returns true if the given path is under the Drive mount point. 96 // Returns true if the given path is under the Drive mount point.
98 bool IsUnderDriveMountPoint(const base::FilePath& path); 97 bool IsUnderDriveMountPoint(const base::FilePath& path);
99 98
100 // Extracts the Drive path from the given path located under the Drive mount 99 // Extracts the Drive path from the given path located under the Drive mount
101 // point. Returns an empty path if |path| is not under the Drive mount point. 100 // point. Returns an empty path if |path| is not under the Drive mount point.
102 // Examples: ExtractDrivePath("/special/drive-xxx/foo.txt") => "drive/foo.txt" 101 // Examples: ExtractDrivePath("/special/drive-xxx/foo.txt") => "drive/foo.txt"
103 base::FilePath ExtractDrivePath(const base::FilePath& path); 102 base::FilePath ExtractDrivePath(const base::FilePath& path);
104 103
104 // Extracts |profile| from the given paths located under
105 // GetDriveMountPointPath(profile). Returns NULL if it does not correspond to
106 // a valid mount point path. Must be called from UI thread.
107 Profile* ExtractProfileFromPath(const base::FilePath& path);
108
105 // Extracts the Drive path (e.g., "drive/foo.txt") from the filesystem URL. 109 // Extracts the Drive path (e.g., "drive/foo.txt") from the filesystem URL.
106 // Returns an empty path if |url| does not point under Drive mount point. 110 // Returns an empty path if |url| does not point under Drive mount point.
107 base::FilePath ExtractDrivePathFromFileSystemUrl( 111 base::FilePath ExtractDrivePathFromFileSystemUrl(
108 const fileapi::FileSystemURL& url); 112 const fileapi::FileSystemURL& url);
109 113
110 // Escapes a file name in Drive cache. 114 // Escapes a file name in Drive cache.
111 // Replaces percent ('%'), period ('.') and slash ('/') with %XX (hex) 115 // Replaces percent ('%'), period ('.') and slash ('/') with %XX (hex)
112 std::string EscapeCacheFileName(const std::string& filename); 116 std::string EscapeCacheFileName(const std::string& filename);
113 117
114 // Unescapes a file path in Drive cache. 118 // Unescapes a file path in Drive cache.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 DRIVE_CONNECTED, 212 DRIVE_CONNECTED,
209 }; 213 };
210 214
211 // Returns the Drive connection status for the |profile|. 215 // Returns the Drive connection status for the |profile|.
212 ConnectionStatusType GetDriveConnectionStatus(Profile* profile); 216 ConnectionStatusType GetDriveConnectionStatus(Profile* profile);
213 217
214 } // namespace util 218 } // namespace util
215 } // namespace drive 219 } // namespace drive
216 220
217 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UTIL_H_ 221 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_integration_service.cc ('k') | chrome/browser/chromeos/drive/file_system_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698