| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/cvc_unmask_view_controller.h" | 5 #include "chrome/browser/ui/views/payments/cvc_unmask_view_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/autofill/risk_util.h" | 10 #include "chrome/browser/autofill/risk_util.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 12 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 13 #include "chrome/browser/signin/signin_manager_factory.h" | 13 #include "chrome/browser/signin/signin_manager_factory.h" |
| 14 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" | 14 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" |
| 15 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" | 15 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" |
| 16 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" | 16 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
| 17 #include "chrome/grit/generated_resources.h" | 17 #include "chrome/grit/generated_resources.h" |
| 18 #include "components/autofill/core/browser/credit_card.h" | 18 #include "components/autofill/core/browser/credit_card.h" |
| 19 #include "components/autofill/core/browser/payments/full_card_request.h" | 19 #include "components/autofill/core/browser/payments/full_card_request.h" |
| 20 #include "components/grit/components_scaled_resources.h" | 20 #include "components/grit/components_scaled_resources.h" |
| 21 #include "components/payments/content/payment_request_state.h" | 21 #include "components/payments/content/payment_request_state.h" |
| 22 #include "components/payments/core/payment_request_delegate.h" | 22 #include "components/payments/core/payment_request_delegate.h" |
| 23 #include "components/signin/core/browser/profile_identity_provider.h" | 23 #include "components/signin/core/browser/profile_identity_provider.h" |
| 24 #include "components/signin/core/browser/signin_manager.h" | 24 #include "components/signin/core/browser/signin_manager.h" |
| 25 #include "components/strings/grit/components_strings.h" | 25 #include "components/strings/grit/components_strings.h" |
| 26 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| 27 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 28 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| 29 #include "ui/views/border.h" |
| 29 #include "ui/views/controls/button/md_text_button.h" | 30 #include "ui/views/controls/button/md_text_button.h" |
| 30 #include "ui/views/controls/textfield/textfield.h" | 31 #include "ui/views/controls/textfield/textfield.h" |
| 31 #include "ui/views/layout/fill_layout.h" | 32 #include "ui/views/layout/fill_layout.h" |
| 32 #include "ui/views/layout/grid_layout.h" | 33 #include "ui/views/layout/grid_layout.h" |
| 33 | 34 |
| 34 namespace payments { | 35 namespace payments { |
| 35 | 36 |
| 36 enum class Tags { | 37 enum class Tags { |
| 37 CONFIRM_TAG = static_cast<int>(PaymentRequestCommonTags::PAY_BUTTON_TAG), | 38 CONFIRM_TAG = static_cast<int>(PaymentRequestCommonTags::PAY_BUTTON_TAG), |
| 38 }; | 39 }; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 117 } |
| 117 | 118 |
| 118 base::string16 CvcUnmaskViewController::GetSheetTitle() { | 119 base::string16 CvcUnmaskViewController::GetSheetTitle() { |
| 119 return l10n_util::GetStringFUTF16(IDS_AUTOFILL_CARD_UNMASK_PROMPT_TITLE, | 120 return l10n_util::GetStringFUTF16(IDS_AUTOFILL_CARD_UNMASK_PROMPT_TITLE, |
| 120 credit_card_.NetworkAndLastFourDigits()); | 121 credit_card_.NetworkAndLastFourDigits()); |
| 121 } | 122 } |
| 122 | 123 |
| 123 void CvcUnmaskViewController::FillContentView(views::View* content_view) { | 124 void CvcUnmaskViewController::FillContentView(views::View* content_view) { |
| 124 std::unique_ptr<views::GridLayout> layout = | 125 std::unique_ptr<views::GridLayout> layout = |
| 125 base::MakeUnique<views::GridLayout>(content_view); | 126 base::MakeUnique<views::GridLayout>(content_view); |
| 126 layout->SetInsets( | 127 content_view->SetBorder(views::CreateEmptyBorder( |
| 127 kPaymentRequestRowVerticalInsets, kPaymentRequestRowHorizontalInsets, | 128 kPaymentRequestRowVerticalInsets, kPaymentRequestRowHorizontalInsets, |
| 128 kPaymentRequestRowVerticalInsets, kPaymentRequestRowHorizontalInsets); | 129 kPaymentRequestRowVerticalInsets, kPaymentRequestRowHorizontalInsets)); |
| 129 | 130 |
| 130 views::ColumnSet* instructions_columns = layout->AddColumnSet(0); | 131 views::ColumnSet* instructions_columns = layout->AddColumnSet(0); |
| 131 instructions_columns->AddColumn(views::GridLayout::Alignment::LEADING, | 132 instructions_columns->AddColumn(views::GridLayout::Alignment::LEADING, |
| 132 views::GridLayout::Alignment::LEADING, 1, | 133 views::GridLayout::Alignment::LEADING, 1, |
| 133 views::GridLayout::SizeType::USE_PREF, 0, 0); | 134 views::GridLayout::SizeType::USE_PREF, 0, 0); |
| 134 | 135 |
| 135 layout->StartRow(0, 0); | 136 layout->StartRow(0, 0); |
| 136 std::unique_ptr<views::Label> instructions = base::MakeUnique<views::Label>( | 137 std::unique_ptr<views::Label> instructions = base::MakeUnique<views::Label>( |
| 137 l10n_util::GetStringUTF16(IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS)); | 138 l10n_util::GetStringUTF16(IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS)); |
| 138 instructions->SetMultiLine(true); | 139 instructions->SetMultiLine(true); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 bool CvcUnmaskViewController::GetSheetId(DialogViewID* sheet_id) { | 210 bool CvcUnmaskViewController::GetSheetId(DialogViewID* sheet_id) { |
| 210 *sheet_id = DialogViewID::CVC_UNMASK_SHEET; | 211 *sheet_id = DialogViewID::CVC_UNMASK_SHEET; |
| 211 return true; | 212 return true; |
| 212 } | 213 } |
| 213 | 214 |
| 214 views::View* CvcUnmaskViewController::GetFirstFocusedView() { | 215 views::View* CvcUnmaskViewController::GetFirstFocusedView() { |
| 215 return cvc_field_; | 216 return cvc_field_; |
| 216 } | 217 } |
| 217 | 218 |
| 218 } // namespace payments | 219 } // namespace payments |
| OLD | NEW |