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_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_
6 #define CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_
8 #include "base/gtest_prod_util.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "content/browser/dom_storage/dom_storage_database_adapter.h"
11 #include "content/common/content_export.h"
19 class DOMStorageDatabase
;
21 class CONTENT_EXPORT LocalStorageDatabaseAdapter
:
22 public DOMStorageDatabaseAdapter
{
24 explicit LocalStorageDatabaseAdapter(const base::FilePath
& path
);
25 virtual ~LocalStorageDatabaseAdapter();
26 virtual void ReadAllValues(DOMStorageValuesMap
* result
) OVERRIDE
;
27 virtual bool CommitChanges(bool clear_all_first
,
28 const DOMStorageValuesMap
& changes
) OVERRIDE
;
29 virtual void DeleteFiles() OVERRIDE
;
30 virtual void Reset() OVERRIDE
;
33 // Constructor that uses an in-memory sqlite database, for testing.
34 LocalStorageDatabaseAdapter();
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 content
50 #endif // CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_