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

Unified Diff: chrome/browser/ui/views/payments/payment_request_views_util.cc

Issue 2923533002: [Merge M60][Payments] Do not select an address if the merchant doesn't support it (Closed)
Patch Set: Created 3 years, 6 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/payments/payment_request_views_util.cc
diff --git a/chrome/browser/ui/views/payments/payment_request_views_util.cc b/chrome/browser/ui/views/payments/payment_request_views_util.cc
index 0a6d5bebf8c29f2da5f40a06b70a40f13425abe8..56dab1e6491dfbbfaa6355cb2e61f58b62757acd 100644
--- a/chrome/browser/ui/views/payments/payment_request_views_util.cc
+++ b/chrome/browser/ui/views/payments/payment_request_views_util.cc
@@ -52,13 +52,13 @@ namespace payments {
namespace {
// |s1|, |s2|, and |s3| are lines identifying the profile. |s1| is the
-// "headline" which may be emphasized depending on |type|. If |disabled_state|
-// is true, the labels will look disabled.
+// "headline" which may be emphasized depending on |type|. If |enabled| is
+// false, the labels will look disabled.
std::unique_ptr<views::View> GetBaseProfileLabel(AddressStyleType type,
const base::string16& s1,
const base::string16& s2,
const base::string16& s3,
- bool disabled_state = false) {
+ bool enabled = true) {
std::unique_ptr<views::View> container = base::MakeUnique<views::View>();
std::unique_ptr<views::BoxLayout> layout =
base::MakeUnique<views::BoxLayout>(views::BoxLayout::kVertical, 0, 0, 0);
@@ -74,7 +74,7 @@ std::unique_ptr<views::View> GetBaseProfileLabel(AddressStyleType type,
s1, views::style::CONTEXT_LABEL, text_style);
label->set_id(static_cast<int>(DialogViewID::PROFILE_LABEL_LINE_1));
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- if (disabled_state) {
+ if (!enabled) {
label->SetEnabledColor(label->GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_LabelDisabledColor));
}
@@ -85,7 +85,7 @@ std::unique_ptr<views::View> GetBaseProfileLabel(AddressStyleType type,
std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>(s2);
label->set_id(static_cast<int>(DialogViewID::PROFILE_LABEL_LINE_2));
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- if (disabled_state) {
+ if (!enabled) {
label->SetEnabledColor(label->GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_LabelDisabledColor));
}
@@ -96,7 +96,7 @@ std::unique_ptr<views::View> GetBaseProfileLabel(AddressStyleType type,
std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>(s3);
label->set_id(static_cast<int>(DialogViewID::PROFILE_LABEL_LINE_3));
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- if (disabled_state) {
+ if (!enabled) {
label->SetEnabledColor(label->GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_LabelDisabledColor));
}
@@ -111,7 +111,7 @@ std::unique_ptr<views::View> GetShippingAddressLabel(
AddressStyleType type,
const std::string& locale,
const autofill::AutofillProfile& profile,
- bool disabled_state) {
+ bool enabled) {
base::string16 name =
profile.GetInfo(autofill::AutofillType(autofill::NAME_FULL), locale);
@@ -121,7 +121,7 @@ std::unique_ptr<views::View> GetShippingAddressLabel(
base::string16 phone =
data_util::GetFormattedPhoneNumberForDisplay(profile, locale);
- return GetBaseProfileLabel(type, name, address, phone, disabled_state);
+ return GetBaseProfileLabel(type, name, address, phone, enabled);
}
std::unique_ptr<views::Label> GetLabelForMissingInformation(
@@ -260,34 +260,14 @@ std::unique_ptr<views::View> CreateProductLogoFooterView() {
return content_view;
}
-std::unique_ptr<views::View> GetShippingAddressLabelWithError(
- AddressStyleType type,
- const std::string& locale,
- const autofill::AutofillProfile& profile,
- const base::string16& error,
- bool disabled_state) {
- std::unique_ptr<views::View> base_label =
- GetShippingAddressLabel(type, locale, profile, disabled_state);
-
- if (!error.empty()) {
- std::unique_ptr<views::Label> label =
- base::MakeUnique<views::Label>(error, CONTEXT_DEPRECATED_SMALL);
- label->set_id(static_cast<int>(DialogViewID::PROFILE_LABEL_ERROR));
- // Error information is typically in red.
- label->SetEnabledColor(label->GetNativeTheme()->GetSystemColor(
- ui::NativeTheme::kColorId_AlertSeverityHigh));
- base_label->AddChildView(label.release());
- }
- return base_label;
-}
-
std::unique_ptr<views::View> GetShippingAddressLabelWithMissingInfo(
AddressStyleType type,
const std::string& locale,
const autofill::AutofillProfile& profile,
- const PaymentsProfileComparator& comp) {
+ const PaymentsProfileComparator& comp,
+ bool enabled) {
std::unique_ptr<views::View> base_label =
- GetShippingAddressLabel(type, locale, profile, /*disabled_state=*/false);
+ GetShippingAddressLabel(type, locale, profile, enabled);
base::string16 missing = comp.GetStringForMissingShippingFields(profile);
if (!missing.empty()) {

Powered by Google App Engine
This is Rietveld 408576698