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" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h" | 12 #include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h" |
13 #include "components/autofill/core/browser/autofill_data_util.h" | 13 #include "components/autofill/core/browser/autofill_data_util.h" |
14 #include "components/autofill/core/browser/autofill_profile.h" | 14 #include "components/autofill/core/browser/autofill_profile.h" |
15 #include "components/autofill/core/browser/autofill_type.h" | 15 #include "components/autofill/core/browser/autofill_type.h" |
16 #include "components/autofill/core/browser/credit_card.h" | 16 #include "components/autofill/core/browser/credit_card.h" |
17 #include "components/autofill/core/browser/field_types.h" | 17 #include "components/autofill/core/browser/field_types.h" |
18 #include "components/strings/grit/components_strings.h" | |
18 #include "third_party/skia/include/core/SkColor.h" | 19 #include "third_party/skia/include/core/SkColor.h" |
20 #include "ui/base/l10n/l10n_util.h" | |
19 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
20 #include "ui/gfx/canvas.h" | 22 #include "ui/gfx/canvas.h" |
21 #include "ui/gfx/font_list.h" | 23 #include "ui/gfx/font_list.h" |
22 #include "ui/gfx/geometry/insets.h" | 24 #include "ui/gfx/geometry/insets.h" |
23 #include "ui/gfx/geometry/point_f.h" | 25 #include "ui/gfx/geometry/point_f.h" |
24 #include "ui/gfx/paint_vector_icon.h" | 26 #include "ui/gfx/paint_vector_icon.h" |
25 #include "ui/vector_icons/vector_icons.h" | 27 #include "ui/vector_icons/vector_icons.h" |
26 #include "ui/views/border.h" | 28 #include "ui/views/border.h" |
27 #include "ui/views/bubble/bubble_frame_view.h" | 29 #include "ui/views/bubble/bubble_frame_view.h" |
28 #include "ui/views/controls/button/button.h" | 30 #include "ui/views/controls/button/button.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 | 241 |
240 std::unique_ptr<views::Label> CreateBoldLabel(const base::string16& text) { | 242 std::unique_ptr<views::Label> CreateBoldLabel(const base::string16& text) { |
241 std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>(text); | 243 std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>(text); |
242 | 244 |
243 label->SetFontList( | 245 label->SetFontList( |
244 label->font_list().DeriveWithWeight(gfx::Font::Weight::BOLD)); | 246 label->font_list().DeriveWithWeight(gfx::Font::Weight::BOLD)); |
245 | 247 |
246 return label; | 248 return label; |
247 } | 249 } |
248 | 250 |
251 base::string16 GetShippingAddressSectionString( | |
252 const payments::mojom::PaymentShippingType& shipping_type) { | |
253 if (shipping_type == payments::mojom::PaymentShippingType::DELIVERY) | |
Mathieu
2017/03/10 20:47:29
Could we have a switch(shipping_type) with three c
anthonyvd
2017/03/10 20:58:53
Good point, I set it up like this when I was confu
| |
254 return l10n_util::GetStringUTF16(IDS_PAYMENTS_DELIVERY_ADDRESS_LABEL); | |
255 if (shipping_type == payments::mojom::PaymentShippingType::PICKUP) | |
256 return l10n_util::GetStringUTF16(IDS_PAYMENTS_PICKUP_ADDRESS_LABEL); | |
257 | |
258 return l10n_util::GetStringUTF16(IDS_PAYMENTS_SHIPPING_ADDRESS_LABEL); | |
259 } | |
260 | |
261 base::string16 GetShippingOptionSectionString( | |
262 const payments::mojom::PaymentShippingType& shipping_type) { | |
263 if (shipping_type == payments::mojom::PaymentShippingType::DELIVERY) | |
264 return l10n_util::GetStringUTF16(IDS_PAYMENTS_DELIVERY_OPTION_LABEL); | |
265 if (shipping_type == payments::mojom::PaymentShippingType::PICKUP) | |
266 return l10n_util::GetStringUTF16(IDS_PAYMENTS_PICKUP_OPTION_LABEL); | |
267 | |
268 return l10n_util::GetStringUTF16(IDS_PAYMENTS_SHIPPING_OPTION_LABEL); | |
269 } | |
270 | |
249 } // namespace payments | 271 } // namespace payments |
OLD | NEW |