• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #include "content/child/indexed_db/webidbfactory_impl.h"
6 
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"
11 
12 using blink::WebIDBCallbacks;
13 using blink::WebIDBDatabase;
14 using blink::WebIDBDatabaseCallbacks;
15 using blink::WebString;
16 
17 namespace content {
18 
WebIDBFactoryImpl(ThreadSafeSender * thread_safe_sender)19 WebIDBFactoryImpl::WebIDBFactoryImpl(ThreadSafeSender* thread_safe_sender)
20     : thread_safe_sender_(thread_safe_sender) {}
21 
~WebIDBFactoryImpl()22 WebIDBFactoryImpl::~WebIDBFactoryImpl() {}
23 
getDatabaseNames(WebIDBCallbacks * callbacks,const WebString & database_identifier)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());
30 }
31 
open(const WebString & name,long long version,long long transaction_id,WebIDBCallbacks * callbacks,WebIDBDatabaseCallbacks * database_callbacks,const WebString & database_identifier)32 void WebIDBFactoryImpl::open(const WebString& name,
33                              long long version,
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,
41                                     version,
42                                     transaction_id,
43                                     callbacks,
44                                     database_callbacks,
45                                     database_identifier.utf8());
46 }
47 
deleteDatabase(const WebString & name,WebIDBCallbacks * callbacks,const WebString & database_identifier)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());
55 }
56 
57 }  // namespace content
58