diff options
author | andreip@chromium.org <andreip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-09 16:58:32 +0000 |
---|---|---|
committer | andreip@chromium.org <andreip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-09 16:58:32 +0000 |
commit | d0c005ad4a569e41db0fc011d5b93aed76442228 (patch) | |
tree | c83ac95647e175019ab6ae33d518ddba1717b7c9 /chrome/renderer/indexed_db_dispatcher.cc | |
parent | 0f53f5628ec01d743afade7de5e8ae350ca6880b (diff) | |
download | chromium_src-d0c005ad4a569e41db0fc011d5b93aed76442228.zip chromium_src-d0c005ad4a569e41db0fc011d5b93aed76442228.tar.gz chromium_src-d0c005ad4a569e41db0fc011d5b93aed76442228.tar.bz2 |
Implement IDBDatabase::createObjectStore. Also refactor IndexedDBCallbacks.
This CL is a clone of
http://codereview.chromium.org/2607001/show
which was reviewd and LGTM'ed by Jeremy Orlow.
Review URL: http://codereview.chromium.org/2740003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49267 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/indexed_db_dispatcher.cc')
-rw-r--r-- | chrome/renderer/indexed_db_dispatcher.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/chrome/renderer/indexed_db_dispatcher.cc b/chrome/renderer/indexed_db_dispatcher.cc index 64c0ec1..fcb5b68 100644 --- a/chrome/renderer/indexed_db_dispatcher.cc +++ b/chrome/renderer/indexed_db_dispatcher.cc @@ -8,6 +8,7 @@ #include "chrome/renderer/render_thread.h" #include "chrome/renderer/render_view.h" #include "chrome/renderer/renderer_webidbdatabase_impl.h" +#include "chrome/renderer/renderer_webidbobjectstore_impl.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabaseError.h" #include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h" @@ -31,6 +32,8 @@ bool IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) { OnIndexedDatabaseOpenSuccess) IPC_MESSAGE_HANDLER(ViewMsg_IndexedDatabaseOpenError, OnIndexedDatabaseOpenError) + IPC_MESSAGE_HANDLER(ViewMsg_IDBDatabaseCreateObjectStoreSuccess, + OnIDBDatabaseCreateObjectStoreSuccess) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -58,6 +61,22 @@ void IndexedDBDispatcher::RequestIndexedDatabaseOpen( RenderThread::current()->Send(new ViewHostMsg_IndexedDatabaseOpen(params)); } +void IndexedDBDispatcher::RequestIDBDatabaseCreateObjectStore( + const string16& name, const string16& keypath, bool auto_increment, + WebIDBCallbacks* callbacks_ptr, int32 idb_database_id) { + scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); + + ViewHostMsg_IDBDatabaseCreateObjectStore_Params params; + params.response_id_ = idb_database_create_object_store_callbacks_.Add( + callbacks.release()); + params.name_ = name; + params.keypath_ = keypath; + params.auto_increment_ = auto_increment; + params.idb_database_id_ = idb_database_id; + RenderThread::current()->Send( + new ViewHostMsg_IDBDatabaseCreateObjectStore(params)); +} + void IndexedDBDispatcher::OnIndexedDatabaseOpenSuccess( int32 response_id, int32 idb_database_id) { WebKit::WebIDBCallbacks* callbacks = @@ -73,3 +92,19 @@ void IndexedDBDispatcher::OnIndexedDatabaseOpenError( callbacks->onError(WebIDBDatabaseError(code, message)); indexed_database_open_callbacks_.Remove(response_id); } + +void IndexedDBDispatcher::OnIDBDatabaseCreateObjectStoreSuccess( + int32 response_id, int32 idb_object_store_id) { + WebKit::WebIDBCallbacks* callbacks = + idb_database_create_object_store_callbacks_.Lookup(response_id); + callbacks->onSuccess(new RendererWebIDBObjectStoreImpl(idb_object_store_id)); + idb_database_create_object_store_callbacks_.Remove(response_id); +} + +void IndexedDBDispatcher::OnIDBDatabaseCreateObjectStoreError( + int32 response_id, int code, const string16& message) { + WebKit::WebIDBCallbacks* callbacks = + idb_database_create_object_store_callbacks_.Lookup(response_id); + callbacks->onError(WebIDBDatabaseError(code, message)); + idb_database_create_object_store_callbacks_.Remove(response_id); +} |