| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/sandbox_file_system_backend.h" | 5 #include "webkit/browser/fileapi/sandbox_file_system_backend.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/task_runner_util.h" | 11 #include "base/task_runner_util.h" |
| 12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 13 #include "webkit/browser/fileapi/async_file_util_adapter.h" | 13 #include "webkit/browser/fileapi/async_file_util_adapter.h" |
| 14 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" | 14 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" |
| 15 #include "webkit/browser/fileapi/file_system_context.h" | 15 #include "webkit/browser/fileapi/file_system_context.h" |
| 16 #include "webkit/browser/fileapi/file_system_file_stream_reader.h" | 16 #include "webkit/browser/fileapi/file_system_file_stream_reader.h" |
| 17 #include "webkit/browser/fileapi/file_system_operation_context.h" | 17 #include "webkit/browser/fileapi/file_system_operation_context.h" |
| 18 #include "webkit/browser/fileapi/file_system_operation_impl.h" |
| 18 #include "webkit/browser/fileapi/file_system_options.h" | 19 #include "webkit/browser/fileapi/file_system_options.h" |
| 19 #include "webkit/browser/fileapi/file_system_task_runners.h" | 20 #include "webkit/browser/fileapi/file_system_task_runners.h" |
| 20 #include "webkit/browser/fileapi/local_file_system_operation.h" | 21 #include "webkit/browser/fileapi/file_system_usage_cache.h" |
| 21 #include "webkit/browser/fileapi/obfuscated_file_util.h" | 22 #include "webkit/browser/fileapi/obfuscated_file_util.h" |
| 22 #include "webkit/browser/fileapi/sandbox_context.h" | 23 #include "webkit/browser/fileapi/sandbox_context.h" |
| 23 #include "webkit/browser/fileapi/sandbox_file_stream_writer.h" | 24 #include "webkit/browser/fileapi/sandbox_file_stream_writer.h" |
| 24 #include "webkit/browser/fileapi/sandbox_quota_observer.h" | 25 #include "webkit/browser/fileapi/sandbox_quota_observer.h" |
| 25 #include "webkit/browser/fileapi/syncable/syncable_file_system_operation.h" | 26 #include "webkit/browser/fileapi/syncable/syncable_file_system_operation.h" |
| 26 #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h" | 27 #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h" |
| 27 #include "webkit/browser/quota/quota_manager.h" | 28 #include "webkit/browser/quota/quota_manager.h" |
| 28 #include "webkit/common/fileapi/file_system_types.h" | 29 #include "webkit/common/fileapi/file_system_types.h" |
| 29 #include "webkit/common/fileapi/file_system_util.h" | 30 #include "webkit/common/fileapi/file_system_util.h" |
| 30 | 31 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // For regular sandboxed types. | 147 // For regular sandboxed types. |
| 147 operation_context->set_update_observers(update_observers_); | 148 operation_context->set_update_observers(update_observers_); |
| 148 operation_context->set_change_observers(change_observers_); | 149 operation_context->set_change_observers(change_observers_); |
| 149 | 150 |
| 150 SpecialStoragePolicy* policy = sandbox_context_->special_storage_policy(); | 151 SpecialStoragePolicy* policy = sandbox_context_->special_storage_policy(); |
| 151 if (policy && policy->IsStorageUnlimited(url.origin())) | 152 if (policy && policy->IsStorageUnlimited(url.origin())) |
| 152 operation_context->set_quota_limit_type(quota::kQuotaLimitTypeUnlimited); | 153 operation_context->set_quota_limit_type(quota::kQuotaLimitTypeUnlimited); |
| 153 else | 154 else |
| 154 operation_context->set_quota_limit_type(quota::kQuotaLimitTypeLimited); | 155 operation_context->set_quota_limit_type(quota::kQuotaLimitTypeLimited); |
| 155 | 156 |
| 156 return new LocalFileSystemOperation(url, context, operation_context.Pass()); | 157 return new FileSystemOperationImpl(url, context, operation_context.Pass()); |
| 157 } | 158 } |
| 158 | 159 |
| 159 scoped_ptr<webkit_blob::FileStreamReader> | 160 scoped_ptr<webkit_blob::FileStreamReader> |
| 160 SandboxFileSystemBackend::CreateFileStreamReader( | 161 SandboxFileSystemBackend::CreateFileStreamReader( |
| 161 const FileSystemURL& url, | 162 const FileSystemURL& url, |
| 162 int64 offset, | 163 int64 offset, |
| 163 const base::Time& expected_modification_time, | 164 const base::Time& expected_modification_time, |
| 164 FileSystemContext* context) const { | 165 FileSystemContext* context) const { |
| 165 DCHECK(CanHandleType(url.type())); | 166 DCHECK(CanHandleType(url.type())); |
| 166 DCHECK(sandbox_context_); | 167 DCHECK(sandbox_context_); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 return &change_observers_; | 304 return &change_observers_; |
| 304 } | 305 } |
| 305 | 306 |
| 306 const AccessObserverList* SandboxFileSystemBackend::GetAccessObservers( | 307 const AccessObserverList* SandboxFileSystemBackend::GetAccessObservers( |
| 307 FileSystemType type) const { | 308 FileSystemType type) const { |
| 308 DCHECK(CanHandleType(type)); | 309 DCHECK(CanHandleType(type)); |
| 309 return &access_observers_; | 310 return &access_observers_; |
| 310 } | 311 } |
| 311 | 312 |
| 312 } // namespace fileapi | 313 } // namespace fileapi |
| OLD | NEW |