Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / browser / dom_storage / local_storage_database_adapter.cc
blob0be1cc0927c34f0110aef39e511e7a6850e6bcd3
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 #include "content/browser/dom_storage/local_storage_database_adapter.h"
7 #include "base/files/file_util.h"
8 #include "content/browser/dom_storage/dom_storage_database.h"
10 namespace content {
12 LocalStorageDatabaseAdapter::LocalStorageDatabaseAdapter(
13 const base::FilePath& path)
14 : db_(new DOMStorageDatabase(path)) {
17 LocalStorageDatabaseAdapter::~LocalStorageDatabaseAdapter() { }
19 void LocalStorageDatabaseAdapter::ReadAllValues(DOMStorageValuesMap* result) {
20 db_->ReadAllValues(result);
23 bool LocalStorageDatabaseAdapter::CommitChanges(
24 bool clear_all_first, const DOMStorageValuesMap& changes) {
25 return db_->CommitChanges(clear_all_first, changes);
28 void LocalStorageDatabaseAdapter::DeleteFiles() {
29 sql::Connection::Delete(db_->file_path());
32 void LocalStorageDatabaseAdapter::Reset() {
33 db_.reset(new DOMStorageDatabase(db_->file_path()));
36 LocalStorageDatabaseAdapter::LocalStorageDatabaseAdapter()
37 : db_(new DOMStorageDatabase()) {
40 } // namespace content