| 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 case payments::mojom::PaymentShippingType::PICKUP: | 270 case payments::mojom::PaymentShippingType::PICKUP: |
| 271 return l10n_util::GetStringUTF16(IDS_PAYMENTS_PICKUP_OPTION_LABEL); | 271 return l10n_util::GetStringUTF16(IDS_PAYMENTS_PICKUP_OPTION_LABEL); |
| 272 case payments::mojom::PaymentShippingType::SHIPPING: | 272 case payments::mojom::PaymentShippingType::SHIPPING: |
| 273 return l10n_util::GetStringUTF16(IDS_PAYMENTS_SHIPPING_OPTION_LABEL); | 273 return l10n_util::GetStringUTF16(IDS_PAYMENTS_SHIPPING_OPTION_LABEL); |
| 274 } | 274 } |
| 275 // MSVC doesn't compile with only the above switch statement because it can't | 275 // MSVC doesn't compile with only the above switch statement because it can't |
| 276 // see that all control paths return a value. | 276 // see that all control paths return a value. |
| 277 return l10n_util::GetStringUTF16(IDS_PAYMENTS_SHIPPING_OPTION_LABEL); | 277 return l10n_util::GetStringUTF16(IDS_PAYMENTS_SHIPPING_OPTION_LABEL); |
| 278 } | 278 } |
| 279 | 279 |
| 280 std::unique_ptr<views::View> CreateShippingOptionLabel( |
| 281 payments::mojom::PaymentShippingOption* shipping_option, |
| 282 const base::string16& formatted_amount) { |
| 283 std::unique_ptr<views::View> container = base::MakeUnique<views::View>(); |
| 284 |
| 285 std::unique_ptr<views::BoxLayout> layout = |
| 286 base::MakeUnique<views::BoxLayout>(views::BoxLayout::kVertical, 0, 0, 0); |
| 287 layout->set_cross_axis_alignment( |
| 288 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); |
| 289 container->SetLayoutManager(layout.release()); |
| 290 |
| 291 if (shipping_option) { |
| 292 container->AddChildView( |
| 293 new views::Label(base::ASCIIToUTF16(shipping_option->label))); |
| 294 container->AddChildView(new views::Label(formatted_amount)); |
| 295 } |
| 296 |
| 297 return container; |
| 298 } |
| 299 |
| 280 } // namespace payments | 300 } // namespace payments |
| OLD | NEW |