| 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 "chrome/grit/chromium_strings.h" |
| 14 #include "chrome/grit/theme_resources.h" |
| 13 #include "components/autofill/core/browser/autofill_data_util.h" | 15 #include "components/autofill/core/browser/autofill_data_util.h" |
| 14 #include "components/autofill/core/browser/autofill_profile.h" | 16 #include "components/autofill/core/browser/autofill_profile.h" |
| 15 #include "components/autofill/core/browser/autofill_type.h" | 17 #include "components/autofill/core/browser/autofill_type.h" |
| 16 #include "components/autofill/core/browser/credit_card.h" | 18 #include "components/autofill/core/browser/credit_card.h" |
| 17 #include "components/autofill/core/browser/field_types.h" | 19 #include "components/autofill/core/browser/field_types.h" |
| 18 #include "components/strings/grit/components_strings.h" | 20 #include "components/strings/grit/components_strings.h" |
| 19 #include "third_party/skia/include/core/SkColor.h" | 21 #include "third_party/skia/include/core/SkColor.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
| 22 #include "ui/gfx/canvas.h" | 24 #include "ui/gfx/canvas.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 card_icon_view->SetImage(ResourceBundle::GetSharedInstance() | 182 card_icon_view->SetImage(ResourceBundle::GetSharedInstance() |
| 181 .GetImageNamed(icon_resource_id) | 183 .GetImageNamed(icon_resource_id) |
| 182 .AsImageSkia()); | 184 .AsImageSkia()); |
| 183 card_icon_view->SetTooltipText(tooltip_text); | 185 card_icon_view->SetTooltipText(tooltip_text); |
| 184 card_icon_view->SetBorder(views::CreateRoundedRectBorder( | 186 card_icon_view->SetBorder(views::CreateRoundedRectBorder( |
| 185 1, 3, card_icon_view->GetNativeTheme()->GetSystemColor( | 187 1, 3, card_icon_view->GetNativeTheme()->GetSystemColor( |
| 186 ui::NativeTheme::kColorId_UnfocusedBorderColor))); | 188 ui::NativeTheme::kColorId_UnfocusedBorderColor))); |
| 187 return card_icon_view; | 189 return card_icon_view; |
| 188 } | 190 } |
| 189 | 191 |
| 192 std::unique_ptr<views::View> CreateProductLogoFooterView() { |
| 193 std::unique_ptr<views::View> content_view = base::MakeUnique<views::View>(); |
| 194 |
| 195 views::BoxLayout* layout = |
| 196 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); |
| 197 layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); |
| 198 layout->set_cross_axis_alignment( |
| 199 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); |
| 200 content_view->SetLayoutManager(layout); |
| 201 |
| 202 // Adds the Chrome logo image. |
| 203 std::unique_ptr<views::ImageView> chrome_logo = |
| 204 base::MakeUnique<views::ImageView>(); |
| 205 chrome_logo->set_can_process_events_within_subtree(false); |
| 206 chrome_logo->SetImage(ResourceBundle::GetSharedInstance() |
| 207 .GetImageNamed(IDR_PRODUCT_LOGO_NAME_22) |
| 208 .AsImageSkia()); |
| 209 chrome_logo->SetTooltipText(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 210 content_view->AddChildView(chrome_logo.release()); |
| 211 |
| 212 return content_view; |
| 213 } |
| 214 |
| 190 std::unique_ptr<views::View> GetShippingAddressLabel( | 215 std::unique_ptr<views::View> GetShippingAddressLabel( |
| 191 AddressStyleType type, | 216 AddressStyleType type, |
| 192 const std::string& locale, | 217 const std::string& locale, |
| 193 const autofill::AutofillProfile& profile) { | 218 const autofill::AutofillProfile& profile) { |
| 194 base::string16 name = | 219 base::string16 name = |
| 195 profile.GetInfo(autofill::AutofillType(autofill::NAME_FULL), locale); | 220 profile.GetInfo(autofill::AutofillType(autofill::NAME_FULL), locale); |
| 196 | 221 |
| 197 base::string16 address = GetAddressFromProfile(profile, locale); | 222 base::string16 address = GetAddressFromProfile(profile, locale); |
| 198 | 223 |
| 199 base::string16 phone = profile.GetInfo( | 224 base::string16 phone = profile.GetInfo( |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 if (shipping_option) { | 315 if (shipping_option) { |
| 291 container->AddChildView( | 316 container->AddChildView( |
| 292 new views::Label(base::ASCIIToUTF16(shipping_option->label))); | 317 new views::Label(base::ASCIIToUTF16(shipping_option->label))); |
| 293 container->AddChildView(new views::Label(formatted_amount)); | 318 container->AddChildView(new views::Label(formatted_amount)); |
| 294 } | 319 } |
| 295 | 320 |
| 296 return container; | 321 return container; |
| 297 } | 322 } |
| 298 | 323 |
| 299 } // namespace payments | 324 } // namespace payments |
| OLD | NEW |