| Index: components/password_manager/core/browser/password_syncable_service.h
|
| diff --git a/components/password_manager/core/browser/password_syncable_service.h b/components/password_manager/core/browser/password_syncable_service.h
|
| index 50ab358c080cb0bb022d7b2daf579e35948c8d73..98b6bcc8ab35147ca38a26e0f92e2dcb72b0bd99 100644
|
| --- a/components/password_manager/core/browser/password_syncable_service.h
|
| +++ b/components/password_manager/core/browser/password_syncable_service.h
|
| @@ -11,6 +11,7 @@
|
|
|
| #include "base/macros.h"
|
| #include "base/sequence_checker.h"
|
| +#include "base/time/clock.h"
|
| #include "components/password_manager/core/browser/password_store_change.h"
|
| #include "components/sync/model/sync_change.h"
|
| #include "components/sync/model/sync_data.h"
|
| @@ -60,6 +61,12 @@ class PasswordSyncableService : public syncer::SyncableService {
|
| void InjectStartSyncFlare(
|
| const syncer::SyncableService::StartSyncFlare& flare);
|
|
|
| +#if defined(UNIT_TEST)
|
| + void set_clock(std::unique_ptr<base::Clock> clock) {
|
| + clock_ = std::move(clock);
|
| + }
|
| +#endif
|
| +
|
| private:
|
| // Map from password sync tag to password form.
|
| typedef std::map<std::string, autofill::PasswordForm*> PasswordEntryMap;
|
| @@ -80,15 +87,24 @@ class PasswordSyncableService : public syncer::SyncableService {
|
| // Uses the |PasswordStore| APIs to change entries.
|
| void WriteToPasswordStore(const SyncEntries& entries);
|
|
|
| - // Examines |data|, an entry in sync db, and updates |sync_entries| or
|
| - // |updated_db_entries| accordingly. An element is removed from
|
| - // |unmatched_data_from_password_db| if its tag is identical to |data|'s.
|
| - static void CreateOrUpdateEntry(
|
| - const syncer::SyncData& data,
|
| + // Goes through |sync_data| and for each entry merges the data with
|
| + // |unmatched_data_from_password_db|. The result of merge is recorded in
|
| + // |sync_entries| or |updated_db_entries|. Successfully merged elements are
|
| + // removed from |unmatched_data_from_password_db|.
|
| + void MergeSyncDataWithLocalData(
|
| + const syncer::SyncDataList& sync_data,
|
| PasswordEntryMap* unmatched_data_from_password_db,
|
| SyncEntries* sync_entries,
|
| syncer::SyncChangeList* updated_db_entries);
|
|
|
| + // Examines |data|, an entry in sync db, and updates |sync_entries| or
|
| + // |updated_db_entries| accordingly. An element is removed from
|
| + // |unmatched_data_from_password_db| if its tag is identical to |data|'s.
|
| + void CreateOrUpdateEntry(const sync_pb::PasswordSpecificsData& data,
|
| + PasswordEntryMap* unmatched_data_from_password_db,
|
| + SyncEntries* sync_entries,
|
| + syncer::SyncChangeList* updated_db_entries);
|
| +
|
| // Calls |operation| for each element in |entries| and appends the changes to
|
| // |all_changes|.
|
| void WriteEntriesToDatabase(
|
| @@ -109,6 +125,9 @@ class PasswordSyncableService : public syncer::SyncableService {
|
| // A signal activated by this class to start sync as soon as possible.
|
| syncer::SyncableService::StartSyncFlare flare_;
|
|
|
| + // Clock for date_synced updates.
|
| + std::unique_ptr<base::Clock> clock_;
|
| +
|
| // True if processing sync changes is in progress.
|
| bool is_processing_sync_changes_;
|
|
|
|
|