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 78d7d35aa792fe7427dd444487c760d40e2b0436..32794b24d25a82db302fb07e932531583fe69cf5 100644 |
--- a/chrome/browser/ui/autofill/autofill_dialog_models.cc |
+++ b/chrome/browser/ui/autofill/autofill_dialog_models.cc |
@@ -96,92 +96,6 @@ void SuggestionsMenuModel::ExecuteCommand(int command_id, int event_flags) { |
delegate_->SuggestionItemSelected(*this); |
} |
-// AccountChooserModel --------------------------------------------------------- |
- |
-const int AccountChooserModel::kWalletItemId = 0; |
-const int AccountChooserModel::kAutofillItemId = 1; |
- |
-AccountChooserModelDelegate::~AccountChooserModelDelegate() {} |
- |
-AccountChooserModel::AccountChooserModel( |
- AccountChooserModelDelegate* delegate, |
- PrefService* prefs) |
- : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)), |
- account_delegate_(delegate), |
- prefs_(prefs), |
- checked_item_(kWalletItemId), |
- had_wallet_error_(false) { |
- pref_change_registrar_.Init(prefs); |
- pref_change_registrar_.Add( |
- prefs::kAutofillDialogPayWithoutWallet, |
- base::Bind(&AccountChooserModel::PrefChanged, base::Unretained(this))); |
- |
- // TODO(estade): proper strings and l10n. |
- AddCheckItem(kWalletItemId, ASCIIToUTF16("Google Wallet")); |
- SetIcon( |
- kWalletItemId, |
- ui::ResourceBundle::GetSharedInstance().GetImageNamed(IDR_WALLET_ICON)); |
- AddCheckItemWithStringId(kAutofillItemId, |
- IDS_AUTOFILL_DIALOG_PAY_WITHOUT_WALLET); |
- UpdateCheckmarkFromPref(); |
-} |
- |
-AccountChooserModel::~AccountChooserModel() { |
-} |
- |
-bool AccountChooserModel::IsCommandIdChecked(int command_id) const { |
- return command_id == checked_item_; |
-} |
- |
-bool AccountChooserModel::IsCommandIdEnabled(int command_id) const { |
- if (command_id == kWalletItemId && had_wallet_error_) |
- return false; |
- |
- return true; |
-} |
- |
-bool AccountChooserModel::GetAcceleratorForCommandId( |
- int command_id, |
- ui::Accelerator* accelerator) { |
- return false; |
-} |
- |
-void AccountChooserModel::ExecuteCommand(int command_id, int event_flags) { |
- if (checked_item_ == command_id) |
- return; |
- |
- checked_item_ = command_id; |
- account_delegate_->AccountChoiceChanged(); |
-} |
- |
-void AccountChooserModel::SetHadWalletError() { |
- had_wallet_error_ = true; |
- checked_item_ = kAutofillItemId; |
- account_delegate_->AccountChoiceChanged(); |
-} |
- |
-void AccountChooserModel::SetHadWalletSigninError() { |
- checked_item_ = kAutofillItemId; |
- account_delegate_->AccountChoiceChanged(); |
-} |
- |
-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() {} |