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

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: 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
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..a5319ff7c0a76f6b1d81c34bfde2c6e7bfbc9130 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
Ilya Sherman 2014/08/06 22:25:08 Optional nit: Hmm, "kMaximumOfferSize" makes me th
Garrett Casto 2014/08/08 18:19:19 Ah, there actually is an off by one error here. Th
+ // characters then the user is not finished typing their password and display
+ // the password suggestion.
Ilya Sherman 2014/08/06 22:25:08 This comment suggests that we think the user proba
Garrett Casto 2014/08/08 18:19:19 I think the idea is that they aren't finish, so it
if (!element->isReadOnly() &&
element->isEnabled() &&
- element->value().isEmpty()) {
+ element->value().length() < kMaximumOfferSize) {
Ilya Sherman 2014/08/06 22:25:08 Optional nit: I think .size() is more commonly use
Garrett Casto 2014/08/08 18:19:19 blink::WebString doesn't have size()
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,13 @@ bool PasswordGenerationAgent::TextDidChangeInTextField(
it != password_elements_.end(); ++it) {
it->setValue(element.value());
}
+ } else if (element.value().length() > kMaximumOfferSize) {
Ilya Sherman 2014/08/06 22:25:08 If the comparison above is "<", then the inverse h
Garrett Casto 2014/08/08 18:19:19 This one is right, the other is wrong.
+ // User has rejected the feature and has started typing a password.
+ HidePopup();
+ } else {
+ // Password isn't generated and there is less than kMaximumOfferSize
Ilya Sherman 2014/08/06 22:25:08 nit: "is less" -> "are fewer"
Garrett Casto 2014/08/08 18:19:19 Done.
+ // characters typed, so keep offering the password.
+ ShowGenerationPopup();
Ilya Sherman 2014/08/06 22:25:08 This looks like it'll show a new popup, rather tha
Garrett Casto 2014/08/08 18:19:19 It actually just updates the bounds of the current
}
return true;

Powered by Google App Engine
This is Rietveld 408576698