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

Unified Diff: chrome/browser/ssl/chrome_security_state_model_client.cc

Issue 1470813002: Add SecurityStateModelClient interface and implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: delegate_ -> client_ Created 5 years, 1 month 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
« no previous file with comments | « chrome/browser/ssl/chrome_security_state_model_client.h ('k') | chrome/browser/ssl/security_state_model.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ssl/chrome_security_state_model_client.cc
diff --git a/chrome/browser/ssl/chrome_security_state_model_client.cc b/chrome/browser/ssl/chrome_security_state_model_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b95f8865faac7ba590cf4e10ee9e2c7464472cfe
--- /dev/null
+++ b/chrome/browser/ssl/chrome_security_state_model_client.cc
@@ -0,0 +1,44 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ssl/chrome_security_state_model_client.h"
+
+#include "base/command_line.h"
+#include "base/metrics/field_trial.h"
+#include "base/metrics/histogram_macros.h"
+#include "chrome/browser/chromeos/policy/policy_cert_service.h"
+#include "chrome/browser/chromeos/policy/policy_cert_service_factory.h"
+#include "chrome/browser/profiles/profile.h"
+#include "content/public/browser/cert_store.h"
+#include "content/public/browser/navigation_entry.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/common/ssl_status.h"
+#include "net/cert/x509_certificate.h"
+
+ChromeSecurityStateModelClient::ChromeSecurityStateModelClient(
+ content::WebContents* web_contents)
+ : web_contents_(web_contents) {}
+
+ChromeSecurityStateModelClient::~ChromeSecurityStateModelClient() {}
+
+bool ChromeSecurityStateModelClient::RetrieveCert(
+ scoped_refptr<net::X509Certificate>* cert) {
+ content::NavigationEntry* entry =
+ web_contents_->GetController().GetVisibleEntry();
+ if (!entry)
+ return false;
+ return content::CertStore::GetInstance()->RetrieveCert(
+ entry->GetSSL().cert_id, cert);
+}
+
+bool ChromeSecurityStateModelClient::UsedPolicyInstalledCertificate() {
+#if defined(OS_CHROMEOS)
+ policy::PolicyCertService* service =
+ policy::PolicyCertServiceFactory::GetForProfile(
+ Profile::FromBrowserContext(web_contents_->GetBrowserContext()));
+ if (service && service->UsedPolicyCertificates())
+ return true;
+#endif
+ return false;
+}
« no previous file with comments | « chrome/browser/ssl/chrome_security_state_model_client.h ('k') | chrome/browser/ssl/security_state_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698