Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(573)

Unified Diff: components/password_manager/core/browser/password_syncable_service.h

Issue 2981293003: Save Android Autofill credentials in the right format. (Closed)
Patch Set: test comment Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/password_manager/core/browser/password_syncable_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « no previous file | components/password_manager/core/browser/password_syncable_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698