OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PENDING_CONNECTION_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_PENDING_CONNECTION_H_ |
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_PENDING_CONNECTION_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_PENDING_CONNECTION_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "content/browser/indexed_db/indexed_db_callbacks.h" | |
12 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" | 11 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" |
13 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 class IndexedDBCallbacks; | 17 class IndexedDBCallbacks; |
| 18 class IndexedDBConnection; |
18 class IndexedDBDatabaseCallbacks; | 19 class IndexedDBDatabaseCallbacks; |
| 20 struct IndexedDBDatabaseMetadata; |
| 21 class IndexedDBOpenRequestObserver; |
19 | 22 |
20 struct CONTENT_EXPORT IndexedDBPendingConnection { | 23 typedef base::Callback<void(std::unique_ptr<IndexedDBConnection> connection, |
| 24 const content::IndexedDBDatabaseMetadata& metadata, |
| 25 const content::IndexedDBDatabaseError&)> |
| 26 OpenResultCallback; |
| 27 |
| 28 class CONTENT_EXPORT IndexedDBPendingConnection { |
| 29 public: |
21 IndexedDBPendingConnection( | 30 IndexedDBPendingConnection( |
22 scoped_refptr<IndexedDBCallbacks> callbacks_in, | 31 const OpenResultCallback& open_callback, |
23 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks_in, | 32 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, |
24 int child_process_id_in, | 33 scoped_refptr<IndexedDBOpenRequestObserver> open_observer, |
25 int64_t transaction_id_in, | 34 int child_process_id, |
26 int64_t version_in); | 35 int64_t transaction_id, |
| 36 int64_t version); |
27 IndexedDBPendingConnection(const IndexedDBPendingConnection& other); | 37 IndexedDBPendingConnection(const IndexedDBPendingConnection& other); |
28 ~IndexedDBPendingConnection(); | 38 ~IndexedDBPendingConnection(); |
29 scoped_refptr<IndexedDBCallbacks> callbacks; | 39 void OnError(const IndexedDBDatabaseError& error) const; |
30 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks; | 40 void OnDataLoss(blink::WebIDBDataLoss data_loss, |
31 int child_process_id; | 41 std::string data_loss_message) const; |
32 int64_t transaction_id; | 42 void OnSuccess(std::unique_ptr<IndexedDBConnection> connection, |
33 int64_t version; | 43 const IndexedDBDatabaseMetadata& metadata) const; |
| 44 void OnBlocked(int64_t old_version); |
| 45 blink::WebIDBDataLoss data_loss() const; |
| 46 int child_process_id() const { return child_process_id_; } |
| 47 int64_t transaction_id() const { return transaction_id_; } |
| 48 int64_t version() const { return version_; } |
| 49 void SetVersion(int64_t version) { version_ = version; } |
| 50 const scoped_refptr<IndexedDBDatabaseCallbacks>& database_callbacks() const { |
| 51 return database_callbacks_; |
| 52 } |
| 53 const scoped_refptr<IndexedDBOpenRequestObserver>& open_observer() const { |
| 54 return open_observer_; |
| 55 } |
| 56 |
| 57 private: |
| 58 OpenResultCallback open_callback_; |
| 59 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks_; |
| 60 scoped_refptr<IndexedDBOpenRequestObserver> open_observer_; |
| 61 int child_process_id_; |
| 62 int64_t transaction_id_; |
| 63 int64_t version_; |
34 }; | 64 }; |
35 | 65 |
36 } // namespace content | 66 } // namespace content |
37 | 67 |
38 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_PENDING_CONNECTION_H_ | 68 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_PENDING_CONNECTION_H_ |
OLD | NEW |