| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/fileapi/sandboxed_file_system_operation.h" | 5 #include "webkit/fileapi/sandboxed_file_system_operation.h" |
| 6 | 6 |
| 7 #include "net/url_request/url_request_context.h" | 7 #include "net/url_request/url_request_context.h" |
| 8 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 8 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
| 9 #include "webkit/fileapi/file_system_path_manager.h" | 9 #include "webkit/fileapi/file_system_path_manager.h" |
| 10 #include "webkit/fileapi/file_system_quota_manager.h" | 10 #include "webkit/fileapi/file_system_quota_manager.h" |
| 11 #include "webkit/fileapi/sandboxed_file_system_context.h" | 11 #include "webkit/fileapi/sandboxed_file_system_context.h" |
| 12 | 12 |
| 13 namespace fileapi { | 13 namespace fileapi { |
| 14 | 14 |
| 15 SandboxedFileSystemOperation::SandboxedFileSystemOperation( | 15 SandboxedFileSystemOperation::SandboxedFileSystemOperation( |
| 16 FileSystemCallbackDispatcher* dispatcher, | 16 FileSystemCallbackDispatcher* dispatcher, |
| 17 scoped_refptr<base::MessageLoopProxy> proxy, | 17 scoped_refptr<base::MessageLoopProxy> proxy, |
| 18 SandboxedFileSystemContext* file_system_context) | 18 SandboxedFileSystemContext* file_system_context) |
| 19 : FileSystemOperation(dispatcher, proxy), | 19 : FileSystemOperation(dispatcher, proxy), |
| 20 file_system_context_(file_system_context), | 20 file_system_context_(file_system_context), |
| 21 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 21 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
| 22 DCHECK(file_system_context_); | 22 DCHECK(file_system_context_); |
| 23 } | 23 } |
| 24 | 24 |
| 25 SandboxedFileSystemOperation::~SandboxedFileSystemOperation() {} |
| 26 |
| 25 void SandboxedFileSystemOperation::OpenFileSystem( | 27 void SandboxedFileSystemOperation::OpenFileSystem( |
| 26 const GURL& origin_url, fileapi::FileSystemType type, bool create) { | 28 const GURL& origin_url, fileapi::FileSystemType type, bool create) { |
| 27 #ifndef NDEBUG | 29 #ifndef NDEBUG |
| 28 DCHECK(kOperationNone == pending_operation_); | 30 DCHECK(kOperationNone == pending_operation_); |
| 29 pending_operation_ = static_cast<FileSystemOperation::OperationType>( | 31 pending_operation_ = static_cast<FileSystemOperation::OperationType>( |
| 30 kOperationOpenFileSystem); | 32 kOperationOpenFileSystem); |
| 31 #endif | 33 #endif |
| 32 | 34 |
| 33 file_system_context_->path_manager()->GetFileSystemRootPath( | 35 file_system_context_->path_manager()->GetFileSystemRootPath( |
| 34 origin_url, type, create, | 36 origin_url, type, create, |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 // need to resolve what amount of size it's going to write. | 193 // need to resolve what amount of size it's going to write. |
| 192 if (!file_system_context_->quota_manager()->CheckOriginQuota( | 194 if (!file_system_context_->quota_manager()->CheckOriginQuota( |
| 193 origin_url, growth)) { | 195 origin_url, growth)) { |
| 194 dispatcher()->DidFail(base::PLATFORM_FILE_ERROR_NO_SPACE); | 196 dispatcher()->DidFail(base::PLATFORM_FILE_ERROR_NO_SPACE); |
| 195 return false; | 197 return false; |
| 196 } | 198 } |
| 197 return true; | 199 return true; |
| 198 } | 200 } |
| 199 | 201 |
| 200 } // namespace fileapi | 202 } // namespace fileapi |
| OLD | NEW |