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

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

Issue 447873004: [Password Generation] Wait longer to dismiss suggestion UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments Created 6 years, 4 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
« no previous file with comments | « components/autofill/content/renderer/password_generation_agent.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/content/renderer/password_generation_agent.cc
diff --git a/components/autofill/content/renderer/password_generation_agent.cc b/components/autofill/content/renderer/password_generation_agent.cc
index e90f1c9c9b79e7f5b34dff22b7846f83b03942bf..b777c9c420815f295a49f5355995fb4e23b9ddfa 100644
--- a/components/autofill/content/renderer/password_generation_agent.cc
+++ b/components/autofill/content/renderer/password_generation_agent.cc
@@ -288,10 +288,12 @@ bool PasswordGenerationAgent::FocusedNodeHasChanged(
return true;
}
- // Only trigger if the password field is empty.
+ // Assume that if the password field has less than kMaximumOfferSize
+ // characters then the user is not finished typing their password and display
+ // the password suggestion.
if (!element->isReadOnly() &&
element->isEnabled() &&
- element->value().isEmpty()) {
+ element->value().length() <= kMaximumOfferSize) {
ShowGenerationPopup();
return true;
}
@@ -318,10 +320,7 @@ bool PasswordGenerationAgent::TextDidChangeInTextField(
// Offer generation again.
ShowGenerationPopup();
- } else if (!password_is_generated_) {
- // User has rejected the feature and has started typing a password.
- HidePopup();
- } else {
+ } else if (password_is_generated_) {
password_edited_ = true;
// Mirror edits to any confirmation password fields.
for (std::vector<blink::WebInputElement>::iterator it =
@@ -329,6 +328,14 @@ bool PasswordGenerationAgent::TextDidChangeInTextField(
it != password_elements_.end(); ++it) {
it->setValue(element.value());
}
+ } else if (element.value().length() > kMaximumOfferSize) {
+ // User has rejected the feature and has started typing a password.
+ HidePopup();
+ } else {
+ // Password isn't generated and there are fewer than kMaximumOfferSize
+ // characters typed, so keep offering the password. Note this function
+ // will just keep the previous popup if one is already showing.
+ ShowGenerationPopup();
}
return true;
« no previous file with comments | « components/autofill/content/renderer/password_generation_agent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698