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