| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ssl/chrome_security_state_model_client.h" |
| 6 |
| 7 #include "base/command_line.h" |
| 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "chrome/browser/chromeos/policy/policy_cert_service.h" |
| 11 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" |
| 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "content/public/browser/cert_store.h" |
| 14 #include "content/public/browser/navigation_entry.h" |
| 15 #include "content/public/browser/web_contents.h" |
| 16 #include "content/public/common/ssl_status.h" |
| 17 #include "net/cert/x509_certificate.h" |
| 18 |
| 19 ChromeSecurityStateModelClient::ChromeSecurityStateModelClient( |
| 20 content::WebContents* web_contents) |
| 21 : web_contents_(web_contents) {} |
| 22 |
| 23 ChromeSecurityStateModelClient::~ChromeSecurityStateModelClient() {} |
| 24 |
| 25 bool ChromeSecurityStateModelClient::RetrieveCert( |
| 26 scoped_refptr<net::X509Certificate>* cert) { |
| 27 content::NavigationEntry* entry = |
| 28 web_contents_->GetController().GetVisibleEntry(); |
| 29 if (!entry) |
| 30 return false; |
| 31 return content::CertStore::GetInstance()->RetrieveCert( |
| 32 entry->GetSSL().cert_id, cert); |
| 33 } |
| 34 |
| 35 bool ChromeSecurityStateModelClient::UsedPolicyInstalledCertificate() { |
| 36 #if defined(OS_CHROMEOS) |
| 37 policy::PolicyCertService* service = |
| 38 policy::PolicyCertServiceFactory::GetForProfile( |
| 39 Profile::FromBrowserContext(web_contents_->GetBrowserContext())); |
| 40 if (service && service->UsedPolicyCertificates()) |
| 41 return true; |
| 42 #endif |
| 43 return false; |
| 44 } |
| OLD | NEW |