| 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_export.h" |
| 10 #include "webkit/dom_storage/dom_storage_database_adapter.h" | 11 #include "webkit/dom_storage/dom_storage_database_adapter.h" |
| 11 | 12 |
| 12 class FilePath; | 13 class FilePath; |
| 13 | 14 |
| 14 namespace dom_storage { | 15 namespace dom_storage { |
| 15 | 16 |
| 16 class DomStorageDatabase; | 17 class DomStorageDatabase; |
| 17 | 18 |
| 18 class LocalStorageDatabaseAdapter : public DomStorageDatabaseAdapter { | 19 class DOM_STORAGE_EXPORT LocalStorageDatabaseAdapter : |
| 20 public DomStorageDatabaseAdapter { |
| 19 public: | 21 public: |
| 20 explicit LocalStorageDatabaseAdapter(const FilePath& path); | 22 explicit LocalStorageDatabaseAdapter(const FilePath& path); |
| 21 virtual ~LocalStorageDatabaseAdapter(); | 23 virtual ~LocalStorageDatabaseAdapter(); |
| 22 virtual void ReadAllValues(ValuesMap* result) OVERRIDE; | 24 virtual void ReadAllValues(ValuesMap* result) OVERRIDE; |
| 23 virtual bool CommitChanges(bool clear_all_first, | 25 virtual bool CommitChanges(bool clear_all_first, |
| 24 const ValuesMap& changes) OVERRIDE; | 26 const ValuesMap& changes) OVERRIDE; |
| 25 virtual void DeleteFiles() OVERRIDE; | 27 virtual void DeleteFiles() OVERRIDE; |
| 26 virtual void Reset() OVERRIDE; | 28 virtual void Reset() OVERRIDE; |
| 27 | 29 |
| 28 protected: | 30 protected: |
| 29 // Constructor that uses an in-memory sqlite database, for testing. | 31 // Constructor that uses an in-memory sqlite database, for testing. |
| 30 LocalStorageDatabaseAdapter(); | 32 LocalStorageDatabaseAdapter(); |
| 31 | 33 |
| 32 private: | 34 private: |
| 33 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, BackingDatabaseOpened); | 35 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, BackingDatabaseOpened); |
| 34 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, CommitChangesAtShutdown); | 36 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, CommitChangesAtShutdown); |
| 35 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, CommitTasks); | 37 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, CommitTasks); |
| 36 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, DeleteOrigin); | 38 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, DeleteOrigin); |
| 37 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, PurgeMemory); | 39 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, PurgeMemory); |
| 38 | 40 |
| 39 scoped_ptr<DomStorageDatabase> db_; | 41 scoped_ptr<DomStorageDatabase> db_; |
| 40 | 42 |
| 41 DISALLOW_COPY_AND_ASSIGN(LocalStorageDatabaseAdapter); | 43 DISALLOW_COPY_AND_ASSIGN(LocalStorageDatabaseAdapter); |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 } // namespace dom_storage | 46 } // namespace dom_storage |
| 45 | 47 |
| 46 #endif // WEBKIT_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_ | 48 #endif // WEBKIT_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_ |
| OLD | NEW |