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
" |
18 #include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabaseError.h" | 19 #include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabaseError.h" |
19 | 20 |
20 // Template magic to figure out what message to send to the renderer based on | 21 // Template magic to figure out what message to send to the renderer based on |
21 // which (overloaded) onSuccess method we expect to be called. | 22 // which (overloaded) onSuccess method we expect to be called. |
22 template <class Type> struct WebIDBToMsgHelper { }; | 23 template <class Type> struct WebIDBToMsgHelper { }; |
23 template <> struct WebIDBToMsgHelper<WebKit::WebIDBDatabase> { | 24 template <> struct WebIDBToMsgHelper<WebKit::WebIDBDatabase> { |
24 typedef ViewMsg_IDBCallbacksSuccessIDBDatabase MsgType; | 25 typedef ViewMsg_IDBCallbacksSuccessIDBDatabase MsgType; |
25 }; | 26 }; |
26 template <> struct WebIDBToMsgHelper<WebKit::WebIDBIndex> { | 27 template <> struct WebIDBToMsgHelper<WebKit::WebIDBIndex> { |
27 typedef ViewMsg_IDBCallbacksSuccessIDBIndex MsgType; | 28 typedef ViewMsg_IDBCallbacksSuccessIDBIndex MsgType; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 152 |
152 virtual void onSuccess() { | 153 virtual void onSuccess() { |
153 dispatcher_host()->Send( | 154 dispatcher_host()->Send( |
154 new ViewMsg_IDBCallbacksSuccessNull(response_id())); | 155 new ViewMsg_IDBCallbacksSuccessNull(response_id())); |
155 } | 156 } |
156 | 157 |
157 private: | 158 private: |
158 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacks); | 159 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacks); |
159 }; | 160 }; |
160 | 161 |
| 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 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; |
| 181 int transaction_id_; |
| 182 }; |
| 183 |
161 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CALLBACKS_H_ | 184 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CALLBACKS_H_ |
162 | 185 |
OLD | NEW |