OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_REUSE_DETECTOR_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_REUSE_DETECTOR_H_ |
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_REUSE_DETECTOR_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_REUSE_DETECTOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // If such suffix is found, |consumer|->OnReuseFound() is called on the same | 51 // If such suffix is found, |consumer|->OnReuseFound() is called on the same |
52 // thread on which this method is called. | 52 // thread on which this method is called. |
53 // |consumer| should not be null. | 53 // |consumer| should not be null. |
54 void CheckReuse(const base::string16& input, | 54 void CheckReuse(const base::string16& input, |
55 const std::string& domain, | 55 const std::string& domain, |
56 PasswordReuseDetectorConsumer* consumer); | 56 PasswordReuseDetectorConsumer* consumer); |
57 | 57 |
58 // Saves a hash of |password| for password reuse checking. | 58 // Saves a hash of |password| for password reuse checking. |
59 void SaveSyncPasswordHash(const base::string16& password); | 59 void SaveSyncPasswordHash(const base::string16& password); |
60 | 60 |
| 61 // Clears a sync password hash if it was saved. |
| 62 void ClearSyncPasswordHash(); |
| 63 |
61 private: | 64 private: |
62 using passwords_iterator = std::map<base::string16, | 65 using passwords_iterator = std::map<base::string16, |
63 std::set<std::string>, | 66 std::set<std::string>, |
64 ReverseStringLess>::const_iterator; | 67 ReverseStringLess>::const_iterator; |
65 | 68 |
66 // Add password from |form| to |passwords_|. | 69 // Add password from |form| to |passwords_|. |
67 void AddPassword(const autofill::PasswordForm& form); | 70 void AddPassword(const autofill::PasswordForm& form); |
68 | 71 |
69 // Returns true iff a reuse of a sync password is found. If reuse is found it | 72 // Returns true iff a reuse of a sync password is found. If reuse is found it |
70 // is reported to |consumer|. | 73 // is reported to |consumer|. |
(...skipping 24 matching lines...) Expand all Loading... |
95 | 98 |
96 base::Optional<uint64_t> sync_password_hash_; | 99 base::Optional<uint64_t> sync_password_hash_; |
97 PrefService* const prefs_; | 100 PrefService* const prefs_; |
98 | 101 |
99 DISALLOW_COPY_AND_ASSIGN(PasswordReuseDetector); | 102 DISALLOW_COPY_AND_ASSIGN(PasswordReuseDetector); |
100 }; | 103 }; |
101 | 104 |
102 } // namespace password_manager | 105 } // namespace password_manager |
103 | 106 |
104 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_REUSE_DETECTOR_H_ | 107 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_REUSE_DETECTOR_H_ |
OLD | NEW |