Chromium Code Reviews| Index: chrome/browser/ui/views/autofill/autofill_popup_view_views.cc |
| diff --git a/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc b/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc |
| index ad9bd1d676f707874ef91c809544bfbe8ca8efab..23d68da54999b0a78077e71d07f3c10b8c24fd5e 100644 |
| --- a/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc |
| +++ b/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc |
| @@ -150,9 +150,12 @@ void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas, |
| GetNativeTheme()->GetSystemColor( |
| controller_->GetBackgroundColorIDForRow(index))); |
| - const bool is_http_warning = |
| - (controller_->GetSuggestionAt(index).frontend_id == |
| - POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE); |
| + int current_row_frontend_id = controller_->GetSuggestionAt(index).frontend_id; |
|
Evan Stade
2017/07/13 16:48:43
same nits as before: const int and no "current_row
melandory
2017/07/25 15:08:50
Done.
|
| + const bool is_http_warning = (current_row_frontend_id == |
| + POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE); |
| + const bool icon_in_front_of_text = |
| + (is_http_warning || |
| + current_row_frontend_id == POPUP_ITEM_ID_ALL_SAVED_PASSWORDS_ENTRY); |
| const bool is_rtl = controller_->IsRTL(); |
| const int text_align = |
| is_rtl ? gfx::Canvas::TEXT_ALIGN_RIGHT : gfx::Canvas::TEXT_ALIGN_LEFT; |
| @@ -160,7 +163,7 @@ void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas, |
| value_rect.Inset(AutofillPopupLayoutModel::kEndPadding, 0); |
| // If the icon is on the right of the rect, no matter in RTL or LTR mode. |
| - bool icon_on_the_right = is_http_warning == is_rtl; |
| + bool icon_on_the_right = icon_in_front_of_text == is_rtl; |
| int x_align_left = icon_on_the_right ? value_rect.right() : value_rect.x(); |
| // Draw the Autofill icon, if one exists |
| @@ -176,12 +179,13 @@ void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas, |
| canvas->DrawImageInt(image, icon_x_align_left, icon_y); |
| // An icon was drawn; adjust the |x_align_left| value for the next element. |
| - if (is_http_warning) { |
| + if (icon_in_front_of_text) { |
| x_align_left = |
| icon_x_align_left + |
| - (is_rtl ? -AutofillPopupLayoutModel::kHttpWarningIconPadding |
| - : image.width() + |
| - AutofillPopupLayoutModel::kHttpWarningIconPadding); |
| + (is_rtl |
| + ? -AutofillPopupLayoutModel::kPaddingBetweenLeftSideIconAndText |
|
Evan Stade
2017/07/13 16:48:43
nit: can we rename kPaddingBetweenLeftSideIconAndT
melandory
2017/07/25 15:08:50
Done.
|
| + : image.width() + AutofillPopupLayoutModel:: |
| + kPaddingBetweenLeftSideIconAndText); |
| } else { |
| x_align_left = |
| icon_x_align_left + |
| @@ -196,7 +200,7 @@ void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas, |
| controller_->layout_model().GetValueFontListForRow(index)); |
| int value_x_align_left = x_align_left; |
| - if (is_http_warning) { |
| + if (icon_in_front_of_text) { |
| value_x_align_left += is_rtl ? -value_width : 0; |
| } else { |
| value_x_align_left = |