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

Side by Side Diff: components/autofill/core/browser/password_generator.h

Issue 308503002: [Password Generation] Start using pronouncable passwords (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unnecessary includes Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_PASSWORD_GENERATOR_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_PASSWORD_GENERATOR_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PASSWORD_GENERATOR_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PASSWORD_GENERATOR_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 12
13 namespace autofill { 13 namespace autofill {
14 14
15 // Class to generate random passwords. Currently we just use a generic algorithm 15 // Class to generate random passwords. Currently we just use a generic algorithm
16 // for all sites, but eventually we can incorporate additional information to 16 // for all sites, but eventually we can incorporate additional information to
17 // determine passwords that are likely to be accepted (i.e. use pattern field, 17 // determine passwords that are likely to be accepted (i.e. use pattern field,
18 // previous generated passwords, crowdsourcing, etc.) 18 // previous generated passwords, crowdsourcing, etc.)
19 class PasswordGenerator { 19 class PasswordGenerator {
20 public: 20 public:
21 // |max_length| is used as a hint for the generated password's length. 21 // |max_length| is used as a hint for the generated password's length.
22 explicit PasswordGenerator(int max_length); 22 explicit PasswordGenerator(int max_length);
23 ~PasswordGenerator(); 23 ~PasswordGenerator();
24 24
25 // Returns a random password such that: 25 // Returns a random password such that:
26 // (1) Each character is guaranteed to be a non-whitespace printable ASCII 26 // (1) Each character is guaranteed to be a non-whitespace printable ASCII
27 // character. 27 // character.
28 // (2) The generated password will contain AT LEAST one upper case letter, one 28 // (2) The generated password will contain AT LEAST one upper case letter, one
29 // lower case letter, one digit, and EXACTLY one other symbol. 29 // lower case letter, and one digit.
30 // (3) The password length will be equal to |password_length_| (see comment 30 // (3) The password length will be equal to |password_length_| (see comment
31 // for the constructor). 31 // for the constructor).
32 // Not thread safe. 32 // Not thread safe.
33 std::string Generate() const; 33 std::string Generate() const;
34 34
35 private: 35 private:
36 // Unit test also need to access |kDefaultPasswordLength|. 36 // Unit test also need to access |kDefaultPasswordLength|.
37 static const int kDefaultPasswordLength; 37 static const int kDefaultPasswordLength;
38 FRIEND_TEST_ALL_PREFIXES(PasswordGeneratorTest, PasswordLength); 38 FRIEND_TEST_ALL_PREFIXES(PasswordGeneratorTest, PasswordLength);
39 39
40 // The length of the generated password. 40 // The length of the generated password.
41 const int password_length_; 41 const int password_length_;
42 42
43 DISALLOW_COPY_AND_ASSIGN(PasswordGenerator); 43 DISALLOW_COPY_AND_ASSIGN(PasswordGenerator);
44 }; 44 };
45 45
46 } // namespace autofill 46 } // namespace autofill
47 47
48 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PASSWORD_GENERATOR_H_ 48 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PASSWORD_GENERATOR_H_
OLDNEW
« no previous file with comments | « components/autofill/core/browser/DEPS ('k') | components/autofill/core/browser/password_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698