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 "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
9 #include "chrome/browser/chromeos/file_system_provider/notification_manager.h" | 9 #include "chrome/browser/chromeos/file_system_provider/notification_manager.h" |
10 #include "chrome/browser/chromeos/file_system_provider/operations/close_file.h" | 10 #include "chrome/browser/chromeos/file_system_provider/operations/close_file.h" |
11 #include "chrome/browser/chromeos/file_system_provider/operations/copy_entry.h" | 11 #include "chrome/browser/chromeos/file_system_provider/operations/copy_entry.h" |
12 #include "chrome/browser/chromeos/file_system_provider/operations/create_directo
ry.h" | 12 #include "chrome/browser/chromeos/file_system_provider/operations/create_directo
ry.h" |
13 #include "chrome/browser/chromeos/file_system_provider/operations/create_file.h" | 13 #include "chrome/browser/chromeos/file_system_provider/operations/create_file.h" |
14 #include "chrome/browser/chromeos/file_system_provider/operations/delete_entry.h
" | 14 #include "chrome/browser/chromeos/file_system_provider/operations/delete_entry.h
" |
15 #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h
" | 15 #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h
" |
16 #include "chrome/browser/chromeos/file_system_provider/operations/move_entry.h" | 16 #include "chrome/browser/chromeos/file_system_provider/operations/move_entry.h" |
17 #include "chrome/browser/chromeos/file_system_provider/operations/open_file.h" | 17 #include "chrome/browser/chromeos/file_system_provider/operations/open_file.h" |
18 #include "chrome/browser/chromeos/file_system_provider/operations/read_directory
.h" | 18 #include "chrome/browser/chromeos/file_system_provider/operations/read_directory
.h" |
19 #include "chrome/browser/chromeos/file_system_provider/operations/read_file.h" | 19 #include "chrome/browser/chromeos/file_system_provider/operations/read_file.h" |
| 20 #include "chrome/browser/chromeos/file_system_provider/operations/truncate.h" |
20 #include "chrome/browser/chromeos/file_system_provider/operations/unmount.h" | 21 #include "chrome/browser/chromeos/file_system_provider/operations/unmount.h" |
21 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" | 22 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" |
22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/common/extensions/api/file_system_provider.h" | 24 #include "chrome/common/extensions/api/file_system_provider.h" |
24 #include "extensions/browser/event_router.h" | 25 #include "extensions/browser/event_router.h" |
25 | 26 |
26 namespace net { | 27 namespace net { |
27 class IOBuffer; | 28 class IOBuffer; |
28 } // namespace net | 29 } // namespace net |
29 | 30 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 scoped_ptr<RequestManager::HandlerInterface>( | 207 scoped_ptr<RequestManager::HandlerInterface>( |
207 new operations::MoveEntry(event_router_, | 208 new operations::MoveEntry(event_router_, |
208 file_system_info_, | 209 file_system_info_, |
209 source_path, | 210 source_path, |
210 target_path, | 211 target_path, |
211 callback)))) { | 212 callback)))) { |
212 callback.Run(base::File::FILE_ERROR_SECURITY); | 213 callback.Run(base::File::FILE_ERROR_SECURITY); |
213 } | 214 } |
214 } | 215 } |
215 | 216 |
| 217 void ProvidedFileSystem::Truncate( |
| 218 const base::FilePath& file_path, |
| 219 int64 length, |
| 220 const fileapi::AsyncFileUtil::StatusCallback& callback) { |
| 221 if (!request_manager_.CreateRequest( |
| 222 TRUNCATE, |
| 223 scoped_ptr<RequestManager::HandlerInterface>( |
| 224 new operations::Truncate(event_router_, |
| 225 file_system_info_, |
| 226 file_path, |
| 227 length, |
| 228 callback)))) { |
| 229 callback.Run(base::File::FILE_ERROR_SECURITY); |
| 230 } |
| 231 } |
| 232 |
216 const ProvidedFileSystemInfo& ProvidedFileSystem::GetFileSystemInfo() const { | 233 const ProvidedFileSystemInfo& ProvidedFileSystem::GetFileSystemInfo() const { |
217 return file_system_info_; | 234 return file_system_info_; |
218 } | 235 } |
219 | 236 |
220 RequestManager* ProvidedFileSystem::GetRequestManager() { | 237 RequestManager* ProvidedFileSystem::GetRequestManager() { |
221 return &request_manager_; | 238 return &request_manager_; |
222 } | 239 } |
223 | 240 |
224 base::WeakPtr<ProvidedFileSystemInterface> ProvidedFileSystem::GetWeakPtr() { | 241 base::WeakPtr<ProvidedFileSystemInterface> ProvidedFileSystem::GetWeakPtr() { |
225 return weak_ptr_factory_.GetWeakPtr(); | 242 return weak_ptr_factory_.GetWeakPtr(); |
226 } | 243 } |
227 | 244 |
228 } // namespace file_system_provider | 245 } // namespace file_system_provider |
229 } // namespace chromeos | 246 } // namespace chromeos |
OLD | NEW |