Create bridges together with password bridge
Introduce sync bridges for password sending data types
This CL just introduces sync bridge skeletons without any logic and
without wiring them.
Bug: 1445868
Change-Id: I31f38a3fd889159e01cca91248798da65f847ea6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4555576
Reviewed-by: Mohamed Amir Yosef <mamir@chromium.org>
Commit-Queue: Rushan Suleymanov <rushans@google.com>
Cr-Commit-Position: refs/heads/main@{#1147748}
diff --git a/components/password_manager/core/browser/BUILD.gn b/components/password_manager/core/browser/BUILD.gn
index b3fd5a55a..b59c0cd 100644
--- a/components/password_manager/core/browser/BUILD.gn
+++ b/components/password_manager/core/browser/BUILD.gn
@@ -239,6 +239,10 @@
"store_metrics_reporter.h",
"sync/credential_model_type_controller.cc",
"sync/credential_model_type_controller.h",
+ "sync/incoming_password_sharing_invitation_sync_bridge.cc",
+ "sync/incoming_password_sharing_invitation_sync_bridge.h",
+ "sync/outgoing_password_sharing_invitation_sync_bridge.cc",
+ "sync/outgoing_password_sharing_invitation_sync_bridge.h",
"sync/password_proto_utils.cc",
"sync/password_proto_utils.h",
"sync/password_sync_bridge.cc",
diff --git a/components/password_manager/core/browser/login_database_async_helper.cc b/components/password_manager/core/browser/login_database_async_helper.cc
index d3fed063..d65fa9f 100644
--- a/components/password_manager/core/browser/login_database_async_helper.cc
+++ b/components/password_manager/core/browser/login_database_async_helper.cc
@@ -4,12 +4,17 @@
#include "components/password_manager/core/browser/login_database_async_helper.h"
+#include <memory>
+
#include "base/functional/bind.h"
#include "base/task/sequenced_task_runner.h"
#include "components/os_crypt/sync/os_crypt.h"
#include "components/password_manager/core/browser/login_database.h"
+#include "components/password_manager/core/browser/sync/incoming_password_sharing_invitation_sync_bridge.h"
+#include "components/password_manager/core/browser/sync/outgoing_password_sharing_invitation_sync_bridge.h"
#include "components/password_manager/core/browser/sync/password_proto_utils.h"
#include "components/password_manager/core/browser/sync/password_sync_bridge.h"
+#include "components/sync/base/model_type.h"
#include "components/sync/model/client_tag_based_model_type_processor.h"
#include "components/sync/model/model_type_controller_delegate.h"
@@ -68,11 +73,19 @@
base::Seconds(30));
}
- sync_bridge_ = std::make_unique<PasswordSyncBridge>(
+ password_sync_bridge_ = std::make_unique<PasswordSyncBridge>(
std::make_unique<syncer::ClientTagBasedModelTypeProcessor>(
syncer::PASSWORDS, base::DoNothing()),
static_cast<PasswordStoreSync*>(this),
std::move(sync_enabled_or_disabled_cb));
+ incoming_sharing_invitation_sync_bridge_ =
+ std::make_unique<IncomingPasswordSharingInvitationSyncBridge>(
+ std::make_unique<syncer::ClientTagBasedModelTypeProcessor>(
+ syncer::INCOMING_PASSWORD_SHARING_INVITATION, base::DoNothing()));
+ outgoing_sharing_invitation_sync_bridge_ =
+ std::make_unique<OutgoingPasswordSharingInvitationSyncBridge>(
+ std::make_unique<syncer::ClientTagBasedModelTypeProcessor>(
+ syncer::OUTGOING_PASSWORD_SHARING_INVITATION, base::DoNothing()));
// On Windows encryption capability is expected to be available by default.
// On MacOS encrpytion is also expected to be available unless the user didn't
@@ -142,8 +155,9 @@
BeginTransaction();
AddCredentialError error = AddCredentialError::kNone;
PasswordStoreChangeList changes = AddLoginImpl(form, &error);
- if (sync_bridge_ && !changes.empty())
- sync_bridge_->ActOnPasswordStoreChanges(changes);
+ if (password_sync_bridge_ && !changes.empty()) {
+ password_sync_bridge_->ActOnPasswordStoreChanges(changes);
+ }
// Sync metadata get updated in ActOnPasswordStoreChanges(). Therefore,
// CommitTransaction() must be called after ActOnPasswordStoreChanges(),
// because sync codebase needs to update metadata atomically together with
@@ -162,8 +176,9 @@
BeginTransaction();
UpdateCredentialError error = UpdateCredentialError::kNone;
PasswordStoreChangeList changes = UpdateLoginImpl(form, &error);
- if (sync_bridge_ && !changes.empty())
- sync_bridge_->ActOnPasswordStoreChanges(changes);
+ if (password_sync_bridge_ && !changes.empty()) {
+ password_sync_bridge_->ActOnPasswordStoreChanges(changes);
+ }
// Sync metadata get updated in ActOnPasswordStoreChanges(). Therefore,
// CommitTransaction() must be called after ActOnPasswordStoreChanges(),
// because sync codebase needs to update metadata atomically together with
@@ -182,8 +197,9 @@
BeginTransaction();
PasswordStoreChangeList changes;
if (login_db_ && login_db_->RemoveLogin(form, &changes)) {
- if (sync_bridge_ && !changes.empty())
- sync_bridge_->ActOnPasswordStoreChanges(changes);
+ if (password_sync_bridge_ && !changes.empty()) {
+ password_sync_bridge_->ActOnPasswordStoreChanges(changes);
+ }
}
// Sync metadata get updated in ActOnPasswordStoreChanges(). Therefore,
// CommitTransaction() must be called after ActOnPasswordStoreChanges(),
@@ -201,8 +217,9 @@
PasswordStoreChangeList changes;
bool success = login_db_ && login_db_->RemoveLoginsCreatedBetween(
delete_begin, delete_end, &changes);
- if (success && sync_bridge_ && !changes.empty())
- sync_bridge_->ActOnPasswordStoreChanges(changes);
+ if (success && password_sync_bridge_ && !changes.empty()) {
+ password_sync_bridge_->ActOnPasswordStoreChanges(changes);
+ }
// Sync metadata get updated in ActOnPasswordStoreChanges(). Therefore,
// CommitTransaction() must be called after ActOnPasswordStoreChanges(),
// because sync codebase needs to update metadata atomically together with
@@ -235,8 +252,9 @@
}
}
}
- if (sync_bridge_ && !changes.empty())
- sync_bridge_->ActOnPasswordStoreChanges(changes);
+ if (password_sync_bridge_ && !changes.empty()) {
+ password_sync_bridge_->ActOnPasswordStoreChanges(changes);
+ }
// Sync metadata get updated in ActOnPasswordStoreChanges(). Therefore,
// CommitTransaction() must be called after ActOnPasswordStoreChanges(),
// because sync codebase needs to update metadata atomically together with
@@ -347,7 +365,7 @@
base::WeakPtr<syncer::ModelTypeControllerDelegate>
LoginDatabaseAsyncHelper::GetSyncControllerDelegate() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- return sync_bridge_->change_processor()->GetControllerDelegate();
+ return password_sync_bridge_->change_processor()->GetControllerDelegate();
}
PasswordStoreChangeList LoginDatabaseAsyncHelper::AddCredentialSync(
diff --git a/components/password_manager/core/browser/login_database_async_helper.h b/components/password_manager/core/browser/login_database_async_helper.h
index b2c698d..8ad7fa6a 100644
--- a/components/password_manager/core/browser/login_database_async_helper.h
+++ b/components/password_manager/core/browser/login_database_async_helper.h
@@ -19,6 +19,8 @@
namespace password_manager {
class LoginDatabase;
+class IncomingPasswordSharingInvitationSyncBridge;
+class OutgoingPasswordSharingInvitationSyncBridge;
class PasswordSyncBridge;
class UnsyncedCredentialsDeletionNotifier;
@@ -36,7 +38,7 @@
~LoginDatabaseAsyncHelper() override;
- // Opens |login_db_| and creates |sync_bridge_|.
+ // Opens |login_db_| and creates sync bridges.
bool Initialize(
PasswordStoreBackend::RemoteChangesReceived remote_form_changes_received,
base::RepeatingClosure sync_enabled_or_disabled_cb);
@@ -125,12 +127,16 @@
std::unique_ptr<LoginDatabase> login_db_
GUARDED_BY_CONTEXT(sequence_checker_);
- std::unique_ptr<PasswordSyncBridge> sync_bridge_
+ std::unique_ptr<PasswordSyncBridge> password_sync_bridge_
GUARDED_BY_CONTEXT(sequence_checker_);
+ std::unique_ptr<IncomingPasswordSharingInvitationSyncBridge>
+ incoming_sharing_invitation_sync_bridge_;
+ std::unique_ptr<OutgoingPasswordSharingInvitationSyncBridge>
+ outgoing_sharing_invitation_sync_bridge_;
- // Whenever 'sync_bridge_'receive remote changes this callback is used to
- // notify PasswordStore observers about them. Called on a main sequence from
- // the 'NotifyLoginsChanged'.
+ // Whenever 'password_sync_bridge_' receive remote changes this callback is
+ // used to notify PasswordStore observers about them. Called on a main
+ // sequence from the 'NotifyLoginsChanged'.
PasswordStoreBackend::RemoteChangesReceived
remote_forms_changes_received_callback_
GUARDED_BY_CONTEXT(sequence_checker_);
diff --git a/components/password_manager/core/browser/sync/incoming_password_sharing_invitation_sync_bridge.cc b/components/password_manager/core/browser/sync/incoming_password_sharing_invitation_sync_bridge.cc
new file mode 100644
index 0000000..073535f7
--- /dev/null
+++ b/components/password_manager/core/browser/sync/incoming_password_sharing_invitation_sync_bridge.cc
@@ -0,0 +1,110 @@
+// 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.
+
+#include "components/password_manager/core/browser/sync/incoming_password_sharing_invitation_sync_bridge.h"
+
+#include "components/sync/model/in_memory_metadata_change_list.h"
+#include "components/sync/model/metadata_batch.h"
+#include "components/sync/model/metadata_change_list.h"
+#include "components/sync/model/model_type_change_processor.h"
+#include "components/sync/model/mutable_data_batch.h"
+
+namespace password_manager {
+
+IncomingPasswordSharingInvitationSyncBridge::
+ IncomingPasswordSharingInvitationSyncBridge(
+ std::unique_ptr<syncer::ModelTypeChangeProcessor> change_processor)
+ : syncer::ModelTypeSyncBridge(std::move(change_processor)) {
+ // TODO(crbug.com/1445868): read metadata from the store.
+ std::unique_ptr<syncer::MetadataBatch> batch =
+ std::make_unique<syncer::MetadataBatch>();
+ this->change_processor()->ModelReadyToSync(std::move(batch));
+}
+
+IncomingPasswordSharingInvitationSyncBridge::
+ ~IncomingPasswordSharingInvitationSyncBridge() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+}
+
+std::unique_ptr<syncer::MetadataChangeList>
+IncomingPasswordSharingInvitationSyncBridge::CreateMetadataChangeList() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ return std::make_unique<syncer::InMemoryMetadataChangeList>();
+}
+
+absl::optional<syncer::ModelError>
+IncomingPasswordSharingInvitationSyncBridge::MergeFullSyncData(
+ std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
+ syncer::EntityChangeList entity_data) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ NOTIMPLEMENTED();
+ return absl::nullopt;
+}
+
+absl::optional<syncer::ModelError>
+IncomingPasswordSharingInvitationSyncBridge::ApplyIncrementalSyncChanges(
+ std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
+ syncer::EntityChangeList entity_changes) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ NOTIMPLEMENTED();
+ return absl::nullopt;
+}
+
+void IncomingPasswordSharingInvitationSyncBridge::GetData(
+ StorageKeyList storage_keys,
+ DataCallback callback) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ NOTIMPLEMENTED();
+ auto batch = std::make_unique<syncer::MutableDataBatch>();
+ std::move(callback).Run(std::move(batch));
+}
+
+void IncomingPasswordSharingInvitationSyncBridge::GetAllDataForDebugging(
+ DataCallback callback) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ NOTIMPLEMENTED();
+ auto batch = std::make_unique<syncer::MutableDataBatch>();
+ std::move(callback).Run(std::move(batch));
+}
+
+std::string IncomingPasswordSharingInvitationSyncBridge::GetClientTag(
+ const syncer::EntityData& entity_data) {
+ NOTREACHED();
+ return std::string();
+}
+
+std::string IncomingPasswordSharingInvitationSyncBridge::GetStorageKey(
+ const syncer::EntityData& entity_data) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ NOTIMPLEMENTED();
+ return std::string();
+}
+
+bool IncomingPasswordSharingInvitationSyncBridge::SupportsGetClientTag() const {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ return false;
+}
+
+bool IncomingPasswordSharingInvitationSyncBridge::SupportsGetStorageKey()
+ const {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ return true;
+}
+
+void IncomingPasswordSharingInvitationSyncBridge::ApplyDisableSyncChanges(
+ std::unique_ptr<syncer::MetadataChangeList> delete_metadata_change_list) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ NOTIMPLEMENTED();
+}
+
+sync_pb::EntitySpecifics IncomingPasswordSharingInvitationSyncBridge::
+ TrimAllSupportedFieldsFromRemoteSpecifics(
+ const sync_pb::EntitySpecifics& entity_specifics) const {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ NOTIMPLEMENTED();
+ return ModelTypeSyncBridge::TrimAllSupportedFieldsFromRemoteSpecifics(
+ entity_specifics);
+}
+
+} // namespace password_manager
diff --git a/components/password_manager/core/browser/sync/incoming_password_sharing_invitation_sync_bridge.h b/components/password_manager/core/browser/sync/incoming_password_sharing_invitation_sync_bridge.h
new file mode 100644
index 0000000..51c21b4
--- /dev/null
+++ b/components/password_manager/core/browser/sync/incoming_password_sharing_invitation_sync_bridge.h
@@ -0,0 +1,58 @@
+// 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_PASSWORD_MANAGER_CORE_BROWSER_SYNC_INCOMING_PASSWORD_SHARING_INVITATION_SYNC_BRIDGE_H_
+#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_SYNC_INCOMING_PASSWORD_SHARING_INVITATION_SYNC_BRIDGE_H_
+
+#include <memory>
+#include "base/sequence_checker.h"
+#include "components/sync/model/model_type_sync_bridge.h"
+
+namespace syncer {
+class MetadataChangeList;
+class ModelTypeChangeProcessor;
+} // namespace syncer
+
+namespace password_manager {
+
+// Sync bridge implementation for INCOMING_PASSWORD_SHARING_INVITATION model
+// type.
+class IncomingPasswordSharingInvitationSyncBridge
+ : public syncer::ModelTypeSyncBridge {
+ public:
+ explicit IncomingPasswordSharingInvitationSyncBridge(
+ std::unique_ptr<syncer::ModelTypeChangeProcessor> change_processor);
+ IncomingPasswordSharingInvitationSyncBridge(
+ const IncomingPasswordSharingInvitationSyncBridge&) = delete;
+ IncomingPasswordSharingInvitationSyncBridge& operator=(
+ const IncomingPasswordSharingInvitationSyncBridge&) = delete;
+ ~IncomingPasswordSharingInvitationSyncBridge() override;
+
+ // ModelTypeSyncBridge implementation.
+ std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList()
+ override;
+ absl::optional<syncer::ModelError> MergeFullSyncData(
+ std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
+ syncer::EntityChangeList entity_data) override;
+ absl::optional<syncer::ModelError> ApplyIncrementalSyncChanges(
+ std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
+ syncer::EntityChangeList entity_changes) override;
+ void GetData(StorageKeyList storage_keys, DataCallback callback) override;
+ void GetAllDataForDebugging(DataCallback callback) override;
+ std::string GetClientTag(const syncer::EntityData& entity_data) override;
+ std::string GetStorageKey(const syncer::EntityData& entity_data) override;
+ bool SupportsGetClientTag() const override;
+ bool SupportsGetStorageKey() const override;
+ void ApplyDisableSyncChanges(std::unique_ptr<syncer::MetadataChangeList>
+ delete_metadata_change_list) override;
+ sync_pb::EntitySpecifics TrimAllSupportedFieldsFromRemoteSpecifics(
+ const sync_pb::EntitySpecifics& entity_specifics) const override;
+
+ private:
+ SEQUENCE_CHECKER(sequence_checker_);
+};
+
+} // namespace password_manager
+
+#endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_SYNC_INCOMING_PASSWORD_SHARING_INVITATION_SYNC_BRIDGE_H_
diff --git a/components/password_manager/core/browser/sync/outgoing_password_sharing_invitation_sync_bridge.cc b/components/password_manager/core/browser/sync/outgoing_password_sharing_invitation_sync_bridge.cc
new file mode 100644
index 0000000..d7e1ea4
--- /dev/null
+++ b/components/password_manager/core/browser/sync/outgoing_password_sharing_invitation_sync_bridge.cc
@@ -0,0 +1,109 @@
+// 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.
+
+#include "components/password_manager/core/browser/sync/outgoing_password_sharing_invitation_sync_bridge.h"
+
+#include "components/sync/model/dummy_metadata_change_list.h"
+#include "components/sync/model/metadata_batch.h"
+#include "components/sync/model/metadata_change_list.h"
+#include "components/sync/model/model_type_change_processor.h"
+#include "components/sync/model/mutable_data_batch.h"
+
+namespace password_manager {
+
+OutgoingPasswordSharingInvitationSyncBridge::
+ OutgoingPasswordSharingInvitationSyncBridge(
+ std::unique_ptr<syncer::ModelTypeChangeProcessor> change_processor)
+ : syncer::ModelTypeSyncBridge(std::move(change_processor)) {
+ // Current data type doesn't have persistent storage so it's ready to sync
+ // immediately.
+ this->change_processor()->ModelReadyToSync(
+ std::make_unique<syncer::MetadataBatch>());
+}
+
+OutgoingPasswordSharingInvitationSyncBridge::
+ ~OutgoingPasswordSharingInvitationSyncBridge() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+}
+
+std::unique_ptr<syncer::MetadataChangeList>
+OutgoingPasswordSharingInvitationSyncBridge::CreateMetadataChangeList() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ // The data type intentionally doesn't persist the data on disk, so metadata
+ // is just ignored.
+ return std::make_unique<syncer::DummyMetadataChangeList>();
+}
+
+absl::optional<syncer::ModelError>
+OutgoingPasswordSharingInvitationSyncBridge::MergeFullSyncData(
+ std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
+ syncer::EntityChangeList entity_data) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ DCHECK(entity_data.empty());
+ return absl::nullopt;
+}
+
+absl::optional<syncer::ModelError>
+OutgoingPasswordSharingInvitationSyncBridge::ApplyIncrementalSyncChanges(
+ std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
+ syncer::EntityChangeList entity_changes) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ NOTIMPLEMENTED();
+ return absl::nullopt;
+}
+
+void OutgoingPasswordSharingInvitationSyncBridge::GetData(
+ StorageKeyList storage_keys,
+ DataCallback callback) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ NOTIMPLEMENTED();
+ auto batch = std::make_unique<syncer::MutableDataBatch>();
+ std::move(callback).Run(std::move(batch));
+}
+
+void OutgoingPasswordSharingInvitationSyncBridge::GetAllDataForDebugging(
+ DataCallback callback) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ NOTIMPLEMENTED();
+ auto batch = std::make_unique<syncer::MutableDataBatch>();
+ std::move(callback).Run(std::move(batch));
+}
+
+std::string OutgoingPasswordSharingInvitationSyncBridge::GetClientTag(
+ const syncer::EntityData& entity_data) {
+ return GetStorageKey(entity_data);
+}
+
+std::string OutgoingPasswordSharingInvitationSyncBridge::GetStorageKey(
+ const syncer::EntityData& entity_data) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ return entity_data.specifics.outgoing_password_sharing_invitation().guid();
+}
+
+bool OutgoingPasswordSharingInvitationSyncBridge::SupportsGetClientTag() const {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ return true;
+}
+
+bool OutgoingPasswordSharingInvitationSyncBridge::SupportsGetStorageKey()
+ const {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ return true;
+}
+
+void OutgoingPasswordSharingInvitationSyncBridge::ApplyDisableSyncChanges(
+ std::unique_ptr<syncer::MetadataChangeList> delete_metadata_change_list) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ NOTIMPLEMENTED();
+}
+
+sync_pb::EntitySpecifics OutgoingPasswordSharingInvitationSyncBridge::
+ TrimAllSupportedFieldsFromRemoteSpecifics(
+ const sync_pb::EntitySpecifics& entity_specifics) const {
+ NOTIMPLEMENTED();
+ return ModelTypeSyncBridge::TrimAllSupportedFieldsFromRemoteSpecifics(
+ entity_specifics);
+}
+
+} // namespace password_manager
diff --git a/components/password_manager/core/browser/sync/outgoing_password_sharing_invitation_sync_bridge.h b/components/password_manager/core/browser/sync/outgoing_password_sharing_invitation_sync_bridge.h
new file mode 100644
index 0000000..223deb1
--- /dev/null
+++ b/components/password_manager/core/browser/sync/outgoing_password_sharing_invitation_sync_bridge.h
@@ -0,0 +1,58 @@
+// 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_PASSWORD_MANAGER_CORE_BROWSER_SYNC_OUTGOING_PASSWORD_SHARING_INVITATION_SYNC_BRIDGE_H_
+#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_SYNC_OUTGOING_PASSWORD_SHARING_INVITATION_SYNC_BRIDGE_H_
+
+#include <memory>
+#include "base/sequence_checker.h"
+#include "components/sync/model/model_type_sync_bridge.h"
+
+namespace syncer {
+class MetadataChangeList;
+class ModelTypeChangeProcessor;
+} // namespace syncer
+
+namespace password_manager {
+
+// Sync bridge implementation for OUTGOING_PASSWORD_SHARING_INVITATION model
+// type.
+class OutgoingPasswordSharingInvitationSyncBridge
+ : public syncer::ModelTypeSyncBridge {
+ public:
+ explicit OutgoingPasswordSharingInvitationSyncBridge(
+ std::unique_ptr<syncer::ModelTypeChangeProcessor> change_processor);
+ OutgoingPasswordSharingInvitationSyncBridge(
+ const OutgoingPasswordSharingInvitationSyncBridge&) = delete;
+ OutgoingPasswordSharingInvitationSyncBridge& operator=(
+ const OutgoingPasswordSharingInvitationSyncBridge&) = delete;
+ ~OutgoingPasswordSharingInvitationSyncBridge() override;
+
+ // ModelTypeSyncBridge implementation.
+ std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList()
+ override;
+ absl::optional<syncer::ModelError> MergeFullSyncData(
+ std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
+ syncer::EntityChangeList entity_data) override;
+ absl::optional<syncer::ModelError> ApplyIncrementalSyncChanges(
+ std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
+ syncer::EntityChangeList entity_changes) override;
+ void GetData(StorageKeyList storage_keys, DataCallback callback) override;
+ void GetAllDataForDebugging(DataCallback callback) override;
+ std::string GetClientTag(const syncer::EntityData& entity_data) override;
+ std::string GetStorageKey(const syncer::EntityData& entity_data) override;
+ bool SupportsGetClientTag() const override;
+ bool SupportsGetStorageKey() const override;
+ void ApplyDisableSyncChanges(std::unique_ptr<syncer::MetadataChangeList>
+ delete_metadata_change_list) override;
+ sync_pb::EntitySpecifics TrimAllSupportedFieldsFromRemoteSpecifics(
+ const sync_pb::EntitySpecifics& entity_specifics) const override;
+
+ private:
+ SEQUENCE_CHECKER(sequence_checker_);
+};
+
+} // namespace password_manager
+
+#endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_SYNC_OUTGOING_PASSWORD_SHARING_INVITATION_SYNC_BRIDGE_H_