1 // Copyright 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.
5 #include "content/child/indexed_db/webidbfactory_impl.h"
7 #include "content/child/indexed_db/indexed_db_dispatcher.h"
8 #include "content/child/thread_safe_sender.h"
9 #include "third_party/WebKit/public/platform/WebCString.h"
10 #include "third_party/WebKit/public/platform/WebString.h"
12 using blink::WebIDBCallbacks
;
13 using blink::WebIDBDatabase
;
14 using blink::WebIDBDatabaseCallbacks
;
15 using blink::WebString
;
19 WebIDBFactoryImpl::WebIDBFactoryImpl(ThreadSafeSender
* thread_safe_sender
)
20 : thread_safe_sender_(thread_safe_sender
) {}
22 WebIDBFactoryImpl::~WebIDBFactoryImpl() {}
24 void WebIDBFactoryImpl::getDatabaseNames(WebIDBCallbacks
* callbacks
,
25 const WebString
& database_identifier
) {
26 IndexedDBDispatcher
* dispatcher
=
27 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_
.get());
28 dispatcher
->RequestIDBFactoryGetDatabaseNames(callbacks
,
29 database_identifier
.utf8());
32 void WebIDBFactoryImpl::open(const WebString
& name
,
34 long long transaction_id
,
35 WebIDBCallbacks
* callbacks
,
36 WebIDBDatabaseCallbacks
* database_callbacks
,
37 const WebString
& database_identifier
) {
38 IndexedDBDispatcher
* dispatcher
=
39 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_
.get());
40 dispatcher
->RequestIDBFactoryOpen(name
,
45 database_identifier
.utf8());
48 void WebIDBFactoryImpl::deleteDatabase(const WebString
& name
,
49 WebIDBCallbacks
* callbacks
,
50 const WebString
& database_identifier
) {
51 IndexedDBDispatcher
* dispatcher
=
52 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_
.get());
53 dispatcher
->RequestIDBFactoryDeleteDatabase(
54 name
, callbacks
, database_identifier
.utf8());
57 } // namespace content