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