Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / chromeos / file_manager / filesystem_api_util.h
blob29f43b4540d6f534290ca3d27c4867dba6890a8c
1 // Copyright 2014 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 // The file contains utility functions to implement chrome.fileSystem API for
6 // file paths that do not directly map to host machine's file system path, such
7 // as Google Drive or virtual volumes provided by fileSystemProvider extensions.
9 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILESYSTEM_API_UTIL_H_
10 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILESYSTEM_API_UTIL_H_
12 #include <string>
13 #include <vector>
15 #include "base/callback_forward.h"
16 #include "storage/common/fileapi/file_system_types.h"
18 class Profile;
20 namespace base {
21 class FilePath;
22 } // namespace base
24 namespace storage {
25 class FileSystemURL;
26 } // namespace storage
28 namespace file_manager {
29 namespace util {
31 // Obtains whether |type| is non-native file system or not.
32 bool IsNonNativeFileSystemType(storage::FileSystemType type);
34 // Checks whether the given |path| points to a non-local filesystem that
35 // requires special handling.
36 bool IsUnderNonNativeLocalPath(Profile* profile, const base::FilePath& path);
38 // Returns the mime type of the file pointed by |path|, and asynchronously sends
39 // the result to |callback|.
40 void GetNonNativeLocalPathMimeType(
41 Profile* profile,
42 const base::FilePath& path,
43 const base::Callback<void(bool, const std::string&)>& callback);
45 // Checks whether the |path| points to a directory, and asynchronously sends
46 // the result to |callback|.
47 void IsNonNativeLocalPathDirectory(
48 Profile* profile,
49 const base::FilePath& path,
50 const base::Callback<void(bool)>& callback);
52 // Ensures a file exists at |path|, i.e., it does nothing if a file is already
53 // present, or creates a file there if it isn't, and asynchronously sends to
54 // |callback| whether it succeeded.
55 void PrepareNonNativeLocalFileForWritableApp(
56 Profile* profile,
57 const base::FilePath& path,
58 const base::Callback<void(bool)>& callback);
60 } // namespace util
61 } // namespace file_manager
63 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILESYSTEM_API_UTIL_H_