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 229fea395cf5c550bbb5270b6cc9f38c5bdcc1b8..b5419dec9ea3c8984710d827f8b1e18002f7412c 100644 |
--- a/chrome/browser/ui/autofill/autofill_dialog_models.cc |
+++ b/chrome/browser/ui/autofill/autofill_dialog_models.cc |
@@ -12,7 +12,6 @@ |
#include "base/utf_string_conversions.h" |
#include "chrome/common/pref_names.h" |
#include "components/autofill/browser/autofill_country.h" |
-#include "components/autofill/browser/autofill_metrics.h" |
#include "grit/generated_resources.h" |
#include "grit/theme_resources.h" |
#include "ui/base/l10n/l10n_util.h" |
@@ -97,90 +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, |
- const AutofillMetrics& metric_logger, |
- DialogType dialog_type) |
- : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)), |
- account_delegate_(delegate), |
- checked_item_( |
- prefs->GetBoolean(::prefs::kAutofillDialogPayWithoutWallet) ? |
- kAutofillItemId : kWalletItemId), |
- had_wallet_error_(false), |
- metric_logger_(metric_logger), |
- dialog_type_(dialog_type) { |
- AddCheckItem(kWalletItemId, |
- l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_GOOGLE_WALLET)); |
- SetIcon( |
- kWalletItemId, |
- ui::ResourceBundle::GetSharedInstance().GetImageNamed(IDR_WALLET_ICON)); |
- AddCheckItemWithStringId(kAutofillItemId, |
- IDS_AUTOFILL_DIALOG_PAY_WITHOUT_WALLET); |
-} |
- |
-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; |
- |
- // Log metrics. |
- AutofillMetrics::DialogUiEvent chooser_event; |
- if (command_id == kAutofillItemId) { |
- chooser_event = |
- AutofillMetrics::DIALOG_UI_ACCOUNT_CHOOSER_SWITCHED_TO_AUTOFILL; |
- } else if (checked_item_ == kAutofillItemId) { |
- chooser_event = |
- AutofillMetrics::DIALOG_UI_ACCOUNT_CHOOSER_SWITCHED_TO_WALLET; |
- } else { |
- chooser_event = |
- AutofillMetrics::DIALOG_UI_ACCOUNT_CHOOSER_SWITCHED_WALLET_ACCOUNT; |
- } |
- metric_logger_.LogDialogUiEvent(dialog_type_, chooser_event); |
- |
- checked_item_ = command_id; |
- account_delegate_->AccountChoiceChanged(); |
-} |
- |
-void AccountChooserModel::SetHadWalletError() { |
- had_wallet_error_ = true; |
- ExecuteCommand(kAutofillItemId, 0); |
-} |
- |
-void AccountChooserModel::SetHadWalletSigninError() { |
- ExecuteCommand(kAutofillItemId, 0); |
-} |
- |
-bool AccountChooserModel::WalletIsSelected() const { |
- return checked_item_ == kWalletItemId; |
-} |
- |
// MonthComboboxModel ---------------------------------------------------------- |
MonthComboboxModel::MonthComboboxModel() {} |