OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_ |
7 | 7 |
8 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" | 8 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" |
9 #include "chrome/browser/chromeos/gdata/gdata_file_system_interface.h" | 9 #include "chrome/browser/chromeos/gdata/gdata_file_system_interface.h" |
10 #include "webkit/chromeos/fileapi/remote_file_system_proxy.h" | 10 #include "webkit/chromeos/fileapi/remote_file_system_proxy.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // Checks if a given |url| belongs to this file system. If it does, | 86 // Checks if a given |url| belongs to this file system. If it does, |
87 // the call will return true and fill in |file_path| with a file path of | 87 // the call will return true and fill in |file_path| with a file path of |
88 // a corresponding element within this file system. | 88 // a corresponding element within this file system. |
89 static bool ValidateUrl(const fileapi::FileSystemURL& url, | 89 static bool ValidateUrl(const fileapi::FileSystemURL& url, |
90 FilePath* file_path); | 90 FilePath* file_path); |
91 | 91 |
92 // Helper callback for relaying reply for status callbacks to the | 92 // Helper callback for relaying reply for status callbacks to the |
93 // calling thread. | 93 // calling thread. |
94 void OnStatusCallback( | 94 void OnStatusCallback( |
95 const fileapi::FileSystemOperationInterface::StatusCallback& callback, | 95 const fileapi::FileSystemOperationInterface::StatusCallback& callback, |
96 GDataFileError error); | 96 DriveFileError error); |
97 | 97 |
98 // Helper callback for relaying reply for metadata retrieval request to the | 98 // Helper callback for relaying reply for metadata retrieval request to the |
99 // calling thread. | 99 // calling thread. |
100 void OnGetMetadata( | 100 void OnGetMetadata( |
101 const FilePath& file_path, | 101 const FilePath& file_path, |
102 const fileapi::FileSystemOperationInterface::GetMetadataCallback& | 102 const fileapi::FileSystemOperationInterface::GetMetadataCallback& |
103 callback, | 103 callback, |
104 GDataFileError error, | 104 DriveFileError error, |
105 scoped_ptr<DriveEntryProto> entry_proto); | 105 scoped_ptr<DriveEntryProto> entry_proto); |
106 | 106 |
107 // Helper callback for relaying reply for GetEntryInfoByPath() to the | 107 // Helper callback for relaying reply for GetEntryInfoByPath() to the |
108 // calling thread. | 108 // calling thread. |
109 void OnGetEntryInfoByPath( | 109 void OnGetEntryInfoByPath( |
110 const FilePath& entry_path, | 110 const FilePath& entry_path, |
111 const fileapi::FileSystemOperationInterface::SnapshotFileCallback& | 111 const fileapi::FileSystemOperationInterface::SnapshotFileCallback& |
112 callback, | 112 callback, |
113 GDataFileError error, | 113 DriveFileError error, |
114 scoped_ptr<DriveEntryProto> entry_proto); | 114 scoped_ptr<DriveEntryProto> entry_proto); |
115 | 115 |
116 // Helper callback for relaying reply for ReadDirectory() to the calling | 116 // Helper callback for relaying reply for ReadDirectory() to the calling |
117 // thread. | 117 // thread. |
118 void OnReadDirectory( | 118 void OnReadDirectory( |
119 const fileapi::FileSystemOperationInterface::ReadDirectoryCallback& | 119 const fileapi::FileSystemOperationInterface::ReadDirectoryCallback& |
120 callback, | 120 callback, |
121 GDataFileError error, | 121 DriveFileError error, |
122 bool hide_hosted_documents, | 122 bool hide_hosted_documents, |
123 scoped_ptr<DriveEntryProtoVector> proto_entries); | 123 scoped_ptr<DriveEntryProtoVector> proto_entries); |
124 | 124 |
125 // Helper callback for relaying reply for CreateWritableSnapshotFile() to | 125 // Helper callback for relaying reply for CreateWritableSnapshotFile() to |
126 // the calling thread. | 126 // the calling thread. |
127 void OnCreateWritableSnapshotFile( | 127 void OnCreateWritableSnapshotFile( |
128 const FilePath& virtual_path, | 128 const FilePath& virtual_path, |
129 const fileapi::WritableSnapshotFile& callback, | 129 const fileapi::WritableSnapshotFile& callback, |
130 GDataFileError result, | 130 DriveFileError result, |
131 const FilePath& local_path); | 131 const FilePath& local_path); |
132 | 132 |
133 // Helper callback for closing the local cache file and committing the dirty | 133 // Helper callback for closing the local cache file and committing the dirty |
134 // flag. This is triggered when the callback for CreateWritableSnapshotFile | 134 // flag. This is triggered when the callback for CreateWritableSnapshotFile |
135 // released the refcounted reference to the file. | 135 // released the refcounted reference to the file. |
136 void CloseWritableSnapshotFile( | 136 void CloseWritableSnapshotFile( |
137 const FilePath& virtual_path, | 137 const FilePath& virtual_path, |
138 const FilePath& local_path); | 138 const FilePath& local_path); |
139 | 139 |
140 // Invoked during Truncate() operation. This is called when a local modifiable | 140 // Invoked during Truncate() operation. This is called when a local modifiable |
141 // cache is ready for truncation. | 141 // cache is ready for truncation. |
142 void OnFileOpenedForTruncate( | 142 void OnFileOpenedForTruncate( |
143 const FilePath& virtual_path, | 143 const FilePath& virtual_path, |
144 int64 length, | 144 int64 length, |
145 const fileapi::FileSystemOperationInterface::StatusCallback& callback, | 145 const fileapi::FileSystemOperationInterface::StatusCallback& callback, |
146 GDataFileError open_result, | 146 DriveFileError open_result, |
147 const FilePath& local_cache_path); | 147 const FilePath& local_cache_path); |
148 | 148 |
149 // Invoked during Truncate() operation. This is called when the truncation of | 149 // Invoked during Truncate() operation. This is called when the truncation of |
150 // a local cache file is finished on FILE thread. | 150 // a local cache file is finished on FILE thread. |
151 void DidTruncate( | 151 void DidTruncate( |
152 const FilePath& virtual_path, | 152 const FilePath& virtual_path, |
153 const fileapi::FileSystemOperationInterface::StatusCallback& callback, | 153 const fileapi::FileSystemOperationInterface::StatusCallback& callback, |
154 base::PlatformFileError* truncate_result); | 154 base::PlatformFileError* truncate_result); |
155 | 155 |
156 // Invoked during OpenFile() operation when truncate or write flags are set. | 156 // Invoked during OpenFile() operation when truncate or write flags are set. |
157 // This is called when a local modifiable cached file is ready for such | 157 // This is called when a local modifiable cached file is ready for such |
158 // operation. | 158 // operation. |
159 void OnOpenFileForWriting( | 159 void OnOpenFileForWriting( |
160 int file_flags, | 160 int file_flags, |
161 base::ProcessHandle peer_handle, | 161 base::ProcessHandle peer_handle, |
162 const fileapi::FileSystemOperationInterface::OpenFileCallback& callback, | 162 const fileapi::FileSystemOperationInterface::OpenFileCallback& callback, |
163 GDataFileError gdata_error, | 163 DriveFileError file_error, |
164 const FilePath& local_cache_path); | 164 const FilePath& local_cache_path); |
165 | 165 |
166 // Invoked during OpenFile() operation when file create flags are set. | 166 // Invoked during OpenFile() operation when file create flags are set. |
167 void OnCreateFileForOpen( | 167 void OnCreateFileForOpen( |
168 const FilePath& file_path, | 168 const FilePath& file_path, |
169 int file_flags, | 169 int file_flags, |
170 base::ProcessHandle peer_handle, | 170 base::ProcessHandle peer_handle, |
171 const fileapi::FileSystemOperationInterface::OpenFileCallback& callback, | 171 const fileapi::FileSystemOperationInterface::OpenFileCallback& callback, |
172 GDataFileError gdata_error); | 172 DriveFileError file_error); |
173 | 173 |
174 // Invoked during OpenFile() operation when base::PLATFORM_FILE_OPEN_TRUNCATED | 174 // Invoked during OpenFile() operation when base::PLATFORM_FILE_OPEN_TRUNCATED |
175 // flag is set. This is called when the truncation of a local cache file is | 175 // flag is set. This is called when the truncation of a local cache file is |
176 // finished on FILE thread. | 176 // finished on FILE thread. |
177 void OnOpenAndTruncate( | 177 void OnOpenAndTruncate( |
178 base::ProcessHandle peer_handle, | 178 base::ProcessHandle peer_handle, |
179 const fileapi::FileSystemOperationInterface::OpenFileCallback& callback, | 179 const fileapi::FileSystemOperationInterface::OpenFileCallback& callback, |
180 base::PlatformFile* platform_file, | 180 base::PlatformFile* platform_file, |
181 base::PlatformFileError* truncate_result); | 181 base::PlatformFileError* truncate_result); |
182 | 182 |
183 // GDataFileSystem is owned by Profile, which outlives GDataFileSystemProxy, | 183 // GDataFileSystem is owned by Profile, which outlives GDataFileSystemProxy, |
184 // which is owned by CrosMountPointProvider (i.e. by the time Profile is | 184 // which is owned by CrosMountPointProvider (i.e. by the time Profile is |
185 // removed, the file manager is already gone). Hence it's safe to use this as | 185 // removed, the file manager is already gone). Hence it's safe to use this as |
186 // a raw pointer. | 186 // a raw pointer. |
187 GDataFileSystemInterface* file_system_; | 187 GDataFileSystemInterface* file_system_; |
188 }; | 188 }; |
189 | 189 |
190 } // namespace chromeos | 190 } // namespace chromeos |
191 | 191 |
192 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_ | 192 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_ |
OLD | NEW |