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