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.
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_
15 #include "base/callback_forward.h"
16 #include "storage/common/fileapi/file_system_types.h"
26 } // namespace storage
28 namespace file_manager
{
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(
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(
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(
57 const base::FilePath
& path
,
58 const base::Callback
<void(bool)>& callback
);
61 } // namespace file_manager
63 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILESYSTEM_API_UTIL_H_