| 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 "content/browser/indexed_db/indexed_db_quota_client.h" | 5 #include "content/browser/indexed_db/indexed_db_quota_client.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 int64_t GetOriginUsageOnIndexedDBThread(IndexedDBContextImpl* context, | 30 int64_t GetOriginUsageOnIndexedDBThread(IndexedDBContextImpl* context, |
| 31 const GURL& origin) { | 31 const GURL& origin) { |
| 32 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); | 32 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); |
| 33 return context->GetOriginDiskUsage(origin); | 33 return context->GetOriginDiskUsage(origin); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void GetAllOriginsOnIndexedDBThread(IndexedDBContextImpl* context, | 36 void GetAllOriginsOnIndexedDBThread(IndexedDBContextImpl* context, |
| 37 std::set<GURL>* origins_to_return) { | 37 std::set<GURL>* origins_to_return) { |
| 38 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); | 38 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); |
| 39 std::vector<GURL> all_origins = context->GetAllOrigins(); | 39 for (const auto& origin : context->GetAllOrigins()) |
| 40 origins_to_return->insert(all_origins.begin(), all_origins.end()); | 40 origins_to_return->insert(GURL(origin.Serialize())); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void DidGetOrigins(const IndexedDBQuotaClient::GetOriginsCallback& callback, | 43 void DidGetOrigins(const IndexedDBQuotaClient::GetOriginsCallback& callback, |
| 44 const std::set<GURL>* origins) { | 44 const std::set<GURL>* origins) { |
| 45 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 45 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 46 callback.Run(*origins); | 46 callback.Run(*origins); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void GetOriginsForHostOnIndexedDBThread(IndexedDBContextImpl* context, | 49 void GetOriginsForHostOnIndexedDBThread(IndexedDBContextImpl* context, |
| 50 const std::string& host, | 50 const std::string& host, |
| 51 std::set<GURL>* origins_to_return) { | 51 std::set<GURL>* origins_to_return) { |
| 52 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); | 52 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); |
| 53 std::vector<GURL> all_origins = context->GetAllOrigins(); | 53 for (const auto& origin : context->GetAllOrigins()) { |
| 54 for (const auto& origin_url : all_origins) { | 54 GURL origin_url(origin.Serialize()); |
| 55 if (host == net::GetHostOrSpecFromURL(origin_url)) | 55 if (host == net::GetHostOrSpecFromURL(origin_url)) |
| 56 origins_to_return->insert(origin_url); | 56 origins_to_return->insert(origin_url); |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 } // namespace | 60 } // namespace |
| 61 | 61 |
| 62 // IndexedDBQuotaClient -------------------------------------------------------- | 62 // IndexedDBQuotaClient -------------------------------------------------------- |
| 63 | 63 |
| 64 IndexedDBQuotaClient::IndexedDBQuotaClient( | 64 IndexedDBQuotaClient::IndexedDBQuotaClient( |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 base::Bind(&DeleteOriginDataOnIndexedDBThread, | 168 base::Bind(&DeleteOriginDataOnIndexedDBThread, |
| 169 base::RetainedRef(indexed_db_context_), origin), | 169 base::RetainedRef(indexed_db_context_), origin), |
| 170 callback); | 170 callback); |
| 171 } | 171 } |
| 172 | 172 |
| 173 bool IndexedDBQuotaClient::DoesSupport(storage::StorageType type) const { | 173 bool IndexedDBQuotaClient::DoesSupport(storage::StorageType type) const { |
| 174 return type == storage::kStorageTypeTemporary; | 174 return type == storage::kStorageTypeTemporary; |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace content | 177 } // namespace content |
| OLD | NEW |