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

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

Issue 7889024: Implementation of IDBFactory::getDatabaseNames (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Remove unnecessary #includes Created 9 years, 3 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_dispatcher_host.h" 5 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "content/browser/browser_thread.h" 9 #include "content/browser/browser_thread.h"
10 #include "content/browser/in_process_webkit/indexed_db_callbacks.h" 10 #include "content/browser/in_process_webkit/indexed_db_callbacks.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 database_dispatcher_host_->OnMessageReceived(message, message_was_ok) || 118 database_dispatcher_host_->OnMessageReceived(message, message_was_ok) ||
119 index_dispatcher_host_->OnMessageReceived(message, message_was_ok) || 119 index_dispatcher_host_->OnMessageReceived(message, message_was_ok) ||
120 object_store_dispatcher_host_->OnMessageReceived( 120 object_store_dispatcher_host_->OnMessageReceived(
121 message, message_was_ok) || 121 message, message_was_ok) ||
122 cursor_dispatcher_host_->OnMessageReceived(message, message_was_ok) || 122 cursor_dispatcher_host_->OnMessageReceived(message, message_was_ok) ||
123 transaction_dispatcher_host_->OnMessageReceived(message, message_was_ok); 123 transaction_dispatcher_host_->OnMessageReceived(message, message_was_ok);
124 124
125 if (!handled) { 125 if (!handled) {
126 handled = true; 126 handled = true;
127 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost, message, *message_was_ok) 127 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost, message, *message_was_ok)
128 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryGetDatabaseNames,
129 OnIDBFactoryGetDatabaseNames)
128 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryOpen, OnIDBFactoryOpen) 130 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryOpen, OnIDBFactoryOpen)
129 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryDeleteDatabase, 131 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryDeleteDatabase,
130 OnIDBFactoryDeleteDatabase) 132 OnIDBFactoryDeleteDatabase)
131 IPC_MESSAGE_UNHANDLED(handled = false) 133 IPC_MESSAGE_UNHANDLED(handled = false)
132 IPC_END_MESSAGE_MAP() 134 IPC_END_MESSAGE_MAP()
133 } 135 }
134 136
135 return handled; 137 return handled;
136 } 138 }
137 139
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (!transaction_dispatcher_host_.get()) { 182 if (!transaction_dispatcher_host_.get()) {
181 delete idb_transaction; 183 delete idb_transaction;
182 return 0; 184 return 0;
183 } 185 }
184 int32 id = transaction_dispatcher_host_->map_.Add(idb_transaction); 186 int32 id = transaction_dispatcher_host_->map_.Add(idb_transaction);
185 idb_transaction->setCallbacks(new IndexedDBTransactionCallbacks(this, id)); 187 idb_transaction->setCallbacks(new IndexedDBTransactionCallbacks(this, id));
186 transaction_dispatcher_host_->transaction_url_map_[id] = url; 188 transaction_dispatcher_host_->transaction_url_map_[id] = url;
187 return id; 189 return id;
188 } 190 }
189 191
192 void IndexedDBDispatcherHost::OnIDBFactoryGetDatabaseNames(
193 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& params) {
194 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
195 FilePath base_path = webkit_context_->data_path();
196 FilePath indexed_db_path;
197 if (!base_path.empty()) {
198 indexed_db_path = base_path.Append(
199 IndexedDBContext::kIndexedDBDirectory);
200 }
201
202 // TODO(jorlow): This doesn't support file:/// urls properly. We probably need
203 // to add some toString method to WebSecurityOrigin that doesn't
204 // return null for them. Look at
205 // DatabaseUtil::GetOriginFromIdentifier.
206 WebSecurityOrigin origin(
207 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin));
208 GURL origin_url(origin.toString());
209
210 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
211
212 WebKit::WebIDBFactory::BackingStoreType backingStoreType =
213 WebKit::WebIDBFactory::LevelDBBackingStore;
214
215 if (CommandLine::ForCurrentProcess()->HasSwitch(
216 switches::kSQLiteIndexedDatabase)) {
217 backingStoreType = WebKit::WebIDBFactory::SQLiteBackingStore;
218 }
219
220 // TODO(dgrogan): Delete this magic constant once we've removed sqlite.
221 static const uint64 kIncognitoSqliteBackendQuota = 50 * 1024 * 1024;
222
223 Context()->GetIDBFactory()->getDatabaseNames(
224 new IndexedDBCallbacks<WebDOMStringList>(this, params.response_id),
225 origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path),
226 kIncognitoSqliteBackendQuota, backingStoreType);
227 }
228
190 void IndexedDBDispatcherHost::OnIDBFactoryOpen( 229 void IndexedDBDispatcherHost::OnIDBFactoryOpen(
191 const IndexedDBHostMsg_FactoryOpen_Params& params) { 230 const IndexedDBHostMsg_FactoryOpen_Params& params) {
192 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 231 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
193 FilePath base_path = webkit_context_->data_path(); 232 FilePath base_path = webkit_context_->data_path();
194 FilePath indexed_db_path; 233 FilePath indexed_db_path;
195 if (!base_path.empty()) { 234 if (!base_path.empty()) {
196 indexed_db_path = base_path.Append( 235 indexed_db_path = base_path.Append(
197 IndexedDBContext::kIndexedDBDirectory); 236 IndexedDBContext::kIndexedDBDirectory);
198 } 237 }
199 238
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 } 1092 }
1054 idb_transaction->didCompleteTaskEvents(); 1093 idb_transaction->didCompleteTaskEvents();
1055 } 1094 }
1056 1095
1057 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( 1096 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed(
1058 int32 object_id) { 1097 int32 object_id) {
1059 transaction_size_map_.erase(object_id); 1098 transaction_size_map_.erase(object_id);
1060 transaction_url_map_.erase(object_id); 1099 transaction_url_map_.erase(object_id);
1061 parent_->DestroyObject(&map_, object_id); 1100 parent_->DestroyObject(&map_, object_id);
1062 } 1101 }
OLDNEW
« no previous file with comments | « content/browser/in_process_webkit/indexed_db_dispatcher_host.h ('k') | content/common/indexed_db_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698