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..419b413b25a87c5d7cb885e32b3cfc025ba0aa3d 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,19 @@ 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; |
+ // Remember the last choice the user made (on this device). |
+ 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 +112,14 @@ bool CardUnmaskPromptControllerImpl::ShouldRequestExpirationDate() const { |
return card_.GetServerStatus() == CreditCard::EXPIRED; |
} |
+bool CardUnmaskPromptControllerImpl::GetStoreLocallyStartState() const { |
+ // TODO(estade): Don't even offer to save on Linux? Offer to save but |
+ // default to false? |
+ PrefService* prefs = |
+ user_prefs::UserPrefs::Get(web_contents_->GetBrowserContext()); |
+ return prefs->GetBoolean(prefs::kAutofillWalletImportStorageCheckboxState); |
+} |
+ |
bool CardUnmaskPromptControllerImpl::InputTextIsValid( |
const base::string16& input_text) const { |
base::string16 trimmed_text; |