chromium/components/autofill/core/browser/webdata/autofill_sync_metadata_table.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_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_SYNC_METADATA_TABLE_H_
#define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_SYNC_METADATA_TABLE_H_

#include "components/sync/base/data_type.h"
#include "components/sync/model/sync_metadata_store.h"
#include "components/webdata/common/web_database_table.h"

class WebDatabase;

namespace syncer {
class MetadataBatch;
}

namespace autofill {

// This class acts as a SyncMetadataStore for components/autofill. It stores the
// metadata in two tables inside the SQLite database passed to the constructor.
// It expects the following schemas:
// -----------------------------------------------------------------------------
// autofill_sync_metadata
//                      Sync-specific metadata for autofill records.
//
//   model_type         An int value corresponding to syncer::DataType enum.
//                      Added in version 78.
//   storage_key        A string that uniquely identifies the metadata record
//                      as well as the corresponding autofill record.
//   value              The serialized EntityMetadata record.
// -----------------------------------------------------------------------------
// autofill_model_type_state
//                      Contains sync DataTypeStates for autofill data types.
//
//   model_type         An int value corresponding to syncer::DataType enum.
//                      Added in version 78. Previously, the table was used only
//                      for one data type, there was an id column with value 1
//                      for the single entry.
//   value              The serialized DataTypeState record.
// -----------------------------------------------------------------------------
class AutofillSyncMetadataTable : public WebDatabaseTable,
                                  public syncer::SyncMetadataStore {};

}  // namespace autofill

#endif  // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_SYNC_METADATA_TABLE_H_