Respond with QuotaExceededError when IndexedDB has no disk space on open.
[chromium-blink-merge.git] / content / browser / indexed_db / indexed_db_fake_backing_store.h
blob20ebf46f815b7bba5b528dc49f1cb671100ef883
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.
5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FAKE_BACKING_STORE_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FAKE_BACKING_STORE_H_
8 #include <vector>
10 #include "content/browser/indexed_db/indexed_db_backing_store.h"
12 namespace content {
14 class IndexedDBFakeBackingStore : public IndexedDBBackingStore {
15 public:
16 IndexedDBFakeBackingStore()
17 : IndexedDBBackingStore(std::string(),
18 scoped_ptr<LevelDBDatabase>(),
19 scoped_ptr<LevelDBComparator>()) {}
20 virtual std::vector<string16> GetDatabaseNames() OVERRIDE;
21 virtual bool GetIDBDatabaseMetaData(const string16& name,
22 IndexedDBDatabaseMetadata*,
23 bool* found) OVERRIDE;
24 virtual bool CreateIDBDatabaseMetaData(const string16& name,
25 const string16& version,
26 int64 int_version,
27 int64* row_id) OVERRIDE;
28 virtual bool UpdateIDBDatabaseMetaData(Transaction*,
29 int64 row_id,
30 const string16& version) OVERRIDE;
31 virtual bool UpdateIDBDatabaseIntVersion(Transaction*,
32 int64 row_id,
33 int64 version) OVERRIDE;
34 virtual bool DeleteDatabase(const string16& name) OVERRIDE;
36 virtual bool CreateObjectStore(Transaction*,
37 int64 database_id,
38 int64 object_store_id,
39 const string16& name,
40 const IndexedDBKeyPath&,
41 bool auto_increment) OVERRIDE;
43 virtual bool ClearObjectStore(Transaction*,
44 int64 database_id,
45 int64 object_store_id) OVERRIDE;
46 virtual bool DeleteRecord(Transaction*,
47 int64 database_id,
48 int64 object_store_id,
49 const RecordIdentifier&) OVERRIDE;
50 virtual bool GetKeyGeneratorCurrentNumber(Transaction*,
51 int64 database_id,
52 int64 object_store_id,
53 int64* current_number) OVERRIDE;
54 virtual bool MaybeUpdateKeyGeneratorCurrentNumber(Transaction*,
55 int64 database_id,
56 int64 object_store_id,
57 int64 new_number,
58 bool check_current)
59 OVERRIDE;
60 virtual bool KeyExistsInObjectStore(Transaction*,
61 int64 database_id,
62 int64 object_store_id,
63 const IndexedDBKey&,
64 RecordIdentifier* found_record_identifier,
65 bool* found) OVERRIDE;
67 virtual bool CreateIndex(Transaction*,
68 int64 database_id,
69 int64 object_store_id,
70 int64 index_id,
71 const string16& name,
72 const IndexedDBKeyPath&,
73 bool is_unique,
74 bool is_multi_entry) OVERRIDE;
75 virtual bool DeleteIndex(Transaction*,
76 int64 database_id,
77 int64 object_store_id,
78 int64 index_id) OVERRIDE;
79 virtual bool PutIndexDataForRecord(Transaction*,
80 int64 database_id,
81 int64 object_store_id,
82 int64 index_id,
83 const IndexedDBKey&,
84 const RecordIdentifier&) OVERRIDE;
86 virtual scoped_ptr<Cursor> OpenObjectStoreKeyCursor(
87 Transaction* transaction,
88 int64 database_id,
89 int64 object_store_id,
90 const IndexedDBKeyRange& key_range,
91 indexed_db::CursorDirection) OVERRIDE;
92 virtual scoped_ptr<Cursor> OpenObjectStoreCursor(
93 Transaction* transaction,
94 int64 database_id,
95 int64 object_store_id,
96 const IndexedDBKeyRange& key_range,
97 indexed_db::CursorDirection) OVERRIDE;
98 virtual scoped_ptr<Cursor> OpenIndexKeyCursor(
99 Transaction* transaction,
100 int64 database_id,
101 int64 object_store_id,
102 int64 index_id,
103 const IndexedDBKeyRange& key_range,
104 indexed_db::CursorDirection) OVERRIDE;
105 virtual scoped_ptr<Cursor> OpenIndexCursor(Transaction* transaction,
106 int64 database_id,
107 int64 object_store_id,
108 int64 index_id,
109 const IndexedDBKeyRange& key_range,
110 indexed_db::CursorDirection)
111 OVERRIDE;
113 protected:
114 friend class base::RefCounted<IndexedDBFakeBackingStore>;
115 virtual ~IndexedDBFakeBackingStore();
118 } // namespace content
120 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FAKE_BACKING_STORE_H_