OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/sync_file_system/local/syncable_file_system_operation.h
" | 5 #include "chrome/browser/sync_file_system/local/syncable_file_system_operation.h
" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" | 8 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
9 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 9 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
10 #include "chrome/browser/sync_file_system/local/syncable_file_operation_runner.h
" | 10 #include "chrome/browser/sync_file_system/local/syncable_file_operation_runner.h
" |
11 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 11 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
12 #include "net/url_request/url_request.h" | 12 #include "net/url_request/url_request.h" |
13 #include "webkit/browser/fileapi/file_system_context.h" | 13 #include "webkit/browser/fileapi/file_system_context.h" |
| 14 #include "webkit/browser/fileapi/file_system_operation.h" |
14 #include "webkit/browser/fileapi/file_system_operation_context.h" | 15 #include "webkit/browser/fileapi/file_system_operation_context.h" |
15 #include "webkit/browser/fileapi/file_system_operation_impl.h" | |
16 #include "webkit/browser/fileapi/file_system_url.h" | 16 #include "webkit/browser/fileapi/file_system_url.h" |
| 17 #include "webkit/browser/fileapi/file_writer_delegate.h" |
17 #include "webkit/browser/fileapi/sandbox_file_system_backend.h" | 18 #include "webkit/browser/fileapi/sandbox_file_system_backend.h" |
18 #include "webkit/common/blob/shareable_file_reference.h" | 19 #include "webkit/common/blob/shareable_file_reference.h" |
19 | 20 |
20 using fileapi::FileSystemURL; | 21 using fileapi::FileSystemURL; |
21 | 22 |
22 namespace sync_file_system { | 23 namespace sync_file_system { |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
26 void WriteCallbackAdapter( | 27 void WriteCallbackAdapter( |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 DCHECK(file_system_context); | 356 DCHECK(file_system_context); |
356 SyncFileSystemBackend* backend = | 357 SyncFileSystemBackend* backend = |
357 SyncFileSystemBackend::GetBackend(file_system_context); | 358 SyncFileSystemBackend::GetBackend(file_system_context); |
358 DCHECK(backend); | 359 DCHECK(backend); |
359 if (!backend->sync_context()) { | 360 if (!backend->sync_context()) { |
360 // Syncable FileSystem is opened in a file system context which doesn't | 361 // Syncable FileSystem is opened in a file system context which doesn't |
361 // support (or is not initialized for) the API. | 362 // support (or is not initialized for) the API. |
362 // Returning here to leave operation_runner_ as NULL. | 363 // Returning here to leave operation_runner_ as NULL. |
363 return; | 364 return; |
364 } | 365 } |
365 impl_.reset(new fileapi::FileSystemOperationImpl(url_, file_system_context, | 366 impl_.reset(fileapi::FileSystemOperation::Create( |
366 operation_context.Pass())); | 367 url_, file_system_context, operation_context.Pass())); |
367 operation_runner_ = backend->sync_context()->operation_runner(); | 368 operation_runner_ = backend->sync_context()->operation_runner(); |
368 is_directory_operation_enabled_ = IsSyncFSDirectoryOperationEnabled(); | 369 is_directory_operation_enabled_ = IsSyncFSDirectoryOperationEnabled(); |
369 } | 370 } |
370 | 371 |
371 void SyncableFileSystemOperation::DidFinish(base::PlatformFileError status) { | 372 void SyncableFileSystemOperation::DidFinish(base::PlatformFileError status) { |
372 DCHECK(CalledOnValidThread()); | 373 DCHECK(CalledOnValidThread()); |
373 DCHECK(!completion_callback_.is_null()); | 374 DCHECK(!completion_callback_.is_null()); |
374 if (operation_runner_.get()) | 375 if (operation_runner_.get()) |
375 operation_runner_->OnOperationCompleted(target_paths_); | 376 operation_runner_->OnOperationCompleted(target_paths_); |
376 completion_callback_.Run(status); | 377 completion_callback_.Run(status); |
(...skipping 13 matching lines...) Expand all Loading... |
390 operation_runner_->OnOperationCompleted(target_paths_); | 391 operation_runner_->OnOperationCompleted(target_paths_); |
391 callback.Run(result, bytes, complete); | 392 callback.Run(result, bytes, complete); |
392 } | 393 } |
393 | 394 |
394 void SyncableFileSystemOperation::OnCancelled() { | 395 void SyncableFileSystemOperation::OnCancelled() { |
395 DCHECK(!completion_callback_.is_null()); | 396 DCHECK(!completion_callback_.is_null()); |
396 completion_callback_.Run(base::PLATFORM_FILE_ERROR_ABORT); | 397 completion_callback_.Run(base::PLATFORM_FILE_ERROR_ABORT); |
397 } | 398 } |
398 | 399 |
399 } // namespace sync_file_system | 400 } // namespace sync_file_system |
OLD | NEW |