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

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_models.cc

Issue 13625002: Change the behavior of the [X] Save details to Wallet checkbox notification to: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/autofill/autofill_dialog_models.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_models.cc b/chrome/browser/ui/autofill/autofill_dialog_models.cc
index 0727783bb417fc0ba0ad526cc542e6ff46095940..ed50352ece95f161686a3c5cc87c2a1a9014a8a6 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_models.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_models.cc
@@ -108,14 +108,9 @@ AccountChooserModel::AccountChooserModel(
PrefService* prefs)
: ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)),
account_delegate_(delegate),
- prefs_(prefs),
- checked_item_(kWalletItemId),
+ checked_item_(prefs->GetBoolean(prefs::kAutofillDialogPayWithoutWallet) ?
+ kAutofillItemId : kWalletItemId),
had_wallet_error_(false) {
- pref_change_registrar_.Init(prefs);
- pref_change_registrar_.Add(
- prefs::kAutofillDialogPayWithoutWallet,
- base::Bind(&AccountChooserModel::PrefChanged, base::Unretained(this)));
-
AddCheckItem(kWalletItemId,
l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_GOOGLE_WALLET));
SetIcon(
@@ -123,7 +118,6 @@ AccountChooserModel::AccountChooserModel(
ui::ResourceBundle::GetSharedInstance().GetImageNamed(IDR_WALLET_ICON));
AddCheckItemWithStringId(kAutofillItemId,
IDS_AUTOFILL_DIALOG_PAY_WITHOUT_WALLET);
- UpdateCheckmarkFromPref();
}
AccountChooserModel::~AccountChooserModel() {
@@ -156,32 +150,17 @@ void AccountChooserModel::ExecuteCommand(int command_id, int event_flags) {
void AccountChooserModel::SetHadWalletError() {
had_wallet_error_ = true;
- checked_item_ = kAutofillItemId;
- account_delegate_->AccountChoiceChanged();
+ ExecuteCommand(kAutofillItemId, 0);
}
void AccountChooserModel::SetHadWalletSigninError() {
- checked_item_ = kAutofillItemId;
- account_delegate_->AccountChoiceChanged();
+ ExecuteCommand(kAutofillItemId, 0);
}
bool AccountChooserModel::WalletIsSelected() const {
return checked_item_ == kWalletItemId;
}
-void AccountChooserModel::PrefChanged(const std::string& pref) {
- DCHECK(pref == prefs::kAutofillDialogPayWithoutWallet);
- UpdateCheckmarkFromPref();
- account_delegate_->AccountChoiceChanged();
-}
-
-void AccountChooserModel::UpdateCheckmarkFromPref() {
- if (prefs_->GetBoolean(prefs::kAutofillDialogPayWithoutWallet))
- checked_item_ = kAutofillItemId;
- else
- checked_item_ = kWalletItemId;
-}
-
// MonthComboboxModel ----------------------------------------------------------
MonthComboboxModel::MonthComboboxModel() {}
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_models.h ('k') | chrome/browser/ui/autofill/autofill_dialog_models_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698