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

Unified 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 side-by-side diff with in-line comments
Download patch
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));
« 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