country_combobox_model.h revision a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7
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/strings/string16.h" 13#include "ui/base/models/combobox_model.h" 14 15namespace autofill { 16 17class AutofillCountry; 18class PersonalDataManager; 19 20// A model for countries to be used to enter addresses. 21class CountryComboboxModel : public ui::ComboboxModel { 22 public: 23 explicit CountryComboboxModel(const PersonalDataManager& manager); 24 virtual ~CountryComboboxModel(); 25 26 // ui::Combobox implementation: 27 virtual int GetItemCount() const OVERRIDE; 28 virtual base::string16 GetItemAt(int index) OVERRIDE; 29 virtual bool IsItemSeparatorAt(int index) OVERRIDE; 30 31 const std::vector<AutofillCountry*>& countries() const { 32 return countries_.get(); 33 } 34 35 private: 36 // The countries to show in the model, including NULL for entries that are 37 // not countries (the separator entry). 38 ScopedVector<AutofillCountry> countries_; 39 40 DISALLOW_COPY_AND_ASSIGN(CountryComboboxModel); 41}; 42 43} // namespace autofill 44 45#endif // CHROME_BROWSER_UI_AUTOFILL_COUNTRY_COMBOBOX_MODEL_H_ 46