OLD | NEW |
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_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_ |
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // |suggestions| from the password manager. | 48 // |suggestions| from the password manager. |
49 void OnShowPasswordSuggestions( | 49 void OnShowPasswordSuggestions( |
50 const autofill::FormFieldData& field, | 50 const autofill::FormFieldData& field, |
51 const gfx::RectF& bounds, | 51 const gfx::RectF& bounds, |
52 const std::vector<base::string16>& suggestions, | 52 const std::vector<base::string16>& suggestions, |
53 const std::vector<base::string16>& realms); | 53 const std::vector<base::string16>& realms); |
54 | 54 |
55 // Invoked to clear any page specific cached values. | 55 // Invoked to clear any page specific cached values. |
56 void Reset(); | 56 void Reset(); |
57 | 57 |
58 // A public version of AcceptSuggestion(), only for use in tests. | 58 // A public version of FillSuggestion(), only for use in tests. |
59 bool AcceptSuggestionForTest(const autofill::FormFieldData& field, | 59 bool FillSuggestionForTest(const autofill::FormFieldData& field, |
60 const base::string16& username); | 60 const base::string16& username); |
| 61 |
| 62 // A public version of PreviewSuggestion(), only for use in tests. |
| 63 bool PreviewSuggestionForTest(const autofill::FormFieldData& field, |
| 64 const base::string16& username); |
61 | 65 |
62 private: | 66 private: |
63 typedef std::map<autofill::FormFieldData, autofill::PasswordFormFillData> | 67 typedef std::map<autofill::FormFieldData, autofill::PasswordFormFillData> |
64 LoginToPasswordInfoMap; | 68 LoginToPasswordInfoMap; |
65 | 69 |
66 // Attempts to fill the password associated with user name |username|, and | 70 // Attempts to fill the password associated with user name |username|, and |
67 // returns true if it was successful. | 71 // returns true if it was successful. |
68 bool AcceptSuggestion(const autofill::FormFieldData& field, | 72 bool FillSuggestion(const autofill::FormFieldData& field, |
69 const base::string16& username); | 73 const base::string16& username); |
| 74 |
| 75 // Attempts to preview the password associated with user name |username|, and |
| 76 // returns true if it was successful. |
| 77 bool PreviewSuggestion(const autofill::FormFieldData& field, |
| 78 const base::string16& username); |
70 | 79 |
71 // If |current_username| matches a username for one of the login mappings in | 80 // If |current_username| matches a username for one of the login mappings in |
72 // |fill_data|, returns true and assigns the password to |out_password|. | 81 // |fill_data|, returns true and assigns the password to |out_password|. |
73 // Otherwise, returns false and leaves |out_password| untouched. | 82 // Otherwise, returns false and leaves |out_password| untouched. |
74 bool GetPasswordForUsername( | 83 bool GetPasswordForUsername( |
75 const base::string16& current_username, | 84 const base::string16& current_username, |
76 const autofill::PasswordFormFillData& fill_data, | 85 const autofill::PasswordFormFillData& fill_data, |
77 base::string16* out_password); | 86 base::string16* out_password); |
78 | 87 |
79 // Finds login information for a |node| that was previously filled. | 88 // Finds login information for a |node| that was previously filled. |
(...skipping 12 matching lines...) Expand all Loading... |
92 autofill::FormFieldData form_field_; | 101 autofill::FormFieldData form_field_; |
93 | 102 |
94 base::WeakPtrFactory<PasswordAutofillManager> weak_ptr_factory_; | 103 base::WeakPtrFactory<PasswordAutofillManager> weak_ptr_factory_; |
95 | 104 |
96 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillManager); | 105 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillManager); |
97 }; | 106 }; |
98 | 107 |
99 } // namespace password_manager | 108 } // namespace password_manager |
100 | 109 |
101 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_ | 110 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_ |
OLD | NEW |