summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/indexed_db_dispatcher.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/renderer/indexed_db_dispatcher.h')
-rw-r--r--chrome/renderer/indexed_db_dispatcher.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/chrome/renderer/indexed_db_dispatcher.h b/chrome/renderer/indexed_db_dispatcher.h
new file mode 100644
index 0000000..78bb80b
--- /dev/null
+++ b/chrome/renderer/indexed_db_dispatcher.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_RENDERER_INDEXED_DB_DISPATCHER_H_
+#define CHROME_RENDERER_INDEXED_DB_DISPATCHER_H_
+
+#include "base/id_map.h"
+#include "base/string16.h"
+#include "ipc/ipc_message.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebIDBCallbacks.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabase.h"
+
+namespace WebKit {
+class WebFrame;
+}
+
+// Handle the indexed db related communication for this entire renderer.
+class IndexedDBDispatcher {
+ public:
+ IndexedDBDispatcher();
+ ~IndexedDBDispatcher();
+
+ // Called to possibly handle the incoming IPC message. Returns true if
+ // handled.
+ bool OnMessageReceived(const IPC::Message& msg);
+
+ void RequestIndexedDatabaseOpen(
+ const string16& name, const string16& description, bool modify_database,
+ WebKit::WebIDBCallbacks* callbacks, const string16& origin,
+ WebKit::WebFrame* web_frame, int* exception_code);
+
+ void SendIDBDatabaseDestroyed(int32 idb_database_id_);
+
+ private:
+ // Message handlers. For each message we send, we need to handle both the
+ // success and the error case.
+ void OnIndexedDatabaseOpenSuccess(int32 response_id,
+ int32 idb_database_id);
+ void OnIndexedDatabaseOpenError(int32 response_id, int code,
+ const string16& message);
+
+ // Careful! WebIDBCallbacks wraps non-threadsafe data types. It must be
+ // destroyed and used on the same thread it was created on.
+ IDMap<WebKit::WebIDBCallbacks, IDMapOwnPointer>
+ indexed_database_open_callbacks_;
+
+ DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher);
+};
+
+#endif // CHROME_RENDERER_INDEXED_DB_DISPATCHER_H_