| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/autofill/account_chooser_model.h" | 5 #include "chrome/browser/ui/autofill/account_chooser_model.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 int command_id, | 84 int command_id, |
| 85 ui::Accelerator* accelerator) { | 85 ui::Accelerator* accelerator) { |
| 86 return false; | 86 return false; |
| 87 } | 87 } |
| 88 | 88 |
| 89 void AccountChooserModel::ExecuteCommand(int command_id, int event_flags) { | 89 void AccountChooserModel::ExecuteCommand(int command_id, int event_flags) { |
| 90 if (checked_item_ == command_id) | 90 if (checked_item_ == command_id) |
| 91 return; | 91 return; |
| 92 | 92 |
| 93 // Log metrics. | 93 // Log metrics. |
| 94 AutofillMetrics::DialogUiEvent chooser_event; | 94 AutofillMetrics::DialogUiEvent chooser_event; |
| 95 if (command_id == kAutofillItemId) { | 95 if (command_id == kAutofillItemId) { |
| 96 chooser_event = | 96 chooser_event = |
| 97 AutofillMetrics::DIALOG_UI_ACCOUNT_CHOOSER_SWITCHED_TO_AUTOFILL; | 97 AutofillMetrics::DIALOG_UI_ACCOUNT_CHOOSER_SWITCHED_TO_AUTOFILL; |
| 98 } else if (checked_item_ == kAutofillItemId) { | 98 } else if (checked_item_ == kAutofillItemId) { |
| 99 chooser_event = | 99 chooser_event = |
| 100 AutofillMetrics::DIALOG_UI_ACCOUNT_CHOOSER_SWITCHED_TO_WALLET; | 100 AutofillMetrics::DIALOG_UI_ACCOUNT_CHOOSER_SWITCHED_TO_WALLET; |
| 101 } else { | 101 } else { |
| 102 chooser_event = | 102 chooser_event = |
| 103 AutofillMetrics::DIALOG_UI_ACCOUNT_CHOOSER_SWITCHED_WALLET_ACCOUNT; | 103 AutofillMetrics::DIALOG_UI_ACCOUNT_CHOOSER_SWITCHED_WALLET_ACCOUNT; |
| 104 } | 104 } |
| 105 metric_logger_.LogDialogUiEvent(dialog_type_, chooser_event); | 105 metric_logger_.LogDialogUiEvent(dialog_type_, chooser_event); |
| 106 | 106 |
| 107 checked_item_ = command_id; | 107 checked_item_ = command_id; |
| 108 ReconstructMenuItems(); | 108 ReconstructMenuItems(); |
| 109 delegate_->AccountChoiceChanged(); | 109 delegate_->AccountChoiceChanged(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void AccountChooserModel::SetHadWalletError() { | 112 void AccountChooserModel::SetHadWalletError() { |
| 113 // Any non-sign-in error disables all Wallet accounts. | 113 // Any non-sign-in error disables all Wallet accounts. |
| 114 had_wallet_error_ = true; | 114 had_wallet_error_ = true; |
| 115 ClearActiveWalletAccountName(); | 115 ClearActiveWalletAccountName(); |
| 116 ExecuteCommand(kAutofillItemId, 0); | 116 ExecuteCommand(kAutofillItemId, 0); |
| 117 } | 117 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 144 // A throbber should be shown until the Wallet account name is set. | 144 // A throbber should be shown until the Wallet account name is set. |
| 145 AddCheckItem(kActiveWalletItemId, | 145 AddCheckItem(kActiveWalletItemId, |
| 146 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_GOOGLE_WALLET)); | 146 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_GOOGLE_WALLET)); |
| 147 } | 147 } |
| 148 | 148 |
| 149 AddCheckItemWithStringId(kAutofillItemId, | 149 AddCheckItemWithStringId(kAutofillItemId, |
| 150 IDS_AUTOFILL_DIALOG_PAY_WITHOUT_WALLET); | 150 IDS_AUTOFILL_DIALOG_PAY_WITHOUT_WALLET); |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace autofill | 153 } // namespace autofill |
| OLD | NEW |