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 "url/gurl.h" | 20 #include "url/gurl.h" |
21 | 21 |
22 namespace content { | 22 namespace content { |
| 23 class IndexedDBBlobInfo; |
23 class IndexedDBConnection; | 24 class IndexedDBConnection; |
24 class IndexedDBCursor; | 25 class IndexedDBCursor; |
25 class IndexedDBDatabase; | 26 class IndexedDBDatabase; |
26 class IndexedDBDatabaseCallbacks; | 27 class IndexedDBDatabaseCallbacks; |
27 struct IndexedDBDatabaseMetadata; | 28 struct IndexedDBDatabaseMetadata; |
| 29 struct IndexedDBValue; |
28 | 30 |
29 class CONTENT_EXPORT IndexedDBCallbacks | 31 class CONTENT_EXPORT IndexedDBCallbacks |
30 : public base::RefCounted<IndexedDBCallbacks> { | 32 : public base::RefCounted<IndexedDBCallbacks> { |
31 public: | 33 public: |
32 // Simple payload responses | 34 // Simple payload responses |
33 IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host, | 35 IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host, |
34 int32 ipc_thread_id, | 36 int32 ipc_thread_id, |
35 int32 ipc_callbacks_id); | 37 int32 ipc_callbacks_id); |
36 | 38 |
37 // IndexedDBCursor responses | 39 // IndexedDBCursor responses |
(...skipping 25 matching lines...) Expand all Loading... |
63 const content::IndexedDBDatabaseMetadata& metadata, | 65 const content::IndexedDBDatabaseMetadata& metadata, |
64 blink::WebIDBDataLoss data_loss, | 66 blink::WebIDBDataLoss data_loss, |
65 std::string data_loss_message); | 67 std::string data_loss_message); |
66 virtual void OnSuccess(scoped_ptr<IndexedDBConnection> connection, | 68 virtual void OnSuccess(scoped_ptr<IndexedDBConnection> connection, |
67 const content::IndexedDBDatabaseMetadata& metadata); | 69 const content::IndexedDBDatabaseMetadata& metadata); |
68 | 70 |
69 // IndexedDBDatabase::OpenCursor | 71 // IndexedDBDatabase::OpenCursor |
70 virtual void OnSuccess(scoped_refptr<IndexedDBCursor> cursor, | 72 virtual void OnSuccess(scoped_refptr<IndexedDBCursor> cursor, |
71 const IndexedDBKey& key, | 73 const IndexedDBKey& key, |
72 const IndexedDBKey& primary_key, | 74 const IndexedDBKey& primary_key, |
73 std::string* value); | 75 IndexedDBValue* value); |
74 | 76 |
75 // IndexedDBCursor::Continue / Advance | 77 // IndexedDBCursor::Continue / Advance |
76 virtual void OnSuccess(const IndexedDBKey& key, | 78 virtual void OnSuccess(const IndexedDBKey& key, |
77 const IndexedDBKey& primary_key, | 79 const IndexedDBKey& primary_key, |
78 std::string* value); | 80 IndexedDBValue* value); |
79 | 81 |
80 // IndexedDBCursor::PrefetchContinue | 82 // IndexedDBCursor::PrefetchContinue |
81 virtual void OnSuccessWithPrefetch( | 83 virtual void OnSuccessWithPrefetch( |
82 const std::vector<IndexedDBKey>& keys, | 84 const std::vector<IndexedDBKey>& keys, |
83 const std::vector<IndexedDBKey>& primary_keys, | 85 const std::vector<IndexedDBKey>& primary_keys, |
84 const std::vector<std::string>& values); | 86 std::vector<IndexedDBValue>& values); |
85 | 87 |
86 // IndexedDBDatabase::Get (with key injection) | 88 // IndexedDBDatabase::Get (with key injection) |
87 virtual void OnSuccess(std::string* data, | 89 virtual void OnSuccess(IndexedDBValue* value, |
88 const IndexedDBKey& key, | 90 const IndexedDBKey& key, |
89 const IndexedDBKeyPath& key_path); | 91 const IndexedDBKeyPath& key_path); |
90 | 92 |
91 // IndexedDBDatabase::Get | 93 // IndexedDBDatabase::Get |
92 virtual void OnSuccess(std::string* value); | 94 virtual void OnSuccess(IndexedDBValue* value); |
93 | 95 |
94 // IndexedDBDatabase::Put / IndexedDBCursor::Update | 96 // IndexedDBDatabase::Put / IndexedDBCursor::Update |
95 virtual void OnSuccess(const IndexedDBKey& value); | 97 virtual void OnSuccess(const IndexedDBKey& key); |
96 | 98 |
97 // IndexedDBDatabase::Count | 99 // IndexedDBDatabase::Count |
98 virtual void OnSuccess(int64 value); | 100 virtual void OnSuccess(int64 value); |
99 | 101 |
100 // IndexedDBDatabase::Delete | 102 // IndexedDBDatabase::Delete |
101 // IndexedDBCursor::Continue / Advance (when complete) | 103 // IndexedDBCursor::Continue / Advance (when complete) |
102 virtual void OnSuccess(); | 104 virtual void OnSuccess(); |
103 | 105 |
104 protected: | 106 protected: |
105 virtual ~IndexedDBCallbacks(); | 107 virtual ~IndexedDBCallbacks(); |
106 | 108 |
107 private: | 109 private: |
| 110 void RegisterBlobsAndSend(const std::vector<IndexedDBBlobInfo>& blob_info, |
| 111 const base::Closure& callback); |
| 112 |
108 friend class base::RefCounted<IndexedDBCallbacks>; | 113 friend class base::RefCounted<IndexedDBCallbacks>; |
109 | 114 |
110 // Originally from IndexedDBCallbacks: | 115 // Originally from IndexedDBCallbacks: |
111 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; | 116 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; |
112 int32 ipc_callbacks_id_; | 117 int32 ipc_callbacks_id_; |
113 int32 ipc_thread_id_; | 118 int32 ipc_thread_id_; |
114 | 119 |
115 // IndexedDBCursor callbacks ------------------------ | 120 // IndexedDBCursor callbacks ------------------------ |
116 int32 ipc_cursor_id_; | 121 int32 ipc_cursor_id_; |
117 | 122 |
118 // IndexedDBDatabase callbacks ------------------------ | 123 // IndexedDBDatabase callbacks ------------------------ |
119 int64 host_transaction_id_; | 124 int64 host_transaction_id_; |
120 GURL origin_url_; | 125 GURL origin_url_; |
121 int32 ipc_database_id_; | 126 int32 ipc_database_id_; |
122 int32 ipc_database_callbacks_id_; | 127 int32 ipc_database_callbacks_id_; |
123 }; | 128 }; |
124 | 129 |
125 } // namespace content | 130 } // namespace content |
126 | 131 |
127 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ | 132 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ |
OLD | NEW |