| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CALLBACKS_H_ | 5 #ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CALLBACKS_H_ |
| 6 #define CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CALLBACKS_H_ | 6 #define CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CALLBACKS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
| 12 #include "chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h" | 12 #include "chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h" |
| 13 #include "chrome/common/indexed_db_key.h" | 13 #include "chrome/common/indexed_db_key.h" |
| 14 #include "chrome/common/render_messages.h" | 14 #include "chrome/common/render_messages.h" |
| 15 #include "chrome/common/serialized_script_value.h" | 15 #include "chrome/common/serialized_script_value.h" |
| 16 #include "third_party/WebKit/WebKit/chromium/public/WebIDBCallbacks.h" | 16 #include "third_party/WebKit/WebKit/chromium/public/WebIDBCallbacks.h" |
| 17 #include "third_party/WebKit/WebKit/chromium/public/WebIDBCursor.h" | 17 #include "third_party/WebKit/WebKit/chromium/public/WebIDBCursor.h" |
| 18 #include "third_party/WebKit/WebKit/chromium/public/WebIDBTransactionCallbacks.h
" | |
| 19 #include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabaseError.h" | 18 #include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabaseError.h" |
| 20 | 19 |
| 21 // Template magic to figure out what message to send to the renderer based on | 20 // Template magic to figure out what message to send to the renderer based on |
| 22 // which (overloaded) onSuccess method we expect to be called. | 21 // which (overloaded) onSuccess method we expect to be called. |
| 23 template <class Type> struct WebIDBToMsgHelper { }; | 22 template <class Type> struct WebIDBToMsgHelper { }; |
| 24 template <> struct WebIDBToMsgHelper<WebKit::WebIDBDatabase> { | 23 template <> struct WebIDBToMsgHelper<WebKit::WebIDBDatabase> { |
| 25 typedef ViewMsg_IDBCallbacksSuccessIDBDatabase MsgType; | 24 typedef ViewMsg_IDBCallbacksSuccessIDBDatabase MsgType; |
| 26 }; | 25 }; |
| 27 template <> struct WebIDBToMsgHelper<WebKit::WebIDBIndex> { | 26 template <> struct WebIDBToMsgHelper<WebKit::WebIDBIndex> { |
| 28 typedef ViewMsg_IDBCallbacksSuccessIDBIndex MsgType; | 27 typedef ViewMsg_IDBCallbacksSuccessIDBIndex MsgType; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 151 |
| 153 virtual void onSuccess() { | 152 virtual void onSuccess() { |
| 154 dispatcher_host()->Send( | 153 dispatcher_host()->Send( |
| 155 new ViewMsg_IDBCallbacksSuccessNull(response_id())); | 154 new ViewMsg_IDBCallbacksSuccessNull(response_id())); |
| 156 } | 155 } |
| 157 | 156 |
| 158 private: | 157 private: |
| 159 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacks); | 158 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacks); |
| 160 }; | 159 }; |
| 161 | 160 |
| 162 class IndexedDBTransactionCallbacks | |
| 163 : public WebKit::WebIDBTransactionCallbacks { | |
| 164 public: | |
| 165 IndexedDBTransactionCallbacks( | |
| 166 IndexedDBDispatcherHost* dispatcher_host, int transaction_id) | |
| 167 : dispatcher_host_(dispatcher_host), transaction_id_(transaction_id) { | |
| 168 } | |
| 169 | |
| 170 virtual void onAbort() { | |
| 171 dispatcher_host_->Send(new ViewMsg_IDBTransactionCallbacksAbort( | |
| 172 transaction_id_)); | |
| 173 } | |
| 174 | |
| 175 virtual int id() const { | |
| 176 return transaction_id_; | |
| 177 } | |
| 178 | |
| 179 private: | |
| 180 int transaction_id_; | |
| 181 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; | |
| 182 }; | |
| 183 | |
| 184 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CALLBACKS_H_ | 161 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CALLBACKS_H_ |
| 185 | 162 |
| OLD | NEW |