OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WEBKIT_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_ | 5 #ifndef WEBKIT_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_ |
6 #define WEBKIT_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_ | 6 #define WEBKIT_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "webkit/dom_storage/dom_storage_database_adapter.h" | 10 #include "webkit/dom_storage/dom_storage_database_adapter.h" |
11 #include "webkit/storage/webkit_storage_export.h" | 11 #include "webkit/storage/webkit_storage_export.h" |
12 | 12 |
| 13 namespace base { |
13 class FilePath; | 14 class FilePath; |
| 15 } |
14 | 16 |
15 namespace dom_storage { | 17 namespace dom_storage { |
16 | 18 |
17 class DomStorageDatabase; | 19 class DomStorageDatabase; |
18 | 20 |
19 class WEBKIT_STORAGE_EXPORT LocalStorageDatabaseAdapter : | 21 class WEBKIT_STORAGE_EXPORT LocalStorageDatabaseAdapter : |
20 public DomStorageDatabaseAdapter { | 22 public DomStorageDatabaseAdapter { |
21 public: | 23 public: |
22 explicit LocalStorageDatabaseAdapter(const FilePath& path); | 24 explicit LocalStorageDatabaseAdapter(const base::FilePath& path); |
23 virtual ~LocalStorageDatabaseAdapter(); | 25 virtual ~LocalStorageDatabaseAdapter(); |
24 virtual void ReadAllValues(ValuesMap* result) OVERRIDE; | 26 virtual void ReadAllValues(ValuesMap* result) OVERRIDE; |
25 virtual bool CommitChanges(bool clear_all_first, | 27 virtual bool CommitChanges(bool clear_all_first, |
26 const ValuesMap& changes) OVERRIDE; | 28 const ValuesMap& changes) OVERRIDE; |
27 virtual void DeleteFiles() OVERRIDE; | 29 virtual void DeleteFiles() OVERRIDE; |
28 virtual void Reset() OVERRIDE; | 30 virtual void Reset() OVERRIDE; |
29 | 31 |
30 protected: | 32 protected: |
31 // Constructor that uses an in-memory sqlite database, for testing. | 33 // Constructor that uses an in-memory sqlite database, for testing. |
32 LocalStorageDatabaseAdapter(); | 34 LocalStorageDatabaseAdapter(); |
33 | 35 |
34 private: | 36 private: |
35 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, BackingDatabaseOpened); | 37 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, BackingDatabaseOpened); |
36 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, CommitChangesAtShutdown); | 38 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, CommitChangesAtShutdown); |
37 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, CommitTasks); | 39 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, CommitTasks); |
38 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, DeleteOrigin); | 40 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, DeleteOrigin); |
39 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, PurgeMemory); | 41 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, PurgeMemory); |
40 | 42 |
41 scoped_ptr<DomStorageDatabase> db_; | 43 scoped_ptr<DomStorageDatabase> db_; |
42 | 44 |
43 DISALLOW_COPY_AND_ASSIGN(LocalStorageDatabaseAdapter); | 45 DISALLOW_COPY_AND_ASSIGN(LocalStorageDatabaseAdapter); |
44 }; | 46 }; |
45 | 47 |
46 } // namespace dom_storage | 48 } // namespace dom_storage |
47 | 49 |
48 #endif // WEBKIT_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_ | 50 #endif // WEBKIT_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_ |
OLD | NEW |