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 "webkit/browser/fileapi/file_system_operation_impl.h" | 5 #include "webkit/browser/fileapi/file_system_operation_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "net/base/escape.h" | 11 #include "net/base/escape.h" |
12 #include "net/url_request/url_request.h" | 12 #include "net/url_request/url_request.h" |
13 #include "webkit/browser/fileapi/async_file_util.h" | 13 #include "webkit/browser/fileapi/async_file_util.h" |
14 #include "webkit/browser/fileapi/copy_or_move_operation_delegate.h" | 14 #include "webkit/browser/fileapi/copy_or_move_operation_delegate.h" |
15 #include "webkit/browser/fileapi/file_observers.h" | 15 #include "webkit/browser/fileapi/file_observers.h" |
16 #include "webkit/browser/fileapi/file_system_backend.h" | 16 #include "webkit/browser/fileapi/file_system_backend.h" |
17 #include "webkit/browser/fileapi/file_system_context.h" | 17 #include "webkit/browser/fileapi/file_system_context.h" |
18 #include "webkit/browser/fileapi/file_system_file_util.h" | 18 #include "webkit/browser/fileapi/file_system_file_util.h" |
19 #include "webkit/browser/fileapi/file_system_operation_context.h" | 19 #include "webkit/browser/fileapi/file_system_operation_context.h" |
20 #include "webkit/browser/fileapi/file_system_url.h" | 20 #include "webkit/browser/fileapi/file_system_url.h" |
21 #include "webkit/browser/fileapi/file_writer_delegate.h" | 21 #include "webkit/browser/fileapi/file_writer_delegate.h" |
22 #include "webkit/browser/fileapi/remove_operation_delegate.h" | 22 #include "webkit/browser/fileapi/remove_operation_delegate.h" |
23 #include "webkit/browser/fileapi/sandbox_file_stream_writer.h" | 23 #include "webkit/browser/fileapi/sandbox_file_system_backend.h" |
24 #include "webkit/browser/quota/quota_manager.h" | 24 #include "webkit/browser/quota/quota_manager.h" |
25 #include "webkit/common/blob/shareable_file_reference.h" | 25 #include "webkit/common/blob/shareable_file_reference.h" |
26 #include "webkit/common/fileapi/file_system_types.h" | 26 #include "webkit/common/fileapi/file_system_types.h" |
27 #include "webkit/common/fileapi/file_system_util.h" | 27 #include "webkit/common/fileapi/file_system_util.h" |
28 #include "webkit/common/quota/quota_types.h" | 28 #include "webkit/common/quota/quota_types.h" |
29 | 29 |
30 using webkit_blob::ScopedFile; | 30 using webkit_blob::ScopedFile; |
31 | 31 |
32 namespace fileapi { | 32 namespace fileapi { |
33 | 33 |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 dest_url, | 301 dest_url, |
302 base::Bind(&FileSystemOperationImpl::DoMoveFileLocal, | 302 base::Bind(&FileSystemOperationImpl::DoMoveFileLocal, |
303 AsWeakPtr(), src_url, dest_url, callback), | 303 AsWeakPtr(), src_url, dest_url, callback), |
304 base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED)); | 304 base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED)); |
305 } | 305 } |
306 | 306 |
307 base::PlatformFileError FileSystemOperationImpl::SyncGetPlatformPath( | 307 base::PlatformFileError FileSystemOperationImpl::SyncGetPlatformPath( |
308 const FileSystemURL& url, | 308 const FileSystemURL& url, |
309 base::FilePath* platform_path) { | 309 base::FilePath* platform_path) { |
310 DCHECK(SetPendingOperationType(kOperationGetLocalPath)); | 310 DCHECK(SetPendingOperationType(kOperationGetLocalPath)); |
311 FileSystemFileUtil* file_util = file_system_context()->GetFileUtil( | 311 if (!file_system_context()->IsSandboxFileSystem(url.type())) |
312 url.type()); | |
313 if (!file_util) | |
314 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; | 312 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; |
| 313 FileSystemFileUtil* file_util = |
| 314 file_system_context()->sandbox_delegate()->sync_file_util(); |
315 file_util->GetLocalFilePath(operation_context_.get(), url, platform_path); | 315 file_util->GetLocalFilePath(operation_context_.get(), url, platform_path); |
316 return base::PLATFORM_FILE_OK; | 316 return base::PLATFORM_FILE_OK; |
317 } | 317 } |
318 | 318 |
319 void FileSystemOperationImpl::GetUsageAndQuotaThenRunTask( | 319 void FileSystemOperationImpl::GetUsageAndQuotaThenRunTask( |
320 const FileSystemURL& url, | 320 const FileSystemURL& url, |
321 const base::Closure& task, | 321 const base::Closure& task, |
322 const base::Closure& error_callback) { | 322 const base::Closure& error_callback) { |
323 quota::QuotaManagerProxy* quota_manager_proxy = | 323 quota::QuotaManagerProxy* quota_manager_proxy = |
324 file_system_context()->quota_manager_proxy(); | 324 file_system_context()->quota_manager_proxy(); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 } | 526 } |
527 | 527 |
528 bool FileSystemOperationImpl::SetPendingOperationType(OperationType type) { | 528 bool FileSystemOperationImpl::SetPendingOperationType(OperationType type) { |
529 if (pending_operation_ != kOperationNone) | 529 if (pending_operation_ != kOperationNone) |
530 return false; | 530 return false; |
531 pending_operation_ = type; | 531 pending_operation_ = type; |
532 return true; | 532 return true; |
533 } | 533 } |
534 | 534 |
535 } // namespace fileapi | 535 } // namespace fileapi |
OLD | NEW |