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

Unified Diff: chrome/browser/chromeos/options/vpn_config_view.cc

Issue 9838092: ui/base/models: Make ComboboxModel::GetItemCount() a constant function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win_rel and reland Created 8 years, 9 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/chromeos/options/vpn_config_view.cc
diff --git a/chrome/browser/chromeos/options/vpn_config_view.cc b/chrome/browser/chromeos/options/vpn_config_view.cc
index 4f657b5ee0a9902afcc7baef8388407b0aed2a4b..bf8f30f7b0502d4acdd26f8335622cac4b45aab5 100644
--- a/chrome/browser/chromeos/options/vpn_config_view.cc
+++ b/chrome/browser/chromeos/options/vpn_config_view.cc
@@ -56,13 +56,16 @@ class ProviderTypeComboboxModel : public ui::ComboboxModel {
public:
ProviderTypeComboboxModel() {}
virtual ~ProviderTypeComboboxModel() {}
- virtual int GetItemCount() {
+
+ // Overridden from ui::ComboboxModel:
+ virtual int GetItemCount() const OVERRIDE {
return chromeos::PROVIDER_TYPE_MAX;
}
- virtual string16 GetItemAt(int index) {
+ virtual string16 GetItemAt(int index) OVERRIDE {
ProviderType type = static_cast<ProviderType>(index);
return ProviderTypeToString(type);
}
+
private:
DISALLOW_COPY_AND_ASSIGN(ProviderTypeComboboxModel);
};
@@ -73,25 +76,28 @@ class ServerCACertComboboxModel : public ui::ComboboxModel {
: cert_library_(cert_library) {
}
virtual ~ServerCACertComboboxModel() {}
- virtual int GetItemCount() {
+
+ // Overridden from ui::ComboboxModel:
+ virtual int GetItemCount() const OVERRIDE {
if (cert_library_->CertificatesLoading())
return 1; // "Loading"
// "Default" + certs.
return cert_library_->GetCACertificates().Size() + 1;
}
- virtual string16 GetItemAt(int combo_index) {
+ virtual string16 GetItemAt(int index) OVERRIDE {
if (cert_library_->CertificatesLoading())
return l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_LOADING);
- if (combo_index == 0)
+ if (index == 0)
return l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA_DEFAULT);
- int cert_index = combo_index - 1;
+ int cert_index = index - 1;
return cert_library_->GetCACertificates().GetDisplayStringAt(cert_index);
}
private:
CertLibrary* cert_library_;
+
DISALLOW_COPY_AND_ASSIGN(ServerCACertComboboxModel);
};
@@ -101,7 +107,9 @@ class UserCertComboboxModel : public ui::ComboboxModel {
: cert_library_(cert_library) {
}
virtual ~UserCertComboboxModel() {}
- virtual int GetItemCount() {
+
+ // Overridden from ui::ComboboxModel:
+ virtual int GetItemCount() const OVERRIDE {
if (cert_library_->CertificatesLoading())
return 1; // "Loading"
int num_certs = cert_library_->GetUserCertificates().Size();
@@ -109,7 +117,7 @@ class UserCertComboboxModel : public ui::ComboboxModel {
return 1; // "None installed"
return num_certs;
}
- virtual string16 GetItemAt(int combo_index) {
+ virtual string16 GetItemAt(int index) OVERRIDE {
if (cert_library_->CertificatesLoading()) {
return l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_LOADING);
@@ -118,7 +126,7 @@ class UserCertComboboxModel : public ui::ComboboxModel {
return l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_USER_CERT_NONE_INSTALLED);
}
- return cert_library_->GetUserCertificates().GetDisplayStringAt(combo_index);
+ return cert_library_->GetUserCertificates().GetDisplayStringAt(index);
}
private:
« no previous file with comments | « chrome/browser/bookmarks/recently_used_folders_combo_model.cc ('k') | chrome/browser/chromeos/options/wifi_config_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698