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

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

Issue 2722183005: [Web Payments] Wrap each sheet's content view in a scrollable view. (Closed)
Patch Set: Rebase 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
« no previous file with comments | « chrome/browser/ui/views/payments/payment_request_sheet_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h" 5 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <string>
9 #include <utility> 10 #include <utility>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
14 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
15 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
16 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" 18 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h"
18 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" 19 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h"
19 #include "chrome/browser/ui/views/payments/payment_request_row_view.h" 20 #include "chrome/browser/ui/views/payments/payment_request_row_view.h"
20 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" 21 #include "chrome/browser/ui/views/payments/payment_request_views_util.h"
21 #include "chrome/grit/generated_resources.h" 22 #include "chrome/grit/generated_resources.h"
22 #include "components/autofill/core/browser/autofill_type.h" 23 #include "components/autofill/core/browser/autofill_type.h"
23 #include "components/autofill/core/browser/credit_card.h" 24 #include "components/autofill/core/browser/credit_card.h"
24 #include "components/autofill/core/browser/field_types.h" 25 #include "components/autofill/core/browser/field_types.h"
25 #include "components/autofill/core/browser/personal_data_manager.h" 26 #include "components/autofill/core/browser/personal_data_manager.h"
26 #include "components/payments/core/currency_formatter.h" 27 #include "components/payments/core/currency_formatter.h"
27 #include "components/strings/grit/components_strings.h" 28 #include "components/strings/grit/components_strings.h"
28 #include "content/public/browser/web_contents.h" 29 #include "content/public/browser/web_contents.h"
29 #include "ui/base/l10n/l10n_util.h" 30 #include "ui/base/l10n/l10n_util.h"
30 #include "ui/gfx/color_utils.h" 31 #include "ui/gfx/color_utils.h"
31 #include "ui/gfx/font.h" 32 #include "ui/gfx/font.h"
32 #include "ui/gfx/paint_vector_icon.h" 33 #include "ui/gfx/paint_vector_icon.h"
33 #include "ui/gfx/range/range.h" 34 #include "ui/gfx/range/range.h"
34 #include "ui/views/controls/button/md_text_button.h" 35 #include "ui/views/controls/button/md_text_button.h"
35 #include "ui/views/controls/image_view.h" 36 #include "ui/views/controls/image_view.h"
36 #include "ui/views/controls/label.h" 37 #include "ui/views/controls/label.h"
37 #include "ui/views/controls/styled_label.h" 38 #include "ui/views/controls/styled_label.h"
38 #include "ui/views/layout/fill_layout.h"
39 #include "ui/views/layout/grid_layout.h" 39 #include "ui/views/layout/grid_layout.h"
40 #include "ui/views/vector_icons.h" 40 #include "ui/views/vector_icons.h"
41 #include "ui/views/view.h" 41 #include "ui/views/view.h"
42 42
43 namespace payments { 43 namespace payments {
44 namespace { 44 namespace {
45 45
46 constexpr int kFirstTagValue = static_cast<int>( 46 constexpr int kFirstTagValue = static_cast<int>(
47 payments::PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX); 47 payments::PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX);
48 48
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 views::GridLayout* layout = new views::GridLayout(content_view.get()); 181 views::GridLayout* layout = new views::GridLayout(content_view.get());
182 content_view->SetLayoutManager(layout); 182 content_view->SetLayoutManager(layout);
183 views::ColumnSet* columns = layout->AddColumnSet(0); 183 views::ColumnSet* columns = layout->AddColumnSet(0);
184 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, 184 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER,
185 1, views::GridLayout::USE_PREF, 0, 0); 185 1, views::GridLayout::USE_PREF, 0, 0);
186 186
187 // The shipping address and contact info rows are optional. 187 // The shipping address and contact info rows are optional.
188 layout->StartRow(0, 0); 188 layout->StartRow(0, 0);
189 layout->AddView(CreatePaymentSheetSummaryRow().release()); 189 layout->AddView(CreatePaymentSheetSummaryRow().release());
190
190 if (request()->request_shipping()) { 191 if (request()->request_shipping()) {
191 layout->StartRow(1, 0); 192 layout->StartRow(0, 0);
192 layout->AddView(CreateShippingRow().release()); 193 layout->AddView(CreateShippingRow().release());
193 } 194 }
194 layout->StartRow(0, 0); 195 layout->StartRow(0, 0);
195 layout->AddView(CreatePaymentMethodRow().release()); 196 layout->AddView(CreatePaymentMethodRow().release());
196 if (request()->request_payer_name() || request()->request_payer_email() || 197 if (request()->request_payer_name() || request()->request_payer_email() ||
197 request()->request_payer_phone()) { 198 request()->request_payer_phone()) {
198 layout->StartRow(1, 0); 199 layout->StartRow(0, 0);
199 layout->AddView(CreateContactInfoRow().release()); 200 layout->AddView(CreateContactInfoRow().release());
200 } 201 }
201 202
202 return CreatePaymentView( 203 return CreatePaymentView(
203 CreateSheetHeaderView( 204 CreateSheetHeaderView(
204 false, 205 false,
205 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_PAYMENT_SHEET_TITLE), 206 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_PAYMENT_SHEET_TITLE),
206 this), 207 this),
207 std::move(content_view)); 208 std::move(content_view));
208 } 209 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 CreateContactInfoSectionContent(), std::unique_ptr<views::View>(nullptr), 395 CreateContactInfoSectionContent(), std::unique_ptr<views::View>(nullptr),
395 widest_name_column_view_width_); 396 widest_name_column_view_width_);
396 section->set_tag(static_cast<int>( 397 section->set_tag(static_cast<int>(
397 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON)); 398 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON));
398 section->set_id( 399 section->set_id(
399 static_cast<int>(DialogViewID::PAYMENT_SHEET_CONTACT_INFO_SECTION)); 400 static_cast<int>(DialogViewID::PAYMENT_SHEET_CONTACT_INFO_SECTION));
400 return section; 401 return section;
401 } 402 }
402 403
403 } // namespace payments 404 } // namespace payments
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/payments/payment_request_sheet_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698