1545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch/*
22daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * Copyright (C) 2011 Google Inc. All rights reserved.
3545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch *
4545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch * Redistribution and use in source and binary forms, with or without
5545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch * modification, are permitted provided that the following conditions
6545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch * are met:
7545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch *
8545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch * 1.  Redistributions of source code must retain the above copyright
9545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch *     notice, this list of conditions and the following disclaimer.
10545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch * 2.  Redistributions in binary form must reproduce the above copyright
11545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch *     notice, this list of conditions and the following disclaimer in the
12545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch *     documentation and/or other materials provided with the distribution.
13545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch *
14545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch */
25545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch
26545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch#ifndef WebIDBObjectStoreImpl_h
27545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch#define WebIDBObjectStoreImpl_h
28545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch
292daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#if ENABLE(INDEXED_DATABASE)
302daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch
31545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch#include "WebCommon.h"
32545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch#include "WebIDBObjectStore.h"
33545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch#include <wtf/PassRefPtr.h>
34545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch#include <wtf/RefPtr.h>
35545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch
36dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochnamespace WebCore { class IDBObjectStoreBackendInterface; }
37545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch
38545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdochnamespace WebKit {
39545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch
40545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdochclass WebIDBIndex;
41545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch
42545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch// See comment in WebIndexedObjectStore for a high level overview these classes.
43545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdochclass WebIDBObjectStoreImpl : public WebIDBObjectStore {
44545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdochpublic:
45dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch    WebIDBObjectStoreImpl(WTF::PassRefPtr<WebCore::IDBObjectStoreBackendInterface>);
46e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke    ~WebIDBObjectStoreImpl();
47545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch
48e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke    WebString name() const;
49e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke    WebString keyPath() const;
50e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke    WebDOMStringList indexNames() const;
51545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch
52a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    void get(const WebIDBKey& key, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
532fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    void put(const WebSerializedScriptValue&, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
544576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang    void deleteFunction(const WebIDBKey& key, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
552fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    void clear(WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
56e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
57a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    WebIDBIndex* createIndex(const WebString& name, const WebString& keyPath, bool unique, const WebIDBTransaction&, WebExceptionCode&);
58a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    WebIDBIndex* index(const WebString& name, WebExceptionCode&);
594576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang    void deleteIndex(const WebString& name, const WebIDBTransaction&, WebExceptionCode&);
60545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch
61a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    void openCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
62dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch
63545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch private:
64dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch    WTF::RefPtr<WebCore::IDBObjectStoreBackendInterface> m_objectStore;
65545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch};
66545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch
67545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch} // namespace WebKit
68545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch
692daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#endif // ENABLE(INDEXED_DATABASE)
702daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch
71545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch#endif // WebIDBObjectStoreImpl_h
72