OLD | NEW |
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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 int CardUnmaskPromptControllerImpl::GetCvcImageRid() const { | 204 int CardUnmaskPromptControllerImpl::GetCvcImageRid() const { |
205 return card_.type() == kAmericanExpressCard ? IDR_CREDIT_CARD_CVC_HINT_AMEX | 205 return card_.type() == kAmericanExpressCard ? IDR_CREDIT_CARD_CVC_HINT_AMEX |
206 : IDR_CREDIT_CARD_CVC_HINT; | 206 : IDR_CREDIT_CARD_CVC_HINT; |
207 } | 207 } |
208 | 208 |
209 bool CardUnmaskPromptControllerImpl::ShouldRequestExpirationDate() const { | 209 bool CardUnmaskPromptControllerImpl::ShouldRequestExpirationDate() const { |
210 return card_.GetServerStatus() == CreditCard::EXPIRED; | 210 return card_.GetServerStatus() == CreditCard::EXPIRED; |
211 } | 211 } |
212 | 212 |
213 bool CardUnmaskPromptControllerImpl::CanStoreLocally() const { | 213 bool CardUnmaskPromptControllerImpl::CanStoreLocally() const { |
214 // TODO(estade): Always return false for Linux. See | 214 #if defined(ENABLE_SAVE_WALLET_CARDS_LOCALLY) |
215 // https://codereview.chromium.org/1012223002/ | |
216 return !Profile::FromBrowserContext(web_contents_->GetBrowserContext()) | 215 return !Profile::FromBrowserContext(web_contents_->GetBrowserContext()) |
217 ->IsOffTheRecord(); | 216 ->IsOffTheRecord(); |
| 217 #else |
| 218 return false; |
| 219 #endif |
218 } | 220 } |
219 | 221 |
220 bool CardUnmaskPromptControllerImpl::GetStoreLocallyStartState() const { | 222 bool CardUnmaskPromptControllerImpl::GetStoreLocallyStartState() const { |
221 PrefService* prefs = | 223 PrefService* prefs = |
222 user_prefs::UserPrefs::Get(web_contents_->GetBrowserContext()); | 224 user_prefs::UserPrefs::Get(web_contents_->GetBrowserContext()); |
223 return prefs->GetBoolean(prefs::kAutofillWalletImportStorageCheckboxState); | 225 return prefs->GetBoolean(prefs::kAutofillWalletImportStorageCheckboxState); |
224 } | 226 } |
225 | 227 |
226 bool CardUnmaskPromptControllerImpl::InputCvcIsValid( | 228 bool CardUnmaskPromptControllerImpl::InputCvcIsValid( |
227 const base::string16& input_text) const { | 229 const base::string16& input_text) const { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 } | 285 } |
284 | 286 |
285 void CardUnmaskPromptControllerImpl::OnDidLoadRiskFingerprint( | 287 void CardUnmaskPromptControllerImpl::OnDidLoadRiskFingerprint( |
286 const std::string& risk_data) { | 288 const std::string& risk_data) { |
287 pending_response_.risk_data = risk_data; | 289 pending_response_.risk_data = risk_data; |
288 if (!pending_response_.cvc.empty()) | 290 if (!pending_response_.cvc.empty()) |
289 delegate_->OnUnmaskResponse(pending_response_); | 291 delegate_->OnUnmaskResponse(pending_response_); |
290 } | 292 } |
291 | 293 |
292 } // namespace autofill | 294 } // namespace autofill |
OLD | NEW |