Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_AUTOFILL_PASSWORD_GENERATOR_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_PASSWORD_GENERATOR_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_PASSWORD_GENERATOR_H_ | 6 #define CHROME_BROWSER_AUTOFILL_PASSWORD_GENERATOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.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 PasswordGenerator(); | 21 PasswordGenerator(); |
| 22 ~PasswordGenerator(); | 22 ~PasswordGenerator(); |
| 23 | 23 |
| 24 // Returns a random password. The string is guaranteed to be printable and | 24 // Returns a random password. The string is guaranteed to be printable and |
| 25 // will not include whitespace characters. | 25 // will not include whitespace characters. Furthermore, it has a maximum |
| 26 std::string Generate(); | 26 // length specified by the |max_length|, and contains AT LEAST one upper |
| 27 // case letter, one lower case letter, one digit, and one other symbol. | |
| 28 std::string Generate(int max_length); | |
|
Garrett Casto
2012/05/30 00:46:35
I was wondering if we might want to change the way
zysxqn
2012/05/31 21:54:08
I like the idea of passing a PasswordGenerator to
| |
| 27 | 29 |
| 28 private: | 30 private: |
| 29 | 31 |
| 30 DISALLOW_COPY_AND_ASSIGN(PasswordGenerator); | 32 DISALLOW_COPY_AND_ASSIGN(PasswordGenerator); |
| 31 }; | 33 }; |
| 32 | 34 |
| 33 } // namespace autofill | 35 } // namespace autofill |
| 34 | 36 |
| 35 #endif // CHROME_BROWSER_AUTOFILL_PASSWORD_GENERATOR_H_ | 37 #endif // CHROME_BROWSER_AUTOFILL_PASSWORD_GENERATOR_H_ |
| OLD | NEW |