blob: 9d7c796ef92ac3f65951dc581b6890051756ea4f (
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
// Copyright (c) 2012 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 "chrome/browser/value_store/value_store.h"
#include "base/logging.h"
// Implementation of ReadResultType.
ValueStore::ReadResultType::ReadResultType(DictionaryValue* settings)
: settings_(settings) {
DCHECK(settings);
}
ValueStore::ReadResultType::ReadResultType(const std::string& error)
: error_(error) {
DCHECK(!error.empty());
}
ValueStore::ReadResultType::~ReadResultType() {}
bool ValueStore::ReadResultType::HasError() const {
return !error_.empty();
}
scoped_ptr<DictionaryValue>& ValueStore::ReadResultType::settings() {
DCHECK(!HasError());
return settings_;
}
const std::string& ValueStore::ReadResultType::error() const {
DCHECK(HasError());
return error_;
}
// Implementation of WriteResultType.
ValueStore::WriteResultType::WriteResultType(ValueStoreChangeList* changes)
: changes_(changes) {
DCHECK(changes);
}
ValueStore::WriteResultType::WriteResultType(const std::string& error)
: error_(error) {
DCHECK(!error.empty());
}
ValueStore::WriteResultType::~WriteResultType() {}
bool ValueStore::WriteResultType::HasError() const {
return !error_.empty();
}
const ValueStoreChangeList& ValueStore::WriteResultType::changes() const {
DCHECK(!HasError());
return *changes_;
}
const std::string& ValueStore::WriteResultType::error() const {
DCHECK(HasError());
return error_;
}
|