summaryrefslogtreecommitdiffstats
path: root/chrome/browser/toolbar_model.cc
diff options
context:
space:
mode:
authorwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-15 02:32:23 +0000
committerwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-15 02:32:23 +0000
commit7c37a7b1ae7ff1df70303891757b09288a5ec743 (patch)
tree859344316fb63f9b45f39407b734cdf2282a91b0 /chrome/browser/toolbar_model.cc
parent8bb2fd7c8896ed389c6414f709381f641bdcd4f8 (diff)
downloadchromium_src-7c37a7b1ae7ff1df70303891757b09288a5ec743.zip
chromium_src-7c37a7b1ae7ff1df70303891757b09288a5ec743.tar.gz
chromium_src-7c37a7b1ae7ff1df70303891757b09288a5ec743.tar.bz2
Display the SECURITY_WARNING status in the location bar for the
ERR_CERT_UNABLE_TO_CHECK_REVOCATION certificate error. Do not display an info bar. Remove the unused ToolbarModel::GetIconHoverText function. R=pkasting,jcivelli BUG=27125 TEST=Visit port 452 on the chrometws server. Review URL: http://codereview.chromium.org/1653003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44611 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/toolbar_model.cc')
-rw-r--r--chrome/browser/toolbar_model.cc76
1 files changed, 7 insertions, 69 deletions
diff --git a/chrome/browser/toolbar_model.cc b/chrome/browser/toolbar_model.cc
index eeae184..9e79335 100644
--- a/chrome/browser/toolbar_model.cc
+++ b/chrome/browser/toolbar_model.cc
@@ -81,6 +81,11 @@ ToolbarModel::SecurityLevel ToolbarModel::GetSecurityLevel() const {
case SECURITY_STYLE_AUTHENTICATED:
if (ssl.has_mixed_content())
return SECURITY_WARNING;
+ if (net::IsCertStatusError(ssl.cert_status())) {
+ DCHECK_EQ(ssl.cert_status() & net::CERT_STATUS_ALL_ERRORS,
+ net::CERT_STATUS_UNABLE_TO_CHECK_REVOCATION);
+ return SECURITY_WARNING;
+ }
if ((ssl.cert_status() & net::CERT_STATUS_IS_EV) &&
CertStore::GetSharedInstance()->RetrieveCert(ssl.cert_id(), NULL))
return EV_SECURE;
@@ -104,45 +109,6 @@ int ToolbarModel::GetIcon() const {
return icon_ids[GetSecurityLevel()];
}
-void ToolbarModel::GetIconHoverText(std::wstring* text) const {
- DCHECK(text);
- text->clear();
-
- switch (GetSecurityLevel()) {
- case NONE:
- // There's no security icon, and thus no hover text.
- return;
-
- case EV_SECURE:
- case SECURE: {
- // Note: Navigation controller and active entry are guaranteed non-NULL or
- // the security level would be NONE.
- GURL url(GetNavigationController()->GetActiveEntry()->url());
- DCHECK(url.has_host());
- *text = l10n_util::GetStringF(IDS_SECURE_CONNECTION,
- UTF8ToWide(url.host()));
- return;
- }
-
- case SECURITY_WARNING:
- *text = SSLErrorInfo::CreateError(SSLErrorInfo::MIXED_CONTENTS, NULL,
- GURL()).short_description();
- return;
-
- case SECURITY_ERROR:
- // See note above.
- CreateErrorText(GetNavigationController()->GetActiveEntry(), text);
- // If the authentication is broken, we should always have at least one
- // error.
- DCHECK(!text->empty());
- return;
-
- default:
- NOTREACHED();
- return;
- }
-}
-
std::wstring ToolbarModel::GetSecurityInfoText() const {
switch (GetSecurityLevel()) {
case NONE:
@@ -152,7 +118,8 @@ std::wstring ToolbarModel::GetSecurityInfoText() const {
case EV_SECURE: {
scoped_refptr<net::X509Certificate> cert;
- // See note in GetIconHoverText().
+ // Note: Navigation controller and active entry are guaranteed non-NULL
+ // or the security level would be NONE.
CertStore::GetSharedInstance()->RetrieveCert(
GetNavigationController()->GetActiveEntry()->ssl().cert_id(),
&cert);
@@ -175,32 +142,3 @@ NavigationController* ToolbarModel::GetNavigationController() const {
TabContents* current_tab = browser_->GetSelectedTabContents();
return current_tab ? &current_tab->controller() : NULL;
}
-
-void ToolbarModel::CreateErrorText(NavigationEntry* entry,
- std::wstring* text) const {
- const NavigationEntry::SSLStatus& ssl = entry->ssl();
- std::vector<SSLErrorInfo> errors;
- SSLErrorInfo::GetErrorsForCertStatus(ssl.cert_id(), ssl.cert_status(),
- entry->url(), &errors);
- if (ssl.has_mixed_content()) {
- errors.push_back(SSLErrorInfo::CreateError(SSLErrorInfo::MIXED_CONTENTS,
- NULL, GURL()));
- }
- if (ssl.has_unsafe_content()) {
- errors.push_back(SSLErrorInfo::CreateError(SSLErrorInfo::UNSAFE_CONTENTS,
- NULL, GURL()));
- }
-
- if (errors.empty()) {
- text->clear();
- } else if (errors.size() == 1) {
- *text = errors[0].short_description();
- } else {
- // Multiple errors.
- *text = l10n_util::GetString(IDS_SEVERAL_SSL_ERRORS);
- for (size_t i = 0; i < errors.size(); ++i) {
- text->append(L"\n");
- text->append(errors[i].short_description());
- }
- }
-}