Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: webkit/browser/fileapi/async_file_util_adapter.h

Issue 539143002: Migrate webkit/browser/ to storage/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android build Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WEBKIT_BROWSER_FILEAPI_ASYNC_FILE_UTIL_ADAPTER_H_ 5 #include "storage/browser/fileapi/async_file_util_adapter.h"
6 #define WEBKIT_BROWSER_FILEAPI_ASYNC_FILE_UTIL_ADAPTER_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "webkit/browser/fileapi/async_file_util.h"
10
11 namespace storage {
12
13 class FileSystemFileUtil;
14
15 // An adapter class for FileSystemFileUtil classes to provide asynchronous
16 // interface.
17 //
18 // A filesystem can do either:
19 // - implement a synchronous version of FileUtil by extending
20 // FileSystemFileUtil and atach it to this adapter, or
21 // - directly implement AsyncFileUtil.
22 //
23 // This instance (as thus this->sync_file_util_) is guaranteed to be alive
24 // as far as FileSystemOperationContext given to each operation is kept alive.
25 class STORAGE_EXPORT AsyncFileUtilAdapter
26 : public NON_EXPORTED_BASE(AsyncFileUtil) {
27 public:
28 // Creates a new AsyncFileUtil for |sync_file_util|. This takes the
29 // ownership of |sync_file_util|. (This doesn't take scoped_ptr<> just
30 // to save extra make_scoped_ptr; in all use cases a new fresh FileUtil is
31 // created only for this adapter.)
32 explicit AsyncFileUtilAdapter(FileSystemFileUtil* sync_file_util);
33
34 virtual ~AsyncFileUtilAdapter();
35
36 FileSystemFileUtil* sync_file_util() {
37 return sync_file_util_.get();
38 }
39
40 // AsyncFileUtil overrides.
41 virtual void CreateOrOpen(
42 scoped_ptr<FileSystemOperationContext> context,
43 const FileSystemURL& url,
44 int file_flags,
45 const CreateOrOpenCallback& callback) OVERRIDE;
46 virtual void EnsureFileExists(
47 scoped_ptr<FileSystemOperationContext> context,
48 const FileSystemURL& url,
49 const EnsureFileExistsCallback& callback) OVERRIDE;
50 virtual void CreateDirectory(
51 scoped_ptr<FileSystemOperationContext> context,
52 const FileSystemURL& url,
53 bool exclusive,
54 bool recursive,
55 const StatusCallback& callback) OVERRIDE;
56 virtual void GetFileInfo(
57 scoped_ptr<FileSystemOperationContext> context,
58 const FileSystemURL& url,
59 const GetFileInfoCallback& callback) OVERRIDE;
60 virtual void ReadDirectory(
61 scoped_ptr<FileSystemOperationContext> context,
62 const FileSystemURL& url,
63 const ReadDirectoryCallback& callback) OVERRIDE;
64 virtual void Touch(
65 scoped_ptr<FileSystemOperationContext> context,
66 const FileSystemURL& url,
67 const base::Time& last_access_time,
68 const base::Time& last_modified_time,
69 const StatusCallback& callback) OVERRIDE;
70 virtual void Truncate(
71 scoped_ptr<FileSystemOperationContext> context,
72 const FileSystemURL& url,
73 int64 length,
74 const StatusCallback& callback) OVERRIDE;
75 virtual void CopyFileLocal(
76 scoped_ptr<FileSystemOperationContext> context,
77 const FileSystemURL& src_url,
78 const FileSystemURL& dest_url,
79 CopyOrMoveOption option,
80 const CopyFileProgressCallback& progress_callback,
81 const StatusCallback& callback) OVERRIDE;
82 virtual void MoveFileLocal(
83 scoped_ptr<FileSystemOperationContext> context,
84 const FileSystemURL& src_url,
85 const FileSystemURL& dest_url,
86 CopyOrMoveOption option,
87 const StatusCallback& callback) OVERRIDE;
88 virtual void CopyInForeignFile(
89 scoped_ptr<FileSystemOperationContext> context,
90 const base::FilePath& src_file_path,
91 const FileSystemURL& dest_url,
92 const StatusCallback& callback) OVERRIDE;
93 virtual void DeleteFile(
94 scoped_ptr<FileSystemOperationContext> context,
95 const FileSystemURL& url,
96 const StatusCallback& callback) OVERRIDE;
97 virtual void DeleteDirectory(
98 scoped_ptr<FileSystemOperationContext> context,
99 const FileSystemURL& url,
100 const StatusCallback& callback) OVERRIDE;
101 virtual void DeleteRecursively(
102 scoped_ptr<FileSystemOperationContext> context,
103 const FileSystemURL& url,
104 const StatusCallback& callback) OVERRIDE;
105 virtual void CreateSnapshotFile(
106 scoped_ptr<FileSystemOperationContext> context,
107 const FileSystemURL& url,
108 const CreateSnapshotFileCallback& callback) OVERRIDE;
109
110 private:
111 scoped_ptr<FileSystemFileUtil> sync_file_util_;
112
113 DISALLOW_COPY_AND_ASSIGN(AsyncFileUtilAdapter);
114 };
115
116 } // namespace storage
117
118 #endif // WEBKIT_BROWSER_FILEAPI_ASYNC_FILE_UTIL_ADAPTER_H_
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/async_file_util.h ('k') | webkit/browser/fileapi/async_file_util_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698