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 #include "webkit/chromeos/fileapi/remote_file_system_operation.h" | 5 #include "webkit/chromeos/fileapi/remote_file_system_operation.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "base/platform_file.h" | 9 #include "base/platform_file.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 if (pending_operation_ != kOperationNone) | 229 if (pending_operation_ != kOperationNone) |
230 return false; | 230 return false; |
231 pending_operation_ = type; | 231 pending_operation_ = type; |
232 return true; | 232 return true; |
233 } | 233 } |
234 | 234 |
235 void RemoteFileSystemOperation::DidDirectoryExists( | 235 void RemoteFileSystemOperation::DidDirectoryExists( |
236 const StatusCallback& callback, | 236 const StatusCallback& callback, |
237 base::PlatformFileError rv, | 237 base::PlatformFileError rv, |
238 const base::PlatformFileInfo& file_info, | 238 const base::PlatformFileInfo& file_info, |
239 const FilePath& unused) { | 239 const base::FilePath& unused) { |
240 if (rv == base::PLATFORM_FILE_OK && !file_info.is_directory) | 240 if (rv == base::PLATFORM_FILE_OK && !file_info.is_directory) |
241 rv = base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; | 241 rv = base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; |
242 callback.Run(rv); | 242 callback.Run(rv); |
243 } | 243 } |
244 | 244 |
245 void RemoteFileSystemOperation::DidFileExists( | 245 void RemoteFileSystemOperation::DidFileExists( |
246 const StatusCallback& callback, | 246 const StatusCallback& callback, |
247 base::PlatformFileError rv, | 247 base::PlatformFileError rv, |
248 const base::PlatformFileInfo& file_info, | 248 const base::PlatformFileInfo& file_info, |
249 const FilePath& unused) { | 249 const base::FilePath& unused) { |
250 if (rv == base::PLATFORM_FILE_OK && file_info.is_directory) | 250 if (rv == base::PLATFORM_FILE_OK && file_info.is_directory) |
251 rv = base::PLATFORM_FILE_ERROR_NOT_A_FILE; | 251 rv = base::PLATFORM_FILE_ERROR_NOT_A_FILE; |
252 callback.Run(rv); | 252 callback.Run(rv); |
253 } | 253 } |
254 | 254 |
255 void RemoteFileSystemOperation::DidGetMetadata( | 255 void RemoteFileSystemOperation::DidGetMetadata( |
256 const GetMetadataCallback& callback, | 256 const GetMetadataCallback& callback, |
257 base::PlatformFileError rv, | 257 base::PlatformFileError rv, |
258 const base::PlatformFileInfo& file_info, | 258 const base::PlatformFileInfo& file_info, |
259 const FilePath& platform_path) { | 259 const base::FilePath& platform_path) { |
260 callback.Run(rv, file_info, platform_path); | 260 callback.Run(rv, file_info, platform_path); |
261 } | 261 } |
262 | 262 |
263 void RemoteFileSystemOperation::DidReadDirectory( | 263 void RemoteFileSystemOperation::DidReadDirectory( |
264 const ReadDirectoryCallback& callback, | 264 const ReadDirectoryCallback& callback, |
265 base::PlatformFileError rv, | 265 base::PlatformFileError rv, |
266 const std::vector<base::FileUtilProxy::Entry>& entries, | 266 const std::vector<base::FileUtilProxy::Entry>& entries, |
267 bool has_more) { | 267 bool has_more) { |
268 callback.Run(rv, entries, has_more /* has_more */); | 268 callback.Run(rv, entries, has_more /* has_more */); |
269 } | 269 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 cancel_callback_.Reset(); | 303 cancel_callback_.Reset(); |
304 } else { | 304 } else { |
305 callback.Run(rv); | 305 callback.Run(rv); |
306 } | 306 } |
307 } | 307 } |
308 | 308 |
309 void RemoteFileSystemOperation::DidCreateSnapshotFile( | 309 void RemoteFileSystemOperation::DidCreateSnapshotFile( |
310 const SnapshotFileCallback& callback, | 310 const SnapshotFileCallback& callback, |
311 base::PlatformFileError result, | 311 base::PlatformFileError result, |
312 const base::PlatformFileInfo& file_info, | 312 const base::PlatformFileInfo& file_info, |
313 const FilePath& platform_path, | 313 const base::FilePath& platform_path, |
314 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { | 314 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { |
315 callback.Run(result, file_info, platform_path, file_ref); | 315 callback.Run(result, file_info, platform_path, file_ref); |
316 } | 316 } |
317 | 317 |
318 void RemoteFileSystemOperation::DidOpenFile( | 318 void RemoteFileSystemOperation::DidOpenFile( |
319 const OpenFileCallback& callback, | 319 const OpenFileCallback& callback, |
320 base::PlatformFileError result, | 320 base::PlatformFileError result, |
321 base::PlatformFile file, | 321 base::PlatformFile file, |
322 base::ProcessHandle peer_handle) { | 322 base::ProcessHandle peer_handle) { |
323 callback.Run(result, file, peer_handle); | 323 callback.Run(result, file, peer_handle); |
324 } | 324 } |
325 | 325 |
326 } // namespace chromeos | 326 } // namespace chromeos |
OLD | NEW |