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

Side by Side Diff: chrome/browser/ui/views/payments/payment_request_views_util.h

Issue 2668063003: [Web Payments] Add Cancel button to all sheets (Closed)
Patch Set: Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_
6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_ 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 12
13 namespace autofill { 13 namespace autofill {
14 class AutofillProfile; 14 class AutofillProfile;
15 } 15 }
16 16
17 namespace views { 17 namespace views {
18 class Border; 18 class Border;
19 class VectorIconButtonDelegate; 19 class VectorIconButtonDelegate;
20 class View; 20 class View;
21 } 21 }
22 22
23 namespace payments { 23 namespace payments {
24 24
25 class PaymentRequestSheetController;
26
25 constexpr int kPaymentRequestRowHorizontalInsets = 14; 27 constexpr int kPaymentRequestRowHorizontalInsets = 14;
26 constexpr int kPaymentRequestRowVerticalInsets = 8; 28 constexpr int kPaymentRequestRowVerticalInsets = 8;
27 29
28 enum class PaymentRequestCommonTags { 30 enum class PaymentRequestCommonTags {
29 BACK_BUTTON_TAG = 0, 31 BACK_BUTTON_TAG = 0,
30 CLOSE_BUTTON_TAG, 32 CLOSE_BUTTON_TAG,
31 // This is the max value of tags for controls common to multiple 33 // This is the max value of tags for controls common to multiple
32 // PaymentRequest contexts. Individual screens that handle both common and 34 // PaymentRequest contexts. Individual screens that handle both common and
33 // specific events with tags can start their specific tags at this value. 35 // specific events with tags can start their specific tags at this value.
34 PAYMENT_REQUEST_COMMON_TAG_MAX 36 PAYMENT_REQUEST_COMMON_TAG_MAX
35 }; 37 };
36 38
37 // Creates and returns a header for all the sheets in the PaymentRequest dialog. 39 // Creates and returns a header for all the sheets in the PaymentRequest dialog.
38 // The header contains an optional back arrow button (if |show_back_arrow| is 40 // The header contains an optional back arrow button (if |show_back_arrow| is
39 // true), a |title| label, and a right-aligned X close button. |delegate| 41 // true), a |title| label, and a right-aligned X close button. |delegate|
40 // becomes the delegate for the back and close buttons. 42 // becomes the delegate for the back and close buttons.
41 // +---------------------------+ 43 // +---------------------------+
42 // | <- | Title | X | 44 // | <- | Title | X |
43 // +---------------------------+ 45 // +---------------------------+
44 std::unique_ptr<views::View> CreateSheetHeaderView( 46 std::unique_ptr<views::View> CreateSheetHeaderView(
45 bool show_back_arrow, 47 bool show_back_arrow,
46 const base::string16& title, 48 const base::string16& title,
47 views::VectorIconButtonDelegate* delegate); 49 views::VectorIconButtonDelegate* delegate);
48 50
49 // Creates a view to be displayed in the PaymentRequestDialog. 51 // Creates a view to be displayed in the PaymentRequestDialog.
50 // |header_view| is the view displayed on top of the dialog, containing title, 52 // |header_view| is the view displayed on top of the dialog, containing title,
51 // (optional) back button, and close buttons. 53 // (optional) back button, and close buttons.
52 // |content_view| is displayed between |header_view| and the pay/cancel buttons. 54 // |content_view| is displayed between |header_view| and the pay/cancel buttons.
Mathieu 2017/01/31 22:53:12 Let's add a similar comment for buttons_view?
anthonyvd 2017/02/01 15:35:23 Done.
53 // The returned view takes ownership of |header_view| and |content_view|. 55 // The returned view takes ownership of |header_view| and |content_view|.
54 // +---------------------------+ 56 // +---------------------------+
55 // | HEADER VIEW | 57 // | HEADER VIEW |
56 // +---------------------------+ 58 // +---------------------------+
57 // | CONTENT | 59 // | CONTENT |
58 // | VIEW | 60 // | VIEW |
59 // +---------------------------+ 61 // +---------------------------+
60 // | | CANCEL | PAY | 62 // | | CANCEL | PAY | <-- |buttons_view|
61 // +---------------------------+ 63 // +---------------------------+
62 std::unique_ptr<views::View> CreatePaymentView( 64 std::unique_ptr<views::View> CreatePaymentView(
63 std::unique_ptr<views::View> header_view, 65 std::unique_ptr<views::View> header_view,
64 std::unique_ptr<views::View> content_view); 66 std::unique_ptr<views::View> content_view,
67 std::unique_ptr<views::View> buttons_view);
65 68
66 // Represents formatting options for each of the different contexts in which an 69 // Represents formatting options for each of the different contexts in which an
67 // Address label may be displayed. 70 // Address label may be displayed.
68 enum class AddressStyleType { SUMMARY, DETAILED }; 71 enum class AddressStyleType { SUMMARY, DETAILED };
69 72
70 // Extracts and formats descriptive text from the given |profile| to represent 73 // Extracts and formats descriptive text from the given |profile| to represent
71 // the address in the context specified by |type|. 74 // the address in the context specified by |type|.
72 std::unique_ptr<views::View> GetShippingAddressLabel( 75 std::unique_ptr<views::View> GetShippingAddressLabel(
73 AddressStyleType type, 76 AddressStyleType type,
74 const std::string& locale, 77 const std::string& locale,
75 const autofill::AutofillProfile& profile); 78 const autofill::AutofillProfile& profile);
76 79
77 // Extracts and formats descriptive text from the given |profile| to represent 80 // Extracts and formats descriptive text from the given |profile| to represent
78 // the contact info in the context specified by |type|. Includes/excludes name, 81 // the contact info in the context specified by |type|. Includes/excludes name,
79 // email, and phone fields according to the respective boolean fields. 82 // email, and phone fields according to the respective boolean fields.
80 std::unique_ptr<views::View> GetContactInfoLabel( 83 std::unique_ptr<views::View> GetContactInfoLabel(
81 AddressStyleType type, 84 AddressStyleType type,
82 const std::string& locale, 85 const std::string& locale,
83 const autofill::AutofillProfile& profile, 86 const autofill::AutofillProfile& profile,
84 bool show_payer_name, 87 bool show_payer_name,
85 bool show_payer_email, 88 bool show_payer_email,
86 bool show_payer_phone); 89 bool show_payer_phone);
87 90
88 // Creates a views::Border object that can paint the gray horizontal ruler used 91 // Creates a views::Border object that can paint the gray horizontal ruler used
89 // as a separator between items in the Payment Request dialog. 92 // as a separator between items in the Payment Request dialog.
90 std::unique_ptr<views::Border> CreatePaymentRequestRowBorder(); 93 std::unique_ptr<views::Border> CreatePaymentRequestRowBorder();
91 94
95 // Creates the row of button containing the Pay, cancel, and extra buttons.
96 // |controller| is installed as the listener for button events.
97 std::unique_ptr<views::View> CreateButtonsView(
98 PaymentRequestSheetController* controller);
99
92 } // namespace payments 100 } // namespace payments
93 101
94 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_ 102 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698