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

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_models.cc

Issue 11743036: requestAutocomplete: change comboboxes to dropdown menus (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: isherman review Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/autofill/autofill_dialog_models.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_comboboxes.cc b/chrome/browser/ui/autofill/autofill_dialog_models.cc
similarity index 55%
rename from chrome/browser/ui/autofill/autofill_dialog_comboboxes.cc
rename to chrome/browser/ui/autofill/autofill_dialog_models.cc
index a858feb05941c7041e725ae29a4df6b088c2f1cb..5bba2f3bcb988d4e42f8613409fac6fbf9d83966 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_comboboxes.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_models.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/autofill/autofill_dialog_comboboxes.h"
+#include "chrome/browser/ui/autofill/autofill_dialog_models.h"
#include "base/string_number_conversions.h"
#include "base/stringprintf.h"
@@ -11,27 +11,47 @@
namespace autofill {
-// SuggestionsComboboxModel ----------------------------------------------------
+SuggestionsMenuModelDelegate::~SuggestionsMenuModelDelegate() {}
-SuggestionsComboboxModel::SuggestionsComboboxModel() {}
+// SuggestionsMenuModel ----------------------------------------------------
-SuggestionsComboboxModel::~SuggestionsComboboxModel() {}
+SuggestionsMenuModel::SuggestionsMenuModel(
+ SuggestionsMenuModelDelegate* delegate)
+ : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)),
+ delegate_(delegate),
+ checked_item_(0) {}
-void SuggestionsComboboxModel::AddItem(
+SuggestionsMenuModel::~SuggestionsMenuModel() {}
+
+void SuggestionsMenuModel::AddKeyedItem(
const std::string& key, const string16& item) {
items_.push_back(std::make_pair(key, item));
+ AddCheckItem(items_.size() - 1, item);
}
-std::string SuggestionsComboboxModel::GetItemKeyAt(int index) const {
+std::string SuggestionsMenuModel::GetItemKeyAt(int index) const {
return items_[index].first;
}
-int SuggestionsComboboxModel::GetItemCount() const {
- return items_.size();
+bool SuggestionsMenuModel::IsCommandIdChecked(
+ int command_id) const {
+ return checked_item_ == command_id;
+}
+
+bool SuggestionsMenuModel::IsCommandIdEnabled(
+ int command_id) const {
+ return true;
+}
+
+bool SuggestionsMenuModel::GetAcceleratorForCommandId(
+ int command_id,
+ ui::Accelerator* accelerator) {
+ return false;
}
-string16 SuggestionsComboboxModel::GetItemAt(int index) {
- return items_[index].second;
+void SuggestionsMenuModel::ExecuteCommand(int command_id) {
+ checked_item_ = command_id;
+ delegate_->SuggestionItemSelected(*this);
}
// MonthComboboxModel ----------------------------------------------------------
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_models.h ('k') | chrome/browser/ui/autofill/autofill_dialog_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698