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

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

Issue 2844293002: [Payments] Handle clicking back on the CVC unmask dialog (Closed)
Patch Set: Test Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/cvc_unmask_view_controller_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/autofill/risk_util.h" 8 #include "chrome/browser/autofill/risk_util.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 10 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 void CvcUnmaskViewController::ShowUnmaskPrompt( 103 void CvcUnmaskViewController::ShowUnmaskPrompt(
104 const autofill::CreditCard& card, 104 const autofill::CreditCard& card,
105 autofill::AutofillClient::UnmaskCardReason reason, 105 autofill::AutofillClient::UnmaskCardReason reason,
106 base::WeakPtr<autofill::CardUnmaskDelegate> delegate) { 106 base::WeakPtr<autofill::CardUnmaskDelegate> delegate) {
107 unmask_delegate_ = delegate; 107 unmask_delegate_ = delegate;
108 } 108 }
109 109
110 void CvcUnmaskViewController::OnUnmaskVerificationResult( 110 void CvcUnmaskViewController::OnUnmaskVerificationResult(
111 autofill::AutofillClient::PaymentsRpcResult result) { 111 autofill::AutofillClient::PaymentsRpcResult result) {
112 // TODO(anthonyvd): Show result. 112 // TODO(crbug.com/716020): Handle FullCardRequest errors with more
113 // granularity and display an error in the UI.
113 } 114 }
114 115
115 base::string16 CvcUnmaskViewController::GetSheetTitle() { 116 base::string16 CvcUnmaskViewController::GetSheetTitle() {
116 return l10n_util::GetStringFUTF16(IDS_AUTOFILL_CARD_UNMASK_PROMPT_TITLE, 117 return l10n_util::GetStringFUTF16(IDS_AUTOFILL_CARD_UNMASK_PROMPT_TITLE,
117 credit_card_.TypeAndLastFourDigits()); 118 credit_card_.TypeAndLastFourDigits());
118 } 119 }
119 120
120 void CvcUnmaskViewController::FillContentView(views::View* content_view) { 121 void CvcUnmaskViewController::FillContentView(views::View* content_view) {
121 std::unique_ptr<views::GridLayout> layout = 122 std::unique_ptr<views::GridLayout> layout =
122 base::MakeUnique<views::GridLayout>(content_view); 123 base::MakeUnique<views::GridLayout>(content_view);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 button->set_tag(static_cast<int>(Tags::CONFIRM_TAG)); 177 button->set_tag(static_cast<int>(Tags::CONFIRM_TAG));
177 return button; 178 return button;
178 } 179 }
179 180
180 void CvcUnmaskViewController::ButtonPressed(views::Button* sender, 181 void CvcUnmaskViewController::ButtonPressed(views::Button* sender,
181 const ui::Event& event) { 182 const ui::Event& event) {
182 switch (sender->tag()) { 183 switch (sender->tag()) {
183 case static_cast<int>(Tags::CONFIRM_TAG): 184 case static_cast<int>(Tags::CONFIRM_TAG):
184 CvcConfirmed(); 185 CvcConfirmed();
185 break; 186 break;
187 case static_cast<int>(PaymentRequestCommonTags::BACK_BUTTON_TAG):
188 unmask_delegate_->OnUnmaskPromptClosed();
189 dialog()->GoBack();
190 break;
186 default: 191 default:
187 PaymentRequestSheetController::ButtonPressed(sender, event); 192 PaymentRequestSheetController::ButtonPressed(sender, event);
188 } 193 }
189 } 194 }
190 195
191 void CvcUnmaskViewController::CvcConfirmed() { 196 void CvcUnmaskViewController::CvcConfirmed() {
192 const base::string16& cvc = cvc_field_->text(); 197 const base::string16& cvc = cvc_field_->text();
193 if (unmask_delegate_) { 198 if (unmask_delegate_) {
194 autofill::CardUnmaskDelegate::UnmaskResponse response; 199 autofill::CardUnmaskDelegate::UnmaskResponse response;
195 response.cvc = cvc; 200 response.cvc = cvc;
196 unmask_delegate_->OnUnmaskResponse(response); 201 unmask_delegate_->OnUnmaskResponse(response);
197 } 202 }
198 203
199 dialog()->ShowProcessingSpinner(); 204 dialog()->ShowProcessingSpinner();
200 } 205 }
201 206
202 } // namespace payments 207 } // namespace payments
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/cvc_unmask_view_controller_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698