Chromium Code Reviews| 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 1b24397deb34abe28169891bfd150173fe235080..caf381ceb102b823d3ba7f25572bef74179eb8f4 100644 |
| --- a/chrome/browser/ui/autofill/autofill_popup_layout_model.cc |
| +++ b/chrome/browser/ui/autofill/autofill_popup_layout_model.cc |
| @@ -10,10 +10,12 @@ |
| #include "base/strings/utf_string_conversions.h" |
| #include "chrome/browser/ui/autofill/autofill_popup_view.h" |
| #include "chrome/browser/ui/autofill/popup_constants.h" |
| +#include "components/autofill/core/browser/autofill_experiments.h" |
| #include "components/autofill/core/browser/popup_item_ids.h" |
| #include "components/autofill/core/browser/suggestion.h" |
| #include "components/autofill/core/common/autofill_util.h" |
| #include "components/grit/components_scaled_resources.h" |
| +#include "third_party/skia/include/core/SkColor.h" |
| #include "ui/base/resource/resource_bundle.h" |
| #include "ui/gfx/color_palette.h" |
| #include "ui/gfx/font_list.h" |
| @@ -61,8 +63,8 @@ int GetRowHeightFromId(int identifier) { |
| } // namespace |
| AutofillPopupLayoutModel::AutofillPopupLayoutModel( |
| - AutofillPopupViewDelegate* delegate) |
| - : delegate_(delegate) { |
| + AutofillPopupViewDelegate* delegate, bool is_credit_card_popup) |
| + : delegate_(delegate), is_credit_card_popup_(is_credit_card_popup) { |
| #if !defined(OS_ANDROID) |
| smaller_font_list_ = |
| normal_font_list_.DeriveWithSizeDelta(kSmallerFontSizeDelta); |
| @@ -244,4 +246,27 @@ const gfx::Rect AutofillPopupLayoutModel::RoundedElementBounds() const { |
| return gfx::ToEnclosingRect(delegate_->element_bounds()); |
| } |
| +bool AutofillPopupLayoutModel::IsPopupLayoutExperimentEnabled() const { |
| + return is_credit_card_popup_ && |
| + IsAutofillCreditCardPopupLayoutExperimentEnabled(); |
| +} |
| + |
| +SkColor AutofillPopupLayoutModel::GetBackgroundColor() const { |
| + return is_credit_card_popup_ ? |
| + GetCreditCardPopupBackgroundColor() : SK_ColorTRANSPARENT; |
|
Ilya Sherman
2016/12/03 00:02:18
Should this be checking for IsPopupLayoutExperimen
csashi
2016/12/03 00:40:07
GetCreditCardPopupBackgroundColor checks if the po
|
| +} |
| + |
| +SkColor AutofillPopupLayoutModel::GetDividerColor() const { |
| + return is_credit_card_popup_ ? |
| + GetCreditCardPopupDividerColor() : SK_ColorTRANSPARENT; |
| +} |
| + |
| +unsigned int AutofillPopupLayoutModel::GetDropdownItemHeight() const { |
| + return is_credit_card_popup_ ? GetCreditCardPopupDropdownItemHeight() : 0; |
| +} |
| + |
| +bool AutofillPopupLayoutModel::IsIconAtStart() const { |
| + return is_credit_card_popup_ && IsCreditCardIconInPopupAtStart(); |
| +} |
| + |
| } // namespace autofill |