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

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

Issue 2910153002: Remove views::Label::SetDisabledColor(). Replace with typography colors. (Closed)
Patch Set: rebase for r476345 Created 3 years, 7 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_sheet_view_controller.cc
diff --git a/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc b/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc
index 704d942a44092068228c8dc6b015ed8640f57496..8d683122725aebb44ef6a5643e48cafc36685e14 100644
--- a/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc
+++ b/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/chrome_pages.h"
+#include "chrome/browser/ui/views/harmony/chrome_typography.h"
#include "chrome/browser/ui/views/payments/payment_request_dialog_view.h"
#include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h"
#include "chrome/browser/ui/views/payments/payment_request_row_view.h"
@@ -84,8 +85,9 @@ class PreviewEliderLabel : public views::Label {
// and |n| is the "N more" item count.
PreviewEliderLabel(const base::string16& preview_text,
const base::string16& format_string,
- int n)
- : views::Label(base::string16()),
+ int n,
+ int text_style)
+ : views::Label(base::string16(), views::style::CONTEXT_LABEL, text_style),
preview_text_(preview_text),
format_string_(format_string),
n_(n) {}
@@ -193,7 +195,7 @@ std::unique_ptr<views::Button> CreatePaymentSheetRow(
std::unique_ptr<views::View> CreateInlineCurrencyAmountItem(
const base::string16& currency,
const base::string16& amount,
- bool disabled_color,
+ bool hint_color,
bool bold) {
std::unique_ptr<views::View> item_amount_line =
base::MakeUnique<views::View>();
@@ -207,15 +209,15 @@ std::unique_ptr<views::View> CreateInlineCurrencyAmountItem(
views::GridLayout::LEADING, 1,
views::GridLayout::USE_PREF, 0, 0);
- std::unique_ptr<views::Label> currency_label =
- bold ? CreateBoldLabel(currency)
- : base::MakeUnique<views::Label>(currency);
- if (disabled_color) {
- currency_label->SetDisabledColor(
- currency_label->GetNativeTheme()->GetSystemColor(
- ui::NativeTheme::kColorId_LabelDisabledColor));
- currency_label->SetEnabled(false);
- }
+ DCHECK(!bold || !hint_color);
+ std::unique_ptr<views::Label> currency_label;
+ if (bold)
+ currency_label = CreateBoldLabel(currency);
+ else if (hint_color)
+ currency_label = CreateHintLabel(currency);
+ else
+ currency_label = base::MakeUnique<views::Label>(currency);
+
std::unique_ptr<views::Label> amount_label =
bold ? CreateBoldLabel(amount) : base::MakeUnique<views::Label>(amount);
amount_label->SetMultiLine(true);
@@ -287,15 +289,8 @@ class PaymentSheetRowBuilder {
const base::string16& truncated_content,
const base::string16& button_string,
bool button_enabled) {
- std::unique_ptr<views::Label> content_view =
- base::MakeUnique<views::Label>(truncated_content);
- content_view->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- content_view->SetDisabledColor(
- content_view->GetNativeTheme()->GetSystemColor(
- ui::NativeTheme::kColorId_LabelDisabledColor));
- content_view->SetEnabled(false);
- return CreateWithButton(std::move(content_view), button_string,
- button_enabled);
+ return CreateWithButton(CreateHintLabel(truncated_content, gfx::ALIGN_LEFT),
+ button_string, button_enabled);
}
// Creates a row with a button in place of the chevron with the string between
@@ -312,12 +307,9 @@ class PaymentSheetRowBuilder {
const base::string16& button_string,
bool button_enabled) {
std::unique_ptr<PreviewEliderLabel> content_view =
- base::MakeUnique<PreviewEliderLabel>(preview_text, format_string, n);
+ base::MakeUnique<PreviewEliderLabel>(preview_text, format_string, n,
+ STYLE_HINT);
content_view->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- content_view->SetDisabledColor(
- content_view->GetNativeTheme()->GetSystemColor(
- ui::NativeTheme::kColorId_LabelDisabledColor));
- content_view->SetEnabled(false);
return CreateWithButton(std::move(content_view), button_string,
button_enabled);
}
@@ -554,20 +546,13 @@ PaymentSheetViewController::CreatePaymentSheetSummaryRow() {
if (hidden_item_count > 0) {
layout->StartRow(0, 0);
std::unique_ptr<views::Label> label =
- base::MakeUnique<views::Label>(l10n_util::GetPluralStringFUTF16(
+ CreateHintLabel(l10n_util::GetPluralStringFUTF16(
IDS_PAYMENT_REQUEST_ORDER_SUMMARY_MORE_ITEMS, hidden_item_count));
- label->SetDisabledColor(label->GetNativeTheme()->GetSystemColor(
- ui::NativeTheme::kColorId_LabelDisabledColor));
- label->SetEnabled(false);
layout->AddView(label.release());
if (is_mixed_currency) {
std::unique_ptr<views::Label> multiple_currency_label =
- base::MakeUnique<views::Label>(l10n_util::GetStringUTF16(
+ CreateHintLabel(l10n_util::GetStringUTF16(
IDS_PAYMENT_REQUEST_ORDER_SUMMARY_MULTIPLE_CURRENCY_INDICATOR));
- multiple_currency_label->SetDisabledColor(
- multiple_currency_label->GetNativeTheme()->GetSystemColor(
- ui::NativeTheme::kColorId_LabelDisabledColor));
- multiple_currency_label->SetEnabled(false);
layout->AddView(multiple_currency_label.release());
}
}

Powered by Google App Engine
This is Rietveld 408576698