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

Unified Diff: ui/base/models/simple_combobox_model.h

Issue 330443004: Bug fix: Translate: leak of a ComboboxModel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sky's review Created 6 years, 6 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: ui/base/models/simple_combobox_model.h
diff --git a/ui/base/models/simple_combobox_model.h b/ui/base/models/simple_combobox_model.h
new file mode 100644
index 0000000000000000000000000000000000000000..75c252c8a5f5f5f2548c73a9e1f51fa671c0b49d
--- /dev/null
+++ b/ui/base/models/simple_combobox_model.h
@@ -0,0 +1,33 @@
+// Copyright 2014 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 UI_BASE_MODELS_SIMPLE_COMBOBOX_MODEL_H_
+#define UI_BASE_MODELS_SIMPLE_COMBOBOX_MODEL_H_
+
+#include "ui/base/models/combobox_model.h"
+
+#include <vector>
+
+namespace ui {
+
+// A simple data model for a combobox that takes string16 vectors as the items.
+// An empty string will be a separator.
+class UI_BASE_EXPORT SimpleComboboxModel : public ComboboxModel {
+ public:
+ explicit SimpleComboboxModel(const std::vector<base::string16>& items);
+ virtual ~SimpleComboboxModel() {}
sky 2014/06/18 16:57:19 Don't inline this.
hajimehoshi 2014/06/19 03:51:23 Done.
+
+ // ui::ComboboxModel:
+ virtual int GetItemCount() const OVERRIDE;
+ virtual base::string16 GetItemAt(int index) OVERRIDE;
+ virtual bool IsItemSeparatorAt(int index) OVERRIDE;
+ virtual int GetDefaultIndex() const OVERRIDE;
+
+ private:
+ std::vector<base::string16> items_;
sky 2014/06/18 16:57:19 const
hajimehoshi 2014/06/19 03:51:23 Done.
+};
sky 2014/06/18 16:57:19 DISALLOW_...
hajimehoshi 2014/06/19 03:51:23 Done.
+
+} // namespace ui
+
+#endif // UI_BASE_MODELS_SIMPLE_COMBOBOX_MODEL_H_

Powered by Google App Engine
This is Rietveld 408576698