| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ |
| 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "content/browser/indexed_db/indexed_db_database_error.h" | 16 #include "content/browser/indexed_db/indexed_db_database_error.h" |
| 17 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h" | 17 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h" |
| 18 #include "content/common/indexed_db/indexed_db_key.h" | 18 #include "content/common/indexed_db/indexed_db_key.h" |
| 19 #include "content/common/indexed_db/indexed_db_key_path.h" | 19 #include "content/common/indexed_db/indexed_db_key_path.h" |
| 20 #include "third_party/WebKit/public/platform/WebIDBCallbacks.h" | 20 #include "third_party/WebKit/public/platform/WebIDBCallbacks.h" |
| 21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 22 | 22 |
| 23 struct IndexedDBMsg_CallbacksSuccessIDBCursor_Params; |
| 24 struct IndexedDBMsg_CallbacksSuccessCursorContinue_Params; |
| 25 struct IndexedDBMsg_CallbacksSuccessValueWithKey_Params; |
| 26 struct IndexedDBMsg_CallbacksSuccessValue_Params; |
| 27 |
| 23 namespace content { | 28 namespace content { |
| 29 class IndexedDBBlobInfo; |
| 24 class IndexedDBConnection; | 30 class IndexedDBConnection; |
| 25 class IndexedDBCursor; | 31 class IndexedDBCursor; |
| 26 class IndexedDBDatabase; | 32 class IndexedDBDatabase; |
| 27 class IndexedDBDatabaseCallbacks; | 33 class IndexedDBDatabaseCallbacks; |
| 28 struct IndexedDBDatabaseMetadata; | 34 struct IndexedDBDatabaseMetadata; |
| 35 struct IndexedDBValue; |
| 29 | 36 |
| 30 class CONTENT_EXPORT IndexedDBCallbacks | 37 class CONTENT_EXPORT IndexedDBCallbacks |
| 31 : public base::RefCounted<IndexedDBCallbacks> { | 38 : public base::RefCounted<IndexedDBCallbacks> { |
| 32 public: | 39 public: |
| 33 // Simple payload responses | 40 // Simple payload responses |
| 34 IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host, | 41 IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host, |
| 35 int32 ipc_thread_id, | 42 int32 ipc_thread_id, |
| 36 int32 ipc_callbacks_id); | 43 int32 ipc_callbacks_id); |
| 37 | 44 |
| 38 // IndexedDBCursor responses | 45 // IndexedDBCursor responses |
| (...skipping 24 matching lines...) Expand all Loading... |
| 63 scoped_ptr<IndexedDBConnection> connection, | 70 scoped_ptr<IndexedDBConnection> connection, |
| 64 const content::IndexedDBDatabaseMetadata& metadata, | 71 const content::IndexedDBDatabaseMetadata& metadata, |
| 65 WebKit::WebIDBCallbacks::DataLoss data_loss); | 72 WebKit::WebIDBCallbacks::DataLoss data_loss); |
| 66 virtual void OnSuccess(scoped_ptr<IndexedDBConnection> connection, | 73 virtual void OnSuccess(scoped_ptr<IndexedDBConnection> connection, |
| 67 const content::IndexedDBDatabaseMetadata& metadata); | 74 const content::IndexedDBDatabaseMetadata& metadata); |
| 68 | 75 |
| 69 // IndexedDBDatabase::OpenCursor | 76 // IndexedDBDatabase::OpenCursor |
| 70 virtual void OnSuccess(scoped_refptr<IndexedDBCursor> cursor, | 77 virtual void OnSuccess(scoped_refptr<IndexedDBCursor> cursor, |
| 71 const IndexedDBKey& key, | 78 const IndexedDBKey& key, |
| 72 const IndexedDBKey& primary_key, | 79 const IndexedDBKey& primary_key, |
| 73 std::string* value); | 80 IndexedDBValue* value); |
| 74 | 81 |
| 75 // IndexedDBCursor::Continue / Advance | 82 // IndexedDBCursor::Continue / Advance |
| 76 virtual void OnSuccess(const IndexedDBKey& key, | 83 virtual void OnSuccess(const IndexedDBKey& key, |
| 77 const IndexedDBKey& primary_key, | 84 const IndexedDBKey& primary_key, |
| 78 std::string* value); | 85 IndexedDBValue* value); |
| 79 | 86 |
| 80 // IndexedDBCursor::PrefetchContinue | 87 // IndexedDBCursor::PrefetchContinue |
| 81 virtual void OnSuccessWithPrefetch( | 88 virtual void OnSuccessWithPrefetch( |
| 82 const std::vector<IndexedDBKey>& keys, | 89 const std::vector<IndexedDBKey>& keys, |
| 83 const std::vector<IndexedDBKey>& primary_keys, | 90 const std::vector<IndexedDBKey>& primary_keys, |
| 84 const std::vector<std::string>& values); | 91 std::vector<IndexedDBValue>& values); |
| 85 | 92 |
| 86 // IndexedDBDatabase::Get (with key injection) | 93 // IndexedDBDatabase::Get (with key injection) |
| 87 virtual void OnSuccess(std::string* data, | 94 virtual void OnSuccess(IndexedDBValue* value, |
| 88 const IndexedDBKey& key, | 95 const IndexedDBKey& key, |
| 89 const IndexedDBKeyPath& key_path); | 96 const IndexedDBKeyPath& key_path); |
| 90 | 97 |
| 91 // IndexedDBDatabase::Get | 98 // IndexedDBDatabase::Get |
| 92 virtual void OnSuccess(std::string* value); | 99 virtual void OnSuccess(IndexedDBValue* value); |
| 93 | 100 |
| 94 // IndexedDBDatabase::Put / IndexedDBCursor::Update | 101 // IndexedDBDatabase::Put / IndexedDBCursor::Update |
| 95 virtual void OnSuccess(const IndexedDBKey& value); | 102 virtual void OnSuccess(const IndexedDBKey& key); |
| 96 | 103 |
| 97 // IndexedDBDatabase::Count | 104 // IndexedDBDatabase::Count |
| 98 virtual void OnSuccess(int64 value); | 105 virtual void OnSuccess(int64 value); |
| 99 | 106 |
| 100 // IndexedDBDatabase::Delete | 107 // IndexedDBDatabase::Delete |
| 101 // IndexedDBCursor::Continue / Advance (when complete) | 108 // IndexedDBCursor::Continue / Advance (when complete) |
| 102 virtual void OnSuccess(); | 109 virtual void OnSuccess(); |
| 103 | 110 |
| 104 protected: | 111 protected: |
| 105 virtual ~IndexedDBCallbacks(); | 112 virtual ~IndexedDBCallbacks(); |
| 106 | 113 |
| 107 private: | 114 private: |
| 115 void RegisterBlobsAndSend( |
| 116 const std::vector<IndexedDBBlobInfo>& blob_info, |
| 117 const base::Closure& callback); |
| 118 |
| 108 friend class base::RefCounted<IndexedDBCallbacks>; | 119 friend class base::RefCounted<IndexedDBCallbacks>; |
| 109 | 120 |
| 110 // Originally from IndexedDBCallbacks: | 121 // Originally from IndexedDBCallbacks: |
| 111 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; | 122 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; |
| 112 int32 ipc_callbacks_id_; | 123 int32 ipc_callbacks_id_; |
| 113 int32 ipc_thread_id_; | 124 int32 ipc_thread_id_; |
| 114 | 125 |
| 115 // IndexedDBCursor callbacks ------------------------ | 126 // IndexedDBCursor callbacks ------------------------ |
| 116 int32 ipc_cursor_id_; | 127 int32 ipc_cursor_id_; |
| 117 | 128 |
| 118 // IndexedDBDatabase callbacks ------------------------ | 129 // IndexedDBDatabase callbacks ------------------------ |
| 119 int64 host_transaction_id_; | 130 int64 host_transaction_id_; |
| 120 GURL origin_url_; | 131 GURL origin_url_; |
| 121 int32 ipc_database_id_; | 132 int32 ipc_database_id_; |
| 122 int32 ipc_database_callbacks_id_; | 133 int32 ipc_database_callbacks_id_; |
| 123 }; | 134 }; |
| 124 | 135 |
| 125 } // namespace content | 136 } // namespace content |
| 126 | 137 |
| 127 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ | 138 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ |
| OLD | NEW |