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..df5aedd95014d474bdd9810bbf9647aba6461f34 100644 |
--- a/chrome/browser/autofill/password_generator.h |
+++ b/chrome/browser/autofill/password_generator.h |
@@ -18,14 +18,26 @@ namespace autofill { |
// previous generated passwords, crowdsourcing, etc.) |
class PasswordGenerator { |
public: |
- PasswordGenerator(); |
+ // |max_length| is used as a hint for the generated password's length. |
+ explicit PasswordGenerator(size_t max_length); |
~PasswordGenerator(); |
- // Returns a random password. The string is guaranteed to be printable and |
- // will not include whitespace characters. |
- std::string Generate(); |
+ // Returns a random password such that: |
+ // (1) Each character is guaranteed to be a non-whitespace printable ASCII |
+ // character. |
+ // (2) The generated password will contain AT LEAST one upper case letter, one |
+ // lower case letter, one digit, and one other symbol. |
+ // (3) The password length will be equal to |password_length_| (see comment |
+ // for the constructor). |
+ std::string Generate() const; |
private: |
+ // Unit test also need to access |kDefaultPasswordLength_|. |
+ const size_t kDefaultPasswordLength_; |
Ilya Sherman
2012/06/04 21:17:52
nit: This variable should be static, and the name
zysxqn
2012/06/04 22:40:15
Done.
|
+ friend class PasswordGeneratorTest; |
Ilya Sherman
2012/06/04 21:17:52
nit: Please use the FRIEND_TEST_ALL_PREFIXES macro
zysxqn
2012/06/04 22:40:15
Done.
|
+ |
+ // The length of the generated password. |
+ const size_t password_length_; |
DISALLOW_COPY_AND_ASSIGN(PasswordGenerator); |
}; |