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

Side by Side Diff: chrome/browser/ui/views/autofill/autofill_popup_view_views.cc

Issue 2152243002: [Autofill] Tweak credit card signin promo visually. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/autofill/autofill_popup_view_views.h" 5 #include "chrome/browser/ui/views/autofill/autofill_popup_view_views.h"
6 6
7 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" 7 #include "chrome/browser/ui/autofill/autofill_popup_controller.h"
8 #include "chrome/browser/ui/autofill/autofill_popup_layout_model.h" 8 #include "chrome/browser/ui/autofill/autofill_popup_layout_model.h"
9 #include "components/autofill/core/browser/popup_item_ids.h" 9 #include "components/autofill/core/browser/popup_item_ids.h"
10 #include "components/autofill/core/browser/suggestion.h" 10 #include "components/autofill/core/browser/suggestion.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 } 64 }
65 65
66 void AutofillPopupViewViews::InvalidateRow(size_t row) { 66 void AutofillPopupViewViews::InvalidateRow(size_t row) {
67 SchedulePaintInRect(controller_->layout_model().GetRowBounds(row)); 67 SchedulePaintInRect(controller_->layout_model().GetRowBounds(row));
68 } 68 }
69 69
70 void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas, 70 void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas,
71 int index, 71 int index,
72 const gfx::Rect& entry_rect) { 72 const gfx::Rect& entry_rect) {
73 if (controller_->selected_line() == index) 73 if (controller_->selected_line() == index) {
74 canvas->FillRect(entry_rect, kHoveredBackgroundColor); 74 canvas->FillRect(entry_rect, kHoveredBackgroundColor);
75 } else if (controller_->GetSuggestionAt(index).frontend_id ==
76 POPUP_ITEM_ID_CREDIT_CARD_SIGNIN_PROMO) {
77 canvas->FillRect(entry_rect, kPromoPopupBackground);
Evan Stade 2016/07/15 17:27:08 can you move this color logic to the controller?
Mathieu 2016/07/15 19:30:20 Done.
Evan Stade 2016/07/15 19:33:38 it seems to still be here. Also I had intended for
Mathieu 2016/07/18 13:48:02 Sorry, moved the logic now.
78 }
75 79
76 const bool is_rtl = controller_->IsRTL(); 80 const bool is_rtl = controller_->IsRTL();
77 const int text_align = 81 const int text_align =
78 is_rtl ? gfx::Canvas::TEXT_ALIGN_RIGHT : gfx::Canvas::TEXT_ALIGN_LEFT; 82 is_rtl ? gfx::Canvas::TEXT_ALIGN_RIGHT : gfx::Canvas::TEXT_ALIGN_LEFT;
79 gfx::Rect value_rect = entry_rect; 83 gfx::Rect value_rect = entry_rect;
80 value_rect.Inset(AutofillPopupLayoutModel::kEndPadding, 0); 84 value_rect.Inset(AutofillPopupLayoutModel::kEndPadding, 0);
81 canvas->DrawStringRectWithFlags( 85 canvas->DrawStringRectWithFlags(
82 controller_->GetElidedValueAt(index), 86 controller_->GetElidedValueAt(index),
83 controller_->GetValueFontListForRow(index), 87 controller_->GetValueFontListForRow(index),
84 controller_->IsWarning(index) ? kWarningTextColor : kValueTextColor, 88 controller_->IsWarning(index) ? kWarningTextColor : kValueTextColor,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 134
131 // If the top level widget can't be found, cancel the popup since we can't 135 // If the top level widget can't be found, cancel the popup since we can't
132 // fully set it up. 136 // fully set it up.
133 if (!observing_widget) 137 if (!observing_widget)
134 return NULL; 138 return NULL;
135 139
136 return new AutofillPopupViewViews(controller, observing_widget); 140 return new AutofillPopupViewViews(controller, observing_widget);
137 } 141 }
138 142
139 } // namespace autofill 143 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698