Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(728)

Side by Side Diff: content/browser/in_process_webkit/indexed_db_quota_client.cc

Issue 7310022: Implement GetOrigins for indexeddb quota (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove url_constants.h include Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 protected: 59 protected:
60 GetOriginsTaskBase( 60 GetOriginsTaskBase(
61 IndexedDBQuotaClient* client, 61 IndexedDBQuotaClient* client,
62 base::MessageLoopProxy* webkit_thread_message_loop) 62 base::MessageLoopProxy* webkit_thread_message_loop)
63 : HelperTask(client, webkit_thread_message_loop) { 63 : HelperTask(client, webkit_thread_message_loop) {
64 } 64 }
65 65
66 virtual bool ShouldAddOrigin(const GURL& origin) = 0; 66 virtual bool ShouldAddOrigin(const GURL& origin) = 0;
67 67
68 virtual void RunOnTargetThread() OVERRIDE { 68 virtual void RunOnTargetThread() OVERRIDE {
69 // TODO(dgrogan): Implement. 69 std::vector<string16> origin_identifiers;
70 indexed_db_context_->GetAllOriginIdentifiers(&origin_identifiers);
71 for (std::vector<string16>::const_iterator iter =
72 origin_identifiers.begin();
73 iter != origin_identifiers.end(); ++iter) {
74 GURL origin = DatabaseUtil::GetOriginFromIdentifier(*iter);
75 if (ShouldAddOrigin(origin))
76 origins_.insert(origin);
77 }
70 } 78 }
71 79
72 std::set<GURL> origins_; 80 std::set<GURL> origins_;
73 }; 81 };
74 82
75 class IndexedDBQuotaClient::GetAllOriginsTask : public GetOriginsTaskBase { 83 class IndexedDBQuotaClient::GetAllOriginsTask : public GetOriginsTaskBase {
76 public: 84 public:
77 GetAllOriginsTask( 85 GetAllOriginsTask(
78 IndexedDBQuotaClient* client, 86 IndexedDBQuotaClient* client,
79 base::MessageLoopProxy* webkit_thread_message_loop) 87 base::MessageLoopProxy* webkit_thread_message_loop)
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 void IndexedDBQuotaClient::DidGetAllOrigins(const std::set<GURL>& origins) { 216 void IndexedDBQuotaClient::DidGetAllOrigins(const std::set<GURL>& origins) {
209 DCHECK(origins_for_type_callbacks_.HasCallbacks()); 217 DCHECK(origins_for_type_callbacks_.HasCallbacks());
210 origins_for_type_callbacks_.Run(origins); 218 origins_for_type_callbacks_.Run(origins);
211 } 219 }
212 220
213 void IndexedDBQuotaClient::DidGetOriginsForHost( 221 void IndexedDBQuotaClient::DidGetOriginsForHost(
214 const std::string& host, const std::set<GURL>& origins) { 222 const std::string& host, const std::set<GURL>& origins) {
215 DCHECK(origins_for_host_callbacks_.HasCallbacks(host)); 223 DCHECK(origins_for_host_callbacks_.HasCallbacks(host));
216 origins_for_host_callbacks_.Run(host, origins); 224 origins_for_host_callbacks_.Run(host, origins);
217 } 225 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698