| 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 "content/browser/in_process_webkit/indexed_db_quota_client.h" | 5 #include "content/browser/in_process_webkit/indexed_db_quota_client.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 160 |
| 161 void IndexedDBQuotaClient::GetOriginsForType( | 161 void IndexedDBQuotaClient::GetOriginsForType( |
| 162 quota::StorageType type, | 162 quota::StorageType type, |
| 163 GetOriginsCallback* callback_ptr) { | 163 GetOriginsCallback* callback_ptr) { |
| 164 DCHECK(callback_ptr); | 164 DCHECK(callback_ptr); |
| 165 DCHECK(indexed_db_context_.get()); | 165 DCHECK(indexed_db_context_.get()); |
| 166 scoped_ptr<GetOriginsCallback> callback(callback_ptr); | 166 scoped_ptr<GetOriginsCallback> callback(callback_ptr); |
| 167 | 167 |
| 168 // All databases are in the temp namespace for now. | 168 // All databases are in the temp namespace for now. |
| 169 if (type != quota::kStorageTypeTemporary) { | 169 if (type != quota::kStorageTypeTemporary) { |
| 170 callback->Run(std::set<GURL>()); | 170 callback->Run(std::set<GURL>(), type); |
| 171 return; | 171 return; |
| 172 } | 172 } |
| 173 | 173 |
| 174 if (origins_for_type_callbacks_.Add(callback.release())) { | 174 if (origins_for_type_callbacks_.Add(callback.release())) { |
| 175 scoped_refptr<GetAllOriginsTask> task( | 175 scoped_refptr<GetAllOriginsTask> task( |
| 176 new GetAllOriginsTask(this, webkit_thread_message_loop_)); | 176 new GetAllOriginsTask(this, webkit_thread_message_loop_)); |
| 177 task->Start(); | 177 task->Start(); |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 | 180 |
| 181 void IndexedDBQuotaClient::GetOriginsForHost( | 181 void IndexedDBQuotaClient::GetOriginsForHost( |
| 182 quota::StorageType type, | 182 quota::StorageType type, |
| 183 const std::string& host, | 183 const std::string& host, |
| 184 GetOriginsCallback* callback_ptr) { | 184 GetOriginsCallback* callback_ptr) { |
| 185 DCHECK(callback_ptr); | 185 DCHECK(callback_ptr); |
| 186 DCHECK(indexed_db_context_.get()); | 186 DCHECK(indexed_db_context_.get()); |
| 187 scoped_ptr<GetOriginsCallback> callback(callback_ptr); | 187 scoped_ptr<GetOriginsCallback> callback(callback_ptr); |
| 188 | 188 |
| 189 // All databases are in the temp namespace for now. | 189 // All databases are in the temp namespace for now. |
| 190 if (type != quota::kStorageTypeTemporary) { | 190 if (type != quota::kStorageTypeTemporary) { |
| 191 callback->Run(std::set<GURL>()); | 191 callback->Run(std::set<GURL>(), type); |
| 192 return; | 192 return; |
| 193 } | 193 } |
| 194 | 194 |
| 195 if (origins_for_host_callbacks_.Add(host, callback.release())) { | 195 if (origins_for_host_callbacks_.Add(host, callback.release())) { |
| 196 scoped_refptr<GetOriginsForHostTask> task( | 196 scoped_refptr<GetOriginsForHostTask> task( |
| 197 new GetOriginsForHostTask(this, webkit_thread_message_loop_, host)); | 197 new GetOriginsForHostTask(this, webkit_thread_message_loop_, host)); |
| 198 task->Start(); | 198 task->Start(); |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 | 201 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 216 void IndexedDBQuotaClient::DidGetAllOrigins(const std::set<GURL>& origins) { | 216 void IndexedDBQuotaClient::DidGetAllOrigins(const std::set<GURL>& origins) { |
| 217 DCHECK(origins_for_type_callbacks_.HasCallbacks()); | 217 DCHECK(origins_for_type_callbacks_.HasCallbacks()); |
| 218 origins_for_type_callbacks_.Run(origins); | 218 origins_for_type_callbacks_.Run(origins); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void IndexedDBQuotaClient::DidGetOriginsForHost( | 221 void IndexedDBQuotaClient::DidGetOriginsForHost( |
| 222 const std::string& host, const std::set<GURL>& origins) { | 222 const std::string& host, const std::set<GURL>& origins) { |
| 223 DCHECK(origins_for_host_callbacks_.HasCallbacks(host)); | 223 DCHECK(origins_for_host_callbacks_.HasCallbacks(host)); |
| 224 origins_for_host_callbacks_.Run(host, origins); | 224 origins_for_host_callbacks_.Run(host, origins); |
| 225 } | 225 } |
| OLD | NEW |