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

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

Issue 2847813003: [Web Payments] Fix alignment of certain Payment Sheet labels. (Closed)
Patch Set: Apply the same treatment to the shipping option labels 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/payment_sheet_view_controller.cc » ('j') | 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_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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); 73 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START);
74 container->SetLayoutManager(layout.release()); 74 container->SetLayoutManager(layout.release());
75 75
76 if (!s1.empty()) { 76 if (!s1.empty()) {
77 std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>(s1); 77 std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>(s1);
78 if (type == AddressStyleType::DETAILED) { 78 if (type == AddressStyleType::DETAILED) {
79 const gfx::FontList& font_list = label->font_list(); 79 const gfx::FontList& font_list = label->font_list();
80 label->SetFontList(font_list.DeriveWithWeight(gfx::Font::Weight::BOLD)); 80 label->SetFontList(font_list.DeriveWithWeight(gfx::Font::Weight::BOLD));
81 } 81 }
82 label->set_id(static_cast<int>(DialogViewID::THREE_LINE_LABEL_LINE_1)); 82 label->set_id(static_cast<int>(DialogViewID::THREE_LINE_LABEL_LINE_1));
83 label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
83 container->AddChildView(label.release()); 84 container->AddChildView(label.release());
84 } 85 }
85 86
86 if (!s2.empty()) { 87 if (!s2.empty()) {
87 std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>(s2); 88 std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>(s2);
88 label->set_id(static_cast<int>(DialogViewID::THREE_LINE_LABEL_LINE_2)); 89 label->set_id(static_cast<int>(DialogViewID::THREE_LINE_LABEL_LINE_2));
90 label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
89 container->AddChildView(label.release()); 91 container->AddChildView(label.release());
90 } 92 }
91 93
92 if (!s3.empty()) { 94 if (!s3.empty()) {
93 std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>(s3); 95 std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>(s3);
94 label->set_id(static_cast<int>(DialogViewID::THREE_LINE_LABEL_LINE_3)); 96 label->set_id(static_cast<int>(DialogViewID::THREE_LINE_LABEL_LINE_3));
97 label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
95 container->AddChildView(label.release()); 98 container->AddChildView(label.release());
96 } 99 }
97 100
98 // TODO(anthonyvd): add the error label 101 // TODO(anthonyvd): add the error label
99 102
100 return container; 103 return container;
101 } 104 }
102 105
103 // Paints the gray horizontal line that doesn't span the entire width of the 106 // Paints the gray horizontal line that doesn't span the entire width of the
104 // dialog at the bottom of the view it borders. 107 // dialog at the bottom of the view it borders.
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 std::unique_ptr<views::BoxLayout> layout = 285 std::unique_ptr<views::BoxLayout> layout =
283 base::MakeUnique<views::BoxLayout>(views::BoxLayout::kVertical, 0, 0, 0); 286 base::MakeUnique<views::BoxLayout>(views::BoxLayout::kVertical, 0, 0, 0);
284 layout->set_cross_axis_alignment( 287 layout->set_cross_axis_alignment(
285 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); 288 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START);
286 container->SetLayoutManager(layout.release()); 289 container->SetLayoutManager(layout.release());
287 290
288 if (shipping_option) { 291 if (shipping_option) {
289 std::unique_ptr<views::Label> shipping_label = 292 std::unique_ptr<views::Label> shipping_label =
290 base::MakeUnique<views::Label>( 293 base::MakeUnique<views::Label>(
291 base::UTF8ToUTF16(shipping_option->label)); 294 base::UTF8ToUTF16(shipping_option->label));
295 shipping_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
292 shipping_label->set_id( 296 shipping_label->set_id(
293 static_cast<int>(DialogViewID::SHIPPING_OPTION_DESCRIPTION)); 297 static_cast<int>(DialogViewID::SHIPPING_OPTION_DESCRIPTION));
294 container->AddChildView(shipping_label.release()); 298 container->AddChildView(shipping_label.release());
295 299
296 std::unique_ptr<views::Label> amount_label = 300 std::unique_ptr<views::Label> amount_label =
297 base::MakeUnique<views::Label>(formatted_amount); 301 base::MakeUnique<views::Label>(formatted_amount);
302 amount_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
298 amount_label->set_id( 303 amount_label->set_id(
299 static_cast<int>(DialogViewID::SHIPPING_OPTION_AMOUNT)); 304 static_cast<int>(DialogViewID::SHIPPING_OPTION_AMOUNT));
300 container->AddChildView(amount_label.release()); 305 container->AddChildView(amount_label.release());
301 } 306 }
302 307
303 return container; 308 return container;
304 } 309 }
305 310
306 } // namespace payments 311 } // namespace payments
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/payment_sheet_view_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698