| 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/file_system_quota_client.h" | 5 #include "webkit/browser/fileapi/file_system_quota_client.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/sequenced_task_runner.h" | 16 #include "base/sequenced_task_runner.h" |
| 17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 18 #include "base/task_runner_util.h" | 18 #include "base/task_runner_util.h" |
| 19 #include "net/base/net_util.h" | 19 #include "net/base/net_util.h" |
| 20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 21 #include "webkit/browser/fileapi/file_system_context.h" | 21 #include "webkit/browser/fileapi/file_system_context.h" |
| 22 #include "webkit/browser/fileapi/file_system_quota_util.h" | 22 #include "webkit/browser/fileapi/file_system_quota_util.h" |
| 23 #include "webkit/browser/fileapi/file_system_task_runners.h" | 23 #include "webkit/browser/fileapi/file_system_task_runners.h" |
| 24 #include "webkit/browser/fileapi/file_system_usage_cache.h" | 24 #include "webkit/browser/fileapi/file_system_usage_cache.h" |
| 25 #include "webkit/browser/fileapi/sandbox_mount_point_provider.h" | 25 #include "webkit/browser/fileapi/sandbox_file_system_backend.h" |
| 26 #include "webkit/common/fileapi/file_system_util.h" | 26 #include "webkit/common/fileapi/file_system_util.h" |
| 27 | 27 |
| 28 using quota::StorageType; | 28 using quota::StorageType; |
| 29 | 29 |
| 30 namespace fileapi { | 30 namespace fileapi { |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 void GetOriginsForTypeOnFileThread( | 34 void GetOriginsForTypeOnFileThread( |
| 35 FileSystemContext* context, | 35 FileSystemContext* context, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 61 void DidGetOrigins( | 61 void DidGetOrigins( |
| 62 const quota::QuotaClient::GetOriginsCallback& callback, | 62 const quota::QuotaClient::GetOriginsCallback& callback, |
| 63 std::set<GURL>* origins_ptr) { | 63 std::set<GURL>* origins_ptr) { |
| 64 callback.Run(*origins_ptr); | 64 callback.Run(*origins_ptr); |
| 65 } | 65 } |
| 66 | 66 |
| 67 quota::QuotaStatusCode DeleteOriginOnFileThread( | 67 quota::QuotaStatusCode DeleteOriginOnFileThread( |
| 68 FileSystemContext* context, | 68 FileSystemContext* context, |
| 69 const GURL& origin, | 69 const GURL& origin, |
| 70 FileSystemType type) { | 70 FileSystemType type) { |
| 71 FileSystemMountPointProvider* provider = context->GetMountPointProvider(type); | 71 FileSystemBackend* provider = context->GetFileSystemBackend(type); |
| 72 if (!provider || !provider->GetQuotaUtil()) | 72 if (!provider || !provider->GetQuotaUtil()) |
| 73 return quota::kQuotaErrorNotSupported; | 73 return quota::kQuotaErrorNotSupported; |
| 74 base::PlatformFileError result = | 74 base::PlatformFileError result = |
| 75 provider->GetQuotaUtil()->DeleteOriginDataOnFileThread( | 75 provider->GetQuotaUtil()->DeleteOriginDataOnFileThread( |
| 76 context, context->quota_manager_proxy(), origin, type); | 76 context, context->quota_manager_proxy(), origin, type); |
| 77 if (result == base::PLATFORM_FILE_OK) | 77 if (result == base::PLATFORM_FILE_OK) |
| 78 return quota::kQuotaStatusOk; | 78 return quota::kQuotaStatusOk; |
| 79 return quota::kQuotaErrorInvalidModification; | 79 return quota::kQuotaErrorInvalidModification; |
| 80 } | 80 } |
| 81 | 81 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 origin, | 196 origin, |
| 197 fs_type), | 197 fs_type), |
| 198 callback); | 198 callback); |
| 199 } | 199 } |
| 200 | 200 |
| 201 base::SequencedTaskRunner* FileSystemQuotaClient::file_task_runner() const { | 201 base::SequencedTaskRunner* FileSystemQuotaClient::file_task_runner() const { |
| 202 return file_system_context_->task_runners()->file_task_runner(); | 202 return file_system_context_->task_runners()->file_task_runner(); |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace fileapi | 205 } // namespace fileapi |
| OLD | NEW |