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

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: Fixed test expectation to match intention and comment 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 ab36e6efeca09923c1e8d1a676e147f2414d0aa7..482c82411822c23adc5ae6130d47a95d24add583 100644
--- a/components/autofill/content/renderer/password_autofill_agent.cc
+++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -8,6 +8,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
+#include "base/strings/utf_string_conversions.h"
#include "components/autofill/content/renderer/form_autofill_util.h"
#include "components/autofill/core/common/autofill_messages.h"
#include "components/autofill/core/common/form_field_data.h"
@@ -493,15 +494,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(UTF8ToUTF16(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(UTF8ToUTF16(iter->second.realm));
+ }
}
for (PasswordFormFillData::UsernamesCollection::const_iterator iter =
@@ -528,7 +534,8 @@ bool PasswordAutofillAgent::ShowSuggestionPopup(
return false;
std::vector<base::string16> suggestions;
- GetSuggestions(fill_data, user_input.value(), &suggestions);
+ std::vector<base::string16> realms;
+ GetSuggestions(fill_data, user_input.value(), &suggestions, &realms);
if (disable_popup_) {
FormData form;
@@ -547,7 +554,8 @@ bool PasswordAutofillAgent::ShowSuggestionPopup(
Send(new AutofillHostMsg_ShowPasswordSuggestions(routing_id(),
field,
bounding_box_scaled,
- suggestions));
+ suggestions,
+ realms));
return !suggestions.empty();
}
@@ -590,7 +598,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