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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/autocomplete/autocomplete_input.h" | 8 #include "chrome/browser/autocomplete/autocomplete_input.h" |
9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 return icon_ids[GetSecurityLevel()]; | 167 return icon_ids[GetSecurityLevel()]; |
168 } | 168 } |
169 | 169 |
170 string16 ToolbarModelImpl::GetEVCertName() const { | 170 string16 ToolbarModelImpl::GetEVCertName() const { |
171 DCHECK_EQ(GetSecurityLevel(), EV_SECURE); | 171 DCHECK_EQ(GetSecurityLevel(), EV_SECURE); |
172 scoped_refptr<net::X509Certificate> cert; | 172 scoped_refptr<net::X509Certificate> cert; |
173 // Note: Navigation controller and active entry are guaranteed non-NULL or | 173 // Note: Navigation controller and active entry are guaranteed non-NULL or |
174 // the security level would be NONE. | 174 // the security level would be NONE. |
175 content::CertStore::GetInstance()->RetrieveCert( | 175 content::CertStore::GetInstance()->RetrieveCert( |
176 GetNavigationController()->GetVisibleEntry()->GetSSL().cert_id, &cert); | 176 GetNavigationController()->GetVisibleEntry()->GetSSL().cert_id, &cert); |
177 return GetEVCertName(*cert); | 177 return GetEVCertName(*cert.get()); |
178 } | 178 } |
179 | 179 |
180 // static | 180 // static |
181 string16 ToolbarModelImpl::GetEVCertName(const net::X509Certificate& cert) { | 181 string16 ToolbarModelImpl::GetEVCertName(const net::X509Certificate& cert) { |
182 // EV are required to have an organization name and country. | 182 // EV are required to have an organization name and country. |
183 if (cert.subject().organization_names.empty() || | 183 if (cert.subject().organization_names.empty() || |
184 cert.subject().country_name.empty()) { | 184 cert.subject().country_name.empty()) { |
185 NOTREACHED(); | 185 NOTREACHED(); |
186 return string16(); | 186 return string16(); |
187 } | 187 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 template_url->ExtractSearchTermsFromURL(url, &result); | 228 template_url->ExtractSearchTermsFromURL(url, &result); |
229 return result; | 229 return result; |
230 } | 230 } |
231 | 231 |
232 Profile* ToolbarModelImpl::GetProfile() const { | 232 Profile* ToolbarModelImpl::GetProfile() const { |
233 NavigationController* navigation_controller = GetNavigationController(); | 233 NavigationController* navigation_controller = GetNavigationController(); |
234 return navigation_controller ? | 234 return navigation_controller ? |
235 Profile::FromBrowserContext(navigation_controller->GetBrowserContext()) : | 235 Profile::FromBrowserContext(navigation_controller->GetBrowserContext()) : |
236 NULL; | 236 NULL; |
237 } | 237 } |
OLD | NEW |