session_certificate_policy_cache_impl.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2017 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. #ifndef IOS_WEB_SESSION_SESSION_CERTIFICATE_POLICY_CACHE_IMPL_H_
  5. #define IOS_WEB_SESSION_SESSION_CERTIFICATE_POLICY_CACHE_IMPL_H_
  6. #import <Foundation/Foundation.h>
  7. #include "ios/web/public/session/session_certificate_policy_cache.h"
  8. namespace net {
  9. class X509Certificate;
  10. }
  11. namespace web {
  12. // Concrete implementation of SessionCertificatePolicyCache.
  13. class SessionCertificatePolicyCacheImpl : public SessionCertificatePolicyCache {
  14. public:
  15. SessionCertificatePolicyCacheImpl(BrowserState* browser_state);
  16. SessionCertificatePolicyCacheImpl(const SessionCertificatePolicyCacheImpl&) =
  17. delete;
  18. SessionCertificatePolicyCacheImpl& operator=(
  19. const SessionCertificatePolicyCacheImpl&) = delete;
  20. ~SessionCertificatePolicyCacheImpl() override;
  21. // SessionCertificatePolicyCache:
  22. void UpdateCertificatePolicyCache(
  23. const scoped_refptr<web::CertificatePolicyCache>& cache) const override;
  24. void RegisterAllowedCertificate(
  25. scoped_refptr<net::X509Certificate> certificate,
  26. const std::string& host,
  27. net::CertStatus status) override;
  28. // Allows for batch updating the allowed certificate storages.
  29. void SetAllowedCerts(NSSet* allowed_certs);
  30. NSSet* GetAllowedCerts() const;
  31. private:
  32. // An set of CRWSessionCertificateStorages representing allowed certs.
  33. NSMutableSet* allowed_certs_;
  34. };
  35. } // namespace web
  36. #endif // IOS_WEB_SESSION_SESSION_CERTIFICATE_POLICY_CACHE_IMPL_H_