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/05 08:39:21
Why is this public? If it's just for testing, ple
lipalani1
2013/11/19 00:46:54
Done.
| |
66 static void ExtractPasswordFromSpecifics( | |
67 const sync_pb::PasswordSpecificsData& password, | |
68 autofill::PasswordForm* new_password); | |
Ilya Sherman
2013/11/05 08:39:21
Why is this public?
lipalani1
2013/11/19 00:46:54
made it private.
On 2013/11/05 08:39:21, Ilya Sher
| |
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, autofill::PasswordForm*> | |
73 PasswordEntryMap; | |
65 | 74 |
66 // Use the |PasswordStore| APIs to add and update entries. | 75 // Use the |PasswordStore| APIs to add and update entries. |
67 void WriteToPasswordStore(PasswordForms* new_entries, | 76 void WriteToPasswordStore(const PasswordForms& new_entries, |
68 PasswordForms* udpated_entries); | 77 const PasswordForms& updated_entries); |
69 | 78 |
70 // Converts the |PasswordForm| to |SyncData| suitable for syncing. | 79 // Checks if |data|, the entry in sync db, needs to be created or updated |
Ilya Sherman
2013/11/05 08:39:21
nit: "db" -> "database" (throughout)
lipalani1
2013/11/19 00:46:54
I borrowed the abbreviation db from db thread. So
Ilya Sherman
2013/11/19 22:49:03
I won't block the review on this, but I do think t
| |
71 syncer::SyncData CreateSyncData(const autofill::PasswordForm& password); | 80 // in the passwords db. Depending on what action needs to be performed the |
81 // entry is added to |new_entries| or |updated_entries|. If the item is | |
82 // identical to an entry in passwords db no action is performed. If an | |
Ilya Sherman
2013/11/05 08:39:21
nit: "an entry in passwords db no action" -> "an e
lipalani1
2013/11/19 00:46:54
Done.
| |
83 // item needs to be updated in the sync database then the item is also | |
84 // added to |updated_db_entries| list. | |
Ilya Sherman
2013/11/05 08:39:21
Please document that this method has a side-effect
lipalani1
2013/11/19 00:46:54
Done.
| |
85 void CreateOrUpdateEntry( | |
86 const syncer::SyncData& data, | |
87 PasswordEntryMap* loaded_data, | |
88 ScopedVector<autofill::PasswordForm>* new_entries, | |
89 ScopedVector<autofill::PasswordForm>* updated_entries, | |
90 syncer::SyncChangeList* updated_db_entries); | |
Ilya Sherman
2013/11/05 08:39:21
nit: "db" -> "database" in variable names as well.
lipalani1
2013/11/19 00:46:54
Done.
| |
91 | |
92 // Virtual so tests can override. | |
Ilya Sherman
2013/11/05 08:39:21
Please document what this method does.
Ilya Sherman
2013/11/05 08:39:21
Subclasses should not override private methods...
lipalani1
2013/11/19 00:46:54
Done.
lipalani1
2013/11/19 00:46:54
Done.
| |
93 virtual void NotifyPasswordStore(); | |
Ilya Sherman
2013/11/05 08:39:21
This method name is somewhat unclear -- what is th
lipalani1
2013/11/19 00:46:54
Done.
| |
72 | 94 |
73 // The factory that creates sync errors. |SyncError| has rich data | 95 // The factory that creates sync errors. |SyncError| has rich data |
74 // suitable for debugging. | 96 // suitable for debugging. |
75 scoped_ptr<syncer::SyncErrorFactory> sync_error_factory_; | 97 scoped_ptr<syncer::SyncErrorFactory> sync_error_factory_; |
76 | 98 |
77 // |SyncProcessor| will mirror the |PasswordStore| changes in the sync db. | 99 // |SyncProcessor| will mirror the |PasswordStore| changes in the sync db. |
78 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; | 100 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; |
79 | 101 |
80 // The password store that adds/updates/deletes password entries. | 102 // The password store that adds/updates/deletes password entries. |
81 scoped_refptr<PasswordStore> password_store_; | 103 scoped_refptr<PasswordStore> password_store_; |
82 }; | 104 }; |
83 | 105 |
84 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_SYNCABLE_SERVICE_H__ | 106 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_SYNCABLE_SERVICE_H__ |
85 | 107 |
OLD | NEW |