net cleanup: Remove unnecessary namespace prefixes.
[chromium-blink-merge.git] / storage / browser / fileapi / native_file_util.h
blob28833ffc0f854aa0c162b7bd21c3643f096ad029
1 // Copyright (c) 2012 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 #ifndef STORAGE_BROWSER_FILEAPI_NATIVE_FILE_UTIL_H_
6 #define STORAGE_BROWSER_FILEAPI_NATIVE_FILE_UTIL_H_
8 #include "base/files/file.h"
9 #include "base/files/file_path.h"
10 #include "base/files/file_util_proxy.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "storage/browser/fileapi/file_system_file_util.h"
13 #include "storage/browser/storage_browser_export.h"
15 namespace base {
16 class Time;
19 namespace storage {
21 // A thin wrapper class for accessing the OS native filesystem.
22 // This performs common error checks necessary to implement FileUtil family
23 // in addition to perform native filesystem operations.
25 // For the error checks it performs please see the comment for
26 // FileSystemFileUtil interface
27 // (storage/browser/fileapi/file_system_file_util.h).
29 // Note that all the methods of this class are static and this does NOT
30 // inherit from FileSystemFileUtil.
31 class STORAGE_EXPORT_PRIVATE NativeFileUtil {
32 public:
33 enum CopyOrMoveMode {
34 COPY_NOSYNC,
35 COPY_SYNC,
36 MOVE
39 static CopyOrMoveMode CopyOrMoveModeForDestination(
40 const FileSystemURL& dest_url, bool copy);
42 static base::File CreateOrOpen(const base::FilePath& path, int file_flags);
43 static base::File::Error EnsureFileExists(const base::FilePath& path,
44 bool* created);
45 static base::File::Error CreateDirectory(const base::FilePath& path,
46 bool exclusive,
47 bool recursive);
48 static base::File::Error GetFileInfo(const base::FilePath& path,
49 base::File::Info* file_info);
50 static scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator>
51 CreateFileEnumerator(const base::FilePath& root_path,
52 bool recursive);
53 static base::File::Error Touch(const base::FilePath& path,
54 const base::Time& last_access_time,
55 const base::Time& last_modified_time);
56 static base::File::Error Truncate(const base::FilePath& path,
57 int64 length);
58 static bool PathExists(const base::FilePath& path);
59 static bool DirectoryExists(const base::FilePath& path);
60 static base::File::Error CopyOrMoveFile(
61 const base::FilePath& src_path,
62 const base::FilePath& dest_path,
63 FileSystemOperation::CopyOrMoveOption option,
64 CopyOrMoveMode mode);
65 static base::File::Error DeleteFile(const base::FilePath& path);
66 static base::File::Error DeleteDirectory(const base::FilePath& path);
68 private:
69 DISALLOW_IMPLICIT_CONSTRUCTORS(NativeFileUtil);
72 } // namespace storage
74 #endif // STORAGE_BROWSER_FILEAPI_NATIVE_FILE_UTIL_H_