Index: chrome/browser/autofill/password_generator.h |
diff --git a/chrome/browser/autofill/password_generator.h b/chrome/browser/autofill/password_generator.h |
index 0adbd435f43627877a26595ce8d54079e397a196..6b886f753373ce592581cea92b04bd962415fceb 100644 |
--- a/chrome/browser/autofill/password_generator.h |
+++ b/chrome/browser/autofill/password_generator.h |
@@ -10,6 +10,8 @@ |
#include "base/basictypes.h" |
+const unsigned int kDefaultPasswordLength = 12; |
Ilya Sherman
2012/06/01 01:09:55
This should still be a member of the PasswordGener
zysxqn
2012/06/01 19:01:32
Hm, can you elaborate more on this? In that case w
Ilya Sherman
2012/06/01 19:32:10
There is only one test that needs access to this c
zysxqn
2012/06/01 22:32:54
Done.
|
+ |
namespace autofill { |
// Class to generate random passwords. Currently we just use a generic algorithm |
@@ -19,13 +21,24 @@ namespace autofill { |
class PasswordGenerator { |
public: |
PasswordGenerator(); |
Ilya Sherman
2012/06/01 01:09:55
nit: Is this constructor still needed?
zysxqn
2012/06/01 19:01:32
Prefer to keep it in case some application just wa
Ilya Sherman
2012/06/01 19:32:10
It's easy enough to re-add in case it's ever neede
zysxqn
2012/06/01 22:32:54
I'm fine with either way so I remove it as you sug
|
+ explicit PasswordGenerator(int max_length); |
Ilya Sherman
2012/06/01 01:09:55
nit: Please comment on the meaning of |max_length|
zysxqn
2012/06/01 19:01:32
Done.
|
~PasswordGenerator(); |
- // Returns a random password. The string is guaranteed to be printable and |
- // will not include whitespace characters. |
+ // Returns a random password such that: |
+ // (1) Each of its character is guaranteed to be printable and will not |
+ // include whitespace characters. |
Ilya Sherman
2012/06/01 01:09:55
nit: Perhaps: "Each character is guaranteed to be
zysxqn
2012/06/01 19:01:32
Done.
|
+ // (2) The generated password will contain AT LEAST one upper case letter, one |
+ // lower case letter, one digit, and one other symbol. |
+ // (3) The length of the password is determined by |max_length|, which is |
+ // passed through the corresponding renderer by examining the |
+ // InputElementAttribute. In particular, if |max_length| is reasonable |
+ // (i.e. [4, 20]), we set the |password_length_| to it. Otherwise, we use |
+ // the default length of 12. |
Ilya Sherman
2012/06/01 01:09:55
nit: This includes too many implementation details
zysxqn
2012/06/01 19:01:32
Done.
|
std::string Generate(); |
private: |
+ // The length of the generated password. |
+ int password_length_; |
Ilya Sherman
2012/06/01 01:09:55
nit: const size_t?
zysxqn
2012/06/01 19:01:32
Won't this make comparisons more complex since all
Ilya Sherman
2012/06/01 19:32:10
The other numbers should probably also all be unsi
zysxqn
2012/06/01 22:32:54
Changed all variables related to password length t
|
DISALLOW_COPY_AND_ASSIGN(PasswordGenerator); |
}; |