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

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: Fix test failure by checking for NULL extension 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..7622bba0e78205d2db64ac0fbd5012ba6970cfd6 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));
@@ -117,10 +104,10 @@ base::string16 ToolbarModelImpl::GetText() const {
if (WouldOmitURLDueToOriginChip())
return base::string16();
- return GetFormattedURL();
+ return GetFormattedURL(NULL);
}
-base::string16 ToolbarModelImpl::GetFormattedURL() const {
+base::string16 ToolbarModelImpl::GetFormattedURL(size_t* prefix_end) const {
std::string languages; // Empty if we don't have a |navigation_controller|.
Profile* profile = GetProfile();
if (profile)
@@ -134,7 +121,7 @@ base::string16 ToolbarModelImpl::GetFormattedURL() const {
// the space.
return AutocompleteInput::FormattedStringWithEquivalentMeaning(
url, net::FormatUrl(url, languages, net::kFormatUrlOmitAll,
- net::UnescapeRule::NORMAL, NULL, NULL, NULL));
+ net::UnescapeRule::NORMAL, NULL, prefix_end, NULL));
}
base::string16 ToolbarModelImpl::GetCorpusNameForMobile() const {
@@ -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