Index: components/autofill/common/password_form_fill_data.cc |
diff --git a/components/autofill/common/password_form_fill_data.cc b/components/autofill/common/password_form_fill_data.cc |
index 99e089e5708990ae0e3777d42ad6f23ff5d46b9c..637d3f2064ac002d9cf7aea9b0826dbe9fee386e 100644 |
--- a/components/autofill/common/password_form_fill_data.cc |
+++ b/components/autofill/common/password_form_fill_data.cc |
@@ -5,6 +5,7 @@ |
#include "components/autofill/common/password_form_fill_data.h" |
#include "base/logging.h" |
+#include "base/utf_string_conversions.h" |
#include "components/autofill/common/form_field_data.h" |
namespace autofill { |
@@ -51,11 +52,25 @@ void InitPasswordFormFillData( |
result->basic_data.fields.push_back(password_field); |
result->wait_for_username = wait_for_username_before_autofill; |
+ if (preferred_match->original_signon_realm.empty()) { |
+ result->preferred_realm = ASCIIToUTF16(preferred_match->signon_realm); |
Ilya Sherman
2013/06/19 09:40:54
How do you know that the signon_realm is ASCII?
nyquist
2013/06/19 22:56:06
Changed to use UTF8->UTF16 instead.
|
+ } else { |
+ result->preferred_realm = |
+ ASCIIToUTF16(preferred_match->original_signon_realm); |
+ } |
Ilya Sherman
2013/06/19 09:40:54
nit: Might be nice to decompose a helper function
nyquist
2013/06/19 22:56:06
Done.
|
+ |
// Copy additional username/value pairs. |
content::PasswordFormMap::const_iterator iter; |
for (iter = matches.begin(); iter != matches.end(); iter++) { |
- if (iter->second != preferred_match) |
- result->additional_logins[iter->first] = iter->second->password_value; |
+ if (iter->second != preferred_match) { |
+ PasswordAndRealm value; |
+ value.password = iter->second->password_value; |
+ if (iter->second->original_signon_realm.empty()) |
+ value.realm = ASCIIToUTF16(iter->second->signon_realm); |
+ else |
+ value.realm = ASCIIToUTF16(iter->second->original_signon_realm); |
+ result->additional_logins[iter->first] = value; |
+ } |
if (enable_other_possible_usernames && |
!iter->second->other_possible_usernames.empty()) { |
// Note that there may be overlap between other_possible_usernames and |