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

Unified Diff: chrome/browser/ui/views/autofill/autofill_popup_view_views.cc

Issue 2971783002: Skeleton for showing "Show all saved passwords row" for Linux/CrOs/Windows platforms (Closed)
Patch Set: more tests Created 3 years, 5 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: 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..6fc7090528daa81211c182ac75c5a7856396f609 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,11 @@ 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;
+ const bool is_icon_in_front_of_text_row =
+ (current_row_frontend_id ==
+ POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE ||
+ 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 +162,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 = is_icon_in_front_of_text_row == is_rtl;
int x_align_left = icon_on_the_right ? value_rect.right() : value_rect.x();
// Draw the Autofill icon, if one exists
@@ -176,7 +178,7 @@ 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 (is_icon_in_front_of_text_row) {
vasilii 2017/07/05 17:12:15 Here something strange is going on. - Do you want
melandory 2017/07/06 13:50:10 Yep, deliberately. Renamed.
x_align_left =
icon_x_align_left +
(is_rtl ? -AutofillPopupLayoutModel::kHttpWarningIconPadding
@@ -196,7 +198,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 (is_icon_in_front_of_text_row) {
vasilii 2017/07/05 17:12:15 Is |is_icon_in_front_of_text_row| saying "there is
melandory 2017/07/06 13:50:10 Done.
value_x_align_left += is_rtl ? -value_width : 0;
} else {
value_x_align_left =
@@ -219,7 +221,7 @@ void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas,
controller_->layout_model().GetLabelFontListForRow(index));
int label_x_align_left = x_align_left;
- if (is_http_warning) {
+ if (is_icon_in_front_of_text_row) {
label_x_align_left =
is_rtl ? value_rect.x() : value_rect.right() - label_width;
} else {

Powered by Google App Engine
This is Rietveld 408576698