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

Unified Diff: chrome/browser/ui/autofill/autofill_popup_controller_impl.cc

Issue 767353002: Support for password manager suggestions on password fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Address gcasto's comments Created 6 years 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: chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
index 72e6c2b13c7e0e5130b93fa8cd6b2cd77fb03810..323597908676cfa030eac834439662f29a205ca4 100644
--- a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
@@ -118,6 +118,7 @@ AutofillPopupControllerImpl::AutofillPopupControllerImpl(
#else
warning_font_list_ = name_font_list_.DeriveWithStyle(gfx::Font::ITALIC);
#endif
+ title_font_list_ = name_font_list_.DeriveWithStyle(gfx::Font::BOLD);
Evan Stade 2014/12/03 17:54:49 nit: put this below subtext_font_list so there are
jww 2014/12/04 18:59:56 Done.
#endif
}
@@ -260,7 +261,10 @@ bool AutofillPopupControllerImpl::HandleKeyPressEvent(
SelectNextLine();
return true;
case ui::VKEY_PRIOR: // Page up.
- SetSelectedLine(0);
+ // Set no line and then select the next line in case the first line is not
+ // selectable.
+ SetSelectedLine(kNoSelection);
+ SelectNextLine();
return true;
case ui::VKEY_NEXT: // Page down.
SetSelectedLine(names().size() - 1);
@@ -405,6 +409,9 @@ const gfx::FontList& AutofillPopupControllerImpl::GetNameFontListForRow(
if (identifiers_[index] == POPUP_ITEM_ID_WARNING_MESSAGE)
return warning_font_list_;
+ if (identifiers_[index] == POPUP_ITEM_ID_TITLE)
+ return title_font_list_;
+
return name_font_list_;
}
@@ -421,6 +428,10 @@ void AutofillPopupControllerImpl::SetSelectedLine(int selected_line) {
if (selected_line_ == selected_line)
return;
+ if (static_cast<size_t>(selected_line) < identifiers_.size() &&
+ !CanAccept(identifiers_[selected_line]))
Evan Stade 2014/12/03 17:54:49 I don't think this is right. You should be calling
jww 2014/12/04 18:59:56 Done, with the slight caveat that we actually have
+ return;
+
if (selected_line_ != kNoSelection &&
static_cast<size_t>(selected_line_) < identifiers_.size())
InvalidateRow(selected_line_);
@@ -522,7 +533,8 @@ int AutofillPopupControllerImpl::GetRowHeightFromId(int identifier) const {
}
bool AutofillPopupControllerImpl::CanAccept(int id) {
- return id != POPUP_ITEM_ID_SEPARATOR && id != POPUP_ITEM_ID_WARNING_MESSAGE;
+ return id != POPUP_ITEM_ID_SEPARATOR && id != POPUP_ITEM_ID_WARNING_MESSAGE &&
Evan Stade 2014/12/03 17:54:49 nit: put each inequality on its own row (or just r
jww 2014/12/04 18:59:56 This is the result of git-cl format, so I'm going
+ id != POPUP_ITEM_ID_TITLE;
}
bool AutofillPopupControllerImpl::HasSuggestions() {

Powered by Google App Engine
This is Rietveld 408576698