OLD | NEW |
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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 std::unique_ptr<views::Label> CreateMediumLabel(const base::string16& text) { | 344 std::unique_ptr<views::Label> CreateMediumLabel(const base::string16& text) { |
345 // TODO(tapted): This should refer to a style in the Chrome typography spec. | 345 // TODO(tapted): This should refer to a style in the Chrome typography spec. |
346 // Also, it needs to handle user setups where the default font is BOLD already | 346 // Also, it needs to handle user setups where the default font is BOLD already |
347 // since asking for a MEDIUM font will give a lighter font. | 347 // since asking for a MEDIUM font will give a lighter font. |
348 std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>(text); | 348 std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>(text); |
349 label->SetFontList(ResourceBundle::GetSharedInstance().GetFontListWithDelta( | 349 label->SetFontList(ResourceBundle::GetSharedInstance().GetFontListWithDelta( |
350 ui::kLabelFontSizeDelta, gfx::Font::NORMAL, gfx::Font::Weight::MEDIUM)); | 350 ui::kLabelFontSizeDelta, gfx::Font::NORMAL, gfx::Font::Weight::MEDIUM)); |
351 return label; | 351 return label; |
352 } | 352 } |
353 | 353 |
| 354 std::unique_ptr<views::Label> CreateHintLabel( |
| 355 const base::string16& text, |
| 356 gfx::HorizontalAlignment alignment) { |
| 357 std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>( |
| 358 text, views::style::CONTEXT_LABEL, STYLE_HINT); |
| 359 label->SetHorizontalAlignment(alignment); |
| 360 return label; |
| 361 } |
| 362 |
354 std::unique_ptr<views::View> CreateShippingOptionLabel( | 363 std::unique_ptr<views::View> CreateShippingOptionLabel( |
355 payments::mojom::PaymentShippingOption* shipping_option, | 364 payments::mojom::PaymentShippingOption* shipping_option, |
356 const base::string16& formatted_amount, | 365 const base::string16& formatted_amount, |
357 bool emphasize_label) { | 366 bool emphasize_label) { |
358 std::unique_ptr<views::View> container = base::MakeUnique<views::View>(); | 367 std::unique_ptr<views::View> container = base::MakeUnique<views::View>(); |
359 | 368 |
360 std::unique_ptr<views::BoxLayout> layout = | 369 std::unique_ptr<views::BoxLayout> layout = |
361 base::MakeUnique<views::BoxLayout>(views::BoxLayout::kVertical, 0, 0, 0); | 370 base::MakeUnique<views::BoxLayout>(views::BoxLayout::kVertical, 0, 0, 0); |
362 layout->set_cross_axis_alignment( | 371 layout->set_cross_axis_alignment( |
363 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); | 372 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); |
(...skipping 14 matching lines...) Expand all Loading... |
378 amount_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 387 amount_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
379 amount_label->set_id( | 388 amount_label->set_id( |
380 static_cast<int>(DialogViewID::SHIPPING_OPTION_AMOUNT)); | 389 static_cast<int>(DialogViewID::SHIPPING_OPTION_AMOUNT)); |
381 container->AddChildView(amount_label.release()); | 390 container->AddChildView(amount_label.release()); |
382 } | 391 } |
383 | 392 |
384 return container; | 393 return container; |
385 } | 394 } |
386 | 395 |
387 } // namespace payments | 396 } // namespace payments |
OLD | NEW |