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

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

Issue 2844463004: Rename card 'type' into 'issuer network.' (Closed)
Patch Set: read -> use Created 3 years, 8 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 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>
8
7 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/autofill/risk_util.h" 10 #include "chrome/browser/autofill/risk_util.h"
9 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 12 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
11 #include "chrome/browser/signin/signin_manager_factory.h" 13 #include "chrome/browser/signin/signin_manager_factory.h"
12 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" 14 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h"
13 #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"
14 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" 16 #include "chrome/browser/ui/views/payments/payment_request_views_util.h"
15 #include "chrome/grit/generated_resources.h" 17 #include "chrome/grit/generated_resources.h"
16 #include "components/autofill/core/browser/credit_card.h" 18 #include "components/autofill/core/browser/credit_card.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 unmask_delegate_ = delegate; 109 unmask_delegate_ = delegate;
108 } 110 }
109 111
110 void CvcUnmaskViewController::OnUnmaskVerificationResult( 112 void CvcUnmaskViewController::OnUnmaskVerificationResult(
111 autofill::AutofillClient::PaymentsRpcResult result) { 113 autofill::AutofillClient::PaymentsRpcResult result) {
112 // TODO(anthonyvd): Show result. 114 // TODO(anthonyvd): Show result.
113 } 115 }
114 116
115 base::string16 CvcUnmaskViewController::GetSheetTitle() { 117 base::string16 CvcUnmaskViewController::GetSheetTitle() {
116 return l10n_util::GetStringFUTF16(IDS_AUTOFILL_CARD_UNMASK_PROMPT_TITLE, 118 return l10n_util::GetStringFUTF16(IDS_AUTOFILL_CARD_UNMASK_PROMPT_TITLE,
117 credit_card_.TypeAndLastFourDigits()); 119 credit_card_.NetworkAndLastFourDigits());
118 } 120 }
119 121
120 void CvcUnmaskViewController::FillContentView(views::View* content_view) { 122 void CvcUnmaskViewController::FillContentView(views::View* content_view) {
121 std::unique_ptr<views::GridLayout> layout = 123 std::unique_ptr<views::GridLayout> layout =
122 base::MakeUnique<views::GridLayout>(content_view); 124 base::MakeUnique<views::GridLayout>(content_view);
123 layout->SetInsets( 125 layout->SetInsets(
124 kPaymentRequestRowVerticalInsets, kPaymentRequestRowHorizontalInsets, 126 kPaymentRequestRowVerticalInsets, kPaymentRequestRowHorizontalInsets,
125 kPaymentRequestRowVerticalInsets, kPaymentRequestRowHorizontalInsets); 127 kPaymentRequestRowVerticalInsets, kPaymentRequestRowHorizontalInsets);
126 128
127 views::ColumnSet* instructions_columns = layout->AddColumnSet(0); 129 views::ColumnSet* instructions_columns = layout->AddColumnSet(0);
(...skipping 18 matching lines...) Expand all
146 cvc_field_columns->AddColumn(views::GridLayout::Alignment::FILL, 148 cvc_field_columns->AddColumn(views::GridLayout::Alignment::FILL,
147 views::GridLayout::Alignment::BASELINE, 0, 149 views::GridLayout::Alignment::BASELINE, 0,
148 views::GridLayout::SizeType::FIXED, 80, 80); 150 views::GridLayout::SizeType::FIXED, 80, 80);
149 151
150 layout->StartRow(0, 1); 152 layout->StartRow(0, 1);
151 std::unique_ptr<views::ImageView> cvc_image = 153 std::unique_ptr<views::ImageView> cvc_image =
152 base::MakeUnique<views::ImageView>(); 154 base::MakeUnique<views::ImageView>();
153 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 155 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
154 // TODO(anthonyvd): Consider using 156 // TODO(anthonyvd): Consider using
155 // CardUnmaskPromptControllerImpl::GetCvcImageRid. 157 // CardUnmaskPromptControllerImpl::GetCvcImageRid.
156 cvc_image->SetImage( 158 cvc_image->SetImage(rb.GetImageSkiaNamed(
157 rb.GetImageSkiaNamed(credit_card_.type() == autofill::kAmericanExpressCard 159 credit_card_.network() == autofill::kAmericanExpressCard
158 ? IDR_CREDIT_CARD_CVC_HINT_AMEX 160 ? IDR_CREDIT_CARD_CVC_HINT_AMEX
159 : IDR_CREDIT_CARD_CVC_HINT)); 161 : IDR_CREDIT_CARD_CVC_HINT));
160 layout->AddView(cvc_image.release()); 162 layout->AddView(cvc_image.release());
161 163
162 std::unique_ptr<views::Textfield> cvc_field = 164 std::unique_ptr<views::Textfield> cvc_field =
163 base::MakeUnique<views::Textfield>(); 165 base::MakeUnique<views::Textfield>();
164 cvc_field->set_id(static_cast<int>(DialogViewID::CVC_PROMPT_TEXT_FIELD)); 166 cvc_field->set_id(static_cast<int>(DialogViewID::CVC_PROMPT_TEXT_FIELD));
165 cvc_field_ = cvc_field.get(); 167 cvc_field_ = cvc_field.get();
166 layout->AddView(cvc_field.release()); 168 layout->AddView(cvc_field.release());
167 169
168 content_view->SetLayoutManager(layout.release()); 170 content_view->SetLayoutManager(layout.release());
169 } 171 }
(...skipping 23 matching lines...) Expand all
193 if (unmask_delegate_) { 195 if (unmask_delegate_) {
194 autofill::CardUnmaskDelegate::UnmaskResponse response; 196 autofill::CardUnmaskDelegate::UnmaskResponse response;
195 response.cvc = cvc; 197 response.cvc = cvc;
196 unmask_delegate_->OnUnmaskResponse(response); 198 unmask_delegate_->OnUnmaskResponse(response);
197 } 199 }
198 200
199 dialog()->ShowProcessingSpinner(); 201 dialog()->ShowProcessingSpinner();
200 } 202 }
201 203
202 } // namespace payments 204 } // namespace payments
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc ('k') | components/autofill/core/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698