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

Side by Side Diff: webkit/chromeos/fileapi/remote_file_system_proxy.h

Issue 11648027: Extract external file systems handling from isolated context. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 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 | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef WEBKIT_CHROMEOS_FILEAPI_REMOTE_FILE_SYSTEM_PROXY_H_
6 #define WEBKIT_CHROMEOS_FILEAPI_REMOTE_FILE_SYSTEM_PROXY_H_
7
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "webkit/fileapi/file_system_operation.h"
11
12 namespace fileapi {
13
14 typedef base::Callback<
15 void(base::PlatformFileError result,
16 const FilePath& platform_path,
17 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref)>
18 WritableSnapshotFile;
19
20 // The interface class for remote file system proxy.
21 class RemoteFileSystemProxyInterface :
22 public base::RefCountedThreadSafe<RemoteFileSystemProxyInterface> {
23 public:
24 // Gets the file or directory info for given|path|.
25 virtual void GetFileInfo(const FileSystemURL& url,
26 const FileSystemOperation::GetMetadataCallback& callback) = 0;
27
28 // Copies a file or directory from |src_url| to |dest_url|. If
29 // |src_url| is a directory, the contents of |src_url| are copied to
30 // |dest_url| recursively. A new file or directory is created at
31 // |dest_url| as needed.
32 virtual void Copy(
33 const FileSystemURL& src_url,
34 const FileSystemURL& dest_url,
35 const FileSystemOperation::StatusCallback& callback) = 0;
36
37 // Moves a file or directory from |src_url| to |dest_url|. A new file
38 // or directory is created at |dest_url| as needed.
39 virtual void Move(
40 const FileSystemURL& src_url,
41 const FileSystemURL& dest_url,
42 const FileSystemOperation::StatusCallback& callback) = 0;
43
44 // Reads contents of a directory at |url|.
45 virtual void ReadDirectory(const FileSystemURL& url,
46 const FileSystemOperation::ReadDirectoryCallback& callback) = 0;
47
48 // Removes a file or directory at |url|. If |recursive| is true, remove
49 // all files and directories under the directory at |url| recursively.
50 virtual void Remove(const FileSystemURL& url, bool recursive,
51 const FileSystemOperation::StatusCallback& callback) = 0;
52
53 // Creates a directory at |url|. If |exclusive| is true, an error is
54 // raised in case a directory is already present at the URL. If
55 // |recursive| is true, create parent directories as needed just like
56 // mkdir -p does.
57 virtual void CreateDirectory(
58 const FileSystemURL& url,
59 bool exclusive,
60 bool recursive,
61 const FileSystemOperation::StatusCallback& callback) = 0;
62
63 // Creates a file at |url|. If the flag |is_exclusive| is true, an
64 // error is raised when a file already exists at the path. It is
65 // an error if a directory or a hosted document is already present at the
66 // path, or the parent directory of the path is not present yet.
67 virtual void CreateFile(
68 const FileSystemURL& url,
69 bool exclusive,
70 const FileSystemOperation::StatusCallback& callback) = 0;
71
72 // Changes the length of an existing file at |url| to |length|. If |length|
73 // is negative, an error is raised. If |length| is more than the current size
74 // of the file, zero is padded for the extended part.
75 virtual void Truncate(
76 const FileSystemURL& url,
77 int64 length,
78 const FileSystemOperation::StatusCallback& callback) = 0;
79
80 // Creates a local snapshot file for a given |url| and returns the
81 // metadata and platform path of the snapshot file via |callback|.
82 // See also FileSystemOperation::CreateSnapshotFile().
83 virtual void CreateSnapshotFile(
84 const FileSystemURL& url,
85 const FileSystemOperation::SnapshotFileCallback& callback) = 0;
86
87 // Creates a local snapshot file for a given |url| and marks it for
88 // modification. A webkit_blob::ShareableFileReference is passed to
89 // |callback|, and when the reference is released, modification to the
90 // snapshot is marked for uploading to the remote file system.
91 virtual void CreateWritableSnapshotFile(
92 const FileSystemURL& url,
93 const WritableSnapshotFile& callback) = 0;
94
95 // Opens file for a given |url| with specified |flags| (see
96 // base::PlatformFileFlags for details).
97 virtual void OpenFile(
98 const FileSystemURL& url,
99 int flags,
100 base::ProcessHandle peer_handle,
101 const FileSystemOperation::OpenFileCallback& callback) = 0;
102
103 // Notifies that a file opened by OpenFile (at |path|) is closed.
104 virtual void NotifyCloseFile(const FileSystemURL& url) = 0;
105
106 // Modifies the timestamp of a given |url| to |last_access_time| and
107 // |last_modified_time|. Note that unlike 'touch' command of Linux, it
108 // does not create a new file.
109 virtual void TouchFile(
110 const fileapi::FileSystemURL& url,
111 const base::Time& last_access_time,
112 const base::Time& last_modified_time,
113 const FileSystemOperation::StatusCallback& callback) = 0;
114
115 protected:
116 friend class base::RefCountedThreadSafe<RemoteFileSystemProxyInterface>;
117 virtual ~RemoteFileSystemProxyInterface() {}
118 };
119
120 } // namespace fileapi
121
122 #endif // WEBKIT_CHROMEOS_FILEAPI_REMOTE_FILE_SYSTEM_PROXY_H_
OLDNEW
« no previous file with comments | « webkit/chromeos/fileapi/remote_file_system_operation.h ('k') | webkit/fileapi/external_mount_points.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698