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

Unified Diff: chrome/browser/password_manager/password_syncable_service.h

Issue 27233003: [Sync] Implementation of model association for passwords using sync API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For review. Created 7 years, 2 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
Index: chrome/browser/password_manager/password_syncable_service.h
diff --git a/chrome/browser/password_manager/password_syncable_service.h b/chrome/browser/password_manager/password_syncable_service.h
index dd32b2c323ab774c14fe583990b7c3724055809e..2ac0d712562126db73adec77bc161d622d814f1d 100644
--- a/chrome/browser/password_manager/password_syncable_service.h
+++ b/chrome/browser/password_manager/password_syncable_service.h
@@ -60,15 +60,38 @@ class PasswordSyncableService : public syncer::SyncableService {
const std::string& password_element,
const std::string& signon_realm);
+ // Converts the |PasswordForm| to |SyncData|.
Nicolas Zea 2013/10/25 20:20:13 nit: the || usually refer to variable names, so "t
lipalani1 2013/10/29 20:16:36 Done.
+ static syncer::SyncData CreateSyncData(
+ const autofill::PasswordForm& password);
+ static void ExtractPasswordFromSpecifics(
+ const sync_pb::PasswordSpecificsData& password,
+ autofill::PasswordForm* new_password);
+
private:
typedef std::vector<autofill::PasswordForm*> PasswordForms;
+ typedef std::map<std::string,
+ std::vector<autofill::PasswordForm*>::iterator>
+ PasswordEntryMap;
// Use the |PasswordStore| APIs to add and update entries.
- void WriteToPasswordStore(PasswordForms* new_entries,
- PasswordForms* udpated_entries);
-
- // Converts the |PasswordForm| to |SyncData| suitable for syncing.
- syncer::SyncData CreateSyncData(const autofill::PasswordForm& password);
+ void WriteToPasswordStore(const PasswordForms& new_entries,
+ const PasswordForms& updated_entries);
+
+ // Checks if |data|, the entry in sync db, needs to be created or updated
+ // in the passwords db. Depending on what action needs to be performed the
+ // entry is added to |new_entries| or |updated_entries|. If the item is
+ // identical to an entry in passwords db no action is performed. If an
+ // item needs to be updated in the sync database then the item is also
+ // added to |updated_db_entries| list.
+ void CreateOrUpdateEntry(
+ const syncer::SyncData& data,
+ PasswordEntryMap* loaded_data,
+ ScopedVector<autofill::PasswordForm>* new_entries,
+ ScopedVector<autofill::PasswordForm>* updated_entries,
+ syncer::SyncChangeList* updated_db_entries);
+
+ // Virtual so tests can override.
+ virtual void NotifyPasswordStore();
// The factory that creates sync errors. |SyncError| has rich data
// suitable for debugging.

Powered by Google App Engine
This is Rietveld 408576698