country_combobox_model.h revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
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
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_UI_AUTOFILL_COUNTRY_COMBOBOX_MODEL_H_
6#define CHROME_BROWSER_UI_AUTOFILL_COUNTRY_COMBOBOX_MODEL_H_
7
8#include <vector>
9
10#include "base/compiler_specific.h"
11#include "base/memory/scoped_vector.h"
12#include "base/string16.h"
13#include "ui/base/models/combobox_model.h"
14
15class AutofillCountry;
16
17namespace autofill {
18
19// A model for countries to be used to enter addresses.
20class CountryComboboxModel : public ui::ComboboxModel {
21 public:
22  CountryComboboxModel();
23  virtual ~CountryComboboxModel();
24
25  // ui::Combobox implementation:
26  virtual int GetItemCount() const OVERRIDE;
27  virtual string16 GetItemAt(int index) OVERRIDE;
28
29  const std::vector<AutofillCountry*>& countries() const {
30    return countries_.get();
31  }
32
33 private:
34  // The countries to show in the model, including NULL for entries that are
35  // not countries (the separator entry).
36  ScopedVector<AutofillCountry> countries_;
37
38  DISALLOW_COPY_AND_ASSIGN(CountryComboboxModel);
39};
40
41}  // namespace autofill
42
43#endif  // CHROME_BROWSER_UI_AUTOFILL_COUNTRY_COMBOBOX_MODEL_H_
44