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
3 // found in the LICENSE file.
5 // This file provides File API related utilities.
7 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILEAPI_UTIL_H_
8 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILEAPI_UTIL_H_
24 class FileSystemContext
;
27 namespace file_manager
{
30 // Returns a file system context associated with the given profile and the
32 fileapi::FileSystemContext
* GetFileSystemContextForExtensionId(
34 const std::string
& extension_id
);
36 // Returns a file system context associated with the given profile and the
38 fileapi::FileSystemContext
* GetFileSystemContextForRenderViewHost(
40 content::RenderViewHost
* render_view_host
);
42 // Converts |relative_path| (e.g., "drive/root" or "Downloads") into external
43 // filesystem URL (e.g., filesystem://id/external/drive/root).
44 GURL
ConvertRelativeFilePathToFileSystemUrl(const base::FilePath
& relative_path
,
45 const std::string
& extension_id
);
47 // Converts |absolute_path| (e.g., "/special/drive/root" or
48 // "/home/chronos/user/Downloads") into external filesystem URL. Returns false
49 // if |absolute_path| is not managed by the external filesystem provider.
50 bool ConvertAbsoluteFilePathToFileSystemUrl(
52 const base::FilePath
& absolute_path
,
53 const std::string
& extension_id
,
56 // Converts |absolute_path| into |relative_path| within the external
57 // provider in File API. Returns false if |absolute_path| is not managed
58 // by the external filesystem provider.
59 bool ConvertAbsoluteFilePathToRelativeFileSystemPath(
61 const std::string
& extension_id
,
62 const base::FilePath
& absolute_path
,
63 base::FilePath
* relative_path
);
66 } // namespace file_manager
68 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILEAPI_UTIL_H_