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 #include "webkit/dom_storage/local_storage_database_adapter.h" | 5 #include "webkit/dom_storage/local_storage_database_adapter.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "webkit/dom_storage/dom_storage_database.h" | 8 #include "webkit/dom_storage/dom_storage_database.h" |
9 | 9 |
10 namespace dom_storage { | 10 namespace dom_storage { |
11 | 11 |
12 LocalStorageDatabaseAdapter::LocalStorageDatabaseAdapter( | 12 LocalStorageDatabaseAdapter::LocalStorageDatabaseAdapter( |
13 const FilePath& path) | 13 const base::FilePath& path) |
14 : db_(new DomStorageDatabase(path)) { | 14 : db_(new DomStorageDatabase(path)) { |
15 } | 15 } |
16 | 16 |
17 LocalStorageDatabaseAdapter::~LocalStorageDatabaseAdapter() { } | 17 LocalStorageDatabaseAdapter::~LocalStorageDatabaseAdapter() { } |
18 | 18 |
19 void LocalStorageDatabaseAdapter::ReadAllValues(ValuesMap* result) { | 19 void LocalStorageDatabaseAdapter::ReadAllValues(ValuesMap* result) { |
20 db_->ReadAllValues(result); | 20 db_->ReadAllValues(result); |
21 } | 21 } |
22 | 22 |
23 bool LocalStorageDatabaseAdapter::CommitChanges( | 23 bool LocalStorageDatabaseAdapter::CommitChanges( |
24 bool clear_all_first, const ValuesMap& changes) { | 24 bool clear_all_first, const ValuesMap& changes) { |
25 return db_->CommitChanges(clear_all_first, changes); | 25 return db_->CommitChanges(clear_all_first, changes); |
26 } | 26 } |
27 | 27 |
28 void LocalStorageDatabaseAdapter::DeleteFiles() { | 28 void LocalStorageDatabaseAdapter::DeleteFiles() { |
29 file_util::Delete(db_->file_path(), false); | 29 file_util::Delete(db_->file_path(), false); |
30 file_util::Delete( | 30 file_util::Delete( |
31 DomStorageDatabase::GetJournalFilePath(db_->file_path()), false); | 31 DomStorageDatabase::GetJournalFilePath(db_->file_path()), false); |
32 } | 32 } |
33 | 33 |
34 void LocalStorageDatabaseAdapter::Reset() { | 34 void LocalStorageDatabaseAdapter::Reset() { |
35 db_.reset(new DomStorageDatabase(db_->file_path())); | 35 db_.reset(new DomStorageDatabase(db_->file_path())); |
36 } | 36 } |
37 | 37 |
38 LocalStorageDatabaseAdapter::LocalStorageDatabaseAdapter() | 38 LocalStorageDatabaseAdapter::LocalStorageDatabaseAdapter() |
39 : db_(new DomStorageDatabase()) { | 39 : db_(new DomStorageDatabase()) { |
40 } | 40 } |
41 | 41 |
42 } // namespace dom_storage | 42 } // namespace dom_storage |
OLD | NEW |