blob: 7cdabf4b03e0fe87ee27800cf7308c290bfd1c44 [file] [log] [blame]
Torne (Richard Coles)868fa2f2013-06-11 10:57:03 +01001// 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.
4
5#ifndef WEBKIT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_
6#define WEBKIT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_
7
8#include "base/gtest_prod_util.h"
9#include "base/memory/scoped_ptr.h"
10#include "webkit/browser/dom_storage/dom_storage_database_adapter.h"
Torne (Richard Coles)7d4cd472013-06-19 11:58:07 +010011#include "webkit/browser/webkit_storage_browser_export.h"
Torne (Richard Coles)868fa2f2013-06-11 10:57:03 +010012
13namespace base {
14class FilePath;
15}
16
17namespace dom_storage {
18
19class DomStorageDatabase;
20
Torne (Richard Coles)7d4cd472013-06-19 11:58:07 +010021class WEBKIT_STORAGE_BROWSER_EXPORT LocalStorageDatabaseAdapter :
Torne (Richard Coles)868fa2f2013-06-11 10:57:03 +010022 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;
31
32 protected:
33 // Constructor that uses an in-memory sqlite database, for testing.
34 LocalStorageDatabaseAdapter();
35
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);
42
43 scoped_ptr<DomStorageDatabase> db_;
44
45 DISALLOW_COPY_AND_ASSIGN(LocalStorageDatabaseAdapter);
46};
47
48} // namespace dom_storage
49
50#endif // WEBKIT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_