Index: content/browser/in_process_webkit/indexed_db_dispatcher_host.cc |
diff --git a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc |
index ff9d31fe828115cdae34d280d9884cca56edc133..9fc0e88960e2c2044a93ec55f91120a7496fb671 100644 |
--- a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc |
+++ b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc |
@@ -125,6 +125,8 @@ bool IndexedDBDispatcherHost::OnMessageReceived(const IPC::Message& message, |
if (!handled) { |
handled = true; |
IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost, message, *message_was_ok) |
+ IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryGetDatabaseNames, |
+ OnIDBFactoryGetDatabaseNames) |
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryOpen, OnIDBFactoryOpen) |
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryDeleteDatabase, |
OnIDBFactoryDeleteDatabase) |
@@ -187,6 +189,43 @@ int32 IndexedDBDispatcherHost::Add(WebIDBTransaction* idb_transaction, |
return id; |
} |
+void IndexedDBDispatcherHost::OnIDBFactoryGetDatabaseNames( |
+ const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& params) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
+ FilePath base_path = webkit_context_->data_path(); |
+ FilePath indexed_db_path; |
+ if (!base_path.empty()) { |
+ indexed_db_path = base_path.Append( |
+ IndexedDBContext::kIndexedDBDirectory); |
+ } |
+ |
+ // TODO(jorlow): This doesn't support file:/// urls properly. We probably need |
+ // to add some toString method to WebSecurityOrigin that doesn't |
+ // return null for them. Look at |
+ // DatabaseUtil::GetOriginFromIdentifier. |
+ WebSecurityOrigin origin( |
+ WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); |
+ GURL origin_url(origin.toString()); |
+ |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
+ |
+ WebKit::WebIDBFactory::BackingStoreType backingStoreType = |
+ WebKit::WebIDBFactory::LevelDBBackingStore; |
+ |
+ if (CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kSQLiteIndexedDatabase)) { |
+ backingStoreType = WebKit::WebIDBFactory::SQLiteBackingStore; |
+ } |
+ |
+ // TODO(dgrogan): Delete this magic constant once we've removed sqlite. |
+ static const uint64 kIncognitoSqliteBackendQuota = 50 * 1024 * 1024; |
+ |
+ Context()->GetIDBFactory()->getDatabaseNames( |
+ new IndexedDBCallbacks<WebDOMStringList>(this, params.response_id), |
+ origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path), |
+ kIncognitoSqliteBackendQuota, backingStoreType); |
+} |
+ |
void IndexedDBDispatcherHost::OnIDBFactoryOpen( |
const IndexedDBHostMsg_FactoryOpen_Params& params) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |