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"
14 } // namespace leveldb
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 {
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);
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_