Commit 1a6a6303 authored by stevenjb@chromium.org's avatar stevenjb@chromium.org

Don't require login to enable CA cert settings


BUG=23658
TEST=See issue


Review URL: http://codereview.chromium.org/8771019

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112861 0039d316-1c4b-4281-b951-d872f2087c98
parent 0474f0f5
......@@ -110,6 +110,7 @@ class CertLibraryImpl
CertLibraryImpl() :
observer_list_(new CertLibraryObserverList),
user_logged_in_(false),
certificates_requested_(false),
certificates_loaded_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(certs_(this)),
ALLOW_THIS_IN_INITIALIZER_LIST(user_certs_(this)),
......@@ -128,6 +129,8 @@ class CertLibraryImpl
virtual void RequestCertificates() OVERRIDE {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
certificates_requested_ = true;
if (!UserManager::Get()->user_is_logged_in()) {
// If we are not logged in, we cannot load any certificates.
// Set 'loaded' to true for the UI, since we are not waiting on loading.
......@@ -186,6 +189,10 @@ class CertLibraryImpl
observer_list_->RemoveObserver(observer);
}
virtual bool CertificatesLoading() const OVERRIDE {
return certificates_requested_ && !certificates_loaded_;
}
virtual bool CertificatesLoaded() const OVERRIDE {
return certificates_loaded_;
}
......@@ -406,6 +413,7 @@ class CertLibraryImpl
// Local state.
bool user_logged_in_;
bool certificates_requested_;
bool certificates_loaded_;
// Certificates.
......
......@@ -80,6 +80,9 @@ class CertLibrary {
// Must be called from the UI thread.
virtual void RequestCertificates() = 0;
// Returns true when the certificate list has been requested but not loaded.
virtual bool CertificatesLoading() const = 0;
// Returns true when the certificate list has been initiailized.
virtual bool CertificatesLoaded() const = 0;
......
......@@ -188,13 +188,13 @@ class ServerCACertComboboxModel : public ui::ComboboxModel {
}
virtual ~ServerCACertComboboxModel() {}
virtual int GetItemCount() {
if (!cert_library_->CertificatesLoaded())
if (cert_library_->CertificatesLoading())
return 1; // "Loading"
// First "Default", then the certs, then "Do not check".
return cert_library_->GetCACertificates().Size() + 2;
}
virtual string16 GetItemAt(int combo_index) {
if (!cert_library_->CertificatesLoaded())
if (cert_library_->CertificatesLoading())
return l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_LOADING);
if (combo_index == 0)
......@@ -220,7 +220,7 @@ class UserCertComboboxModel : public ui::ComboboxModel {
}
virtual ~UserCertComboboxModel() {}
virtual int GetItemCount() {
if (!cert_library_->CertificatesLoaded())
if (cert_library_->CertificatesLoading())
return 1; // "Loading"
int num_certs = cert_library_->GetUserCertificates().Size();
if (num_certs == 0)
......@@ -228,7 +228,7 @@ class UserCertComboboxModel : public ui::ComboboxModel {
return num_certs;
}
virtual string16 GetItemAt(int combo_index) {
if (!cert_library_->CertificatesLoaded())
if (cert_library_->CertificatesLoading())
return l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_LOADING);
if (cert_library_->GetUserCertificates().Size() == 0)
......@@ -385,7 +385,7 @@ void WifiConfigView::RefreshEapFields() {
passphrase_textfield_->SetText(string16());
// User certs only for EAP-TLS
bool certs_loading = !cert_library_->CertificatesLoaded();
bool certs_loading = cert_library_->CertificatesLoading();
bool user_cert_enabled = (selected == EAP_METHOD_INDEX_TLS);
user_cert_label_->SetEnabled(user_cert_enabled);
bool have_user_certs = !certs_loading && HaveUserCerts();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment