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