1e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block/*
22daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * Copyright (C) 2011 Google Inc. All rights reserved.
3e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block *
4e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block * Redistribution and use in source and binary forms, with or without
5e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block * modification, are permitted provided that the following conditions
6e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block * are met:
7e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block *
8e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block * 1.  Redistributions of source code must retain the above copyright
9e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block *     notice, this list of conditions and the following disclaimer.
10e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block * 2.  Redistributions in binary form must reproduce the above copyright
11e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block *     notice, this list of conditions and the following disclaimer in the
12e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block *     documentation and/or other materials provided with the distribution.
13e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block *
14e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block */
25e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block
26e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block#include "config.h"
27e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block#include "WebIDBCallbacksImpl.h"
28e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block
292daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#if ENABLE(INDEXED_DATABASE)
302daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch
31e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block#include "IDBCallbacks.h"
32dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch#include "IDBCursorBackendProxy.h"
332daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#include "IDBDatabaseBackendProxy.h"
34e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block#include "IDBDatabaseError.h"
35e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke#include "IDBKey.h"
36a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#include "IDBTransactionBackendProxy.h"
37e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block#include "WebIDBCallbacks.h"
38e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block#include "WebIDBDatabase.h"
39e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block#include "WebIDBDatabaseError.h"
40e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke#include "WebIDBKey.h"
41a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#include "WebIDBTransaction.h"
42e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block#include "WebSerializedScriptValue.h"
43e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block
442daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochusing namespace WebCore;
45e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block
462daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochnamespace WebKit {
47e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block
48e78cbe89e6f337f2f1fe40315be88f742b547151Steve BlockWebIDBCallbacksImpl::WebIDBCallbacksImpl(PassRefPtr<IDBCallbacks> callbacks)
49e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block    : m_callbacks(callbacks)
50e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block{
51e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block}
52e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block
53e78cbe89e6f337f2f1fe40315be88f742b547151Steve BlockWebIDBCallbacksImpl::~WebIDBCallbacksImpl()
54e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block{
55e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block}
56e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block
572daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochvoid WebIDBCallbacksImpl::onError(const WebIDBDatabaseError& error)
58e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block{
59e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block    m_callbacks->onError(error);
60e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block}
61e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block
622daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochvoid WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor)
63dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch{
64dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch    m_callbacks->onSuccess(IDBCursorBackendProxy::create(cursor));
65dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch}
66dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch
672daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochvoid WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* webKitInstance)
68e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block{
692daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    m_callbacks->onSuccess(IDBDatabaseBackendProxy::create(webKitInstance));
70e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block}
71e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block
722daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochvoid WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key)
73e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke{
74e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke    m_callbacks->onSuccess(key);
75e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke}
76e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
772daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochvoid WebIDBCallbacksImpl::onSuccess(WebIDBTransaction* webKitInstance)
78a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
79a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    m_callbacks->onSuccess(IDBTransactionBackendProxy::create(webKitInstance));
80a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
81a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
822daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochvoid WebIDBCallbacksImpl::onSuccess(const WebSerializedScriptValue& serializedScriptValue)
83e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block{
84e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block    m_callbacks->onSuccess(serializedScriptValue);
85e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block}
86e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block
8781bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdochvoid WebIDBCallbacksImpl::onBlocked()
8881bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch{
8981bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    m_callbacks->onBlocked();
9081bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch}
9181bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch
922daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch} // namespace WebKit
93e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block
94e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block#endif // ENABLE(INDEXED_DATABASE)
95