OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_SYNCABLE_SERVICE_H__ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_SYNCABLE_SERVICE_H__ |
6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_SYNCABLE_SERVICE_H__ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_SYNCABLE_SERVICE_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 // Returns the unique tag that will serve as the sync identifier for the | 53 // Returns the unique tag that will serve as the sync identifier for the |
54 // |password| entry. | 54 // |password| entry. |
55 static std::string MakeTag(const autofill::PasswordForm& password); | 55 static std::string MakeTag(const autofill::PasswordForm& password); |
56 static std::string MakeTag(const sync_pb::PasswordSpecificsData& password); | 56 static std::string MakeTag(const sync_pb::PasswordSpecificsData& password); |
57 static std::string MakeTag(const std::string& origin_url, | 57 static std::string MakeTag(const std::string& origin_url, |
58 const std::string& username_element, | 58 const std::string& username_element, |
59 const std::string& username_value, | 59 const std::string& username_value, |
60 const std::string& password_element, | 60 const std::string& password_element, |
61 const std::string& signon_realm); | 61 const std::string& signon_realm); |
62 | 62 |
63 // Converts the |password| into a SyncData object. | |
64 static syncer::SyncData CreateSyncData( | |
65 const autofill::PasswordForm& password); | |
Ilya Sherman
2013/11/02 02:05:00
nit: Please leave a blank line between function de
| |
66 static void ExtractPasswordFromSpecifics( | |
67 const sync_pb::PasswordSpecificsData& password, | |
68 autofill::PasswordForm* new_password); | |
69 | |
63 private: | 70 private: |
64 typedef std::vector<autofill::PasswordForm*> PasswordForms; | 71 typedef std::vector<autofill::PasswordForm*> PasswordForms; |
72 typedef std::map<std::string, | |
73 std::vector<autofill::PasswordForm*>::iterator> | |
74 PasswordEntryMap; | |
Nicolas Zea
2013/11/01 21:45:34
I just realized this contains iterators to another
| |
65 | 75 |
66 // Use the |PasswordStore| APIs to add and update entries. | 76 // Use the |PasswordStore| APIs to add and update entries. |
67 void WriteToPasswordStore(PasswordForms* new_entries, | 77 void WriteToPasswordStore(const PasswordForms& new_entries, |
68 PasswordForms* udpated_entries); | 78 const PasswordForms& updated_entries); |
69 | 79 |
70 // Converts the |PasswordForm| to |SyncData| suitable for syncing. | 80 // Checks if |data|, the entry in sync db, needs to be created or updated |
71 syncer::SyncData CreateSyncData(const autofill::PasswordForm& password); | 81 // in the passwords db. Depending on what action needs to be performed the |
82 // entry is added to |new_entries| or |updated_entries|. If the item is | |
83 // identical to an entry in passwords db no action is performed. If an | |
84 // item needs to be updated in the sync database then the item is also | |
85 // added to |updated_db_entries| list. | |
86 void CreateOrUpdateEntry( | |
87 const syncer::SyncData& data, | |
88 PasswordEntryMap* loaded_data, | |
89 ScopedVector<autofill::PasswordForm>* new_entries, | |
90 ScopedVector<autofill::PasswordForm>* updated_entries, | |
91 syncer::SyncChangeList* updated_db_entries); | |
92 | |
93 // Virtual so tests can override. | |
94 virtual void NotifyPasswordStore(); | |
72 | 95 |
73 // The factory that creates sync errors. |SyncError| has rich data | 96 // The factory that creates sync errors. |SyncError| has rich data |
74 // suitable for debugging. | 97 // suitable for debugging. |
75 scoped_ptr<syncer::SyncErrorFactory> sync_error_factory_; | 98 scoped_ptr<syncer::SyncErrorFactory> sync_error_factory_; |
76 | 99 |
77 // |SyncProcessor| will mirror the |PasswordStore| changes in the sync db. | 100 // |SyncProcessor| will mirror the |PasswordStore| changes in the sync db. |
78 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; | 101 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; |
79 | 102 |
80 // The password store that adds/updates/deletes password entries. | 103 // The password store that adds/updates/deletes password entries. |
81 scoped_refptr<PasswordStore> password_store_; | 104 scoped_refptr<PasswordStore> password_store_; |
82 }; | 105 }; |
83 | 106 |
84 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_SYNCABLE_SERVICE_H__ | 107 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_SYNCABLE_SERVICE_H__ |
85 | 108 |
OLD | NEW |