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

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: Added message value to iOS grit whitelist 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 ced23b6c5b05cade7af96cc1086384c0e2ca494a..51fb59e10efebe2dc55a84a1d4fa154f3c121f3a 100644
--- a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
@@ -111,6 +111,7 @@ AutofillPopupControllerImpl::AutofillPopupControllerImpl(
base::Unretained(this)));
#if !defined(OS_ANDROID)
subtext_font_list_ = name_font_list_.DeriveWithSizeDelta(kLabelFontSizeDelta);
+ title_font_list_ = name_font_list_.DeriveWithStyle(gfx::Font::BOLD);
#if defined(OS_MACOSX)
// There is no italic version of the system font.
warning_font_list_ = name_font_list_;
@@ -259,7 +260,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);
@@ -404,6 +408,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_;
}
@@ -424,9 +431,13 @@ void AutofillPopupControllerImpl::SetSelectedLine(int selected_line) {
static_cast<size_t>(selected_line_) < identifiers_.size())
InvalidateRow(selected_line_);
- if (selected_line != kNoSelection)
+ if (selected_line != kNoSelection) {
InvalidateRow(selected_line);
+ if (!CanAccept(identifiers_[selected_line]))
+ selected_line = kNoSelection;
+ }
+
selected_line_ = selected_line;
if (selected_line_ != kNoSelection) {
@@ -521,7 +532,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 &&
+ id != POPUP_ITEM_ID_TITLE;
}
bool AutofillPopupControllerImpl::HasSuggestions() {

Powered by Google App Engine
This is Rietveld 408576698