| 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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 file_system_info_(file_system_info), | 86 file_system_info_(file_system_info), |
| 87 notification_manager_( | 87 notification_manager_( |
| 88 new NotificationManager(profile_, file_system_info_)), | 88 new NotificationManager(profile_, file_system_info_)), |
| 89 request_manager_(new RequestManager(notification_manager_.get())), | 89 request_manager_(new RequestManager(notification_manager_.get())), |
| 90 weak_ptr_factory_(this) { | 90 weak_ptr_factory_(this) { |
| 91 } | 91 } |
| 92 | 92 |
| 93 ProvidedFileSystem::~ProvidedFileSystem() { | 93 ProvidedFileSystem::~ProvidedFileSystem() { |
| 94 const std::vector<int> request_ids = request_manager_->GetActiveRequestIds(); | 94 const std::vector<int> request_ids = request_manager_->GetActiveRequestIds(); |
| 95 for (size_t i = 0; i < request_ids.size(); ++i) { | 95 for (size_t i = 0; i < request_ids.size(); ++i) { |
| 96 Abort(request_ids[i], base::Bind(&EmptyStatusCallback)); | 96 Abort(request_ids[i]); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 void ProvidedFileSystem::SetEventRouterForTesting( | 100 void ProvidedFileSystem::SetEventRouterForTesting( |
| 101 extensions::EventRouter* event_router) { | 101 extensions::EventRouter* event_router) { |
| 102 event_router_ = event_router; | 102 event_router_ = event_router; |
| 103 } | 103 } |
| 104 | 104 |
| 105 void ProvidedFileSystem::SetNotificationManagerForTesting( | 105 void ProvidedFileSystem::SetNotificationManagerForTesting( |
| 106 scoped_ptr<NotificationManagerInterface> notification_manager) { | 106 scoped_ptr<NotificationManagerInterface> notification_manager) { |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 watcher_it->second, | 550 watcher_it->second, |
| 551 change_type, | 551 change_type, |
| 552 changes_ref, | 552 changes_ref, |
| 553 auto_updater->CreateCallback())); | 553 auto_updater->CreateCallback())); |
| 554 } | 554 } |
| 555 | 555 |
| 556 base::WeakPtr<ProvidedFileSystemInterface> ProvidedFileSystem::GetWeakPtr() { | 556 base::WeakPtr<ProvidedFileSystemInterface> ProvidedFileSystem::GetWeakPtr() { |
| 557 return weak_ptr_factory_.GetWeakPtr(); | 557 return weak_ptr_factory_.GetWeakPtr(); |
| 558 } | 558 } |
| 559 | 559 |
| 560 void ProvidedFileSystem::Abort( | 560 void ProvidedFileSystem::Abort(int operation_request_id) { |
| 561 int operation_request_id, | |
| 562 const storage::AsyncFileUtil::StatusCallback& callback) { | |
| 563 request_manager_->RejectRequest(operation_request_id, | 561 request_manager_->RejectRequest(operation_request_id, |
| 564 make_scoped_ptr(new RequestValue()), | 562 make_scoped_ptr(new RequestValue()), |
| 565 base::File::FILE_ERROR_ABORT); | 563 base::File::FILE_ERROR_ABORT); |
| 566 if (!request_manager_->CreateRequest( | 564 if (!request_manager_->CreateRequest( |
| 567 ABORT, | 565 ABORT, |
| 568 scoped_ptr<RequestManager::HandlerInterface>( | 566 scoped_ptr<RequestManager::HandlerInterface>(new operations::Abort( |
| 569 new operations::Abort(event_router_, | 567 event_router_, file_system_info_, operation_request_id, |
| 570 file_system_info_, | 568 base::Bind(&EmptyStatusCallback))))) { |
| 571 operation_request_id, | 569 LOG(ERROR) << "Failed to create an abort request."; |
| 572 callback)))) { | |
| 573 callback.Run(base::File::FILE_ERROR_SECURITY); | |
| 574 } | 570 } |
| 575 } | 571 } |
| 576 | 572 |
| 577 void ProvidedFileSystem::OnAddWatcherCompleted( | 573 void ProvidedFileSystem::OnAddWatcherCompleted( |
| 578 const base::FilePath& entry_path, | 574 const base::FilePath& entry_path, |
| 579 bool recursive, | 575 bool recursive, |
| 580 const Subscriber& subscriber, | 576 const Subscriber& subscriber, |
| 581 const storage::AsyncFileUtil::StatusCallback& callback, | 577 const storage::AsyncFileUtil::StatusCallback& callback, |
| 582 base::File::Error result) { | 578 base::File::Error result) { |
| 583 if (result != base::File::FILE_OK) { | 579 if (result != base::File::FILE_OK) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 recursive, | 636 recursive, |
| 641 base::Bind(&EmptyStatusCallback)); | 637 base::Bind(&EmptyStatusCallback)); |
| 642 } | 638 } |
| 643 } | 639 } |
| 644 | 640 |
| 645 callback.Run(base::File::FILE_OK); | 641 callback.Run(base::File::FILE_OK); |
| 646 } | 642 } |
| 647 | 643 |
| 648 } // namespace file_system_provider | 644 } // namespace file_system_provider |
| 649 } // namespace chromeos | 645 } // namespace chromeos |
| OLD | NEW |