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

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

Issue 2742643004: [Web Payments] Use shippingType to choose the Payment Sheet shipping strings. (Closed)
Patch Set: Fix windows compile. Created 3 years, 9 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"
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
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 payments::mojom::PaymentShippingType shipping_type) {
253 switch (shipping_type) {
254 case payments::mojom::PaymentShippingType::DELIVERY:
255 return l10n_util::GetStringUTF16(IDS_PAYMENTS_DELIVERY_ADDRESS_LABEL);
256 case payments::mojom::PaymentShippingType::PICKUP:
257 return l10n_util::GetStringUTF16(IDS_PAYMENTS_PICKUP_ADDRESS_LABEL);
258 case payments::mojom::PaymentShippingType::SHIPPING:
259 return l10n_util::GetStringUTF16(IDS_PAYMENTS_SHIPPING_ADDRESS_LABEL);
260 }
261 // MSVC doesn't compile with only the above switch statement because it can't
262 // see that all control paths return a value.
263 return l10n_util::GetStringUTF16(IDS_PAYMENTS_SHIPPING_ADDRESS_LABEL);
264 }
265
266 base::string16 GetShippingOptionSectionString(
267 payments::mojom::PaymentShippingType shipping_type) {
268 switch (shipping_type) {
269 case payments::mojom::PaymentShippingType::DELIVERY:
270 return l10n_util::GetStringUTF16(IDS_PAYMENTS_DELIVERY_OPTION_LABEL);
271 case payments::mojom::PaymentShippingType::PICKUP:
272 return l10n_util::GetStringUTF16(IDS_PAYMENTS_PICKUP_OPTION_LABEL);
273 case payments::mojom::PaymentShippingType::SHIPPING:
274 return l10n_util::GetStringUTF16(IDS_PAYMENTS_SHIPPING_OPTION_LABEL);
275 }
276 // MSVC doesn't compile with only the above switch statement because it can't
277 // see that all control paths return a value.
278 return l10n_util::GetStringUTF16(IDS_PAYMENTS_SHIPPING_OPTION_LABEL);
279 }
280
249 } // namespace payments 281 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698