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

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

Issue 2592833002: [WebPayments] Start populating the Payment Sheet. (Closed)
Patch Set: 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/views/payments/order_summary_view_controller.cc
diff --git a/chrome/browser/ui/views/payments/order_summary_view_controller.cc b/chrome/browser/ui/views/payments/order_summary_view_controller.cc
index 81f0ba12560b78432ee4a924a4d0d3d80ec310ad..c6aa176b555dc942219420c11f312c2f64ad49e5 100644
--- a/chrome/browser/ui/views/payments/order_summary_view_controller.cc
+++ b/chrome/browser/ui/views/payments/order_summary_view_controller.cc
@@ -10,22 +10,16 @@
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/payments/payment_request_impl.h"
#include "chrome/browser/ui/views/payments/payment_request_dialog.h"
#include "chrome/browser/ui/views/payments/payment_request_views_util.h"
#include "chrome/grit/generated_resources.h"
+#include "components/strings/grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"
-#include "ui/views/controls/button/label_button.h"
-#include "ui/views/controls/button/md_text_button.h"
+#include "ui/views/controls/label.h"
#include "ui/views/layout/grid_layout.h"
#include "ui/views/view.h"
-namespace {
-
-// The tag for the button that navigates back to the payment sheet.
-constexpr int kBackButtonTag = 0;
-
-} // namespace
-
namespace payments {
OrderSummaryViewController::OrderSummaryViewController(
@@ -40,26 +34,33 @@ std::unique_ptr<views::View> OrderSummaryViewController::CreateView() {
views::GridLayout* layout = new views::GridLayout(content_view.get());
content_view->SetLayoutManager(layout);
views::ColumnSet* columns = layout->AddColumnSet(0);
- columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
+ columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER,
0, views::GridLayout::USE_PREF, 0, 0);
layout->StartRow(0, 0);
- views::LabelButton* back_button =
- views::MdTextButton::CreateSecondaryUiBlueButton(
- this, base::ASCIIToUTF16("Back"));
- back_button->set_tag(kBackButtonTag);
- layout->AddView(back_button);
+ layout->AddView(new views::Label(
+ l10n_util::GetStringFUTF16(
+ IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_TOTAL_FORMAT,
+ l10n_util::GetStringUTF16(
+ IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_TOTAL),
+ base::ASCIIToUTF16(impl()->details()->total->amount->value),
+ base::ASCIIToUTF16(impl()->details()->total->amount->currency))));
please use gerrit instead 2017/01/04 15:55:27 By the way, you will eventually need to write a C+
anthonyvd 2017/01/04 19:08:55 Makes sense, will do.
return payments::CreatePaymentView(
- l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_ORDER_SUMMARY_TITLE),
+ CreateSheetHeaderView(
+ true,
+ l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_ORDER_SUMMARY_TITLE),
+ this),
std::move(content_view));
}
void OrderSummaryViewController::ButtonPressed(
views::Button* sender, const ui::Event& event) {
- DCHECK_EQ(kBackButtonTag, sender->tag());
-
- dialog()->GoBack();
+ if (sender->tag() == CLOSE_BUTTON_TAG) {
sky 2017/01/04 17:24:45 no {}. optional: use a switch statement.
anthonyvd 2017/01/04 19:08:55 Done.
+ dialog()->CloseDialog();
+ } else if (sender->tag() == BACK_BUTTON_TAG) {
+ dialog()->GoBack();
+ }
}
} // namespace payments

Powered by Google App Engine
This is Rietveld 408576698