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

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

Issue 2748133004: [Payments] View controllers no longer have access to PaymentRequest (Closed)
Patch Set: Initial 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/payments/content/payment_request.h"
10 #include "components/strings/grit/components_strings.h" 10 #include "components/strings/grit/components_strings.h"
11 #include "ui/base/l10n/l10n_util.h" 11 #include "ui/base/l10n/l10n_util.h"
12 #include "ui/views/background.h" 12 #include "ui/views/background.h"
13 #include "ui/views/controls/button/md_text_button.h" 13 #include "ui/views/controls/button/md_text_button.h"
14 #include "ui/views/controls/scroll_view.h" 14 #include "ui/views/controls/scroll_view.h"
15 #include "ui/views/layout/box_layout.h" 15 #include "ui/views/layout/box_layout.h"
16 #include "ui/views/layout/grid_layout.h" 16 #include "ui/views/layout/grid_layout.h"
17 17
18 namespace payments { 18 namespace payments {
19 19
20 PaymentRequestSheetController::PaymentRequestSheetController( 20 PaymentRequestSheetController::PaymentRequestSheetController(
21 PaymentRequest* request, PaymentRequestDialogView* dialog) 21 PaymentRequestSpec* spec,
22 : request_(request), dialog_(dialog) { 22 PaymentRequestState* state,
23 } 23 PaymentRequestDialogView* dialog)
24 : spec_(spec), state_(state), dialog_(dialog) {}
24 25
25 std::unique_ptr<views::Button> 26 std::unique_ptr<views::Button>
26 PaymentRequestSheetController::CreatePrimaryButton() { 27 PaymentRequestSheetController::CreatePrimaryButton() {
27 return nullptr; 28 return nullptr;
28 } 29 }
29 30
30 std::unique_ptr<views::View> 31 std::unique_ptr<views::View>
31 PaymentRequestSheetController::CreateExtraFooterView() { 32 PaymentRequestSheetController::CreateExtraFooterView() {
32 return nullptr; 33 return nullptr;
33 } 34 }
34 35
35 void PaymentRequestSheetController::ButtonPressed( 36 void PaymentRequestSheetController::ButtonPressed(
36 views::Button* sender, const ui::Event& event) { 37 views::Button* sender, const ui::Event& event) {
37 switch (static_cast<PaymentRequestCommonTags>(sender->tag())) { 38 switch (static_cast<PaymentRequestCommonTags>(sender->tag())) {
38 case PaymentRequestCommonTags::CLOSE_BUTTON_TAG: 39 case PaymentRequestCommonTags::CLOSE_BUTTON_TAG:
39 dialog()->CloseDialog(); 40 dialog()->CloseDialog();
40 break; 41 break;
41 case PaymentRequestCommonTags::BACK_BUTTON_TAG: 42 case PaymentRequestCommonTags::BACK_BUTTON_TAG:
42 dialog()->GoBack(); 43 dialog()->GoBack();
43 break; 44 break;
44 case PaymentRequestCommonTags::PAY_BUTTON_TAG: 45 case PaymentRequestCommonTags::PAY_BUTTON_TAG:
45 request()->Pay(); 46 dialog()->Pay();
46 break; 47 break;
47 case PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX: 48 case PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX:
48 NOTREACHED(); 49 NOTREACHED();
49 break; 50 break;
50 } 51 }
51 } 52 }
52 53
53 std::unique_ptr<views::View> PaymentRequestSheetController::CreatePaymentView( 54 std::unique_ptr<views::View> PaymentRequestSheetController::CreatePaymentView(
54 std::unique_ptr<views::View> header_view, 55 std::unique_ptr<views::View> header_view,
55 std::unique_ptr<views::View> content_view) { 56 std::unique_ptr<views::View> content_view) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 this, l10n_util::GetStringUTF16(IDS_CANCEL)); 134 this, l10n_util::GetStringUTF16(IDS_CANCEL));
134 button->set_tag(static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG)); 135 button->set_tag(static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG));
135 trailing_buttons_container->AddChildView(button); 136 trailing_buttons_container->AddChildView(button);
136 137
137 layout->AddView(trailing_buttons_container.release()); 138 layout->AddView(trailing_buttons_container.release());
138 139
139 return container; 140 return container;
140 } 141 }
141 142
142 } // namespace payments 143 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698