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

Unified Diff: chrome/browser/ui/views/payments/preselected_combobox_model.h

Issue 2689363004: [Payments] Add combobox support to editors. (Closed)
Patch Set: re-enable test, addressed comments Created 3 years, 10 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/views/payments/preselected_combobox_model.h
diff --git a/chrome/browser/ui/views/payments/preselected_combobox_model.h b/chrome/browser/ui/views/payments/preselected_combobox_model.h
new file mode 100644
index 0000000000000000000000000000000000000000..8a1bb757a92b3b4308debe84e0263a3ff2ee5e0b
--- /dev/null
+++ b/chrome/browser/ui/views/payments/preselected_combobox_model.h
@@ -0,0 +1,35 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PRESELECTED_COMBOBOX_MODEL_H_
+#define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PRESELECTED_COMBOBOX_MODEL_H_
+
+#include <vector>
+
+#include "base/macros.h"
+#include "base/strings/string16.h"
+#include "ui/base/models/simple_combobox_model.h"
+
+namespace payments {
+
+// A simple data model for a combobox that takes a string16 vector as the items,
+// as well as the default selected index. An empty string is a separator.
+class PreselectedComboboxModel : public ui::SimpleComboboxModel {
+ public:
+ PreselectedComboboxModel(const std::vector<base::string16>& items,
+ int default_index);
+ ~PreselectedComboboxModel() override;
+
+ // ui::ComboboxModel:
+ int GetDefaultIndex() const override;
+
+ private:
+ const int default_index_;
+
+ DISALLOW_COPY_AND_ASSIGN(PreselectedComboboxModel);
+};
+
+} // namespace payments
+
+#endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PRESELECTED_COMBOBOX_MODEL_H_

Powered by Google App Engine
This is Rietveld 408576698