Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: chrome/browser/autofill/password_generator.h

Issue 10458018: This CL does the following: (1) Pass the max_length attribute to the password generator; (2) Update… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix a windows UI bug. Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autofill/autofill_manager.cc ('k') | chrome/browser/autofill/password_generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7c2f3d44f96fb223c75454f5de5fd206f64a887f 100644
--- a/chrome/browser/autofill/password_generator.h
+++ b/chrome/browser/autofill/password_generator.h
@@ -9,6 +9,7 @@
#include <string>
#include "base/basictypes.h"
+#include "base/gtest_prod_util.h"
namespace autofill {
@@ -18,14 +19,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|.
+ static const size_t kDefaultPasswordLength;
+ FRIEND_TEST_ALL_PREFIXES(PasswordGeneratorTest, PasswordLength);
+
+ // The length of the generated password.
+ const size_t password_length_;
DISALLOW_COPY_AND_ASSIGN(PasswordGenerator);
};
« no previous file with comments | « chrome/browser/autofill/autofill_manager.cc ('k') | chrome/browser/autofill/password_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698