| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_RENDERER_INDEXED_DB_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_INDEXED_DB_DISPATCHER_H_ |
| 6 #define CONTENT_RENDERER_INDEXED_DB_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_INDEXED_DB_DISPATCHER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/id_map.h" | 9 #include "base/id_map.h" |
| 10 #include "base/nullable_string16.h" | 10 #include "base/nullable_string16.h" |
| 11 #include "ipc/ipc_channel.h" | 11 #include "ipc/ipc_channel.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCallbacks.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCallbacks.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransactionCall
backs.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransactionCall
backs.h" |
| 17 | 17 |
| 18 class IndexedDBKey; | 18 class IndexedDBKey; |
| 19 class SerializedScriptValue; | 19 class SerializedScriptValue; |
| 20 | 20 |
| 21 namespace WebKit { | 21 namespace WebKit { |
| 22 class WebDOMStringList; |
| 22 class WebFrame; | 23 class WebFrame; |
| 23 class WebIDBKeyRange; | 24 class WebIDBKeyRange; |
| 24 class WebIDBTransaction; | 25 class WebIDBTransaction; |
| 25 } | 26 } |
| 26 | 27 |
| 27 // Handle the indexed db related communication for this entire renderer. | 28 // Handle the indexed db related communication for this entire renderer. |
| 28 class IndexedDBDispatcher : public IPC::Channel::Listener { | 29 class IndexedDBDispatcher : public IPC::Channel::Listener { |
| 29 public: | 30 public: |
| 30 IndexedDBDispatcher(); | 31 IndexedDBDispatcher(); |
| 31 virtual ~IndexedDBDispatcher(); | 32 virtual ~IndexedDBDispatcher(); |
| 32 | 33 |
| 33 // IPC::Channel::Listener implementation. | 34 // IPC::Channel::Listener implementation. |
| 34 virtual bool OnMessageReceived(const IPC::Message& msg); | 35 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 35 | 36 |
| 37 void RequestIDBFactoryGetDatabaseNames( |
| 38 WebKit::WebIDBCallbacks* callbacks, |
| 39 const string16& origin, |
| 40 WebKit::WebFrame* web_frame); |
| 41 |
| 36 void RequestIDBFactoryOpen( | 42 void RequestIDBFactoryOpen( |
| 37 const string16& name, | 43 const string16& name, |
| 38 WebKit::WebIDBCallbacks* callbacks, | 44 WebKit::WebIDBCallbacks* callbacks, |
| 39 const string16& origin, | 45 const string16& origin, |
| 40 WebKit::WebFrame* web_frame); | 46 WebKit::WebFrame* web_frame); |
| 41 | 47 |
| 42 void RequestIDBFactoryDeleteDatabase( | 48 void RequestIDBFactoryDeleteDatabase( |
| 43 const string16& name, | 49 const string16& name, |
| 44 WebKit::WebIDBCallbacks* callbacks, | 50 WebKit::WebIDBCallbacks* callbacks, |
| 45 const string16& origin, | 51 const string16& origin, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 150 |
| 145 static int32 TransactionId(const WebKit::WebIDBTransaction& transaction); | 151 static int32 TransactionId(const WebKit::WebIDBTransaction& transaction); |
| 146 | 152 |
| 147 private: | 153 private: |
| 148 // IDBCallback message handlers. | 154 // IDBCallback message handlers. |
| 149 void OnSuccessNull(int32 response_id); | 155 void OnSuccessNull(int32 response_id); |
| 150 void OnSuccessIDBDatabase(int32 response_id, int32 object_id); | 156 void OnSuccessIDBDatabase(int32 response_id, int32 object_id); |
| 151 void OnSuccessIndexedDBKey(int32 response_id, const IndexedDBKey& key); | 157 void OnSuccessIndexedDBKey(int32 response_id, const IndexedDBKey& key); |
| 152 void OnSuccessIDBTransaction(int32 response_id, int32 object_id); | 158 void OnSuccessIDBTransaction(int32 response_id, int32 object_id); |
| 153 void OnSuccessOpenCursor(int32 response_id, int32 object_id); | 159 void OnSuccessOpenCursor(int32 response_id, int32 object_id); |
| 160 void OnSuccessStringList(int32 response_id, |
| 161 const std::vector<string16>& value); |
| 154 void OnSuccessSerializedScriptValue(int32 response_id, | 162 void OnSuccessSerializedScriptValue(int32 response_id, |
| 155 const SerializedScriptValue& value); | 163 const SerializedScriptValue& value); |
| 156 void OnError(int32 response_id, int code, const string16& message); | 164 void OnError(int32 response_id, int code, const string16& message); |
| 157 void OnBlocked(int32 response_id); | 165 void OnBlocked(int32 response_id); |
| 158 void OnAbort(int32 transaction_id); | 166 void OnAbort(int32 transaction_id); |
| 159 void OnComplete(int32 transaction_id); | 167 void OnComplete(int32 transaction_id); |
| 160 void OnVersionChange(int32 database_id, const string16& newVersion); | 168 void OnVersionChange(int32 database_id, const string16& newVersion); |
| 161 | 169 |
| 162 // Careful! WebIDBCallbacks wraps non-threadsafe data types. It must be | 170 // Careful! WebIDBCallbacks wraps non-threadsafe data types. It must be |
| 163 // destroyed and used on the same thread it was created on. | 171 // destroyed and used on the same thread it was created on. |
| 164 IDMap<WebKit::WebIDBCallbacks, IDMapOwnPointer> pending_callbacks_; | 172 IDMap<WebKit::WebIDBCallbacks, IDMapOwnPointer> pending_callbacks_; |
| 165 IDMap<WebKit::WebIDBTransactionCallbacks, IDMapOwnPointer> | 173 IDMap<WebKit::WebIDBTransactionCallbacks, IDMapOwnPointer> |
| 166 pending_transaction_callbacks_; | 174 pending_transaction_callbacks_; |
| 167 IDMap<WebKit::WebIDBDatabaseCallbacks, IDMapOwnPointer> | 175 IDMap<WebKit::WebIDBDatabaseCallbacks, IDMapOwnPointer> |
| 168 pending_database_callbacks_; | 176 pending_database_callbacks_; |
| 169 | 177 |
| 170 DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher); | 178 DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher); |
| 171 }; | 179 }; |
| 172 | 180 |
| 173 #endif // CONTENT_RENDERER_INDEXED_DB_DISPATCHER_H_ | 181 #endif // CONTENT_RENDERER_INDEXED_DB_DISPATCHER_H_ |
| OLD | NEW |