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..5dfb72dbb79ab9758566ce50584a0a69d158a729 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_FactoryDatabaseNames, |
+ OnIDBFactoryDatabaseNames) |
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryOpen, OnIDBFactoryOpen) |
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryDeleteDatabase, |
OnIDBFactoryDeleteDatabase) |
@@ -187,6 +189,50 @@ int32 IndexedDBDispatcherHost::Add(WebIDBTransaction* idb_transaction, |
return id; |
} |
+void IndexedDBDispatcherHost::OnIDBFactoryDatabaseNames( |
+ const IndexedDBHostMsg_FactoryDatabaseNames_Params& params, |
+ std::vector<string16>* database_names) { |
+ 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; |
dgrogan
2011/09/14 01:25:20
Get rid of this quota stuff, as elsewhere.
|
+ |
+ // TODO(dgrogan): Don't let a non-existing database be opened (and therefore |
dgrogan
2011/09/14 01:25:20
And this comment.
|
+ // created) if this origin is already over quota. |
+ WebDOMStringList web_db_names = Context()->GetIDBFactory()->databaseNames( |
+ origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path), |
+ kIncognitoSqliteBackendQuota, backingStoreType); |
+ |
+ database_names->reserve(web_db_names.length()); |
+ for (unsigned i = 0; i < web_db_names.length(); ++i) |
+ database_names->push_back(web_db_names.item(i)); |
+} |
+ |
void IndexedDBDispatcherHost::OnIDBFactoryOpen( |
const IndexedDBHostMsg_FactoryOpen_Params& params) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |