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