Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / webkit / dom_storage / local_storage_database_adapter.h
blobe9e646b71be9edbe0e7217be3af092fbad420166
1 // Copyright (c) 2012 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 WEBKIT_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_
6 #define WEBKIT_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_
8 #include "base/gtest_prod_util.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "webkit/dom_storage/dom_storage_database_adapter.h"
11 #include "webkit/storage/webkit_storage_export.h"
13 namespace base {
14 class FilePath;
17 namespace dom_storage {
19 class DomStorageDatabase;
21 class WEBKIT_STORAGE_EXPORT LocalStorageDatabaseAdapter :
22 public DomStorageDatabaseAdapter {
23 public:
24 explicit LocalStorageDatabaseAdapter(const base::FilePath& path);
25 virtual ~LocalStorageDatabaseAdapter();
26 virtual void ReadAllValues(ValuesMap* result) OVERRIDE;
27 virtual bool CommitChanges(bool clear_all_first,
28 const ValuesMap& changes) OVERRIDE;
29 virtual void DeleteFiles() OVERRIDE;
30 virtual void Reset() OVERRIDE;
32 protected:
33 // Constructor that uses an in-memory sqlite database, for testing.
34 LocalStorageDatabaseAdapter();
36 private:
37 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, BackingDatabaseOpened);
38 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, CommitChangesAtShutdown);
39 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, CommitTasks);
40 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, DeleteOrigin);
41 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, PurgeMemory);
43 scoped_ptr<DomStorageDatabase> db_;
45 DISALLOW_COPY_AND_ASSIGN(LocalStorageDatabaseAdapter);
48 } // namespace dom_storage
50 #endif // WEBKIT_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_