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

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

Issue 2531223003: Expanded Autofill Credit Card Popup Layout Experiment in Android. (Closed)
Patch Set: Fixes compile error. Created 4 years 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 5364cb6130d7ab676b29b1076e67bb330b6e667f..c93e702862e9ba4b2a74dcda6fd74e43e7a719c8 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/color_utils.h"
@@ -70,8 +72,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);
@@ -282,4 +284,28 @@ 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;
+}
+
+SkColor AutofillPopupLayoutModel::GetDividerColor() const {
+ return is_credit_card_popup_ ?
+ GetCreditCardPopupDividerColor() : SK_ColorTRANSPARENT;
+}
+
+unsigned int AutofillPopupLayoutModel::GetDropdownItemHeight() const {
+ return GetPopupDropdownItemHeight();
+}
+
+bool AutofillPopupLayoutModel::IsIconAtStart(int frontend_id) const {
+ return frontend_id == POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE ||
+ (is_credit_card_popup_ && IsIconInCreditCardPopupAtStart());
+}
+
} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698