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.
8
9#ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILESYSTEM_API_UTIL_H_
10#define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILESYSTEM_API_UTIL_H_
11
12#include <string>
13#include <vector>
14
15#include "base/callback_forward.h"
16
17class Profile;
18
19namespace base {
20class FilePath;
21}  // namespace base
22
23namespace storage {
24class FileSystemURL;
25}  // namespace storage
26
27namespace file_manager {
28namespace util {
29
30// Checks whether the given |path| points to a non-local filesystem that
31// requires special handling.
32bool IsUnderNonNativeLocalPath(Profile* profile, const base::FilePath& path);
33
34// Returns the mime type of the file pointed by |path|, and asynchronously sends
35// the result to |callback|.
36void GetNonNativeLocalPathMimeType(
37    Profile* profile,
38    const base::FilePath& path,
39    const base::Callback<void(bool, const std::string&)>& callback);
40
41// Checks whether the |path| points to a directory, and asynchronously sends
42// the result to |callback|.
43void IsNonNativeLocalPathDirectory(
44    Profile* profile,
45    const base::FilePath& path,
46    const base::Callback<void(bool)>& callback);
47
48// Ensures a file exists at |path|, i.e., it does nothing if a file is already
49// present, or creates a file there if it isn't, and asynchronously sends to
50// |callback| whether it succeeded.
51void PrepareNonNativeLocalFileForWritableApp(
52    Profile* profile,
53    const base::FilePath& path,
54    const base::Callback<void(bool)>& callback);
55
56}  // namespace util
57}  // namespace file_manager
58
59#endif  // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILESYSTEM_API_UTIL_H_
60