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

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_models.cc

Issue 14129005: Remove "Use billing for shipping" checkbox in favor of item in suggestions menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix bad merge 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 return items_[index].first; 69 return items_[index].first;
70 } 70 }
71 71
72 std::string SuggestionsMenuModel::GetItemKeyForCheckedItem() const { 72 std::string SuggestionsMenuModel::GetItemKeyForCheckedItem() const {
73 if (items_.empty()) 73 if (items_.empty())
74 return std::string(); 74 return std::string();
75 75
76 return items_[checked_item_].first; 76 return items_[checked_item_].first;
77 } 77 }
78 78
79 void SuggestionsMenuModel::SetCheckedItem(const std::string& item_key) {
80 for (size_t i = 0; i < items_.size(); ++i) {
81 if (items_[i].first == item_key) {
82 checked_item_ = i;
83 break;
Dan Beam 2013/04/16 03:01:14 return;
Evan Stade 2013/04/16 19:06:20 sure, why not
84 }
85 }
Dan Beam 2013/04/16 03:01:14 NOTREACHED(); IMO (unless this is valid for some r
Evan Stade 2013/04/16 19:06:20 Done.
86 }
87
79 bool SuggestionsMenuModel::IsCommandIdChecked( 88 bool SuggestionsMenuModel::IsCommandIdChecked(
80 int command_id) const { 89 int command_id) const {
81 return checked_item_ == command_id; 90 return checked_item_ == command_id;
82 } 91 }
83 92
84 bool SuggestionsMenuModel::IsCommandIdEnabled( 93 bool SuggestionsMenuModel::IsCommandIdEnabled(
85 int command_id) const { 94 int command_id) const {
86 return true; 95 return true;
87 } 96 }
88 97
89 bool SuggestionsMenuModel::GetAcceleratorForCommandId( 98 bool SuggestionsMenuModel::GetAcceleratorForCommandId(
90 int command_id, 99 int command_id,
91 ui::Accelerator* accelerator) { 100 ui::Accelerator* accelerator) {
92 return false; 101 return false;
93 } 102 }
94 103
95 void SuggestionsMenuModel::ExecuteCommand(int command_id, int event_flags) { 104 void SuggestionsMenuModel::ExecuteCommand(int command_id, int event_flags) {
96 checked_item_ = command_id; 105 delegate_->SuggestionItemSelected(this, GetItemKeyAt(command_id));
97 delegate_->SuggestionItemSelected(*this);
98 } 106 }
99 107
100 // AccountChooserModel --------------------------------------------------------- 108 // AccountChooserModel ---------------------------------------------------------
101 109
102 const int AccountChooserModel::kWalletItemId = 0; 110 const int AccountChooserModel::kWalletItemId = 0;
103 const int AccountChooserModel::kAutofillItemId = 1; 111 const int AccountChooserModel::kAutofillItemId = 1;
104 112
105 AccountChooserModelDelegate::~AccountChooserModelDelegate() {} 113 AccountChooserModelDelegate::~AccountChooserModelDelegate() {}
106 114
107 AccountChooserModel::AccountChooserModel( 115 AccountChooserModel::AccountChooserModel(
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 226 }
219 227
220 string16 YearComboboxModel::GetItemAt(int index) { 228 string16 YearComboboxModel::GetItemAt(int index) {
221 if (index == 0) 229 if (index == 0)
222 return string16(); 230 return string16();
223 231
224 return base::IntToString16(this_year_ + index - 1); 232 return base::IntToString16(this_year_ + index - 1);
225 } 233 }
226 234
227 } // autofill 235 } // autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698