| Index: chrome/browser/in_process_webkit/indexed_db_callbacks.h
|
| diff --git a/chrome/browser/in_process_webkit/indexed_db_callbacks.h b/chrome/browser/in_process_webkit/indexed_db_callbacks.h
|
| index 4b104a7229f802525460c9b08e2232e598200f08..8b845d8026f4cb35101557776adc4578df957b46 100644
|
| --- a/chrome/browser/in_process_webkit/indexed_db_callbacks.h
|
| +++ b/chrome/browser/in_process_webkit/indexed_db_callbacks.h
|
| @@ -6,28 +6,32 @@
|
| #define CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CALLBACKS_H_
|
|
|
| #include "base/basictypes.h"
|
| +#include "base/logging.h"
|
| #include "base/ref_counted.h"
|
| +#include "chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h"
|
| #include "third_party/WebKit/WebKit/chromium/public/WebIDBCallbacks.h"
|
| +#include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabaseError.h"
|
|
|
| -class IndexedDBDispatcherHost;
|
|
|
| +template <class WebObjectType, typename SuccessMsgType, typename ErrorMsgType>
|
| class IndexedDBCallbacks : public WebKit::WebIDBCallbacks {
|
| public:
|
| - IndexedDBCallbacks(IndexedDBDispatcherHost* parent, int32 response_id);
|
| - virtual ~IndexedDBCallbacks();
|
| + IndexedDBCallbacks(
|
| + IndexedDBDispatcherHost* dispatcher_host, int32 response_id)
|
| + : dispatcher_host_(dispatcher_host), response_id_(response_id) { }
|
|
|
| - // We define default versions of these functions which simply DCHECK.
|
| - // For each WebIDBCallbacks implementation, there should only be one success
|
| - // callback that can possibly be called.
|
| - virtual void onSuccess(WebKit::WebIDBDatabase* idb_database);
|
| - virtual void onSuccess(const WebKit::WebSerializedScriptValue& value);
|
| + virtual void onError(const WebKit::WebIDBDatabaseError& error) {
|
| + dispatcher_host_->Send(new ErrorMsgType(
|
| + response_id_, error.code(), error.message()));
|
| + }
|
|
|
| - protected:
|
| - IndexedDBDispatcherHost* parent() { return parent_.get(); }
|
| - int32 response_id() const { return response_id_; }
|
| + virtual void onSuccess(WebObjectType* idb_object) {
|
| + int32 object_id = dispatcher_host_->Add(idb_object);
|
| + dispatcher_host_->Send(new SuccessMsgType(response_id_, object_id));
|
| + }
|
|
|
| private:
|
| - scoped_refptr<IndexedDBDispatcherHost> parent_;
|
| + scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_;
|
| int32 response_id_;
|
|
|
| DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacks);
|
|
|