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/WebIDBTransactionCallbacks.h
" |
17 #include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabaseError.h" | 18 #include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabaseError.h" |
18 | 19 |
19 // 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 |
20 // which (overloaded) onSuccess method we expect to be called. | 21 // which (overloaded) onSuccess method we expect to be called. |
21 template <class Type> struct WebIDBToMsgHelper { }; | 22 template <class Type> struct WebIDBToMsgHelper { }; |
22 template <> struct WebIDBToMsgHelper<WebKit::WebIDBDatabase> { | 23 template <> struct WebIDBToMsgHelper<WebKit::WebIDBDatabase> { |
23 typedef ViewMsg_IDBCallbacksSuccessIDBDatabase MsgType; | 24 typedef ViewMsg_IDBCallbacksSuccessIDBDatabase MsgType; |
24 }; | 25 }; |
25 template <> struct WebIDBToMsgHelper<WebKit::WebIDBIndex> { | 26 template <> struct WebIDBToMsgHelper<WebKit::WebIDBIndex> { |
26 typedef ViewMsg_IDBCallbacksSuccessIDBIndex MsgType; | 27 typedef ViewMsg_IDBCallbacksSuccessIDBIndex MsgType; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 126 |
126 virtual void onSuccess() { | 127 virtual void onSuccess() { |
127 dispatcher_host()->Send( | 128 dispatcher_host()->Send( |
128 new ViewMsg_IDBCallbacksSuccessNull(response_id())); | 129 new ViewMsg_IDBCallbacksSuccessNull(response_id())); |
129 } | 130 } |
130 | 131 |
131 private: | 132 private: |
132 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacks); | 133 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacks); |
133 }; | 134 }; |
134 | 135 |
| 136 class IndexedDBTransactionCallbacks |
| 137 : public WebKit::WebIDBTransactionCallbacks { |
| 138 public: |
| 139 IndexedDBTransactionCallbacks( |
| 140 IndexedDBDispatcherHost* dispatcher_host, int transaction_id) |
| 141 : dispatcher_host_(dispatcher_host), transaction_id_(transaction_id) { |
| 142 } |
| 143 |
| 144 virtual void onAbort() { |
| 145 dispatcher_host_->Send(new ViewMsg_IDBTransactionCallbacksAbort( |
| 146 transaction_id_)); |
| 147 } |
| 148 |
| 149 virtual int id() const { |
| 150 return transaction_id_; |
| 151 } |
| 152 |
| 153 private: |
| 154 int transaction_id_; |
| 155 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; |
| 156 }; |
| 157 |
135 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CALLBACKS_H_ | 158 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CALLBACKS_H_ |
136 | 159 |
OLD | NEW |