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

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

Issue 2859193004: Remove GridLayout::SetInsets in favor of an empty border on the host. (Closed)
Patch Set: missed a merge problem 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_request_views_util.h" 5 #include "chrome/browser/ui/views/payments/payment_request_views_util.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 bool show_back_arrow, 188 bool show_back_arrow,
189 const base::string16& title, 189 const base::string16& title,
190 views::ButtonListener* listener) { 190 views::ButtonListener* listener) {
191 std::unique_ptr<views::View> container = base::MakeUnique<views::View>(); 191 std::unique_ptr<views::View> container = base::MakeUnique<views::View>();
192 views::GridLayout* layout = new views::GridLayout(container.get()); 192 views::GridLayout* layout = new views::GridLayout(container.get());
193 container->SetLayoutManager(layout); 193 container->SetLayoutManager(layout);
194 194
195 constexpr int kHeaderTopVerticalInset = 14; 195 constexpr int kHeaderTopVerticalInset = 14;
196 constexpr int kHeaderBottomVerticalInset = 8; 196 constexpr int kHeaderBottomVerticalInset = 8;
197 constexpr int kHeaderHorizontalInset = 16; 197 constexpr int kHeaderHorizontalInset = 16;
198 // Top, left, bottom, right. 198 container->SetBorder(views::CreateEmptyBorder(
199 layout->SetInsets(kHeaderTopVerticalInset, kHeaderHorizontalInset, 199 kHeaderTopVerticalInset, kHeaderHorizontalInset,
200 kHeaderBottomVerticalInset, kHeaderHorizontalInset); 200 kHeaderBottomVerticalInset, kHeaderHorizontalInset));
201 201
202 views::ColumnSet* columns = layout->AddColumnSet(0); 202 views::ColumnSet* columns = layout->AddColumnSet(0);
203 // A column for the optional back arrow. 203 // A column for the optional back arrow.
204 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 204 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER,
205 0, views::GridLayout::USE_PREF, 0, 0); 205 0, views::GridLayout::USE_PREF, 0, 0);
206 206
207 constexpr int kPaddingBetweenArrowAndTitle = 16; 207 constexpr int kPaddingBetweenArrowAndTitle = 16;
208 if (show_back_arrow) 208 if (show_back_arrow)
209 columns->AddPaddingColumn(0, kPaddingBetweenArrowAndTitle); 209 columns->AddPaddingColumn(0, kPaddingBetweenArrowAndTitle);
210 210
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 338
339 std::unique_ptr<views::View> base_label = 339 std::unique_ptr<views::View> base_label =
340 GetBaseProfileLabel(type, name, phone, email); 340 GetBaseProfileLabel(type, name, phone, email);
341 341
342 base_label->AddChildView(GetLabelForMissingInformation( 342 base_label->AddChildView(GetLabelForMissingInformation(
343 comp.GetStringForMissingContactFields(profile)) 343 comp.GetStringForMissingContactFields(profile))
344 .release()); 344 .release());
345 return base_label; 345 return base_label;
346 } 346 }
347 347
348 std::unique_ptr<views::Border> CreatePaymentRequestRowBorder(SkColor color) { 348 std::unique_ptr<views::Border> CreatePaymentRequestRowBorder(
349 SkColor color,
350 const gfx::Insets& insets) {
349 return views::CreateBorderPainter( 351 return views::CreateBorderPainter(
350 base::MakeUnique<PaymentRequestRowBorderPainter>(color), gfx::Insets()); 352 base::MakeUnique<PaymentRequestRowBorderPainter>(color), insets);
351 } 353 }
352 354
353 std::unique_ptr<views::Label> CreateBoldLabel(const base::string16& text) { 355 std::unique_ptr<views::Label> CreateBoldLabel(const base::string16& text) {
354 std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>(text); 356 std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>(text);
355 357
356 label->SetFontList( 358 label->SetFontList(
357 label->font_list().DeriveWithWeight(gfx::Font::Weight::BOLD)); 359 label->font_list().DeriveWithWeight(gfx::Font::Weight::BOLD));
358 360
359 return label; 361 return label;
360 } 362 }
(...skipping 28 matching lines...) Expand all
389 amount_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 391 amount_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
390 amount_label->set_id( 392 amount_label->set_id(
391 static_cast<int>(DialogViewID::SHIPPING_OPTION_AMOUNT)); 393 static_cast<int>(DialogViewID::SHIPPING_OPTION_AMOUNT));
392 container->AddChildView(amount_label.release()); 394 container->AddChildView(amount_label.release());
393 } 395 }
394 396
395 return container; 397 return container;
396 } 398 }
397 399
398 } // namespace payments 400 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698