| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // This file provides File API related utilities. | 5 // This file provides File API related utilities. |
| 6 | 6 |
| 7 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILEAPI_UTIL_H_ | 7 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILEAPI_UTIL_H_ |
| 8 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILEAPI_UTIL_H_ | 8 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILEAPI_UTIL_H_ |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 fileapi::FileSystemContext* GetFileSystemContextForExtensionId( | 32 fileapi::FileSystemContext* GetFileSystemContextForExtensionId( |
| 33 Profile* profile, | 33 Profile* profile, |
| 34 const std::string& extension_id); | 34 const std::string& extension_id); |
| 35 | 35 |
| 36 // Returns a file system context associated with the given profile and the | 36 // Returns a file system context associated with the given profile and the |
| 37 // render view host. | 37 // render view host. |
| 38 fileapi::FileSystemContext* GetFileSystemContextForRenderViewHost( | 38 fileapi::FileSystemContext* GetFileSystemContextForRenderViewHost( |
| 39 Profile* profile, | 39 Profile* profile, |
| 40 content::RenderViewHost* render_view_host); | 40 content::RenderViewHost* render_view_host); |
| 41 | 41 |
| 42 // Converts |relative_path| (e.g., "drive/root" or "Downloads") into external | 42 // Converts DrivePath (e.g., "drive/root", which always starts with the fixed |
| 43 // filesystem URL (e.g., filesystem://id/external/drive/root). | 43 // "drive" directory) to a RelativeFileSystemPathrelative (e.g., |
| 44 GURL ConvertRelativeFilePathToFileSystemUrl(const base::FilePath& relative_path, | 44 // "drive-xxx/root/foo". which starts from the "mount point" in the FileSystem |
| 45 const std::string& extension_id); | 45 // API that may be distinguished for each profile by the appended "xxx" part.) |
| 46 base::FilePath ConvertDrivePathToRelativeFileSystemPath( |
| 47 Profile* profile, |
| 48 const base::FilePath& drive_path); |
| 46 | 49 |
| 47 // Converts |absolute_path| (e.g., "/special/drive/root" or | 50 // Converts DrivePath to FileSystem URL. |
| 48 // "/home/chronos/user/Downloads") into external filesystem URL. Returns false | 51 // E.g., "drive/root" to filesystem://id/external/drive-xxx/root. |
| 52 GURL ConvertDrivePathToFileSystemUrl(Profile* profile, |
| 53 const base::FilePath& drive_path, |
| 54 const std::string& extension_id); |
| 55 |
| 56 // Converts AbsolutePath (e.g., "/special/drive-xxx/root" or |
| 57 // "/home/chronos/u-xxx/Downloads") into filesystem URL. Returns false |
| 49 // if |absolute_path| is not managed by the external filesystem provider. | 58 // if |absolute_path| is not managed by the external filesystem provider. |
| 50 bool ConvertAbsoluteFilePathToFileSystemUrl( | 59 bool ConvertAbsoluteFilePathToFileSystemUrl(Profile* profile, |
| 51 Profile* profile, | 60 const base::FilePath& absolute_path, |
| 52 const base::FilePath& absolute_path, | 61 const std::string& extension_id, |
| 53 const std::string& extension_id, | 62 GURL* url); |
| 54 GURL* url); | |
| 55 | 63 |
| 56 // Converts |absolute_path| into |relative_path| within the external | 64 // Converts AbsolutePath into RelativeFileSystemPath (e.g., |
| 57 // provider in File API. Returns false if |absolute_path| is not managed | 65 // "/special/drive-xxx/root/foo" => "drive-xxx/root/foo".) Returns false if |
| 58 // by the external filesystem provider. | 66 // |absolute_path| is not managed by the external filesystem provider. |
| 59 bool ConvertAbsoluteFilePathToRelativeFileSystemPath( | 67 bool ConvertAbsoluteFilePathToRelativeFileSystemPath( |
| 60 Profile* profile, | 68 Profile* profile, |
| 61 const std::string& extension_id, | 69 const std::string& extension_id, |
| 62 const base::FilePath& absolute_path, | 70 const base::FilePath& absolute_path, |
| 63 base::FilePath* relative_path); | 71 base::FilePath* relative_path); |
| 64 | 72 |
| 65 } // namespace util | 73 } // namespace util |
| 66 } // namespace file_manager | 74 } // namespace file_manager |
| 67 | 75 |
| 68 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILEAPI_UTIL_H_ | 76 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILEAPI_UTIL_H_ |
| OLD | NEW |