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/configure.h" |
16 #include "chrome/browser/chromeos/file_system_provider/operations/copy_entry.h" | 16 #include "chrome/browser/chromeos/file_system_provider/operations/copy_entry.h" |
17 #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" |
18 #include "chrome/browser/chromeos/file_system_provider/operations/create_file.h" | 18 #include "chrome/browser/chromeos/file_system_provider/operations/create_file.h" |
19 #include "chrome/browser/chromeos/file_system_provider/operations/delete_entry.h
" | 19 #include "chrome/browser/chromeos/file_system_provider/operations/delete_entry.h
" |
| 20 #include "chrome/browser/chromeos/file_system_provider/operations/get_actions.h" |
20 #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h
" | 21 #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h
" |
21 #include "chrome/browser/chromeos/file_system_provider/operations/move_entry.h" | 22 #include "chrome/browser/chromeos/file_system_provider/operations/move_entry.h" |
22 #include "chrome/browser/chromeos/file_system_provider/operations/open_file.h" | 23 #include "chrome/browser/chromeos/file_system_provider/operations/open_file.h" |
23 #include "chrome/browser/chromeos/file_system_provider/operations/read_directory
.h" | 24 #include "chrome/browser/chromeos/file_system_provider/operations/read_directory
.h" |
24 #include "chrome/browser/chromeos/file_system_provider/operations/read_file.h" | 25 #include "chrome/browser/chromeos/file_system_provider/operations/read_file.h" |
25 #include "chrome/browser/chromeos/file_system_provider/operations/remove_watcher
.h" | 26 #include "chrome/browser/chromeos/file_system_provider/operations/remove_watcher
.h" |
26 #include "chrome/browser/chromeos/file_system_provider/operations/truncate.h" | 27 #include "chrome/browser/chromeos/file_system_provider/operations/truncate.h" |
27 #include "chrome/browser/chromeos/file_system_provider/operations/unmount.h" | 28 #include "chrome/browser/chromeos/file_system_provider/operations/unmount.h" |
28 #include "chrome/browser/chromeos/file_system_provider/operations/write_file.h" | 29 #include "chrome/browser/chromeos/file_system_provider/operations/write_file.h" |
29 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" | 30 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 if (!request_id) { | 189 if (!request_id) { |
189 callback.Run(make_scoped_ptr<EntryMetadata>(NULL), | 190 callback.Run(make_scoped_ptr<EntryMetadata>(NULL), |
190 base::File::FILE_ERROR_SECURITY); | 191 base::File::FILE_ERROR_SECURITY); |
191 return AbortCallback(); | 192 return AbortCallback(); |
192 } | 193 } |
193 | 194 |
194 return base::Bind( | 195 return base::Bind( |
195 &ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), request_id); | 196 &ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), request_id); |
196 } | 197 } |
197 | 198 |
| 199 AbortCallback ProvidedFileSystem::GetActions( |
| 200 const base::FilePath& entry_path, |
| 201 const GetActionsCallback& callback) { |
| 202 const int request_id = request_manager_->CreateRequest( |
| 203 GET_ACTIONS, |
| 204 scoped_ptr<RequestManager::HandlerInterface>(new operations::GetActions( |
| 205 event_router_, file_system_info_, entry_path, callback))); |
| 206 if (!request_id) { |
| 207 callback.Run(Actions(), base::File::FILE_ERROR_SECURITY); |
| 208 return AbortCallback(); |
| 209 } |
| 210 |
| 211 return base::Bind(&ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), |
| 212 request_id); |
| 213 } |
| 214 |
198 AbortCallback ProvidedFileSystem::ReadDirectory( | 215 AbortCallback ProvidedFileSystem::ReadDirectory( |
199 const base::FilePath& directory_path, | 216 const base::FilePath& directory_path, |
200 const storage::AsyncFileUtil::ReadDirectoryCallback& callback) { | 217 const storage::AsyncFileUtil::ReadDirectoryCallback& callback) { |
201 const int request_id = request_manager_->CreateRequest( | 218 const int request_id = request_manager_->CreateRequest( |
202 READ_DIRECTORY, | 219 READ_DIRECTORY, |
203 scoped_ptr<RequestManager::HandlerInterface>( | 220 scoped_ptr<RequestManager::HandlerInterface>( |
204 new operations::ReadDirectory( | 221 new operations::ReadDirectory( |
205 event_router_, file_system_info_, directory_path, callback))); | 222 event_router_, file_system_info_, directory_path, callback))); |
206 if (!request_id) { | 223 if (!request_id) { |
207 callback.Run(base::File::FILE_ERROR_SECURITY, | 224 callback.Run(base::File::FILE_ERROR_SECURITY, |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 const storage::AsyncFileUtil::StatusCallback& callback, | 799 const storage::AsyncFileUtil::StatusCallback& callback, |
783 base::File::Error result) { | 800 base::File::Error result) { |
784 // Closing files is final. Even if an error happened, we remove it from the | 801 // Closing files is final. Even if an error happened, we remove it from the |
785 // list of opened files. | 802 // list of opened files. |
786 opened_files_.erase(file_handle); | 803 opened_files_.erase(file_handle); |
787 callback.Run(result); | 804 callback.Run(result); |
788 } | 805 } |
789 | 806 |
790 } // namespace file_system_provider | 807 } // namespace file_system_provider |
791 } // namespace chromeos | 808 } // namespace chromeos |
OLD | NEW |