| 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/webidbfactory_impl.h" | 5 #include "content/browser/indexed_db/webidbfactory_impl.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "content/browser/indexed_db/indexed_db_callbacks_wrapper.h" | 8 #include "content/browser/indexed_db/indexed_db_callbacks_wrapper.h" |
| 9 #include "content/browser/indexed_db/indexed_db_factory.h" | 9 #include "content/browser/indexed_db/indexed_db_factory.h" |
| 10 #include "content/browser/indexed_db/indexed_db_factory_impl.h" | 10 #include "content/browser/indexed_db/indexed_db_factory_impl.h" |
| 11 #include "third_party/WebKit/public/platform/WebIDBDatabaseCallbacks.h" | |
| 12 #include "third_party/WebKit/public/platform/WebIDBDatabaseError.h" | 11 #include "third_party/WebKit/public/platform/WebIDBDatabaseError.h" |
| 13 | 12 |
| 14 using WebKit::WebIDBCallbacks; | |
| 15 using WebKit::WebIDBDatabaseCallbacks; | |
| 16 using WebKit::WebIDBFactory; | 13 using WebKit::WebIDBFactory; |
| 17 using WebKit::WebString; | 14 using WebKit::WebString; |
| 18 | 15 |
| 19 namespace content { | 16 namespace content { |
| 20 | 17 |
| 21 WebIDBFactoryImpl::WebIDBFactoryImpl() | 18 WebIDBFactoryImpl::WebIDBFactoryImpl() |
| 22 : idb_factory_backend_(IndexedDBFactoryImpl::Create()) {} | 19 : idb_factory_backend_(IndexedDBFactoryImpl::Create()) {} |
| 23 | 20 |
| 24 WebIDBFactoryImpl::~WebIDBFactoryImpl() {} | 21 WebIDBFactoryImpl::~WebIDBFactoryImpl() {} |
| 25 | 22 |
| 26 void WebIDBFactoryImpl::getDatabaseNames(WebIDBCallbacks* callbacks, | 23 void WebIDBFactoryImpl::getDatabaseNames(IndexedDBCallbacksBase* callbacks, |
| 27 const WebString& database_identifier, | 24 const WebString& database_identifier, |
| 28 const WebString& data_dir) { | 25 const WebString& data_dir) { |
| 29 idb_factory_backend_->GetDatabaseNames( | 26 idb_factory_backend_->GetDatabaseNames( |
| 30 IndexedDBCallbacksWrapper::Create(callbacks), | 27 IndexedDBCallbacksWrapper::Create(callbacks), |
| 31 database_identifier, | 28 database_identifier, |
| 32 data_dir); | 29 data_dir); |
| 33 } | 30 } |
| 34 | 31 |
| 35 void WebIDBFactoryImpl::open(const WebString& name, | 32 void WebIDBFactoryImpl::open(const WebString& name, |
| 36 long long version, | 33 long long version, |
| 37 long long transaction_id, | 34 long long transaction_id, |
| 38 WebIDBCallbacks* callbacks, | 35 IndexedDBCallbacksBase* callbacks, |
| 39 WebIDBDatabaseCallbacks* database_callbacks, | 36 IndexedDBDatabaseCallbacks* database_callbacks, |
| 40 const WebString& database_identifier, | 37 const WebString& database_identifier, |
| 41 const WebString& data_dir) { | 38 const WebString& data_dir) { |
| 42 scoped_refptr<IndexedDBCallbacksWrapper> callbacks_proxy = | 39 scoped_refptr<IndexedDBCallbacksWrapper> callbacks_proxy = |
| 43 IndexedDBCallbacksWrapper::Create(callbacks); | 40 IndexedDBCallbacksWrapper::Create(callbacks); |
| 44 scoped_refptr<IndexedDBDatabaseCallbacksWrapper> database_callbacks_proxy = | 41 scoped_refptr<IndexedDBDatabaseCallbacksWrapper> database_callbacks_proxy = |
| 45 IndexedDBDatabaseCallbacksWrapper::Create(database_callbacks); | 42 IndexedDBDatabaseCallbacksWrapper::Create(database_callbacks); |
| 46 | 43 |
| 47 callbacks_proxy->SetDatabaseCallbacks(database_callbacks_proxy); | 44 callbacks_proxy->SetDatabaseCallbacks(database_callbacks_proxy); |
| 48 idb_factory_backend_->Open(name, | 45 idb_factory_backend_->Open(name, |
| 49 version, | 46 version, |
| 50 transaction_id, | 47 transaction_id, |
| 51 callbacks_proxy.get(), | 48 callbacks_proxy.get(), |
| 52 database_callbacks_proxy.get(), | 49 database_callbacks_proxy.get(), |
| 53 database_identifier, | 50 database_identifier, |
| 54 data_dir); | 51 data_dir); |
| 55 } | 52 } |
| 56 | 53 |
| 57 void WebIDBFactoryImpl::deleteDatabase(const WebString& name, | 54 void WebIDBFactoryImpl::deleteDatabase(const WebString& name, |
| 58 WebIDBCallbacks* callbacks, | 55 IndexedDBCallbacksBase* callbacks, |
| 59 const WebString& database_identifier, | 56 const WebString& database_identifier, |
| 60 const WebString& data_dir) { | 57 const WebString& data_dir) { |
| 61 idb_factory_backend_->DeleteDatabase( | 58 idb_factory_backend_->DeleteDatabase( |
| 62 name, | 59 name, |
| 63 IndexedDBCallbacksWrapper::Create(callbacks), | 60 IndexedDBCallbacksWrapper::Create(callbacks), |
| 64 database_identifier, | 61 database_identifier, |
| 65 data_dir); | 62 data_dir); |
| 66 } | 63 } |
| 67 | 64 |
| 68 } // namespace WebKit | 65 } // namespace WebKit |
| OLD | NEW |