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

Side by Side Diff: chrome/browser/ui/autofill/card_unmask_prompt_controller_impl.cc

Issue 1012223002: Add flag to disable full PAN storage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/autofill/card_unmask_prompt_views.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/autofill/card_unmask_prompt_controller_impl.h" 5 #include "chrome/browser/ui/autofill/card_unmask_prompt_controller_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 void CardUnmaskPromptControllerImpl::OnUnmaskDialogClosed() { 83 void CardUnmaskPromptControllerImpl::OnUnmaskDialogClosed() {
84 card_unmask_view_ = nullptr; 84 card_unmask_view_ = nullptr;
85 delegate_->OnUnmaskPromptClosed(); 85 delegate_->OnUnmaskPromptClosed();
86 } 86 }
87 87
88 void CardUnmaskPromptControllerImpl::OnUnmaskResponse( 88 void CardUnmaskPromptControllerImpl::OnUnmaskResponse(
89 const base::string16& cvc, 89 const base::string16& cvc,
90 const base::string16& exp_month, 90 const base::string16& exp_month,
91 const base::string16& exp_year, 91 const base::string16& exp_year,
92 bool should_store_pan) { 92 bool should_store_pan) {
93 #if defined(OS_LINUX)
please use gerrit instead 2015/03/17 20:30:45 I've seen code that checks for OS_LINUX && !OS_CHR
Evan Stade 2015/03/17 22:24:34 good point. I've changed tactics though. I added a
94 DCHECK(!should_store_pan);
95 #endif
96
93 card_unmask_view_->DisableAndWaitForVerification(); 97 card_unmask_view_->DisableAndWaitForVerification();
94 98
95 DCHECK(!cvc.empty()); 99 DCHECK(!cvc.empty());
96 pending_response_.cvc = cvc; 100 pending_response_.cvc = cvc;
97 if (ShouldRequestExpirationDate()) { 101 if (ShouldRequestExpirationDate()) {
98 pending_response_.exp_month = exp_month; 102 pending_response_.exp_month = exp_month;
99 pending_response_.exp_year = exp_year; 103 pending_response_.exp_year = exp_year;
100 } 104 }
101 pending_response_.should_store_pan = should_store_pan; 105 pending_response_.should_store_pan = should_store_pan;
102 // Remember the last choice the user made (on this device). 106 // Remember the last choice the user made (on this device).
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 int CardUnmaskPromptControllerImpl::GetCvcImageRid() const { 139 int CardUnmaskPromptControllerImpl::GetCvcImageRid() const {
136 return card_.type() == kAmericanExpressCard ? IDR_CREDIT_CARD_CVC_HINT_AMEX 140 return card_.type() == kAmericanExpressCard ? IDR_CREDIT_CARD_CVC_HINT_AMEX
137 : IDR_CREDIT_CARD_CVC_HINT; 141 : IDR_CREDIT_CARD_CVC_HINT;
138 } 142 }
139 143
140 bool CardUnmaskPromptControllerImpl::ShouldRequestExpirationDate() const { 144 bool CardUnmaskPromptControllerImpl::ShouldRequestExpirationDate() const {
141 return card_.GetServerStatus() == CreditCard::EXPIRED; 145 return card_.GetServerStatus() == CreditCard::EXPIRED;
142 } 146 }
143 147
144 bool CardUnmaskPromptControllerImpl::GetStoreLocallyStartState() const { 148 bool CardUnmaskPromptControllerImpl::GetStoreLocallyStartState() const {
145 // TODO(estade): Don't even offer to save on Linux? Offer to save but
146 // default to false?
147 PrefService* prefs = 149 PrefService* prefs =
148 user_prefs::UserPrefs::Get(web_contents_->GetBrowserContext()); 150 user_prefs::UserPrefs::Get(web_contents_->GetBrowserContext());
149 return prefs->GetBoolean(prefs::kAutofillWalletImportStorageCheckboxState); 151 return prefs->GetBoolean(prefs::kAutofillWalletImportStorageCheckboxState);
150 } 152 }
151 153
152 bool CardUnmaskPromptControllerImpl::InputCvcIsValid( 154 bool CardUnmaskPromptControllerImpl::InputCvcIsValid(
153 const base::string16& input_text) const { 155 const base::string16& input_text) const {
154 base::string16 trimmed_text; 156 base::string16 trimmed_text;
155 base::TrimWhitespace(input_text, base::TRIM_ALL, &trimmed_text); 157 base::TrimWhitespace(input_text, base::TRIM_ALL, &trimmed_text);
156 size_t input_size = card_.type() == kAmericanExpressCard ? 4 : 3; 158 size_t input_size = card_.type() == kAmericanExpressCard ? 4 : 3;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 } 202 }
201 203
202 void CardUnmaskPromptControllerImpl::OnDidLoadRiskFingerprint( 204 void CardUnmaskPromptControllerImpl::OnDidLoadRiskFingerprint(
203 const std::string& risk_data) { 205 const std::string& risk_data) {
204 pending_response_.risk_data = risk_data; 206 pending_response_.risk_data = risk_data;
205 if (!pending_response_.cvc.empty()) 207 if (!pending_response_.cvc.empty())
206 delegate_->OnUnmaskResponse(pending_response_); 208 delegate_->OnUnmaskResponse(pending_response_);
207 } 209 }
208 210
209 } // namespace autofill 211 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/autofill/card_unmask_prompt_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698