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 <memory> |
| 11 |
| 12 #include "base/callback.h" |
| 13 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
11 #include "content/browser/indexed_db/indexed_db_callbacks.h" | 15 #include "content/browser/indexed_db/indexed_db_callbacks.h" |
| 16 #include "content/browser/indexed_db/indexed_db_change_handler.h" |
12 #include "content/browser/indexed_db/indexed_db_data_loss_info.h" | 17 #include "content/browser/indexed_db/indexed_db_data_loss_info.h" |
13 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" | |
14 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 19 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" |
| 20 #include "url/origin.h" |
15 | 21 |
16 namespace content { | 22 namespace content { |
17 | 23 |
18 class IndexedDBCallbacks; | 24 class IndexedDBChangeHandler; |
19 class IndexedDBDatabaseCallbacks; | 25 class IndexedDBConnection; |
| 26 struct IndexedDBDatabaseMetadata; |
| 27 class IndexedDBOpenRequestObserver; |
20 | 28 |
21 struct CONTENT_EXPORT IndexedDBPendingConnection { | 29 class CONTENT_EXPORT IndexedDBPendingConnection { |
| 30 public: |
22 IndexedDBPendingConnection( | 31 IndexedDBPendingConnection( |
23 scoped_refptr<IndexedDBCallbacks> callbacks_in, | 32 const OpenResultCallback& open_callback, |
24 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks_in, | 33 scoped_refptr<IndexedDBChangeHandler> change_handler, |
25 int child_process_id_in, | 34 scoped_refptr<IndexedDBOpenRequestObserver> open_observer, |
26 int64_t transaction_id_in, | 35 int child_process_id, |
27 int64_t version_in); | 36 int64_t transaction_id, |
28 IndexedDBPendingConnection(const IndexedDBPendingConnection& other); | 37 int64_t version, |
| 38 const url::Origin& origin); |
29 ~IndexedDBPendingConnection(); | 39 ~IndexedDBPendingConnection(); |
30 scoped_refptr<IndexedDBCallbacks> callbacks; | 40 void SetDataLossInfo(const IndexedDBDataLossInfo& data_loss_info); |
31 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks; | 41 const IndexedDBDataLossInfo& data_loss_info() const { |
32 int child_process_id; | 42 return data_loss_info_; |
33 int64_t transaction_id; | 43 } |
34 int64_t version; | 44 void OnError(const IndexedDBDatabaseError& error) const; |
35 IndexedDBDataLossInfo data_loss_info; | 45 void OnSuccess(std::unique_ptr<IndexedDBConnection> connection, |
| 46 const IndexedDBDatabaseMetadata& metadata) const; |
| 47 void OnBlocked(int64_t old_version) const; |
| 48 void OnUpgradeNeeded(int64_t old_version, |
| 49 IndexedDBConnection* connection, |
| 50 const IndexedDBDatabaseMetadata& metadata) const; |
| 51 int child_process_id() const { return child_process_id_; } |
| 52 int64_t transaction_id() const { return transaction_id_; } |
| 53 void set_version(int64_t version) { version_ = version; } |
| 54 int64_t version() const { return version_; } |
| 55 const scoped_refptr<IndexedDBChangeHandler>& change_handler() const { |
| 56 return change_handler_; |
| 57 } |
| 58 const scoped_refptr<IndexedDBOpenRequestObserver>& open_observer() const { |
| 59 return open_observer_; |
| 60 } |
| 61 |
| 62 private: |
| 63 OpenResultCallback open_callback_; |
| 64 scoped_refptr<IndexedDBChangeHandler> change_handler_; |
| 65 scoped_refptr<IndexedDBOpenRequestObserver> open_observer_; |
| 66 int child_process_id_; |
| 67 int64_t transaction_id_; |
| 68 int64_t version_; |
| 69 const url::Origin origin_; |
| 70 IndexedDBDataLossInfo data_loss_info_; |
| 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(IndexedDBPendingConnection); |
36 }; | 73 }; |
37 | 74 |
38 } // namespace content | 75 } // namespace content |
39 | 76 |
40 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_PENDING_CONNECTION_H_ | 77 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_PENDING_CONNECTION_H_ |
OLD | NEW |