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

Side by Side Diff: webkit/browser/chromeos/fileapi/remote_file_system_operation.h

Issue 17644006: Move files under webkit/browser/fileapi/... to chrome/browser/chromeos/fileapi/... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments. Created 7 years, 6 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_BROWSER_CHROMEOS_FILEAPI_REMOTE_FILE_SYSTEM_OPERATION_H_
6 #define WEBKIT_BROWSER_CHROMEOS_FILEAPI_REMOTE_FILE_SYSTEM_OPERATION_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "webkit/browser/fileapi/file_system_operation.h"
10 #include "webkit/browser/fileapi/file_writer_delegate.h"
11 #include "webkit/browser/fileapi/remote_file_system_proxy.h"
12
13 namespace base {
14 class Value;
15 }
16
17 namespace fileapi {
18 class FileWriterDelegate;
19 class LocalFileSystemOperation;
20 }
21
22 namespace chromeos {
23
24 // FileSystemOperation implementation for local file systems.
25 class RemoteFileSystemOperation
26 : public fileapi::FileSystemOperation,
27 public base::SupportsWeakPtr<RemoteFileSystemOperation> {
28 public:
29 typedef fileapi::FileWriterDelegate FileWriterDelegate;
30 virtual ~RemoteFileSystemOperation();
31
32 // FileSystemOperation overrides.
33 virtual void CreateFile(const fileapi::FileSystemURL& url,
34 bool exclusive,
35 const StatusCallback& callback) OVERRIDE;
36 virtual void CreateDirectory(const fileapi::FileSystemURL& url,
37 bool exclusive,
38 bool recursive,
39 const StatusCallback& callback) OVERRIDE;
40 virtual void Copy(const fileapi::FileSystemURL& src_url,
41 const fileapi::FileSystemURL& dest_url,
42 const StatusCallback& callback) OVERRIDE;
43 virtual void Move(const fileapi::FileSystemURL& src_url,
44 const fileapi::FileSystemURL& dest_url,
45 const StatusCallback& callback) OVERRIDE;
46 virtual void DirectoryExists(const fileapi::FileSystemURL& url,
47 const StatusCallback& callback) OVERRIDE;
48 virtual void FileExists(const fileapi::FileSystemURL& url,
49 const StatusCallback& callback) OVERRIDE;
50 virtual void GetMetadata(const fileapi::FileSystemURL& url,
51 const GetMetadataCallback& callback) OVERRIDE;
52 virtual void ReadDirectory(const fileapi::FileSystemURL& url,
53 const ReadDirectoryCallback& callback) OVERRIDE;
54 virtual void Remove(const fileapi::FileSystemURL& url, bool recursive,
55 const StatusCallback& callback) OVERRIDE;
56 virtual void Write(const fileapi::FileSystemURL& url,
57 scoped_ptr<fileapi::FileWriterDelegate> writer_delegate,
58 scoped_ptr<net::URLRequest> blob_request,
59 const WriteCallback& callback) OVERRIDE;
60 virtual void Truncate(const fileapi::FileSystemURL& url, int64 length,
61 const StatusCallback& callback) OVERRIDE;
62 virtual void Cancel(const StatusCallback& cancel_callback) OVERRIDE;
63 virtual void TouchFile(const fileapi::FileSystemURL& url,
64 const base::Time& last_access_time,
65 const base::Time& last_modified_time,
66 const StatusCallback& callback) OVERRIDE;
67 virtual void OpenFile(
68 const fileapi::FileSystemURL& url,
69 int file_flags,
70 base::ProcessHandle peer_handle,
71 const OpenFileCallback& callback) OVERRIDE;
72 virtual fileapi::LocalFileSystemOperation*
73 AsLocalFileSystemOperation() OVERRIDE;
74 virtual void CreateSnapshotFile(
75 const fileapi::FileSystemURL& url,
76 const SnapshotFileCallback& callback) OVERRIDE;
77
78 private:
79 friend class CrosMountPointProvider;
80
81 RemoteFileSystemOperation(
82 scoped_refptr<fileapi::RemoteFileSystemProxyInterface> remote_proxy);
83
84 // Used only for internal assertions.
85 // Returns false if there's another inflight pending operation.
86 bool SetPendingOperationType(OperationType type);
87
88 // Generic callback that translates platform errors to WebKit error codes.
89 void DidDirectoryExists(const StatusCallback& callback,
90 base::PlatformFileError rv,
91 const base::PlatformFileInfo& file_info);
92 void DidFileExists(const StatusCallback& callback,
93 base::PlatformFileError rv,
94 const base::PlatformFileInfo& file_info);
95 void DidWrite(const WriteCallback& write_callback,
96 base::PlatformFileError result,
97 int64 bytes,
98 FileWriterDelegate::WriteProgressStatus write_status);
99 void DidFinishFileOperation(const StatusCallback& callback,
100 base::PlatformFileError rv);
101 void DidOpenFile(
102 const fileapi::FileSystemURL& url,
103 const OpenFileCallback& callback,
104 base::PlatformFileError result,
105 base::PlatformFile file,
106 base::ProcessHandle peer_handle);
107
108 scoped_refptr<fileapi::RemoteFileSystemProxyInterface> remote_proxy_;
109 // A flag to make sure we call operation only once per instance.
110 OperationType pending_operation_;
111 scoped_ptr<fileapi::FileWriterDelegate> file_writer_delegate_;
112
113 StatusCallback cancel_callback_;
114
115 DISALLOW_COPY_AND_ASSIGN(RemoteFileSystemOperation);
116 };
117
118 } // namespace chromeos
119
120 #endif // WEBKIT_BROWSER_CHROMEOS_FILEAPI_REMOTE_FILE_SYSTEM_OPERATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698