file_manager: Move FindPreferredIcon() to drive_app_registry.h
[chromium-blink-merge.git] / chrome / browser / chromeos / extensions / file_manager / fileapi_util.h
blob0d6e08fd7f5dcc068424ddb40ca8339baf9b4caa
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.
4 //
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_
10 #include <string>
11 #include "url/gurl.h"
13 class Profile;
15 namespace base {
16 class FilePath;
19 namespace content {
20 class RenderViewHost;
23 namespace fileapi {
24 class FileSystemContext;
27 namespace file_manager {
28 namespace util {
30 // Returns a file system context associated with the given profile and the
31 // extension ID.
32 fileapi::FileSystemContext* GetFileSystemContextForExtensionId(
33 Profile* profile,
34 const std::string& extension_id);
36 // Returns a file system context associated with the given profile and the
37 // render view host.
38 fileapi::FileSystemContext* GetFileSystemContextForRenderViewHost(
39 Profile* profile,
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(
51 Profile* profile,
52 const base::FilePath& absolute_path,
53 const std::string& extension_id,
54 GURL* url);
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(
60 Profile* profile,
61 const std::string& extension_id,
62 const base::FilePath& absolute_path,
63 base::FilePath* relative_path);
65 } // namespace util
66 } // namespace file_manager
68 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILEAPI_UTIL_H_