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" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 return quota::kQuotaErrorInvalidModification; | 78 return quota::kQuotaErrorInvalidModification; |
79 } | 79 } |
80 | 80 |
81 } // namespace | 81 } // namespace |
82 | 82 |
83 FileSystemQuotaClient::FileSystemQuotaClient( | 83 FileSystemQuotaClient::FileSystemQuotaClient( |
84 FileSystemContext* file_system_context, | 84 FileSystemContext* file_system_context, |
85 bool is_incognito) | 85 bool is_incognito) |
86 : file_system_context_(file_system_context), | 86 : file_system_context_(file_system_context), |
87 is_incognito_(is_incognito) { | 87 is_incognito_(is_incognito) { |
| 88 file_system_context_->GetFileSystemTypes(&file_system_types_); |
88 } | 89 } |
89 | 90 |
90 FileSystemQuotaClient::~FileSystemQuotaClient() {} | 91 FileSystemQuotaClient::~FileSystemQuotaClient() {} |
91 | 92 |
92 quota::QuotaClient::ID FileSystemQuotaClient::id() const { | 93 quota::QuotaClient::ID FileSystemQuotaClient::id() const { |
93 return quota::QuotaClient::kFileSystem; | 94 return quota::QuotaClient::kFileSystem; |
94 } | 95 } |
95 | 96 |
96 void FileSystemQuotaClient::OnQuotaManagerDestroyed() { | 97 void FileSystemQuotaClient::OnQuotaManagerDestroyed() { |
97 delete this; | 98 delete this; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 base::PostTaskAndReplyWithResult( | 191 base::PostTaskAndReplyWithResult( |
191 file_task_runner(), | 192 file_task_runner(), |
192 FROM_HERE, | 193 FROM_HERE, |
193 base::Bind(&DeleteOriginOnFileThread, | 194 base::Bind(&DeleteOriginOnFileThread, |
194 file_system_context_, | 195 file_system_context_, |
195 origin, | 196 origin, |
196 fs_type), | 197 fs_type), |
197 callback); | 198 callback); |
198 } | 199 } |
199 | 200 |
| 201 bool FileSystemQuotaClient::DoesSupport(quota::StorageType storage_type) const { |
| 202 FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type); |
| 203 DCHECK(type != kFileSystemTypeUnknown); |
| 204 return std::find(file_system_types_.begin(), file_system_types_.end(), type) |
| 205 != file_system_types_.end(); |
| 206 } |
| 207 |
200 base::SequencedTaskRunner* FileSystemQuotaClient::file_task_runner() const { | 208 base::SequencedTaskRunner* FileSystemQuotaClient::file_task_runner() const { |
201 return file_system_context_->default_file_task_runner(); | 209 return file_system_context_->default_file_task_runner(); |
202 } | 210 } |
203 | 211 |
204 } // namespace fileapi | 212 } // namespace fileapi |
OLD | NEW |