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

Unified Diff: chrome/browser/ui/autofill/country_combobox_model.h

Issue 63053003: Ask libaddressinput for address components to use in requestAutocomplete(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: base:: Created 6 years, 12 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/country_combobox_model.h
diff --git a/chrome/browser/ui/autofill/country_combobox_model.h b/chrome/browser/ui/autofill/country_combobox_model.h
index 74afeaee8a927b6a367c41197684dc2f8dcff032..90326419c67b560f0c73d2f91779fccb64e41d5b 100644
--- a/chrome/browser/ui/autofill/country_combobox_model.h
+++ b/chrome/browser/ui/autofill/country_combobox_model.h
@@ -5,38 +5,57 @@
#ifndef CHROME_BROWSER_UI_AUTOFILL_COUNTRY_COMBOBOX_MODEL_H_
#define CHROME_BROWSER_UI_AUTOFILL_COUNTRY_COMBOBOX_MODEL_H_
+#include <string>
#include <vector>
#include "base/compiler_specific.h"
#include "base/memory/scoped_vector.h"
+#include "base/observer_list.h"
#include "base/strings/string16.h"
#include "ui/base/models/combobox_model.h"
+namespace ui {
+class ComboboxModelObserver;
+}
+
namespace autofill {
class AutofillCountry;
-class PersonalDataManager;
// A model for countries to be used to enter addresses.
class CountryComboboxModel : public ui::ComboboxModel {
public:
- explicit CountryComboboxModel(const PersonalDataManager& manager);
+ explicit CountryComboboxModel(const std::string& default_country_code);
virtual ~CountryComboboxModel();
// ui::Combobox implementation:
virtual int GetItemCount() const OVERRIDE;
virtual base::string16 GetItemAt(int index) OVERRIDE;
virtual bool IsItemSeparatorAt(int index) OVERRIDE;
+ virtual int GetDefaultIndex() const OVERRIDE;
+ virtual void AddObserver(ui::ComboboxModelObserver* observer) OVERRIDE;
+ virtual void RemoveObserver(ui::ComboboxModelObserver* observer) OVERRIDE;
const std::vector<AutofillCountry*>& countries() const {
return countries_.get();
}
+ // Changes the default index and default country (which is based on this).
+ void SetDefaultIndex(int default_index);
+
+ // Returns which country should be the default when the combobox is shown.
+ std::string GetDefaultCountryCode() const;
+
private:
// The countries to show in the model, including NULL for entries that are
// not countries (the separator entry).
ScopedVector<AutofillCountry> countries_;
+ // The index of the item that should be shown by default.
+ int default_index_;
+
+ ObserverList<ui::ComboboxModelObserver> observers_;
+
DISALLOW_COPY_AND_ASSIGN(CountryComboboxModel);
};

Powered by Google App Engine
This is Rietveld 408576698