| 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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/task_runner_util.h" | 13 #include "base/task_runner_util.h" |
| 14 #include "net/base/net_util.h" | 14 #include "net/base/net_util.h" |
| 15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 16 #include "webkit/browser/fileapi/async_file_util_adapter.h" | 16 #include "webkit/browser/fileapi/async_file_util_adapter.h" |
| 17 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" | 17 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" |
| 18 #include "webkit/browser/fileapi/file_system_context.h" | 18 #include "webkit/browser/fileapi/file_system_context.h" |
| 19 #include "webkit/browser/fileapi/file_system_file_stream_reader.h" | 19 #include "webkit/browser/fileapi/file_system_file_stream_reader.h" |
| 20 #include "webkit/browser/fileapi/file_system_operation_context.h" | 20 #include "webkit/browser/fileapi/file_system_operation_context.h" |
| 21 #include "webkit/browser/fileapi/file_system_operation_impl.h" |
| 21 #include "webkit/browser/fileapi/file_system_options.h" | 22 #include "webkit/browser/fileapi/file_system_options.h" |
| 22 #include "webkit/browser/fileapi/file_system_task_runners.h" | 23 #include "webkit/browser/fileapi/file_system_task_runners.h" |
| 23 #include "webkit/browser/fileapi/file_system_usage_cache.h" | 24 #include "webkit/browser/fileapi/file_system_usage_cache.h" |
| 24 #include "webkit/browser/fileapi/local_file_system_operation.h" | |
| 25 #include "webkit/browser/fileapi/obfuscated_file_util.h" | 25 #include "webkit/browser/fileapi/obfuscated_file_util.h" |
| 26 #include "webkit/browser/fileapi/sandbox_context.h" | 26 #include "webkit/browser/fileapi/sandbox_context.h" |
| 27 #include "webkit/browser/fileapi/sandbox_file_stream_writer.h" | 27 #include "webkit/browser/fileapi/sandbox_file_stream_writer.h" |
| 28 #include "webkit/browser/fileapi/sandbox_quota_observer.h" | 28 #include "webkit/browser/fileapi/sandbox_quota_observer.h" |
| 29 #include "webkit/browser/fileapi/syncable/syncable_file_system_operation.h" | 29 #include "webkit/browser/fileapi/syncable/syncable_file_system_operation.h" |
| 30 #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h" | 30 #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h" |
| 31 #include "webkit/browser/quota/quota_manager.h" | 31 #include "webkit/browser/quota/quota_manager.h" |
| 32 #include "webkit/common/fileapi/file_system_types.h" | 32 #include "webkit/common/fileapi/file_system_types.h" |
| 33 #include "webkit/common/fileapi/file_system_util.h" | 33 #include "webkit/common/fileapi/file_system_util.h" |
| 34 | 34 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 // For regular sandboxed types. | 254 // For regular sandboxed types. |
| 255 operation_context->set_update_observers(update_observers_); | 255 operation_context->set_update_observers(update_observers_); |
| 256 operation_context->set_change_observers(change_observers_); | 256 operation_context->set_change_observers(change_observers_); |
| 257 | 257 |
| 258 SpecialStoragePolicy* policy = sandbox_context_->special_storage_policy(); | 258 SpecialStoragePolicy* policy = sandbox_context_->special_storage_policy(); |
| 259 if (policy && policy->IsStorageUnlimited(url.origin())) | 259 if (policy && policy->IsStorageUnlimited(url.origin())) |
| 260 operation_context->set_quota_limit_type(quota::kQuotaLimitTypeUnlimited); | 260 operation_context->set_quota_limit_type(quota::kQuotaLimitTypeUnlimited); |
| 261 else | 261 else |
| 262 operation_context->set_quota_limit_type(quota::kQuotaLimitTypeLimited); | 262 operation_context->set_quota_limit_type(quota::kQuotaLimitTypeLimited); |
| 263 | 263 |
| 264 return new LocalFileSystemOperation(url, context, operation_context.Pass()); | 264 return new FileSystemOperationImpl(url, context, operation_context.Pass()); |
| 265 } | 265 } |
| 266 | 266 |
| 267 scoped_ptr<webkit_blob::FileStreamReader> | 267 scoped_ptr<webkit_blob::FileStreamReader> |
| 268 SandboxFileSystemBackend::CreateFileStreamReader( | 268 SandboxFileSystemBackend::CreateFileStreamReader( |
| 269 const FileSystemURL& url, | 269 const FileSystemURL& url, |
| 270 int64 offset, | 270 int64 offset, |
| 271 const base::Time& expected_modification_time, | 271 const base::Time& expected_modification_time, |
| 272 FileSystemContext* context) const { | 272 FileSystemContext* context) const { |
| 273 if (!IsAccessValid(url)) | 273 if (!IsAccessValid(url)) |
| 274 return scoped_ptr<webkit_blob::FileStreamReader>(); | 274 return scoped_ptr<webkit_blob::FileStreamReader>(); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 | 637 |
| 638 while (!(file_path_each = enumerator->Next()).empty()) { | 638 while (!(file_path_each = enumerator->Next()).empty()) { |
| 639 usage += enumerator->Size(); | 639 usage += enumerator->Size(); |
| 640 usage += ObfuscatedFileUtil::ComputeFilePathCost(file_path_each); | 640 usage += ObfuscatedFileUtil::ComputeFilePathCost(file_path_each); |
| 641 } | 641 } |
| 642 | 642 |
| 643 return usage; | 643 return usage; |
| 644 } | 644 } |
| 645 | 645 |
| 646 } // namespace fileapi | 646 } // namespace fileapi |
| OLD | NEW |