blob: 11f79ded47f643dd9184c8efc649d8ee714c490a [file] [log] [blame]
// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_VALUE_STORE_VALUE_STORE_CHANGE_H_
#define COMPONENTS_VALUE_STORE_VALUE_STORE_CHANGE_H_
#include <string>
#include <vector>
#include "base/memory/ref_counted.h"
#include "base/values.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
namespace value_store {
struct ValueStoreChange;
typedef std::vector<ValueStoreChange> ValueStoreChangeList;
// A change to a setting.
struct ValueStoreChange {
// Converts an ValueStoreChangeList into base::Value of the form:
// { "foo": { "key": "foo", "oldValue": "bar", "newValue": "baz" } }
static base::Value ToValue(ValueStoreChangeList changes);
ValueStoreChange(const std::string& key,
absl::optional<base::Value> old_value,
absl::optional<base::Value> new_value);
ValueStoreChange(const ValueStoreChange& other) = delete;
ValueStoreChange(ValueStoreChange&& other);
ValueStoreChange& operator=(const ValueStoreChange& other) = delete;
ValueStoreChange& operator=(ValueStoreChange&& other);
~ValueStoreChange();
std::string key;
absl::optional<base::Value> old_value;
absl::optional<base::Value> new_value;
};
} // namespace value_store
#endif // COMPONENTS_VALUE_STORE_VALUE_STORE_CHANGE_H_