OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_callbacks.h" | 5 #include "content/browser/indexed_db/indexed_db_callbacks.h" |
6 #include "content/browser/indexed_db/indexed_db_callbacks_wrapper.h" | 6 #include "content/browser/indexed_db/indexed_db_callbacks_wrapper.h" |
7 #include "content/browser/indexed_db/indexed_db_cursor.h" | 7 #include "content/browser/indexed_db/indexed_db_cursor.h" |
8 #include "content/browser/indexed_db/indexed_db_metadata.h" | 8 #include "content/browser/indexed_db/indexed_db_metadata.h" |
9 #include "content/browser/indexed_db/webidbcursor_impl.h" | 9 #include "content/browser/indexed_db/webidbcursor_impl.h" |
10 #include "content/browser/indexed_db/webidbdatabase_impl.h" | 10 #include "content/browser/indexed_db/webidbdatabase_impl.h" |
11 #include "third_party/WebKit/public/platform/WebIDBDatabaseError.h" | |
12 | 11 |
13 namespace content { | 12 namespace content { |
14 | 13 |
15 using WebKit::WebIDBCallbacks; | 14 using WebKit::WebIDBCallbacks; |
16 | 15 |
17 IndexedDBCallbacksWrapper::IndexedDBCallbacksWrapper( | 16 IndexedDBCallbacksWrapper::IndexedDBCallbacksWrapper( |
18 IndexedDBCallbacksBase* callbacks) | 17 IndexedDBCallbacksBase* callbacks) |
19 : callbacks_(callbacks), did_complete_(false), did_create_proxy_(false) {} | 18 : callbacks_(callbacks), did_complete_(false), did_create_proxy_(false) {} |
20 | 19 |
21 IndexedDBCallbacksWrapper::~IndexedDBCallbacksWrapper() {} | 20 IndexedDBCallbacksWrapper::~IndexedDBCallbacksWrapper() {} |
22 | 21 |
23 void IndexedDBCallbacksWrapper::OnError(const IndexedDBDatabaseError& error) { | 22 void IndexedDBCallbacksWrapper::OnError(const IndexedDBDatabaseError& error) { |
24 DCHECK(callbacks_); | 23 DCHECK(callbacks_); |
25 callbacks_->onError( | 24 callbacks_->onError(error); |
26 WebKit::WebIDBDatabaseError(error.code(), error.message())); | |
27 callbacks_.reset(); | 25 callbacks_.reset(); |
28 } | 26 } |
29 | 27 |
30 void IndexedDBCallbacksWrapper::OnSuccess(const std::vector<string16>& value) { | 28 void IndexedDBCallbacksWrapper::OnSuccess(const std::vector<string16>& value) { |
31 DCHECK(callbacks_); | 29 DCHECK(callbacks_); |
32 callbacks_->onSuccess(value); | 30 callbacks_->onSuccess(value); |
33 callbacks_.reset(); | 31 callbacks_.reset(); |
34 } | 32 } |
35 | 33 |
36 void IndexedDBCallbacksWrapper::OnSuccess(scoped_refptr<IndexedDBCursor> cursor, | 34 void IndexedDBCallbacksWrapper::OnSuccess(scoped_refptr<IndexedDBCursor> cursor, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 125 |
128 callbacks_->onSuccess(impl, metadata); | 126 callbacks_->onSuccess(impl, metadata); |
129 callbacks_.reset(); | 127 callbacks_.reset(); |
130 } | 128 } |
131 | 129 |
132 void IndexedDBCallbacksWrapper::SetDatabaseCallbacks( | 130 void IndexedDBCallbacksWrapper::SetDatabaseCallbacks( |
133 scoped_refptr<IndexedDBDatabaseCallbacksWrapper> database_callbacks) { | 131 scoped_refptr<IndexedDBDatabaseCallbacksWrapper> database_callbacks) { |
134 database_callbacks_ = database_callbacks; | 132 database_callbacks_ = database_callbacks; |
135 } | 133 } |
136 } // namespace content | 134 } // namespace content |
OLD | NEW |