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

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

Issue 2813203004: [Payments] Show what's missing for incomplete payment methods. (Closed)
Patch Set: addressed comments, now two functions Created 3 years, 8 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_method_view_controller.cc
diff --git a/chrome/browser/ui/views/payments/payment_method_view_controller.cc b/chrome/browser/ui/views/payments/payment_method_view_controller.cc
index 828fd2e7f037ec67a34c58828414e57bb66d666d..2a2aea501d380dfd1ec735d65dbbbb0c4621a2e3 100644
--- a/chrome/browser/ui/views/payments/payment_method_view_controller.cc
+++ b/chrome/browser/ui/views/payments/payment_method_view_controller.cc
@@ -25,6 +25,7 @@
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/paint_vector_icon.h"
+#include "ui/native_theme/native_theme.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/button/md_text_button.h"
#include "ui/views/layout/box_layout.h"
@@ -82,11 +83,23 @@ class PaymentMethodListItem : public payments::PaymentRequestItemList::Item {
views::BoxLayout::CROSS_AXIS_ALIGNMENT_START);
card_info_container->SetLayoutManager(box_layout.release());
- card_info_container->AddChildView(new views::Label(instrument_->label()));
- card_info_container->AddChildView(
- new views::Label(instrument_->sublabel()));
- // TODO(anthonyvd): Add the "card is incomplete" label once the
- // completedness logic is implemented.
+ if (!instrument_->label().empty())
+ card_info_container->AddChildView(new views::Label(instrument_->label()));
+ if (!instrument_->sublabel().empty()) {
+ card_info_container->AddChildView(
+ new views::Label(instrument_->sublabel()));
+ }
+ if (!instrument_->IsCompleteForPayment()) {
+ std::unique_ptr<views::Label> missing_info_label =
+ base::MakeUnique<views::Label>(instrument_->GetMissingInfoLabel());
+ missing_info_label->SetFontList(
+ missing_info_label->GetDefaultFontList().DeriveWithSizeDelta(-1));
+ missing_info_label->SetEnabledColor(
+ missing_info_label->GetNativeTheme()->GetSystemColor(
+ ui::NativeTheme::kColorId_LinkEnabled));
+ card_info_container->AddChildView(missing_info_label.release());
+ }
+
return card_info_container;
}
« no previous file with comments | « chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc ('k') | components/autofill/core/browser/validation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698