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 #include "content/browser/indexed_db/indexed_db_pending_connection.h" | 5 #include "content/browser/indexed_db/indexed_db_pending_connection.h" |
6 | 6 |
| 7 #include "content/browser/indexed_db/indexed_db_connection.h" |
| 8 #include "content/browser/indexed_db/indexed_db_metadata.h" |
| 9 #include "content/browser/indexed_db/indexed_db_open_request_observer.h" |
| 10 |
7 namespace content { | 11 namespace content { |
8 | 12 |
9 IndexedDBPendingConnection::IndexedDBPendingConnection( | 13 IndexedDBPendingConnection::IndexedDBPendingConnection( |
10 scoped_refptr<IndexedDBCallbacks> callbacks_in, | 14 const OpenResultCallback& open_callback, |
11 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks_in, | 15 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, |
12 int child_process_id_in, | 16 scoped_refptr<IndexedDBOpenRequestObserver> open_observer, |
13 int64_t transaction_id_in, | 17 int child_process_id, |
14 int64_t version_in) | 18 int64_t transaction_id, |
15 : callbacks(callbacks_in), | 19 int64_t version) |
16 database_callbacks(database_callbacks_in), | 20 : open_callback_(open_callback), |
17 child_process_id(child_process_id_in), | 21 database_callbacks_(database_callbacks), |
18 transaction_id(transaction_id_in), | 22 open_observer_(open_observer), |
19 version(version_in) {} | 23 child_process_id_(child_process_id), |
| 24 transaction_id_(transaction_id), |
| 25 version_(version) {} |
20 | 26 |
21 IndexedDBPendingConnection::IndexedDBPendingConnection( | 27 IndexedDBPendingConnection::IndexedDBPendingConnection( |
22 const IndexedDBPendingConnection& other) = default; | 28 const IndexedDBPendingConnection& other) = default; |
23 | 29 |
24 IndexedDBPendingConnection::~IndexedDBPendingConnection() {} | 30 IndexedDBPendingConnection::~IndexedDBPendingConnection() {} |
25 | 31 |
| 32 void IndexedDBPendingConnection::OnError( |
| 33 const IndexedDBDatabaseError& error) const { |
| 34 IndexedDBDatabaseMetadata metadata; |
| 35 open_callback_.Run(nullptr, metadata, error); |
| 36 } |
| 37 |
| 38 void IndexedDBPendingConnection::OnDataLoss( |
| 39 blink::WebIDBDataLoss data_loss, |
| 40 std::string data_loss_message) const { |
| 41 // TODO(cmumford): Move this to the database callbacks. |
| 42 // database_callbacks_->OnDataLoss(); |
| 43 } |
| 44 |
| 45 blink::WebIDBDataLoss IndexedDBPendingConnection::data_loss() const { |
| 46 // TODO(cmumford): Get this from IndexedDBDatabaseCallbacks once moved. |
| 47 return blink::WebIDBDataLossNone; |
| 48 } |
| 49 |
| 50 void IndexedDBPendingConnection::OnSuccess( |
| 51 std::unique_ptr<IndexedDBConnection> connection, |
| 52 const IndexedDBDatabaseMetadata& metadata) const { |
| 53 IndexedDBDatabaseError error; |
| 54 open_callback_.Run(std::move(connection), metadata, error); |
| 55 } |
| 56 |
| 57 void IndexedDBPendingConnection::OnBlocked(int64_t old_version) { |
| 58 open_observer_->OnBlocked(old_version); |
| 59 } |
| 60 |
26 } // namespace content | 61 } // namespace content |
OLD | NEW |