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 #import <Foundation/Foundation.h> | |
6 | |
7 #include "base/ios/block_types.h" | |
8 #include "base/memory/ref_counted.h" | |
9 #include "ios/web/public/cert_policy.h" | |
10 #include "net/cert/cert_status_flags.h" | |
11 | |
12 namespace net { | |
13 class X509Certificate; | |
14 } | |
15 | |
16 namespace web { | |
17 class CertificatePolicyCache; | |
18 } | |
19 | |
20 // Adapter for web::CertificatePolicyCache, which is used to remember decisions | |
21 // about how to handle invalid certs that have been given a user exception. | |
22 // web::CertificatePolicyCache can be used only on IO thread while | |
23 // CRWCertPolicyCache is threadsafe and can be used on any thread. | |
24 @interface CRWCertPolicyCache : NSObject | |
25 | |
26 // Unavailable, use |initWithCache:| instead. | |
27 - (instancetype)init NS_UNAVAILABLE; | |
28 | |
29 // Initializes CRWCertPolicyCache. | |
30 - (instancetype)initWithCache:(scoped_refptr<web::CertificatePolicyCache>)cache | |
31 NS_DESIGNATED_INITIALIZER; | |
32 | |
33 // Asynchronously queries whether |cert| with |status| is allowed or denied for | |
34 // |host|. |handler| can not be null and is always called on the main thread. | |
35 - (void)queryJudgementForCert:(scoped_refptr<net::X509Certificate>)cert | |
36 forHost:(NSString*)host | |
37 status:(net::CertStatus)certStatus | |
38 completionHandler:(void (^)(web::CertPolicy::Judgment))handler; | |
39 | |
40 // Records that |cert| is permitted to be used for |host| in the future. | |
41 - (void)allowCert:(scoped_refptr<net::X509Certificate>)cert | |
42 forHost:(NSString*)host | |
43 status:(net::CertStatus)status; | |
44 | |
45 @end | |
OLD | NEW |