From 92411906a4da3454e552da6f85c0417551f32e45 Mon Sep 17 00:00:00 2001 From: "kinaba@chromium.org" Date: Wed, 29 Jan 2014 01:16:47 +0000 Subject: Clarify and separate the concept of "Drive path" and "Filesystem relative path". - RelativeFileSystemPath (also called VirtualPath) is the path appended in the filesystem URL, after .../external/. So it looks like "drive-xxx/root/foo/bar" or "Downloads-xxx/foo/bar". Note that in the Drive case, it begins with the mount point name, that differs from profile to profile. - DrivePath is the path in the hierarchy we manage in drive::ResourceMetadata. It is like "drive/root/foo/bar" and always begins with "drive". Every path comes from drive::FileSystem is in DrivePath. Every path that will be the part of FileSystem API must be in RelativeFileSystemPath. We need proper conversion for the bridging codes. BUG=337095 Review URL: https://codereview.chromium.org/147993003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247561 0039d316-1c4b-4281-b951-d872f2087c98 --- .../browser/chromeos/file_manager/fileapi_util.h | 36 +++++++++++++--------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'chrome/browser/chromeos/file_manager/fileapi_util.h') diff --git a/chrome/browser/chromeos/file_manager/fileapi_util.h b/chrome/browser/chromeos/file_manager/fileapi_util.h index 703b14a..454c806 100644 --- a/chrome/browser/chromeos/file_manager/fileapi_util.h +++ b/chrome/browser/chromeos/file_manager/fileapi_util.h @@ -39,23 +39,31 @@ fileapi::FileSystemContext* GetFileSystemContextForRenderViewHost( Profile* profile, content::RenderViewHost* render_view_host); -// Converts |relative_path| (e.g., "drive/root" or "Downloads") into external -// filesystem URL (e.g., filesystem://id/external/drive/root). -GURL ConvertRelativeFilePathToFileSystemUrl(const base::FilePath& relative_path, - const std::string& extension_id); +// Converts DrivePath (e.g., "drive/root", which always starts with the fixed +// "drive" directory) to a RelativeFileSystemPathrelative (e.g., +// "drive-xxx/root/foo". which starts from the "mount point" in the FileSystem +// API that may be distinguished for each profile by the appended "xxx" part.) +base::FilePath ConvertDrivePathToRelativeFileSystemPath( + Profile* profile, + const base::FilePath& drive_path); + +// Converts DrivePath to FileSystem URL. +// E.g., "drive/root" to filesystem://id/external/drive-xxx/root. +GURL ConvertDrivePathToFileSystemUrl(Profile* profile, + const base::FilePath& drive_path, + const std::string& extension_id); -// Converts |absolute_path| (e.g., "/special/drive/root" or -// "/home/chronos/user/Downloads") into external filesystem URL. Returns false +// Converts AbsolutePath (e.g., "/special/drive-xxx/root" or +// "/home/chronos/u-xxx/Downloads") into filesystem URL. Returns false // if |absolute_path| is not managed by the external filesystem provider. -bool ConvertAbsoluteFilePathToFileSystemUrl( - Profile* profile, - const base::FilePath& absolute_path, - const std::string& extension_id, - GURL* url); +bool ConvertAbsoluteFilePathToFileSystemUrl(Profile* profile, + const base::FilePath& absolute_path, + const std::string& extension_id, + GURL* url); -// Converts |absolute_path| into |relative_path| within the external -// provider in File API. Returns false if |absolute_path| is not managed -// by the external filesystem provider. +// Converts AbsolutePath into RelativeFileSystemPath (e.g., +// "/special/drive-xxx/root/foo" => "drive-xxx/root/foo".) Returns false if +// |absolute_path| is not managed by the external filesystem provider. bool ConvertAbsoluteFilePathToRelativeFileSystemPath( Profile* profile, const std::string& extension_id, -- cgit v1.1