| 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; |
| 28 struct IndexedDBValue; | 29 struct IndexedDBValue; |
| 29 | 30 |
| 30 class CONTENT_EXPORT IndexedDBCallbacks | 31 class CONTENT_EXPORT IndexedDBCallbacks |
| 31 : public base::RefCounted<IndexedDBCallbacks> { | 32 : public base::RefCounted<IndexedDBCallbacks> { |
| 32 public: | 33 public: |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 76 |
| 76 // IndexedDBCursor::Continue / Advance | 77 // IndexedDBCursor::Continue / Advance |
| 77 virtual void OnSuccess(const IndexedDBKey& key, | 78 virtual void OnSuccess(const IndexedDBKey& key, |
| 78 const IndexedDBKey& primary_key, | 79 const IndexedDBKey& primary_key, |
| 79 IndexedDBValue* value); | 80 IndexedDBValue* value); |
| 80 | 81 |
| 81 // IndexedDBCursor::PrefetchContinue | 82 // IndexedDBCursor::PrefetchContinue |
| 82 virtual void OnSuccessWithPrefetch( | 83 virtual void OnSuccessWithPrefetch( |
| 83 const std::vector<IndexedDBKey>& keys, | 84 const std::vector<IndexedDBKey>& keys, |
| 84 const std::vector<IndexedDBKey>& primary_keys, | 85 const std::vector<IndexedDBKey>& primary_keys, |
| 85 const std::vector<IndexedDBValue>& values); | 86 std::vector<IndexedDBValue>& values); |
| 86 | 87 |
| 87 // IndexedDBDatabase::Get (with key injection) | 88 // IndexedDBDatabase::Get (with key injection) |
| 88 virtual void OnSuccess(IndexedDBValue* value, | 89 virtual void OnSuccess(IndexedDBValue* value, |
| 89 const IndexedDBKey& key, | 90 const IndexedDBKey& key, |
| 90 const IndexedDBKeyPath& key_path); | 91 const IndexedDBKeyPath& key_path); |
| 91 | 92 |
| 92 // IndexedDBDatabase::Get | 93 // IndexedDBDatabase::Get |
| 93 virtual void OnSuccess(IndexedDBValue* value); | 94 virtual void OnSuccess(IndexedDBValue* value); |
| 94 | 95 |
| 95 // IndexedDBDatabase::Put / IndexedDBCursor::Update | 96 // IndexedDBDatabase::Put / IndexedDBCursor::Update |
| 96 virtual void OnSuccess(const IndexedDBKey& key); | 97 virtual void OnSuccess(const IndexedDBKey& key); |
| 97 | 98 |
| 98 // IndexedDBDatabase::Count | 99 // IndexedDBDatabase::Count |
| 99 // IndexedDBFactory::DeleteDatabase | 100 // IndexedDBFactory::DeleteDatabase |
| 100 virtual void OnSuccess(int64 value); | 101 virtual void OnSuccess(int64 value); |
| 101 | 102 |
| 102 // IndexedDBDatabase::Delete | 103 // IndexedDBDatabase::Delete |
| 103 // IndexedDBCursor::Continue / Advance (when complete) | 104 // IndexedDBCursor::Continue / Advance (when complete) |
| 104 virtual void OnSuccess(); | 105 virtual void OnSuccess(); |
| 105 | 106 |
| 106 blink::WebIDBDataLoss data_loss() const { return data_loss_; } | 107 blink::WebIDBDataLoss data_loss() const { return data_loss_; } |
| 107 | 108 |
| 108 protected: | 109 protected: |
| 109 virtual ~IndexedDBCallbacks(); | 110 virtual ~IndexedDBCallbacks(); |
| 110 | 111 |
| 111 private: | 112 private: |
| 113 void RegisterBlobsAndSend(const std::vector<IndexedDBBlobInfo>& blob_info, |
| 114 const base::Closure& callback); |
| 115 |
| 112 friend class base::RefCounted<IndexedDBCallbacks>; | 116 friend class base::RefCounted<IndexedDBCallbacks>; |
| 113 | 117 |
| 114 // Originally from IndexedDBCallbacks: | 118 // Originally from IndexedDBCallbacks: |
| 115 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; | 119 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; |
| 116 int32 ipc_callbacks_id_; | 120 int32 ipc_callbacks_id_; |
| 117 int32 ipc_thread_id_; | 121 int32 ipc_thread_id_; |
| 118 | 122 |
| 119 // IndexedDBCursor callbacks ------------------------ | 123 // IndexedDBCursor callbacks ------------------------ |
| 120 int32 ipc_cursor_id_; | 124 int32 ipc_cursor_id_; |
| 121 | 125 |
| 122 // IndexedDBDatabase callbacks ------------------------ | 126 // IndexedDBDatabase callbacks ------------------------ |
| 123 int64 host_transaction_id_; | 127 int64 host_transaction_id_; |
| 124 GURL origin_url_; | 128 GURL origin_url_; |
| 125 int32 ipc_database_id_; | 129 int32 ipc_database_id_; |
| 126 int32 ipc_database_callbacks_id_; | 130 int32 ipc_database_callbacks_id_; |
| 127 | 131 |
| 128 // Stored in OnDataLoss, merged with OnUpgradeNeeded response. | 132 // Stored in OnDataLoss, merged with OnUpgradeNeeded response. |
| 129 blink::WebIDBDataLoss data_loss_; | 133 blink::WebIDBDataLoss data_loss_; |
| 130 std::string data_loss_message_; | 134 std::string data_loss_message_; |
| 131 }; | 135 }; |
| 132 | 136 |
| 133 } // namespace content | 137 } // namespace content |
| 134 | 138 |
| 135 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ | 139 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ |
| OLD | NEW |