193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)/*
293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * Copyright (C) 2010 Google Inc. All rights reserved.
393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) *
493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * Redistribution and use in source and binary forms, with or without
593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * modification, are permitted provided that the following conditions
693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * are met:
793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) *
893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * 1.  Redistributions of source code must retain the above copyright
993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) *     notice, this list of conditions and the following disclaimer.
1093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * 2.  Redistributions in binary form must reproduce the above copyright
1193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) *     notice, this list of conditions and the following disclaimer in the
1293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) *     documentation and/or other materials provided with the distribution.
1393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) *
1493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
1593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
1893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
2193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) */
2593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
2693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#ifndef WebIDBDatabase_h
2793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#define WebIDBDatabase_h
2893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
29323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)#include "WebBlobInfo.h"
3093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#include "WebCommon.h"
3109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "WebIDBCursor.h"
3293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#include "WebIDBMetadata.h"
3376c265b59aa821ccbf8c75ab2bb0d036e97d2956Torne (Richard Coles)#include "public/platform/WebIDBTypes.h"
3493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
3551b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)namespace blink {
3693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
3793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)class WebData;
3893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)class WebIDBCallbacks;
3993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)class WebIDBDatabaseCallbacks;
4093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)class WebIDBDatabaseError;
4193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)class WebIDBKey;
4293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)class WebIDBKeyPath;
4393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)class WebIDBKeyRange;
4493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
4593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)// See comment in WebIDBFactory for a high level overview of these classes.
4693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)class WebIDBDatabase {
4793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)public:
4893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    virtual ~WebIDBDatabase() { }
4993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
501e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    virtual void createObjectStore(long long transactionId, long long objectStoreId, const WebString& name, const WebIDBKeyPath&, bool autoIncrement) { BLINK_ASSERT_NOT_REACHED(); }
511e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    virtual void deleteObjectStore(long long transactionId, long long objectStoreId) { BLINK_ASSERT_NOT_REACHED(); }
52e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    virtual void createTransaction(long long id, WebIDBDatabaseCallbacks*, const WebVector<long long>& scope, WebIDBTransactionMode) { BLINK_ASSERT_NOT_REACHED(); }
531e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    virtual void close() { BLINK_ASSERT_NOT_REACHED(); }
54197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    virtual void versionChangeIgnored() { BLINK_ASSERT_NOT_REACHED(); }
5593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
561e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    virtual void abort(long long transactionId) { BLINK_ASSERT_NOT_REACHED(); }
571e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    virtual void commit(long long transactionId) { BLINK_ASSERT_NOT_REACHED(); }
5893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
591e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    virtual void createIndex(long long transactionId, long long objectStoreId, long long indexId, const WebString& name, const WebIDBKeyPath&, bool unique, bool multiEntry) { BLINK_ASSERT_NOT_REACHED(); }
601e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    virtual void deleteIndex(long long transactionId, long long objectStoreId, long long indexId) { BLINK_ASSERT_NOT_REACHED(); }
6193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
6251b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    static const long long minimumIndexId = 30;
6351b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)
6493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    typedef WebVector<WebIDBKey> WebIndexKeys;
6593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
661e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    virtual void get(long long transactionId, long long objectStoreId, long long indexId, const WebIDBKeyRange&, bool keyOnly, WebIDBCallbacks*) { BLINK_ASSERT_NOT_REACHED(); }
67e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    virtual void put(long long transactionId, long long objectStoreId, const WebData& value, const WebVector<WebBlobInfo>&, const WebIDBKey&, WebIDBPutMode, WebIDBCallbacks*, const WebVector<long long>& indexIds, const WebVector<WebIndexKeys>&) { BLINK_ASSERT_NOT_REACHED(); }
681e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    virtual void setIndexKeys(long long transactionId, long long objectStoreId, const WebIDBKey&, const WebVector<long long>& indexIds, const WebVector<WebIndexKeys>&) { BLINK_ASSERT_NOT_REACHED(); }
691e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    virtual void setIndexesReady(long long transactionId, long long objectStoreId, const WebVector<long long>& indexIds) { BLINK_ASSERT_NOT_REACHED(); }
70e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    virtual void openCursor(long long transactionId, long long objectStoreId, long long indexId, const WebIDBKeyRange&, WebIDBCursorDirection, bool keyOnly, WebIDBTaskType, WebIDBCallbacks*) { BLINK_ASSERT_NOT_REACHED(); }
711e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    virtual void count(long long transactionId, long long objectStoreId, long long indexId, const WebIDBKeyRange&, WebIDBCallbacks*) { BLINK_ASSERT_NOT_REACHED(); }
721e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    virtual void deleteRange(long long transactionId, long long objectStoreId, const WebIDBKeyRange&, WebIDBCallbacks*) { BLINK_ASSERT_NOT_REACHED(); }
731e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    virtual void clear(long long transactionId, long long objectStoreId, WebIDBCallbacks*) { BLINK_ASSERT_NOT_REACHED(); }
74f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu    virtual void ackReceivedBlobs(const WebVector<WebString>& uuids) { BLINK_ASSERT_NOT_REACHED(); }
7593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
7693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)protected:
7793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    WebIDBDatabase() { }
7893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)};
7993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
8051b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)} // namespace blink
8193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
8293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#endif // WebIDBDatabase_h
83