| Index: components/autofill/core/browser/webdata/autofill_table.h
|
| diff --git a/components/autofill/core/browser/webdata/autofill_table.h b/components/autofill/core/browser/webdata/autofill_table.h
|
| index a8eceb0ae1b99c469fd9ba4cc3c234cc5d20b094..0cd473bc0b68136339df3550801a1d3aef4c7e3c 100644
|
| --- a/components/autofill/core/browser/webdata/autofill_table.h
|
| +++ b/components/autofill/core/browser/webdata/autofill_table.h
|
| @@ -13,6 +13,7 @@
|
| #include "base/gtest_prod_util.h"
|
| #include "base/macros.h"
|
| #include "base/strings/string16.h"
|
| +#include "components/sync/base/model_type.h"
|
| #include "components/webdata/common/web_database_table.h"
|
|
|
| class WebDatabase;
|
| @@ -21,6 +22,11 @@ namespace base {
|
| class Time;
|
| }
|
|
|
| +namespace sync_pb {
|
| +class EntityMetadata;
|
| +class ModelTypeState;
|
| +}
|
| +
|
| namespace autofill {
|
|
|
| class AutofillChange;
|
| @@ -228,6 +234,18 @@ struct FormFieldData;
|
| // a form.
|
| // use_date The date this address was last used to fill a form,
|
| // in internal t.
|
| +// autofill_sync_metadata
|
| +// Sync-specific metadata for autofill records.
|
| +//
|
| +// 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
|
| +// Single row table that contains the sync ModelTypeState
|
| +// for the autofill model type.
|
| +//
|
| +// value The serialized ModelTypeState record.
|
|
|
| class AutofillTable : public WebDatabaseTable {
|
| public:
|
| @@ -403,6 +421,39 @@ class AutofillTable : public WebDatabaseTable {
|
| // Clear all profiles.
|
| bool ClearAutofillProfiles();
|
|
|
| + // Look up the metadata record of |model_type| keyed by |storage_key| and fill
|
| + // |metadata| with it.
|
| + bool GetSyncMetadata(syncer::ModelType model_type,
|
| + const std::string& storage_key,
|
| + sync_pb::EntityMetadata* metadata);
|
| +
|
| + // Read all the stored metadata of |model_type| and fill |metadata_records|
|
| + // with it.
|
| + bool GetAllSyncMetadata(
|
| + syncer::ModelType model_type,
|
| + std::vector<sync_pb::EntityMetadata>* metadata_records);
|
| +
|
| + // Update the metadata row for |model_type|, keyed by |storage_key|, to
|
| + // contain the contents of |metadata|.
|
| + bool UpdateSyncMetadata(syncer::ModelType model_type,
|
| + const std::string& storage_key,
|
| + const sync_pb::EntityMetadata& metadata);
|
| +
|
| + // Remove the metadata row of type |model_type| keyed by |storage|key|.
|
| + bool ClearSyncMetadata(syncer::ModelType model_type,
|
| + const std::string& storage_key);
|
| +
|
| + // Retrieve the stored sync state for the |model_type|.
|
| + bool GetModelTypeState(syncer::ModelType model_type,
|
| + sync_pb::ModelTypeState* state);
|
| +
|
| + // Update the stored sync state for the |model_type|.
|
| + bool UpdateModelTypeState(syncer::ModelType model_type,
|
| + sync_pb::ModelTypeState& model_type_state);
|
| +
|
| + // Clear the stored sync state for |model_type|.
|
| + bool ClearModelTypeState(syncer::ModelType model_type);
|
| +
|
| // Table migration functions. NB: These do not and should not rely on other
|
| // functions in this class. The implementation of a function such as
|
| // GetCreditCard may change over time, but MigrateToVersionXX should never
|
| @@ -419,6 +470,7 @@ class AutofillTable : public WebDatabaseTable {
|
| bool MigrateToVersion65AddServerMetadataTables();
|
| bool MigrateToVersion66AddCardBillingAddress();
|
| bool MigrateToVersion67AddMaskedCardBillingAddress();
|
| + bool MigrateToVersion70AddSyncMetadata();
|
|
|
| // Max data length saved in the table, AKA the maximum length allowed for
|
| // form data.
|
| @@ -496,6 +548,8 @@ class AutofillTable : public WebDatabaseTable {
|
| bool InitServerCardMetadataTable();
|
| bool InitServerAddressesTable();
|
| bool InitServerAddressMetadataTable();
|
| + bool InitAutofillSyncMetadataTable();
|
| + bool InitModelTypeStateTable();
|
|
|
| DISALLOW_COPY_AND_ASSIGN(AutofillTable);
|
| };
|
|
|