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

Unified Diff: ios/web/public/certificate_policy_cache.h

Issue 986743003: Upstream (most of) ios/web/public (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix namespace comment Created 5 years, 9 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
« no previous file with comments | « ios/web/public/cert_policy.h ('k') | ios/web/public/favicon_url.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/public/certificate_policy_cache.h
diff --git a/ios/web/public/certificate_policy_cache.h b/ios/web/public/certificate_policy_cache.h
new file mode 100644
index 0000000000000000000000000000000000000000..51d5d4be26a54c181d509031e1bf11ed46e0bda2
--- /dev/null
+++ b/ios/web/public/certificate_policy_cache.h
@@ -0,0 +1,56 @@
+// Copyright 2012 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.
+
+#ifndef IOS_WEB_PUBLIC_CERTIFICATE_POLICY_CACHE_H_
+#define IOS_WEB_PUBLIC_CERTIFICATE_POLICY_CACHE_H_
+
+#include <map>
+#include <string>
+
+#include "ios/web/public/cert_policy.h"
+#include "net/cert/x509_certificate.h"
+
+namespace web {
+
+// A manager for certificate policy decisions for hosts, used to remember
+// decisions about how to handle problematic certs.
+// This class is thread-safe only in that in can be created and passed around
+// on any thread; the policy-related methods can only be called from the IO
+// thread.
+class CertificatePolicyCache
+ : public base::RefCountedThreadSafe<CertificatePolicyCache> {
+ public:
+ // Can be called from any thread:
+ CertificatePolicyCache();
+
+ // Everything from here on can only be called from the IO thread.
+
+ // Records that |cert| is permitted to be used for |host| in the future.
+ virtual void AllowCertForHost(net::X509Certificate* cert,
+ const std::string& host,
+ net::CertStatus error);
+
+ // Queries whether |cert| is allowed or denied for |host|.
+ virtual CertPolicy::Judgment QueryPolicy(net::X509Certificate* cert,
+ const std::string& host,
+ net::CertStatus error);
+
+ // Removes all policies stored in this instance.
+ virtual void ClearCertificatePolicies();
+
+ protected:
+ virtual ~CertificatePolicyCache();
+
+ private:
+ friend class base::RefCountedThreadSafe<CertificatePolicyCache>;
+
+ // Certificate policies for each host.
+ std::map<std::string, CertPolicy> cert_policy_for_host_;
+
+ DISALLOW_COPY_AND_ASSIGN(CertificatePolicyCache);
+};
+
+} // namespace web
+
+#endif // IOS_WEB_PUBLIC_CERTIFICATE_POLICY_CACHE_H_
« no previous file with comments | « ios/web/public/cert_policy.h ('k') | ios/web/public/favicon_url.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698