chromium/components/sync_preferences/dual_layer_user_pref_store.h

// Copyright 2023 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_SYNC_PREFERENCES_DUAL_LAYER_USER_PREF_STORE_H_
#define COMPONENTS_SYNC_PREFERENCES_DUAL_LAYER_USER_PREF_STORE_H_

#include <memory>
#include <set>
#include <string>
#include <string_view>
#include <utility>

#include "base/containers/flat_set.h"
#include "base/functional/callback_forward.h"
#include "base/memory/raw_ptr.h"
#include "base/observer_list.h"
#include "components/prefs/persistent_pref_store.h"
#include "components/prefs/value_map_pref_store.h"
#include "components/sync/base/data_type.h"
#include "components/sync/service/sync_service_observer.h"

namespace syncer {
class SyncService;
}  // namespace syncer

namespace sync_preferences {

class PrefModelAssociatorClient;

// A two-layer user PrefStore that combines local preferences (scoped to this
// profile) with account-scoped preferences (scoped to the user's signed-in
// account).
// * Account takes precedence: If a pref has a value in both stores, then
//   typically the account-scoped one takes precedence. However, for some prefs,
//   the two values may be merged.
// * Dual writes: Any changes made to prefs *on this device* are written to both
//   stores. However, incoming changes made on other devices only go into the
//   account store.
class DualLayerUserPrefStore : public PersistentPrefStore,
                               public syncer::SyncServiceObserver {};

}  // namespace sync_preferences

#endif  // COMPONENTS_SYNC_PREFERENCES_DUAL_LAYER_USER_PREF_STORE_H_