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 WEBKIT_BROWSER_FILEAPI_LOCAL_FILE_UTIL_H_
6 #define WEBKIT_BROWSER_FILEAPI_LOCAL_FILE_UTIL_H_
8 #include "base/compiler_specific.h"
9 #include "base/files/file_path.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "webkit/browser/fileapi/file_system_file_util.h"
12 #include "webkit/browser/webkit_storage_browser_export.h"
22 class FileSystemOperationContext
;
25 // An instance of this class is created and owned by *FileSystemBackend.
26 class WEBKIT_STORAGE_BROWSER_EXPORT LocalFileUtil
27 : public FileSystemFileUtil
{
30 virtual ~LocalFileUtil();
32 virtual base::File
CreateOrOpen(
33 FileSystemOperationContext
* context
,
34 const FileSystemURL
& url
,
35 int file_flags
) OVERRIDE
;
36 virtual base::File::Error
EnsureFileExists(
37 FileSystemOperationContext
* context
,
38 const FileSystemURL
& url
, bool* created
) OVERRIDE
;
39 virtual base::File::Error
CreateDirectory(
40 FileSystemOperationContext
* context
,
41 const FileSystemURL
& url
,
43 bool recursive
) OVERRIDE
;
44 virtual base::File::Error
GetFileInfo(
45 FileSystemOperationContext
* context
,
46 const FileSystemURL
& url
,
47 base::File::Info
* file_info
,
48 base::FilePath
* platform_file
) OVERRIDE
;
49 virtual scoped_ptr
<AbstractFileEnumerator
> CreateFileEnumerator(
50 FileSystemOperationContext
* context
,
51 const FileSystemURL
& root_url
) OVERRIDE
;
52 virtual base::File::Error
GetLocalFilePath(
53 FileSystemOperationContext
* context
,
54 const FileSystemURL
& file_system_url
,
55 base::FilePath
* local_file_path
) OVERRIDE
;
56 virtual base::File::Error
Touch(
57 FileSystemOperationContext
* context
,
58 const FileSystemURL
& url
,
59 const base::Time
& last_access_time
,
60 const base::Time
& last_modified_time
) OVERRIDE
;
61 virtual base::File::Error
Truncate(
62 FileSystemOperationContext
* context
,
63 const FileSystemURL
& url
,
64 int64 length
) OVERRIDE
;
65 virtual base::File::Error
CopyOrMoveFile(
66 FileSystemOperationContext
* context
,
67 const FileSystemURL
& src_url
,
68 const FileSystemURL
& dest_url
,
69 CopyOrMoveOption option
,
71 virtual base::File::Error
CopyInForeignFile(
72 FileSystemOperationContext
* context
,
73 const base::FilePath
& src_file_path
,
74 const FileSystemURL
& dest_url
) OVERRIDE
;
75 virtual base::File::Error
DeleteFile(
76 FileSystemOperationContext
* context
,
77 const FileSystemURL
& url
) OVERRIDE
;
78 virtual base::File::Error
DeleteDirectory(
79 FileSystemOperationContext
* context
,
80 const FileSystemURL
& url
) OVERRIDE
;
81 virtual webkit_blob::ScopedFile
CreateSnapshotFile(
82 FileSystemOperationContext
* context
,
83 const FileSystemURL
& url
,
84 base::File::Error
* error
,
85 base::File::Info
* file_info
,
86 base::FilePath
* platform_path
) OVERRIDE
;
89 DISALLOW_COPY_AND_ASSIGN(LocalFileUtil
);
92 } // namespace fileapi
94 #endif // WEBKIT_BROWSER_FILEAPI_LOCAL_FILE_UTIL_H_