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 #include "components/autofill/core/browser/password_generator.h" | 5 #include "components/autofill/core/browser/password_generator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // No special characters included for now. | 87 // No special characters included for now. |
88 unsigned int mode = S_NB | S_CL | S_SL; | 88 unsigned int mode = S_NB | S_CL | S_SL; |
89 | 89 |
90 // gen_pron_pass() doesn't guarantee that it includes all of the type given | 90 // gen_pron_pass() doesn't guarantee that it includes all of the type given |
91 // in mode, so regenerate a few times if neccessary. | 91 // in mode, so regenerate a few times if neccessary. |
92 // TODO(gcasto): Is it worth regenerating at all? | 92 // TODO(gcasto): Is it worth regenerating at all? |
93 for (int i = 0; i < 10; ++i) { | 93 for (int i = 0; i < 10; ++i) { |
94 gen_pron_pass(password, unused_hypenated_password, | 94 gen_pron_pass(password, unused_hypenated_password, |
95 password_length_, password_length_, mode); | 95 password_length_, password_length_, mode); |
96 if (VerifyPassword(password)) | 96 if (VerifyPassword(password)) |
97 break; | 97 return std::string(password); |
98 } | 98 } |
99 | 99 |
100 // If the password still isn't conforming after a few iterations, force it | 100 // If the password still isn't conforming after a few iterations, force it |
101 // to be so. This may change a syllable in the password. | 101 // to be so. This may change a syllable in the password. |
102 std::string str_password(password); | 102 std::string str_password(password); |
103 if (!VerifyPassword(str_password)) { | 103 if (!VerifyPassword(str_password)) { |
104 ForceFixPassword(&str_password); | 104 ForceFixPassword(&str_password); |
105 } | 105 } |
106 return str_password; | 106 return str_password; |
107 } | 107 } |
108 | 108 |
109 } // namespace autofill | 109 } // namespace autofill |
OLD | NEW |