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