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#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_ASYNC_FILE_UTIL_H_
6#define CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_ASYNC_FILE_UTIL_H_
7
8#include "base/basictypes.h"
9#include "base/callback.h"
10#include "storage/browser/fileapi/async_file_util.h"
11
12namespace drive {
13
14class FileSystemInterface;
15
16namespace internal {
17
18// The implementation of storage::AsyncFileUtil for Drive File System.
19class AsyncFileUtil : public storage::AsyncFileUtil {
20 public:
21  AsyncFileUtil();
22  virtual ~AsyncFileUtil();
23
24  // storage::AsyncFileUtil overrides.
25  virtual void CreateOrOpen(
26      scoped_ptr<storage::FileSystemOperationContext> context,
27      const storage::FileSystemURL& url,
28      int file_flags,
29      const CreateOrOpenCallback& callback) OVERRIDE;
30  virtual void EnsureFileExists(
31      scoped_ptr<storage::FileSystemOperationContext> context,
32      const storage::FileSystemURL& url,
33      const EnsureFileExistsCallback& callback) OVERRIDE;
34  virtual void CreateDirectory(
35      scoped_ptr<storage::FileSystemOperationContext> context,
36      const storage::FileSystemURL& url,
37      bool exclusive,
38      bool recursive,
39      const StatusCallback& callback) OVERRIDE;
40  virtual void GetFileInfo(
41      scoped_ptr<storage::FileSystemOperationContext> context,
42      const storage::FileSystemURL& url,
43      const GetFileInfoCallback& callback) OVERRIDE;
44  virtual void ReadDirectory(
45      scoped_ptr<storage::FileSystemOperationContext> context,
46      const storage::FileSystemURL& url,
47      const ReadDirectoryCallback& callback) OVERRIDE;
48  virtual void Touch(scoped_ptr<storage::FileSystemOperationContext> context,
49                     const storage::FileSystemURL& url,
50                     const base::Time& last_access_time,
51                     const base::Time& last_modified_time,
52                     const StatusCallback& callback) OVERRIDE;
53  virtual void Truncate(scoped_ptr<storage::FileSystemOperationContext> context,
54                        const storage::FileSystemURL& url,
55                        int64 length,
56                        const StatusCallback& callback) OVERRIDE;
57  virtual void CopyFileLocal(
58      scoped_ptr<storage::FileSystemOperationContext> context,
59      const storage::FileSystemURL& src_url,
60      const storage::FileSystemURL& dest_url,
61      CopyOrMoveOption option,
62      const CopyFileProgressCallback& progress_callback,
63      const StatusCallback& callback) OVERRIDE;
64  virtual void MoveFileLocal(
65      scoped_ptr<storage::FileSystemOperationContext> context,
66      const storage::FileSystemURL& src_url,
67      const storage::FileSystemURL& dest_url,
68      CopyOrMoveOption option,
69      const StatusCallback& callback) OVERRIDE;
70  virtual void CopyInForeignFile(
71      scoped_ptr<storage::FileSystemOperationContext> context,
72      const base::FilePath& src_file_path,
73      const storage::FileSystemURL& dest_url,
74      const StatusCallback& callback) OVERRIDE;
75  virtual void DeleteFile(
76      scoped_ptr<storage::FileSystemOperationContext> context,
77      const storage::FileSystemURL& url,
78      const StatusCallback& callback) OVERRIDE;
79  virtual void DeleteDirectory(
80      scoped_ptr<storage::FileSystemOperationContext> context,
81      const storage::FileSystemURL& url,
82      const StatusCallback& callback) OVERRIDE;
83  virtual void DeleteRecursively(
84      scoped_ptr<storage::FileSystemOperationContext> context,
85      const storage::FileSystemURL& url,
86      const StatusCallback& callback) OVERRIDE;
87  virtual void CreateSnapshotFile(
88      scoped_ptr<storage::FileSystemOperationContext> context,
89      const storage::FileSystemURL& url,
90      const CreateSnapshotFileCallback& callback) OVERRIDE;
91
92 private:
93  DISALLOW_COPY_AND_ASSIGN(AsyncFileUtil);
94};
95
96}  // namespace internal
97}  // namespace drive
98
99#endif  // CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_ASYNC_FILE_UTIL_H_
100