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/fileapi/file_system_quota_client.h" | 5 #include "webkit/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/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
16 #include "net/base/net_util.h" | 16 #include "net/base/net_util.h" |
17 #include "webkit/fileapi/file_system_context.h" | 17 #include "webkit/fileapi/file_system_context.h" |
18 #include "webkit/fileapi/file_system_quota_util.h" | 18 #include "webkit/fileapi/file_system_quota_util.h" |
19 #include "webkit/fileapi/file_system_usage_cache.h" | 19 #include "webkit/fileapi/file_system_usage_cache.h" |
20 #include "webkit/fileapi/file_system_util.h" | 20 #include "webkit/fileapi/file_system_util.h" |
| 21 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
21 | 22 |
22 using base::SequencedTaskRunner; | 23 using base::SequencedTaskRunner; |
23 using quota::QuotaThreadTask; | 24 using quota::QuotaThreadTask; |
24 using quota::StorageType; | 25 using quota::StorageType; |
25 | 26 |
26 namespace fileapi { | 27 namespace fileapi { |
27 | 28 |
28 class FileSystemQuotaClient::GetOriginUsageTask : public QuotaThreadTask { | 29 class FileSystemQuotaClient::GetOriginUsageTask : public QuotaThreadTask { |
29 public: | 30 public: |
30 GetOriginUsageTask( | 31 GetOriginUsageTask( |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 type_(type), | 146 type_(type), |
146 status_(quota::kQuotaStatusUnknown), | 147 status_(quota::kQuotaStatusUnknown), |
147 callback_(callback) { | 148 callback_(callback) { |
148 } | 149 } |
149 | 150 |
150 protected: | 151 protected: |
151 virtual ~DeleteOriginTask() {} | 152 virtual ~DeleteOriginTask() {} |
152 | 153 |
153 // QuotaThreadTask: | 154 // QuotaThreadTask: |
154 virtual void RunOnTargetThread() OVERRIDE { | 155 virtual void RunOnTargetThread() OVERRIDE { |
155 if (file_system_context_->DeleteDataForOriginAndTypeOnFileThread( | 156 base::PlatformFileError result = |
156 origin_, type_)) | 157 file_system_context_->sandbox_provider()->DeleteOriginDataOnFileThread( |
| 158 file_system_context_, |
| 159 file_system_context_->quota_manager_proxy(), |
| 160 origin_, |
| 161 type_); |
| 162 if (result == base::PLATFORM_FILE_OK) |
157 status_ = quota::kQuotaStatusOk; | 163 status_ = quota::kQuotaStatusOk; |
158 else | 164 else |
159 status_ = quota::kQuotaErrorInvalidModification; | 165 status_ = quota::kQuotaErrorInvalidModification; |
160 } | 166 } |
161 | 167 |
162 virtual void Completed() OVERRIDE { | 168 virtual void Completed() OVERRIDE { |
163 callback_.Run(status_); | 169 callback_.Run(status_); |
164 } | 170 } |
165 | 171 |
166 private: | 172 private: |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 DCHECK(pending_origins_for_host_callbacks_.HasCallbacks(type_and_host)); | 293 DCHECK(pending_origins_for_host_callbacks_.HasCallbacks(type_and_host)); |
288 pending_origins_for_host_callbacks_.Run(type_and_host, origins, | 294 pending_origins_for_host_callbacks_.Run(type_and_host, origins, |
289 FileSystemTypeToQuotaStorageType(type_and_host.first)); | 295 FileSystemTypeToQuotaStorageType(type_and_host.first)); |
290 } | 296 } |
291 | 297 |
292 base::SequencedTaskRunner* FileSystemQuotaClient::file_task_runner() const { | 298 base::SequencedTaskRunner* FileSystemQuotaClient::file_task_runner() const { |
293 return file_system_context_->file_task_runner(); | 299 return file_system_context_->file_task_runner(); |
294 } | 300 } |
295 | 301 |
296 } // namespace fileapi | 302 } // namespace fileapi |
OLD | NEW |