Chromium Code Reviews| Index: chrome/browser/ui/autofill/card_unmask_prompt_controller_impl.cc |
| diff --git a/chrome/browser/ui/autofill/card_unmask_prompt_controller_impl.cc b/chrome/browser/ui/autofill/card_unmask_prompt_controller_impl.cc |
| index 910c0e2c442883fe3a73a13b7080aafd99c12914..d42c2418a46e1a3f9c706638bc3b81fbfecf9107 100644 |
| --- a/chrome/browser/ui/autofill/card_unmask_prompt_controller_impl.cc |
| +++ b/chrome/browser/ui/autofill/card_unmask_prompt_controller_impl.cc |
| @@ -5,11 +5,15 @@ |
| #include "chrome/browser/ui/autofill/card_unmask_prompt_controller_impl.h" |
| #include "base/bind.h" |
| +#include "base/prefs/pref_service.h" |
| #include "base/strings/string_util.h" |
| #include "base/strings/utf_string_conversions.h" |
| #include "chrome/browser/autofill/risk_util.h" |
| #include "chrome/browser/ui/autofill/card_unmask_prompt_view.h" |
| #include "chrome/grit/generated_resources.h" |
| +#include "components/autofill/core/common/autofill_pref_names.h" |
| +#include "components/user_prefs/user_prefs.h" |
| +#include "content/public/browser/web_contents.h" |
| #include "grit/theme_resources.h" |
| #include "ui/base/l10n/l10n_util.h" |
| @@ -53,13 +57,18 @@ void CardUnmaskPromptControllerImpl::OnUnmaskDialogClosed() { |
| void CardUnmaskPromptControllerImpl::OnUnmaskResponse( |
| const base::string16& cvc, |
| const base::string16& exp_month, |
| - const base::string16& exp_year) { |
| + const base::string16& exp_year, |
| + bool should_store_pan) { |
| card_unmask_view_->DisableAndWaitForVerification(); |
| DCHECK(!cvc.empty()); |
| pending_response_.cvc = cvc; |
| pending_response_.exp_month = exp_month; |
| pending_response_.exp_year = exp_year; |
| + pending_response_.should_store_pan = should_store_pan; |
| + user_prefs::UserPrefs::Get(web_contents_->GetBrowserContext())->SetBoolean( |
| + prefs::kAutofillWalletImportStorageCheckboxState, should_store_pan); |
| + |
| if (!pending_response_.risk_data.empty()) |
| delegate_->OnUnmaskResponse(pending_response_); |
| } |
| @@ -102,6 +111,18 @@ bool CardUnmaskPromptControllerImpl::ShouldRequestExpirationDate() const { |
| return card_.GetServerStatus() == CreditCard::EXPIRED; |
| } |
| +bool CardUnmaskPromptControllerImpl::ShouldOfferToStoreLocally( |
|
brettw
2015/02/11 23:55:54
Can we make the store locally default to false on
|
| + bool* default_choice) const { |
| + PrefService* prefs = |
| + user_prefs::UserPrefs::Get(web_contents_->GetBrowserContext()); |
| + *default_choice = |
| + prefs->GetBoolean(prefs::kAutofillWalletImportStorageCheckboxState); |
| + |
| + // TODO(estade): perhaps we should always show the checkbox, but require |
| + // both prefs to be true for the starting state to be checked. |
| + return prefs->GetBoolean(prefs::kAutofillWalletImportStorageEnabled); |
| +} |
| + |
| bool CardUnmaskPromptControllerImpl::InputTextIsValid( |
| const base::string16& input_text) const { |
| base::string16 trimmed_text; |