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

Unified Diff: components/autofill/content/renderer/password_autofill_agent.cc

Issue 15660018: [autofill] Add support for PSL domain matching for password autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments from palmer Created 7 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 side-by-side diff with in-line comments
Download patch
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;
}
}

Powered by Google App Engine
This is Rietveld 408576698