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

Unified Diff: chrome/browser/ui/toolbar/toolbar_model_impl.cc

Issue 302453002: New animation for the origin chip URL showing/hiding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bugfixes and more animations Created 6 years, 7 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/toolbar/toolbar_model_impl.cc
diff --git a/chrome/browser/ui/toolbar/toolbar_model_impl.cc b/chrome/browser/ui/toolbar/toolbar_model_impl.cc
index d4df2bbe267f875465069869a95781f169b672ae..9ade28c491c2dd6ec6a9727f0f219807f3630ab2 100644
--- a/chrome/browser/ui/toolbar/toolbar_model_impl.cc
+++ b/chrome/browser/ui/toolbar/toolbar_model_impl.cc
@@ -95,19 +95,6 @@ ToolbarModel::SecurityLevel ToolbarModelImpl::GetSecurityLevelForWebContents(
}
}
-// static
-base::string16 ToolbarModelImpl::GetEVCertName(
- const net::X509Certificate& cert) {
- // EV are required to have an organization name and country.
- DCHECK(!cert.subject().organization_names.empty());
- DCHECK(!cert.subject().country_name.empty());
-
- return l10n_util::GetStringFUTF16(
- IDS_SECURE_CONNECTION_EV,
- base::UTF8ToUTF16(cert.subject().organization_names[0]),
- base::UTF8ToUTF16(cert.subject().country_name));
-}
-
// ToolbarModelImpl Implementation.
base::string16 ToolbarModelImpl::GetText() const {
base::string16 search_terms(GetSearchTerms(false));
@@ -207,13 +194,22 @@ int ToolbarModelImpl::GetIconForSecurityLevel(SecurityLevel level) const {
}
base::string16 ToolbarModelImpl::GetEVCertName() const {
- DCHECK_EQ(EV_SECURE, GetSecurityLevel(false));
- scoped_refptr<net::X509Certificate> cert;
+ if (GetSecurityLevel(false) != EV_SECURE)
+ return base::string16();
+
// Note: Navigation controller and active entry are guaranteed non-NULL or
// the security level would be NONE.
+ scoped_refptr<net::X509Certificate> cert;
content::CertStore::GetInstance()->RetrieveCert(
GetNavigationController()->GetVisibleEntry()->GetSSL().cert_id, &cert);
- return GetEVCertName(*cert.get());
+
+ // EV are required to have an organization name and country.
+ DCHECK(!cert->subject().organization_names.empty());
+ DCHECK(!cert->subject().country_name.empty());
+ return l10n_util::GetStringFUTF16(
+ IDS_SECURE_CONNECTION_EV,
+ base::UTF8ToUTF16(cert->subject().organization_names[0]),
+ base::UTF8ToUTF16(cert->subject().country_name));
}
bool ToolbarModelImpl::ShouldDisplayURL() const {

Powered by Google App Engine
This is Rietveld 408576698