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

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

Issue 124533003: Add country combobox to change country and rebuild address inputs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment Created 6 years, 11 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..c545d6364368b946034185d72634b692e610e45d 100644
--- a/chrome/browser/ui/autofill/country_combobox_model.h
+++ b/chrome/browser/ui/autofill/country_combobox_model.h
@@ -5,10 +5,12 @@
#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"
@@ -23,20 +25,41 @@ class CountryComboboxModel : public ui::ComboboxModel {
explicit CountryComboboxModel(const PersonalDataManager& manager);
virtual ~CountryComboboxModel();
- // ui::Combobox implementation:
+ // ui::ComboboxModel 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();
}
+ // Clears the default country.
+ void ResetDefault();
+
+ // Changes |country_code| to the default country.
+ void SetDefaultCountry(const std::string& country_code);
+
+ // Returns the default country code for this model.
+ std::string GetDefaultCountryCode() const;
+
private:
+ // Changes |default_index_| to |index| after checking it's sane. Notifies
+ // observers if |default_index_| changed.
+ void SetDefaultIndex(int index);
+
// 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 default country.
+ int default_index_;
+
+ ObserverList<ui::ComboboxModelObserver> observers_;
+
DISALLOW_COPY_AND_ASSIGN(CountryComboboxModel);
};
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_view_delegate.h ('k') | chrome/browser/ui/autofill/country_combobox_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698