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

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

Issue 2859193004: Remove GridLayout::SetInsets in favor of an empty border on the host. (Closed)
Patch Set: edits Created 3 years, 7 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 #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 <string>
10 #include <utility> 10 #include <utility>
(...skipping 21 matching lines...) Expand all
32 #include "components/strings/grit/components_strings.h" 32 #include "components/strings/grit/components_strings.h"
33 #include "content/public/browser/web_contents.h" 33 #include "content/public/browser/web_contents.h"
34 #include "ui/base/l10n/l10n_util.h" 34 #include "ui/base/l10n/l10n_util.h"
35 #include "ui/base/resource/resource_bundle.h" 35 #include "ui/base/resource/resource_bundle.h"
36 #include "ui/gfx/color_utils.h" 36 #include "ui/gfx/color_utils.h"
37 #include "ui/gfx/font.h" 37 #include "ui/gfx/font.h"
38 #include "ui/gfx/paint_vector_icon.h" 38 #include "ui/gfx/paint_vector_icon.h"
39 #include "ui/gfx/range/range.h" 39 #include "ui/gfx/range/range.h"
40 #include "ui/gfx/text_elider.h" 40 #include "ui/gfx/text_elider.h"
41 #include "ui/gfx/text_utils.h" 41 #include "ui/gfx/text_utils.h"
42 #include "ui/views/border.h"
42 #include "ui/views/controls/button/md_text_button.h" 43 #include "ui/views/controls/button/md_text_button.h"
43 #include "ui/views/controls/image_view.h" 44 #include "ui/views/controls/image_view.h"
44 #include "ui/views/controls/label.h" 45 #include "ui/views/controls/label.h"
45 #include "ui/views/controls/styled_label.h" 46 #include "ui/views/controls/styled_label.h"
46 #include "ui/views/layout/box_layout.h" 47 #include "ui/views/layout/box_layout.h"
47 #include "ui/views/layout/fill_layout.h" 48 #include "ui/views/layout/fill_layout.h"
48 #include "ui/views/layout/grid_layout.h" 49 #include "ui/views/layout/grid_layout.h"
49 #include "ui/views/vector_icons.h" 50 #include "ui/views/vector_icons.h"
50 #include "ui/views/view.h" 51 #include "ui/views/view.h"
51 52
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 views::ButtonListener* listener, 148 views::ButtonListener* listener,
148 const base::string16& section_name, 149 const base::string16& section_name,
149 std::unique_ptr<views::View> content_view, 150 std::unique_ptr<views::View> content_view,
150 std::unique_ptr<views::View> extra_content_view, 151 std::unique_ptr<views::View> extra_content_view,
151 std::unique_ptr<views::View> trailing_button, 152 std::unique_ptr<views::View> trailing_button,
152 bool clickable, 153 bool clickable,
153 int name_column_width) { 154 int name_column_width) {
154 std::unique_ptr<PaymentRequestRowView> row = 155 std::unique_ptr<PaymentRequestRowView> row =
155 base::MakeUnique<PaymentRequestRowView>(listener, clickable); 156 base::MakeUnique<PaymentRequestRowView>(listener, clickable);
156 views::GridLayout* layout = new views::GridLayout(row.get()); 157 views::GridLayout* layout = new views::GridLayout(row.get());
158 row->SetLayoutManager(layout);
157 159
158 // The rows have extra inset compared to the header so that their right edge 160 // The rows have extra padding compared to the header so that their right edge
159 // lines up with the close button's X rather than its invisible right edge. 161 // lines up with the close button's X rather than its invisible right edge.
160 layout->SetInsets( 162 row->SetBorder(views::CreateEmptyBorder(
161 kPaymentRequestRowVerticalInsets, kPaymentRequestRowHorizontalInsets, 163 kPaymentRequestRowVerticalInsets, kPaymentRequestRowHorizontalInsets,
162 kPaymentRequestRowVerticalInsets, 164 kPaymentRequestRowVerticalInsets,
163 kPaymentRequestRowHorizontalInsets + kPaymentRequestRowExtraRightInset); 165 kPaymentRequestRowHorizontalInsets + kPaymentRequestRowExtraRightInset));
164 row->SetLayoutManager(layout);
165 166
166 views::ColumnSet* columns = layout->AddColumnSet(0); 167 views::ColumnSet* columns = layout->AddColumnSet(0);
167 // A column for the section name. 168 // A column for the section name.
168 columns->AddColumn(views::GridLayout::LEADING, 169 columns->AddColumn(views::GridLayout::LEADING,
169 views::GridLayout::LEADING, 170 views::GridLayout::LEADING,
170 0, 171 0,
171 views::GridLayout::FIXED, 172 views::GridLayout::FIXED,
172 name_column_width, 173 name_column_width,
173 0); 174 0);
174 175
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 } else { 899 } else {
899 return builder 900 return builder
900 .Id(DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION_BUTTON) 901 .Id(DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION_BUTTON)
901 .CreateWithButton( 902 .CreateWithButton(
902 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_CHOOSE_AN_ADDRESS), 903 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_CHOOSE_AN_ADDRESS),
903 l10n_util::GetStringUTF16(IDS_CHOOSE), /*button_enabled=*/false); 904 l10n_util::GetStringUTF16(IDS_CHOOSE), /*button_enabled=*/false);
904 } 905 }
905 } 906 }
906 907
907 } // namespace payments 908 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698