summaryrefslogtreecommitdiff
path: root/chromium/content/browser/dom_storage/local_storage_database_adapter.cc
blob: f5d87e31c198af77da3852fec888ab933aa819fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/dom_storage/local_storage_database_adapter.h"

#include "base/file_util.h"
#include "content/browser/dom_storage/dom_storage_database.h"

namespace content {

LocalStorageDatabaseAdapter::LocalStorageDatabaseAdapter(
    const base::FilePath& path)
    : db_(new DOMStorageDatabase(path)) {
}

LocalStorageDatabaseAdapter::~LocalStorageDatabaseAdapter() { }

void LocalStorageDatabaseAdapter::ReadAllValues(DOMStorageValuesMap* result) {
  db_->ReadAllValues(result);
}

bool LocalStorageDatabaseAdapter::CommitChanges(
    bool clear_all_first, const DOMStorageValuesMap& changes) {
  return db_->CommitChanges(clear_all_first, changes);
}

void LocalStorageDatabaseAdapter::DeleteFiles() {
  sql::Connection::Delete(db_->file_path());
}

void LocalStorageDatabaseAdapter::Reset() {
  db_.reset(new DOMStorageDatabase(db_->file_path()));
}

LocalStorageDatabaseAdapter::LocalStorageDatabaseAdapter()
    : db_(new DOMStorageDatabase()) {
}

}  // namespace content