Index: components/autofill/content/renderer/password_autofill_agent.cc |
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc |
index 551afd9726e4dd2cf3a85858153896a880ef7fde..e9e679092a81d9bcf72017c86d9b202ed5a19006 100644 |
--- a/components/autofill/content/renderer/password_autofill_agent.cc |
+++ b/components/autofill/content/renderer/password_autofill_agent.cc |
@@ -4,6 +4,8 @@ |
#include "components/autofill/content/renderer/password_autofill_agent.h" |
+#include <vector> |
+ |
#include "base/bind.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/message_loop.h" |
@@ -486,15 +488,20 @@ void PasswordAutofillAgent::OnFillPasswordForm( |
void PasswordAutofillAgent::GetSuggestions( |
const PasswordFormFillData& fill_data, |
const base::string16& input, |
- std::vector<base::string16>* suggestions) { |
- if (StartsWith(fill_data.basic_data.fields[0].value, input, false)) |
+ std::vector<base::string16>* suggestions, |
+ std::vector<base::string16>* realms) { |
+ if (StartsWith(fill_data.basic_data.fields[0].value, input, false)) { |
suggestions->push_back(fill_data.basic_data.fields[0].value); |
+ realms->push_back(fill_data.preferred_realm); |
+ } |
for (PasswordFormFillData::LoginCollection::const_iterator iter = |
fill_data.additional_logins.begin(); |
iter != fill_data.additional_logins.end(); ++iter) { |
- if (StartsWith(iter->first, input, false)) |
+ if (StartsWith(iter->first, input, false)) { |
suggestions->push_back(iter->first); |
+ realms->push_back(iter->second.realm); |
+ } |
} |
for (PasswordFormFillData::UsernamesCollection::const_iterator iter = |
@@ -521,7 +528,11 @@ bool PasswordAutofillAgent::ShowSuggestionPopup( |
return false; |
std::vector<base::string16> suggestions; |
- GetSuggestions(fill_data, user_input.value(), &suggestions); |
+ std::vector<base::string16> suggestions_realms; |
+ GetSuggestions(fill_data, |
+ user_input.value(), |
+ &suggestions, |
+ &suggestions_realms); |
if (disable_popup_) { |
FormData form; |
@@ -540,7 +551,8 @@ bool PasswordAutofillAgent::ShowSuggestionPopup( |
Send(new AutofillHostMsg_ShowPasswordSuggestions(routing_id(), |
field, |
bounding_box_scaled, |
- suggestions)); |
+ suggestions, |
+ suggestions_realms)); |
return !suggestions.empty(); |
} |
@@ -583,7 +595,7 @@ bool PasswordAutofillAgent::FillUserNameAndPassword( |
if (DoUsernamesMatch(iter->first, current_username, |
exact_username_match)) { |
username = iter->first; |
- password = iter->second; |
+ password = iter->second.password; |
break; |
} |
} |