| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 | 215 |
| 216 void FileSystemQuotaClient::GetOriginsForType( | 216 void FileSystemQuotaClient::GetOriginsForType( |
| 217 StorageType storage_type, | 217 StorageType storage_type, |
| 218 GetOriginsCallback* callback_ptr) { | 218 GetOriginsCallback* callback_ptr) { |
| 219 std::set<GURL> origins; | 219 std::set<GURL> origins; |
| 220 scoped_ptr<GetOriginsCallback> callback(callback_ptr); | 220 scoped_ptr<GetOriginsCallback> callback(callback_ptr); |
| 221 if (is_incognito_) { | 221 if (is_incognito_) { |
| 222 // We don't support FileSystem in incognito mode yet. | 222 // We don't support FileSystem in incognito mode yet. |
| 223 callback->Run(origins); | 223 callback->Run(origins, storage_type); |
| 224 return; | 224 return; |
| 225 } | 225 } |
| 226 | 226 |
| 227 FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type); | 227 FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type); |
| 228 DCHECK(type != kFileSystemTypeUnknown); | 228 DCHECK(type != kFileSystemTypeUnknown); |
| 229 | 229 |
| 230 if (pending_origins_for_type_callbacks_.Add(type, callback.release())) { | 230 if (pending_origins_for_type_callbacks_.Add(type, callback.release())) { |
| 231 scoped_refptr<GetOriginsForTypeTask> task( | 231 scoped_refptr<GetOriginsForTypeTask> task( |
| 232 new GetOriginsForTypeTask(this, file_message_loop_, type)); | 232 new GetOriginsForTypeTask(this, file_message_loop_, type)); |
| 233 task->Start(); | 233 task->Start(); |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 | 236 |
| 237 void FileSystemQuotaClient::GetOriginsForHost( | 237 void FileSystemQuotaClient::GetOriginsForHost( |
| 238 StorageType storage_type, | 238 StorageType storage_type, |
| 239 const std::string& host, | 239 const std::string& host, |
| 240 GetOriginsCallback* callback_ptr) { | 240 GetOriginsCallback* callback_ptr) { |
| 241 std::set<GURL> origins; | 241 std::set<GURL> origins; |
| 242 scoped_ptr<GetOriginsCallback> callback(callback_ptr); | 242 scoped_ptr<GetOriginsCallback> callback(callback_ptr); |
| 243 if (is_incognito_) { | 243 if (is_incognito_) { |
| 244 // We don't support FileSystem in incognito mode yet. | 244 // We don't support FileSystem in incognito mode yet. |
| 245 callback->Run(origins); | 245 callback->Run(origins, storage_type); |
| 246 return; | 246 return; |
| 247 } | 247 } |
| 248 | 248 |
| 249 FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type); | 249 FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type); |
| 250 DCHECK(type != kFileSystemTypeUnknown); | 250 DCHECK(type != kFileSystemTypeUnknown); |
| 251 | 251 |
| 252 if (pending_origins_for_host_callbacks_.Add( | 252 if (pending_origins_for_host_callbacks_.Add( |
| 253 std::make_pair(type, host), callback.release())) { | 253 std::make_pair(type, host), callback.release())) { |
| 254 scoped_refptr<GetOriginsForHostTask> task( | 254 scoped_refptr<GetOriginsForHostTask> task( |
| 255 new GetOriginsForHostTask(this, file_message_loop_, | 255 new GetOriginsForHostTask(this, file_message_loop_, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 273 FileSystemType type, const GURL& origin_url, int64 usage) { | 273 FileSystemType type, const GURL& origin_url, int64 usage) { |
| 274 TypeAndHostOrOrigin type_and_origin(std::make_pair( | 274 TypeAndHostOrOrigin type_and_origin(std::make_pair( |
| 275 type, origin_url.spec())); | 275 type, origin_url.spec())); |
| 276 DCHECK(pending_usage_callbacks_.HasCallbacks(type_and_origin)); | 276 DCHECK(pending_usage_callbacks_.HasCallbacks(type_and_origin)); |
| 277 pending_usage_callbacks_.Run(type_and_origin, usage); | 277 pending_usage_callbacks_.Run(type_and_origin, usage); |
| 278 } | 278 } |
| 279 | 279 |
| 280 void FileSystemQuotaClient::DidGetOriginsForType( | 280 void FileSystemQuotaClient::DidGetOriginsForType( |
| 281 FileSystemType type, const std::set<GURL>& origins) { | 281 FileSystemType type, const std::set<GURL>& origins) { |
| 282 DCHECK(pending_origins_for_type_callbacks_.HasCallbacks(type)); | 282 DCHECK(pending_origins_for_type_callbacks_.HasCallbacks(type)); |
| 283 pending_origins_for_type_callbacks_.Run(type, origins); | 283 pending_origins_for_type_callbacks_.Run(type, origins, |
| 284 FileSystemTypeToQuotaStorageType(type)); |
| 284 } | 285 } |
| 285 | 286 |
| 286 void FileSystemQuotaClient::DidGetOriginsForHost( | 287 void FileSystemQuotaClient::DidGetOriginsForHost( |
| 287 const TypeAndHostOrOrigin& type_and_host, const std::set<GURL>& origins) { | 288 const TypeAndHostOrOrigin& type_and_host, const std::set<GURL>& origins) { |
| 288 DCHECK(pending_origins_for_host_callbacks_.HasCallbacks(type_and_host)); | 289 DCHECK(pending_origins_for_host_callbacks_.HasCallbacks(type_and_host)); |
| 289 pending_origins_for_host_callbacks_.Run(type_and_host, origins); | 290 pending_origins_for_host_callbacks_.Run(type_and_host, origins, |
| 291 FileSystemTypeToQuotaStorageType(type_and_host.first)); |
| 290 } | 292 } |
| 291 | 293 |
| 292 } // namespace fileapi | 294 } // namespace fileapi |
| OLD | NEW |