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

Side by Side Diff: content/browser/in_process_webkit/indexed_db_context.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_context.h" 5 #include "content/browser/in_process_webkit/indexed_db_context.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 IndexedDBContext::IndexedDBContext( 59 IndexedDBContext::IndexedDBContext(
60 WebKitContext* webkit_context, 60 WebKitContext* webkit_context,
61 quota::SpecialStoragePolicy* special_storage_policy, 61 quota::SpecialStoragePolicy* special_storage_policy,
62 quota::QuotaManagerProxy* quota_manager_proxy, 62 quota::QuotaManagerProxy* quota_manager_proxy,
63 base::MessageLoopProxy* webkit_thread_loop) 63 base::MessageLoopProxy* webkit_thread_loop)
64 : clear_local_state_on_exit_(false), 64 : clear_local_state_on_exit_(false),
65 special_storage_policy_(special_storage_policy) { 65 special_storage_policy_(special_storage_policy) {
66 data_path_ = webkit_context->data_path().Append(kIndexedDBDirectory); 66 data_path_ = webkit_context->data_path().Append(kIndexedDBDirectory);
67 if (quota_manager_proxy) { 67 if (quota_manager_proxy) {
68 // quota_manager_proxy->RegisterClient( 68 quota_manager_proxy->RegisterClient(
69 // new IndexedDBQuotaClient(webkit_thread_loop, this)); 69 new IndexedDBQuotaClient(webkit_thread_loop, this));
70 } 70 }
71 } 71 }
72 72
73 IndexedDBContext::~IndexedDBContext() { 73 IndexedDBContext::~IndexedDBContext() {
74 WebKit::WebIDBFactory* factory = idb_factory_.release(); 74 WebKit::WebIDBFactory* factory = idb_factory_.release();
75 if (factory) 75 if (factory)
76 BrowserThread::DeleteSoon(BrowserThread::WEBKIT, FROM_HERE, factory); 76 BrowserThread::DeleteSoon(BrowserThread::WEBKIT, FROM_HERE, factory);
77 77
78 if (clear_local_state_on_exit_) { 78 if (clear_local_state_on_exit_) {
79 // No WEBKIT thread here means we are running in a unit test where no clean 79 // No WEBKIT thread here means we are running in a unit test where no clean
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 FilePath idb_file = GetIndexedDBFilePath(origin_id); 111 FilePath idb_file = GetIndexedDBFilePath(origin_id);
112 DCHECK_EQ(idb_file.BaseName().value().substr(0, strlen("chrome-extension")), 112 DCHECK_EQ(idb_file.BaseName().value().substr(0, strlen("chrome-extension")),
113 FILE_PATH_LITERAL("chrome-extension")); 113 FILE_PATH_LITERAL("chrome-extension"));
114 DeleteIndexedDBFile(GetIndexedDBFilePath(origin_id)); 114 DeleteIndexedDBFile(GetIndexedDBFilePath(origin_id));
115 } 115 }
116 116
117 bool IndexedDBContext::IsUnlimitedStorageGranted( 117 bool IndexedDBContext::IsUnlimitedStorageGranted(
118 const GURL& origin) const { 118 const GURL& origin) const {
119 return special_storage_policy_->IsStorageUnlimited(origin); 119 return special_storage_policy_->IsStorageUnlimited(origin);
120 } 120 }
121
122 // TODO(dgrogan): Merge this code with the similar loop in
123 // BrowsingDataIndexedDBHelperImpl::FetchIndexedDBInfoInWebKitThread.
124 void IndexedDBContext::GetAllOriginIdentifiers(
125 std::vector<string16>* origin_ids) {
126 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
127 file_util::FileEnumerator file_enumerator(data_path_,
128 false, file_util::FileEnumerator::DIRECTORIES);
129 for (FilePath file_path = file_enumerator.Next(); !file_path.empty();
130 file_path = file_enumerator.Next()) {
131 if (file_path.Extension() == IndexedDBContext::kIndexedDBExtension) {
132 WebKit::WebString origin_id_webstring =
133 webkit_glue::FilePathToWebString(file_path.BaseName());
134 origin_ids->push_back(origin_id_webstring);
135 }
136 }
137 }
OLDNEW
« no previous file with comments | « content/browser/in_process_webkit/indexed_db_context.h ('k') | content/browser/in_process_webkit/indexed_db_quota_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698