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

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

Issue 2517843002: Http Bad: Put icon on the left of http warning message on Views (Closed)
Patch Set: add test Created 4 years, 1 month 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_layout_model.cc
diff --git a/chrome/browser/ui/autofill/autofill_popup_layout_model.cc b/chrome/browser/ui/autofill/autofill_popup_layout_model.cc
index 532bbf9cf4dce5afcf2cb5003d3833785e95051d..31c21679300121499112efe7433b6277f9279498 100644
--- a/chrome/browser/ui/autofill/autofill_popup_layout_model.cc
+++ b/chrome/browser/ui/autofill/autofill_popup_layout_model.cc
@@ -111,11 +111,13 @@ int AutofillPopupLayoutModel::GetDesiredPopupWidth() const {
int AutofillPopupLayoutModel::RowWidthWithoutText(int row,
bool with_label) const {
std::vector<autofill::Suggestion> suggestions = delegate_->GetSuggestions();
+ bool isWarningMessage = (suggestions[row].frontend_id ==
+ POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE);
int row_size = kEndPadding;
if (with_label)
- row_size += kNamePadding;
+ row_size += isWarningMessage ? kHttpWarningNamePadding : kNamePadding;
// Add the Autofill icon size, if required.
const base::string16& icon = suggestions[row].icon;
@@ -123,7 +125,8 @@ int AutofillPopupLayoutModel::RowWidthWithoutText(int row,
int icon_width = ui::ResourceBundle::GetSharedInstance()
.GetImageNamed(GetIconResourceID(icon))
.Width();
- row_size += icon_width + kIconPadding;
+ row_size += isWarningMessage ? icon_width + kHttpWarningIconPadding
+ : icon_width + kIconPadding;
}
// Add the padding at the end.
@@ -179,7 +182,13 @@ const gfx::FontList& AutofillPopupLayoutModel::GetValueFontListForRow(
return normal_font_list_;
}
-const gfx::FontList& AutofillPopupLayoutModel::GetLabelFontList() const {
+const gfx::FontList& AutofillPopupLayoutModel::GetLabelFontListForRow(
+ size_t index) const {
+ std::vector<autofill::Suggestion> suggestions = delegate_->GetSuggestions();
+ PopupItemId id = static_cast<PopupItemId>(suggestions[index].frontend_id);
+ if (id == POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE)
Mathieu 2016/11/22 14:36:45 curious, can't you do if (suggestions[index].fron
lshang 2016/11/27 04:59:13 Done.
+ return normal_font_list_;
+
return smaller_font_list_;
}

Powered by Google App Engine
This is Rietveld 408576698