| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/file_system_provider/provided_file_system.h" | 5 #include "chrome/browser/chromeos/file_system_provider/provided_file_system.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| 11 #include "chrome/browser/chromeos/file_system_provider/notification_manager.h" | 11 #include "chrome/browser/chromeos/file_system_provider/notification_manager.h" |
| 12 #include "chrome/browser/chromeos/file_system_provider/operations/abort.h" | 12 #include "chrome/browser/chromeos/file_system_provider/operations/abort.h" |
| 13 #include "chrome/browser/chromeos/file_system_provider/operations/add_watcher.h" | 13 #include "chrome/browser/chromeos/file_system_provider/operations/add_watcher.h" |
| 14 #include "chrome/browser/chromeos/file_system_provider/operations/close_file.h" | 14 #include "chrome/browser/chromeos/file_system_provider/operations/close_file.h" |
| 15 #include "chrome/browser/chromeos/file_system_provider/operations/configure.h" |
| 15 #include "chrome/browser/chromeos/file_system_provider/operations/copy_entry.h" | 16 #include "chrome/browser/chromeos/file_system_provider/operations/copy_entry.h" |
| 16 #include "chrome/browser/chromeos/file_system_provider/operations/create_directo
ry.h" | 17 #include "chrome/browser/chromeos/file_system_provider/operations/create_directo
ry.h" |
| 17 #include "chrome/browser/chromeos/file_system_provider/operations/create_file.h" | 18 #include "chrome/browser/chromeos/file_system_provider/operations/create_file.h" |
| 18 #include "chrome/browser/chromeos/file_system_provider/operations/delete_entry.h
" | 19 #include "chrome/browser/chromeos/file_system_provider/operations/delete_entry.h
" |
| 19 #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h
" | 20 #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h
" |
| 20 #include "chrome/browser/chromeos/file_system_provider/operations/move_entry.h" | 21 #include "chrome/browser/chromeos/file_system_provider/operations/move_entry.h" |
| 21 #include "chrome/browser/chromeos/file_system_provider/operations/open_file.h" | 22 #include "chrome/browser/chromeos/file_system_provider/operations/open_file.h" |
| 22 #include "chrome/browser/chromeos/file_system_provider/operations/read_directory
.h" | 23 #include "chrome/browser/chromeos/file_system_provider/operations/read_directory
.h" |
| 23 #include "chrome/browser/chromeos/file_system_provider/operations/read_file.h" | 24 #include "chrome/browser/chromeos/file_system_provider/operations/read_file.h" |
| 24 #include "chrome/browser/chromeos/file_system_provider/operations/remove_watcher
.h" | 25 #include "chrome/browser/chromeos/file_system_provider/operations/remove_watcher
.h" |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 const storage::AsyncFileUtil::StatusCallback& callback) { | 484 const storage::AsyncFileUtil::StatusCallback& callback) { |
| 484 const size_t token = watcher_queue_.NewToken(); | 485 const size_t token = watcher_queue_.NewToken(); |
| 485 watcher_queue_.Enqueue( | 486 watcher_queue_.Enqueue( |
| 486 token, base::Bind(&ProvidedFileSystem::NotifyInQueue, | 487 token, base::Bind(&ProvidedFileSystem::NotifyInQueue, |
| 487 base::Unretained(this), // Outlived by the queue. | 488 base::Unretained(this), // Outlived by the queue. |
| 488 base::Passed(make_scoped_ptr(new NotifyInQueueArgs( | 489 base::Passed(make_scoped_ptr(new NotifyInQueueArgs( |
| 489 token, entry_path, recursive, change_type, | 490 token, entry_path, recursive, change_type, |
| 490 changes.Pass(), tag, callback))))); | 491 changes.Pass(), tag, callback))))); |
| 491 } | 492 } |
| 492 | 493 |
| 494 void ProvidedFileSystem::Configure( |
| 495 const storage::AsyncFileUtil::StatusCallback& callback) { |
| 496 const int request_id = request_manager_->CreateRequest( |
| 497 CONFIGURE, |
| 498 scoped_ptr<RequestManager::HandlerInterface>(new operations::Configure( |
| 499 event_router_, file_system_info_, callback))); |
| 500 if (!request_id) |
| 501 callback.Run(base::File::FILE_ERROR_SECURITY); |
| 502 } |
| 503 |
| 493 void ProvidedFileSystem::Abort(int operation_request_id) { | 504 void ProvidedFileSystem::Abort(int operation_request_id) { |
| 494 request_manager_->RejectRequest(operation_request_id, | 505 request_manager_->RejectRequest(operation_request_id, |
| 495 make_scoped_ptr(new RequestValue()), | 506 make_scoped_ptr(new RequestValue()), |
| 496 base::File::FILE_ERROR_ABORT); | 507 base::File::FILE_ERROR_ABORT); |
| 497 if (!request_manager_->CreateRequest( | 508 if (!request_manager_->CreateRequest( |
| 498 ABORT, | 509 ABORT, |
| 499 scoped_ptr<RequestManager::HandlerInterface>(new operations::Abort( | 510 scoped_ptr<RequestManager::HandlerInterface>(new operations::Abort( |
| 500 event_router_, file_system_info_, operation_request_id, | 511 event_router_, file_system_info_, operation_request_id, |
| 501 base::Bind(&EmptyStatusCallback))))) { | 512 base::Bind(&EmptyStatusCallback))))) { |
| 502 LOG(ERROR) << "Failed to create an abort request."; | 513 LOG(ERROR) << "Failed to create an abort request."; |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 const storage::AsyncFileUtil::StatusCallback& callback, | 779 const storage::AsyncFileUtil::StatusCallback& callback, |
| 769 base::File::Error result) { | 780 base::File::Error result) { |
| 770 // Closing files is final. Even if an error happened, we remove it from the | 781 // Closing files is final. Even if an error happened, we remove it from the |
| 771 // list of opened files. | 782 // list of opened files. |
| 772 opened_files_.erase(file_handle); | 783 opened_files_.erase(file_handle); |
| 773 callback.Run(result); | 784 callback.Run(result); |
| 774 } | 785 } |
| 775 | 786 |
| 776 } // namespace file_system_provider | 787 } // namespace file_system_provider |
| 777 } // namespace chromeos | 788 } // namespace chromeos |
| OLD | NEW |