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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/autofill_dialog_models.h" 5 #include "chrome/browser/ui/autofill/autofill_dialog_models.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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 bool AccountChooserModel::GetAcceleratorForCommandId( 143 bool AccountChooserModel::GetAcceleratorForCommandId(
144 int command_id, 144 int command_id,
145 ui::Accelerator* accelerator) { 145 ui::Accelerator* accelerator) {
146 return false; 146 return false;
147 } 147 }
148 148
149 void AccountChooserModel::ExecuteCommand(int command_id, int event_flags) { 149 void AccountChooserModel::ExecuteCommand(int command_id, int event_flags) {
150 if (checked_item_ == command_id) 150 if (checked_item_ == command_id)
151 return; 151 return;
152 152
153 prefs_->SetBoolean(prefs::kAutofillDialogPayWithoutWallet,
Dan Beam 2013/04/05 02:45:57 should this model know about prefs?
aruslan 2013/04/05 03:45:35 I'd rather didn't pretend the account chooser know
154 command_id == kAutofillItemId);
155
153 checked_item_ = command_id; 156 checked_item_ = command_id;
154 account_delegate_->AccountChoiceChanged(); 157 account_delegate_->AccountChoiceChanged();
155 } 158 }
156 159
157 void AccountChooserModel::SetHadWalletError() { 160 void AccountChooserModel::SetHadWalletError() {
158 had_wallet_error_ = true; 161 had_wallet_error_ = true;
159 checked_item_ = kAutofillItemId; 162 ExecuteCommand(kAutofillItemId, 0);
160 account_delegate_->AccountChoiceChanged();
161 } 163 }
162 164
163 void AccountChooserModel::SetHadWalletSigninError() { 165 void AccountChooserModel::SetHadWalletSigninError() {
164 checked_item_ = kAutofillItemId; 166 ExecuteCommand(kAutofillItemId, 0);
165 account_delegate_->AccountChoiceChanged();
166 } 167 }
167 168
168 bool AccountChooserModel::WalletIsSelected() const { 169 bool AccountChooserModel::WalletIsSelected() const {
169 return checked_item_ == kWalletItemId; 170 return checked_item_ == kWalletItemId;
170 } 171 }
171 172
172 void AccountChooserModel::PrefChanged(const std::string& pref) { 173 void AccountChooserModel::PrefChanged(const std::string& pref) {
173 DCHECK(pref == prefs::kAutofillDialogPayWithoutWallet); 174 DCHECK_EQ(pref, prefs::kAutofillDialogPayWithoutWallet);
174 UpdateCheckmarkFromPref(); 175 UpdateCheckmarkFromPref();
175 account_delegate_->AccountChoiceChanged(); 176 account_delegate_->AccountChoiceChanged();
176 } 177 }
177 178
178 void AccountChooserModel::UpdateCheckmarkFromPref() { 179 void AccountChooserModel::UpdateCheckmarkFromPref() {
179 if (prefs_->GetBoolean(prefs::kAutofillDialogPayWithoutWallet)) 180 if (prefs_->GetBoolean(prefs::kAutofillDialogPayWithoutWallet))
Dan Beam 2013/04/05 02:45:57 ^ it already did here, but this could be changed
180 checked_item_ = kAutofillItemId; 181 checked_item_ = kAutofillItemId;
181 else 182 else
182 checked_item_ = kWalletItemId; 183 checked_item_ = kWalletItemId;
183 } 184 }
184 185
185 // MonthComboboxModel ---------------------------------------------------------- 186 // MonthComboboxModel ----------------------------------------------------------
186 187
187 MonthComboboxModel::MonthComboboxModel() {} 188 MonthComboboxModel::MonthComboboxModel() {}
188 189
189 MonthComboboxModel::~MonthComboboxModel() {} 190 MonthComboboxModel::~MonthComboboxModel() {}
(...skipping 29 matching lines...) Expand all
219 } 220 }
220 221
221 string16 YearComboboxModel::GetItemAt(int index) { 222 string16 YearComboboxModel::GetItemAt(int index) {
222 if (index == 0) 223 if (index == 0)
223 return string16(); 224 return string16();
224 225
225 return base::IntToString16(this_year_ + index - 1); 226 return base::IntToString16(this_year_ + index - 1);
226 } 227 }
227 228
228 } // autofill 229 } // autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698