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