Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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}
- Loading branch information
Rushan Suleymanov
authored and
Chromium LUCI CQ
committed
May 23, 2023
1 parent
692840e
commit 9d25ec3
Showing
7 changed files
with
381 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
...ts/password_manager/core/browser/sync/incoming_password_sharing_invitation_sync_bridge.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
58 changes: 58 additions & 0 deletions
58
...nts/password_manager/core/browser/sync/incoming_password_sharing_invitation_sync_bridge.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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_ |
Oops, something went wrong.