| OLD | NEW |
| (Empty) | |
| 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * |
| 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are |
| 6 * met: |
| 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. |
| 10 * |
| 11 * 2. Redistributions in binary form must reproduce the above |
| 12 * copyright notice, this list of conditions and the following disclaimer |
| 13 * in the documentation and/or other materials provided with the |
| 14 * distribution. |
| 15 * |
| 16 * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS |
| 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. |
| 20 * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ |
| 28 |
| 29 #include "config.h" |
| 30 #include "modules/indexeddb/WebIDBCallbacksImpl.h" |
| 31 |
| 32 #include "core/dom/DOMError.h" |
| 33 #include "modules/indexeddb/IDBMetadata.h" |
| 34 #include "modules/indexeddb/IDBRequest.h" |
| 35 #include "platform/SharedBuffer.h" |
| 36 #include "public/platform/WebData.h" |
| 37 #include "public/platform/WebIDBCursor.h" |
| 38 #include "public/platform/WebIDBDatabase.h" |
| 39 #include "public/platform/WebIDBDatabaseError.h" |
| 40 #include "public/platform/WebIDBKey.h" |
| 41 |
| 42 using blink::WebData; |
| 43 using blink::WebIDBCursor; |
| 44 using blink::WebIDBDatabase; |
| 45 using blink::WebIDBDatabaseError; |
| 46 using blink::WebIDBIndex; |
| 47 using blink::WebIDBKey; |
| 48 using blink::WebIDBKeyPath; |
| 49 using blink::WebIDBMetadata; |
| 50 |
| 51 namespace WebCore { |
| 52 |
| 53 // static |
| 54 PassOwnPtr<WebIDBCallbacksImpl> WebIDBCallbacksImpl::create(PassRefPtr<IDBReques
t> request) |
| 55 { |
| 56 return adoptPtr(new WebIDBCallbacksImpl(request)); |
| 57 } |
| 58 |
| 59 WebIDBCallbacksImpl::WebIDBCallbacksImpl(PassRefPtr<IDBRequest> request) |
| 60 : m_request(request) |
| 61 { |
| 62 } |
| 63 |
| 64 WebIDBCallbacksImpl::~WebIDBCallbacksImpl() |
| 65 { |
| 66 } |
| 67 |
| 68 void WebIDBCallbacksImpl::onError(const WebIDBDatabaseError& error) |
| 69 { |
| 70 m_request->onError(error); |
| 71 } |
| 72 |
| 73 void WebIDBCallbacksImpl::onSuccess(const blink::WebVector<blink::WebString>& we
bStringList) |
| 74 { |
| 75 Vector<String> stringList; |
| 76 for (size_t i = 0; i < webStringList.size(); ++i) |
| 77 stringList.append(webStringList[i]); |
| 78 m_request->onSuccess(stringList); |
| 79 } |
| 80 |
| 81 void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key,
const WebIDBKey& primaryKey, const WebData& value) |
| 82 { |
| 83 m_request->onSuccess(adoptPtr(cursor), key, primaryKey, value); |
| 84 } |
| 85 |
| 86 void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* backend, const WebIDBMetadat
a& metadata) |
| 87 { |
| 88 m_request->onSuccess(adoptPtr(backend), metadata); |
| 89 } |
| 90 |
| 91 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key) |
| 92 { |
| 93 m_request->onSuccess(key); |
| 94 } |
| 95 |
| 96 void WebIDBCallbacksImpl::onSuccess(const WebData& value) |
| 97 { |
| 98 m_request->onSuccess(value); |
| 99 } |
| 100 |
| 101 void WebIDBCallbacksImpl::onSuccess(const WebData& value, const WebIDBKey& key,
const WebIDBKeyPath& keyPath) |
| 102 { |
| 103 m_request->onSuccess(value, key, keyPath); |
| 104 } |
| 105 |
| 106 void WebIDBCallbacksImpl::onSuccess(long long value) |
| 107 { |
| 108 m_request->onSuccess(value); |
| 109 } |
| 110 |
| 111 void WebIDBCallbacksImpl::onSuccess() |
| 112 { |
| 113 m_request->onSuccess(); |
| 114 } |
| 115 |
| 116 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key, const WebIDBKey& prima
ryKey, const WebData& value) |
| 117 { |
| 118 m_request->onSuccess(key, primaryKey, value); |
| 119 } |
| 120 |
| 121 void WebIDBCallbacksImpl::onBlocked(long long oldVersion) |
| 122 { |
| 123 m_request->onBlocked(oldVersion); |
| 124 } |
| 125 |
| 126 void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBDatabase*
database, const WebIDBMetadata& metadata, unsigned short dataLoss, blink::WebStr
ing dataLossMessage) |
| 127 { |
| 128 m_request->onUpgradeNeeded(oldVersion, adoptPtr(database), metadata, static_
cast<blink::WebIDBDataLoss>(dataLoss), dataLossMessage); |
| 129 } |
| 130 |
| 131 } // namespace blink |
| OLD | NEW |