• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBDATABASE_IMPL_H_
6 #define CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBDATABASE_IMPL_H_
7 
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "third_party/WebKit/public/platform/WebIDBDatabase.h"
11 
12 namespace blink {
13 class WebIDBCallbacks;
14 class WebIDBDatabaseCallbacks;
15 class WebString;
16 }
17 
18 namespace content {
19 class ThreadSafeSender;
20 
21 class WebIDBDatabaseImpl : public blink::WebIDBDatabase {
22  public:
23   WebIDBDatabaseImpl(int32 ipc_database_id,
24                      int32 ipc_database_callbacks_id,
25                      ThreadSafeSender* thread_safe_sender);
26   virtual ~WebIDBDatabaseImpl();
27 
28   // blink::WebIDBDatabase
29   virtual void createObjectStore(long long transaction_id,
30                                  long long objectstore_id,
31                                  const blink::WebString& name,
32                                  const blink::WebIDBKeyPath& key_path,
33                                  bool auto_increment);
34   virtual void deleteObjectStore(long long transaction_id,
35                                  long long object_store_id);
36   virtual void createTransaction(long long transaction_id,
37                                  blink::WebIDBDatabaseCallbacks* callbacks,
38                                  const blink::WebVector<long long>& scope,
39                                  unsigned short mode);
40   virtual void close();
41   virtual void get(long long transactionId,
42                    long long objectStoreId,
43                    long long indexId,
44                    const blink::WebIDBKeyRange&,
45                    bool keyOnly,
46                    blink::WebIDBCallbacks*);
47   virtual void put(long long transactionId,
48                    long long objectStoreId,
49                    const blink::WebData& value,
50                    const blink::WebIDBKey&,
51                    PutMode,
52                    blink::WebIDBCallbacks*,
53                    const blink::WebVector<long long>& indexIds,
54                    const blink::WebVector<WebIndexKeys>&);
55   virtual void setIndexKeys(long long transactionId,
56                             long long objectStoreId,
57                             const blink::WebIDBKey&,
58                             const blink::WebVector<long long>& indexIds,
59                             const blink::WebVector<WebIndexKeys>&);
60   virtual void setIndexesReady(long long transactionId,
61                                long long objectStoreId,
62                                const blink::WebVector<long long>& indexIds);
63   virtual void openCursor(long long transactionId,
64                           long long objectStoreId,
65                           long long indexId,
66                           const blink::WebIDBKeyRange&,
67                           unsigned short direction,
68                           bool keyOnly,
69                           TaskType,
70                           blink::WebIDBCallbacks*);
71   virtual void count(long long transactionId,
72                      long long objectStoreId,
73                      long long indexId,
74                      const blink::WebIDBKeyRange&,
75                      blink::WebIDBCallbacks*);
76   virtual void deleteRange(long long transactionId,
77                            long long objectStoreId,
78                            const blink::WebIDBKeyRange&,
79                            blink::WebIDBCallbacks*);
80   virtual void clear(long long transactionId,
81                      long long objectStoreId,
82                      blink::WebIDBCallbacks*);
83   virtual void createIndex(long long transactionId,
84                            long long objectStoreId,
85                            long long indexId,
86                            const blink::WebString& name,
87                            const blink::WebIDBKeyPath&,
88                            bool unique,
89                            bool multiEntry);
90   virtual void deleteIndex(long long transactionId,
91                            long long objectStoreId,
92                            long long indexId);
93   virtual void abort(long long transaction_id);
94   virtual void commit(long long transaction_id);
95 
96  private:
97   int32 ipc_database_id_;
98   int32 ipc_database_callbacks_id_;
99   scoped_refptr<ThreadSafeSender> thread_safe_sender_;
100 };
101 
102 }  // namespace content
103 
104 #endif  // CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBDATABASE_IMPL_H_
105