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

Side by Side Diff: chrome/browser/ui/views/payments/payment_request_sheet_controller.cc

Issue 2715213005: [Payments] Add the pay button, and control its enabled state (Closed)
Patch Set: addressed comments Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h" 5 #include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h"
6 6
7 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" 7 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h"
8 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" 8 #include "chrome/browser/ui/views/payments/payment_request_views_util.h"
9 #include "components/payments/content/payment_request.h"
9 #include "components/strings/grit/components_strings.h" 10 #include "components/strings/grit/components_strings.h"
10 #include "ui/base/l10n/l10n_util.h" 11 #include "ui/base/l10n/l10n_util.h"
11 #include "ui/views/background.h" 12 #include "ui/views/background.h"
12 #include "ui/views/controls/button/md_text_button.h" 13 #include "ui/views/controls/button/md_text_button.h"
13 #include "ui/views/layout/box_layout.h" 14 #include "ui/views/layout/box_layout.h"
14 #include "ui/views/layout/grid_layout.h" 15 #include "ui/views/layout/grid_layout.h"
15 16
16 namespace payments { 17 namespace payments {
17 18
18 PaymentRequestSheetController::PaymentRequestSheetController( 19 PaymentRequestSheetController::PaymentRequestSheetController(
(...skipping 13 matching lines...) Expand all
32 33
33 void PaymentRequestSheetController::ButtonPressed( 34 void PaymentRequestSheetController::ButtonPressed(
34 views::Button* sender, const ui::Event& event) { 35 views::Button* sender, const ui::Event& event) {
35 switch (static_cast<PaymentRequestCommonTags>(sender->tag())) { 36 switch (static_cast<PaymentRequestCommonTags>(sender->tag())) {
36 case PaymentRequestCommonTags::CLOSE_BUTTON_TAG: 37 case PaymentRequestCommonTags::CLOSE_BUTTON_TAG:
37 dialog()->CloseDialog(); 38 dialog()->CloseDialog();
38 break; 39 break;
39 case PaymentRequestCommonTags::BACK_BUTTON_TAG: 40 case PaymentRequestCommonTags::BACK_BUTTON_TAG:
40 dialog()->GoBack(); 41 dialog()->GoBack();
41 break; 42 break;
43 case PaymentRequestCommonTags::PAY_BUTTON_TAG:
44 request()->Pay();
45 break;
42 case PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX: 46 case PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX:
43 NOTREACHED(); 47 NOTREACHED();
44 break; 48 break;
45 } 49 }
46 } 50 }
47 51
48 std::unique_ptr<views::View> PaymentRequestSheetController::CreatePaymentView( 52 std::unique_ptr<views::View> PaymentRequestSheetController::CreatePaymentView(
49 std::unique_ptr<views::View> header_view, 53 std::unique_ptr<views::View> header_view,
50 std::unique_ptr<views::View> content_view) { 54 std::unique_ptr<views::View> content_view) {
51 std::unique_ptr<views::View> view = base::MakeUnique<views::View>(); 55 std::unique_ptr<views::View> view = base::MakeUnique<views::View>();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 this, l10n_util::GetStringUTF16(IDS_CANCEL)); 125 this, l10n_util::GetStringUTF16(IDS_CANCEL));
122 button->set_tag(static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG)); 126 button->set_tag(static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG));
123 trailing_buttons_container->AddChildView(button); 127 trailing_buttons_container->AddChildView(button);
124 128
125 layout->AddView(trailing_buttons_container.release()); 129 layout->AddView(trailing_buttons_container.release());
126 130
127 return container; 131 return container;
128 } 132 }
129 133
130 } // namespace payments 134 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698