Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / content / browser / indexed_db / indexed_db_class_factory.h
blob03b03597f6755ebbd977a2a6f169f9ffc4337c1b
1 // Copyright 2014 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_CLASS_FACTORY_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CLASS_FACTORY_H_
8 #include "base/lazy_instance.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "content/common/content_export.h"
12 namespace leveldb {
13 class Iterator;
14 } // namespace leveldb
16 namespace content {
18 class LevelDBIteratorImpl;
19 class LevelDBDatabase;
20 class LevelDBTransaction;
22 // Use this factory to create some IndexedDB objects. Exists solely to
23 // facilitate tests which sometimes need to inject mock objects into the system.
24 class CONTENT_EXPORT IndexedDBClassFactory {
25 public:
26 typedef IndexedDBClassFactory* GetterCallback();
28 static IndexedDBClassFactory* Get();
30 static void SetIndexedDBClassFactoryGetter(GetterCallback* cb);
32 virtual LevelDBIteratorImpl* CreateIteratorImpl(
33 scoped_ptr<leveldb::Iterator> iterator);
34 virtual LevelDBTransaction* CreateLevelDBTransaction(LevelDBDatabase* db);
36 protected:
37 IndexedDBClassFactory() {}
38 virtual ~IndexedDBClassFactory() {}
39 friend struct base::DefaultLazyInstanceTraits<IndexedDBClassFactory>;
42 } // namespace content
44 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CLASS_FACTORY_H_