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

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: 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 return items_[index].first; 68 return items_[index].first;
69 } 69 }
70 70
71 std::string SuggestionsMenuModel::GetItemKeyForCheckedItem() const { 71 std::string SuggestionsMenuModel::GetItemKeyForCheckedItem() const {
72 if (items_.empty()) 72 if (items_.empty())
73 return std::string(); 73 return std::string();
74 74
75 return items_[checked_item_].first; 75 return items_[checked_item_].first;
76 } 76 }
77 77
78 void SuggestionsMenuModel::SetCheckedItem(const std::string& item_key) {
79 for (size_t i = 0; i < items_.size(); ++i) {
80 if (items_[i].first == item_key) {
81 checked_item_ = i;
82 break;
83 }
84 }
85 }
86
78 bool SuggestionsMenuModel::IsCommandIdChecked( 87 bool SuggestionsMenuModel::IsCommandIdChecked(
79 int command_id) const { 88 int command_id) const {
80 return checked_item_ == command_id; 89 return checked_item_ == command_id;
81 } 90 }
82 91
83 bool SuggestionsMenuModel::IsCommandIdEnabled( 92 bool SuggestionsMenuModel::IsCommandIdEnabled(
84 int command_id) const { 93 int command_id) const {
85 return true; 94 return true;
86 } 95 }
87 96
88 bool SuggestionsMenuModel::GetAcceleratorForCommandId( 97 bool SuggestionsMenuModel::GetAcceleratorForCommandId(
89 int command_id, 98 int command_id,
90 ui::Accelerator* accelerator) { 99 ui::Accelerator* accelerator) {
91 return false; 100 return false;
92 } 101 }
93 102
94 void SuggestionsMenuModel::ExecuteCommand(int command_id, int event_flags) { 103 void SuggestionsMenuModel::ExecuteCommand(int command_id, int event_flags) {
95 checked_item_ = command_id; 104 delegate_->SuggestionItemSelected(this, GetItemKeyAt(command_id));
96 delegate_->SuggestionItemSelected(*this);
97 } 105 }
98 106
99 // AccountChooserModel --------------------------------------------------------- 107 // AccountChooserModel ---------------------------------------------------------
100 108
101 const int AccountChooserModel::kWalletItemId = 0; 109 const int AccountChooserModel::kWalletItemId = 0;
102 const int AccountChooserModel::kAutofillItemId = 1; 110 const int AccountChooserModel::kAutofillItemId = 1;
103 111
104 AccountChooserModelDelegate::~AccountChooserModelDelegate() {} 112 AccountChooserModelDelegate::~AccountChooserModelDelegate() {}
105 113
106 AccountChooserModel::AccountChooserModel( 114 AccountChooserModel::AccountChooserModel(
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 } 206 }
199 207
200 string16 YearComboboxModel::GetItemAt(int index) { 208 string16 YearComboboxModel::GetItemAt(int index) {
201 if (index == 0) 209 if (index == 0)
202 return string16(); 210 return string16();
203 211
204 return base::IntToString16(this_year_ + index - 1); 212 return base::IntToString16(this_year_ + index - 1);
205 } 213 }
206 214
207 } // autofill 215 } // autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698