Home | History | Annotate | Download | only in indexed_db
      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/proxy_webidbfactory_impl.h"
      6 
      7 #include "content/child/thread_safe_sender.h"
      8 #include "content/child/indexed_db/indexed_db_dispatcher.h"
      9 #include "third_party/WebKit/public/platform/WebCString.h"
     10 #include "third_party/WebKit/public/platform/WebString.h"
     11 
     12 using WebKit::WebIDBCallbacks;
     13 using WebKit::WebIDBDatabase;
     14 using WebKit::WebIDBDatabaseCallbacks;
     15 using WebKit::WebString;
     16 
     17 namespace content {
     18 
     19 RendererWebIDBFactoryImpl::RendererWebIDBFactoryImpl(
     20     ThreadSafeSender* thread_safe_sender)
     21     : thread_safe_sender_(thread_safe_sender) {
     22 }
     23 
     24 RendererWebIDBFactoryImpl::~RendererWebIDBFactoryImpl() {
     25 }
     26 
     27 void RendererWebIDBFactoryImpl::getDatabaseNames(
     28     WebIDBCallbacks* callbacks,
     29     const WebString& database_identifier) {
     30   IndexedDBDispatcher* dispatcher =
     31       IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
     32   dispatcher->RequestIDBFactoryGetDatabaseNames(callbacks,
     33                                                 database_identifier.utf8());
     34 }
     35 
     36 void RendererWebIDBFactoryImpl::open(
     37     const WebString& name,
     38     long long version,
     39     long long transaction_id,
     40     WebIDBCallbacks* callbacks,
     41     WebIDBDatabaseCallbacks* database_callbacks,
     42     const WebString& database_identifier) {
     43   IndexedDBDispatcher* dispatcher =
     44       IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
     45   dispatcher->RequestIDBFactoryOpen(name,
     46                                     version,
     47                                     transaction_id,
     48                                     callbacks,
     49                                     database_callbacks,
     50                                     database_identifier.utf8());
     51 }
     52 
     53 void RendererWebIDBFactoryImpl::deleteDatabase(
     54     const WebString& name,
     55     WebIDBCallbacks* callbacks,
     56     const WebString& database_identifier) {
     57   IndexedDBDispatcher* dispatcher =
     58       IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
     59   dispatcher->RequestIDBFactoryDeleteDatabase(
     60       name, callbacks, database_identifier.utf8());
     61 }
     62 
     63 }  // namespace content
     64