OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" | 5 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 10 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 return icon_ids[security_level]; | 214 return icon_ids[security_level]; |
215 } | 215 } |
216 | 216 |
217 string16 ToolbarModelImpl::GetEVCertName() const { | 217 string16 ToolbarModelImpl::GetEVCertName() const { |
218 DCHECK_EQ(GetSecurityLevel(), EV_SECURE); | 218 DCHECK_EQ(GetSecurityLevel(), EV_SECURE); |
219 scoped_refptr<net::X509Certificate> cert; | 219 scoped_refptr<net::X509Certificate> cert; |
220 // Note: Navigation controller and active entry are guaranteed non-NULL or | 220 // Note: Navigation controller and active entry are guaranteed non-NULL or |
221 // the security level would be NONE. | 221 // the security level would be NONE. |
222 content::CertStore::GetInstance()->RetrieveCert( | 222 content::CertStore::GetInstance()->RetrieveCert( |
223 GetNavigationController()->GetVisibleEntry()->GetSSL().cert_id, &cert); | 223 GetNavigationController()->GetVisibleEntry()->GetSSL().cert_id, &cert); |
224 return GetEVCertName(*cert); | 224 return GetEVCertName(*cert.get()); |
225 } | 225 } |
226 | 226 |
227 // static | 227 // static |
228 string16 ToolbarModelImpl::GetEVCertName(const net::X509Certificate& cert) { | 228 string16 ToolbarModelImpl::GetEVCertName(const net::X509Certificate& cert) { |
229 // EV are required to have an organization name and country. | 229 // EV are required to have an organization name and country. |
230 if (cert.subject().organization_names.empty() || | 230 if (cert.subject().organization_names.empty() || |
231 cert.subject().country_name.empty()) { | 231 cert.subject().country_name.empty()) { |
232 NOTREACHED(); | 232 NOTREACHED(); |
233 return string16(); | 233 return string16(); |
234 } | 234 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 // If the page is still loading and the security style is unkown then consider | 296 // If the page is still loading and the security style is unkown then consider |
297 // the page secure. | 297 // the page secure. |
298 if (nav_controller.GetVisibleEntry()->GetSSL().security_style == | 298 if (nav_controller.GetVisibleEntry()->GetSSL().security_style == |
299 content::SECURITY_STYLE_UNKNOWN && nav_controller.GetVisibleEntry() != | 299 content::SECURITY_STYLE_UNKNOWN && nav_controller.GetVisibleEntry() != |
300 nav_controller.GetLastCommittedEntry()) | 300 nav_controller.GetLastCommittedEntry()) |
301 return true; | 301 return true; |
302 | 302 |
303 ToolbarModel::SecurityLevel security_level = GetSecurityLevel(); | 303 ToolbarModel::SecurityLevel security_level = GetSecurityLevel(); |
304 return security_level == SECURE || security_level == EV_SECURE; | 304 return security_level == SECURE || security_level == EV_SECURE; |
305 } | 305 } |
OLD | NEW |