OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/web/navigation/crw_session_certificate_policy_manager.h" | 5 #import "ios/web/navigation/crw_session_certificate_policy_manager.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
14 #include "ios/web/public/certificate_policy_cache.h" | 14 #include "ios/web/public/certificate_policy_cache.h" |
15 #include "ios/web/public/web_thread.h" | 15 #include "ios/web/public/web_thread.h" |
16 #include "net/cert/x509_certificate.h" | 16 #include "net/cert/x509_certificate.h" |
17 | 17 |
18 // Break if we detect that CertStatus values changed, because we persist them on | 18 // Break if we detect that CertStatus values changed, because we persist them on |
19 // disk and thus require them to be consistent. | 19 // disk and thus require them to be consistent. |
20 COMPILE_ASSERT(net::CERT_STATUS_ALL_ERRORS == 0xFFFF, | 20 static_assert(net::CERT_STATUS_ALL_ERRORS == 0xFFFF, |
21 cert_status_value_changed); | 21 "The value of CERT_STATUS_ALL_ERRORS changed!"); |
22 COMPILE_ASSERT(net::CERT_STATUS_COMMON_NAME_INVALID == 1 << 0, | 22 static_assert(net::CERT_STATUS_COMMON_NAME_INVALID == 1 << 0, |
23 cert_status_value_changed); | 23 "The value of CERT_STATUS_COMMON_NAME_INVALID changed!"); |
24 COMPILE_ASSERT(net::CERT_STATUS_DATE_INVALID == 1 << 1, | 24 static_assert(net::CERT_STATUS_DATE_INVALID == 1 << 1, |
25 cert_status_value_changed); | 25 "The value of CERT_STATUS_DATE_INVALID changed!"); |
26 COMPILE_ASSERT(net::CERT_STATUS_AUTHORITY_INVALID == 1 << 2, | 26 static_assert(net::CERT_STATUS_AUTHORITY_INVALID == 1 << 2, |
27 cert_status_value_changed); | 27 "The value of CERT_STATUS_AUTHORITY_INVALID changed!"); |
28 COMPILE_ASSERT(net::CERT_STATUS_NO_REVOCATION_MECHANISM == 1 << 4, | 28 static_assert(net::CERT_STATUS_NO_REVOCATION_MECHANISM == 1 << 4, |
29 cert_status_value_changed); | 29 "The value of CERT_STATUS_NO_REVOCATION_MECHANISM changed!"); |
30 COMPILE_ASSERT(net::CERT_STATUS_UNABLE_TO_CHECK_REVOCATION == 1 << 5, | 30 static_assert(net::CERT_STATUS_UNABLE_TO_CHECK_REVOCATION == 1 << 5, |
31 cert_status_value_changed); | 31 "The value of CERT_STATUS_UNABLE_TO_CHECK_REVOCATION changed!"); |
32 COMPILE_ASSERT(net::CERT_STATUS_REVOKED == 1 << 6, | 32 static_assert(net::CERT_STATUS_REVOKED == 1 << 6, |
33 cert_status_value_changed); | 33 "The value of CERT_STATUS_REVOKED changed!"); |
34 COMPILE_ASSERT(net::CERT_STATUS_INVALID == 1 << 7, | 34 static_assert(net::CERT_STATUS_INVALID == 1 << 7, |
35 cert_status_value_changed); | 35 "The value of CERT_STATUS_INVALID changed!"); |
36 COMPILE_ASSERT(net::CERT_STATUS_WEAK_SIGNATURE_ALGORITHM == 1 << 8, | 36 static_assert(net::CERT_STATUS_WEAK_SIGNATURE_ALGORITHM == 1 << 8, |
37 cert_status_value_changed); | 37 "The value of CERT_STATUS_WEAK_SIGNATURE_ALGORITHM changed!"); |
38 COMPILE_ASSERT(net::CERT_STATUS_NON_UNIQUE_NAME == 1 << 10, | 38 static_assert(net::CERT_STATUS_NON_UNIQUE_NAME == 1 << 10, |
39 cert_status_value_changed); | 39 "The value of CERT_STATUS_NON_UNIQUE_NAME changed!"); |
40 COMPILE_ASSERT(net::CERT_STATUS_WEAK_KEY == 1 << 11, | 40 static_assert(net::CERT_STATUS_WEAK_KEY == 1 << 11, |
41 cert_status_value_changed); | 41 "The value of CERT_STATUS_WEAK_KEY changed!"); |
42 COMPILE_ASSERT(net::CERT_STATUS_IS_EV == 1 << 16, | 42 static_assert(net::CERT_STATUS_IS_EV == 1 << 16, |
43 cert_status_value_changed); | 43 "The value of CERT_STATUS_IS_EV changed!"); |
44 COMPILE_ASSERT(net::CERT_STATUS_REV_CHECKING_ENABLED == 1 << 17, | 44 static_assert(net::CERT_STATUS_REV_CHECKING_ENABLED == 1 << 17, |
45 cert_status_value_changed); | 45 "The value of CERT_STATUS_REV_CHECKING_ENABLED changed!"); |
46 | 46 |
47 namespace { | 47 namespace { |
48 | 48 |
49 NSString* const kAllowedCertificatesKey = @"allowedCertificates"; | 49 NSString* const kAllowedCertificatesKey = @"allowedCertificates"; |
50 | 50 |
51 struct AllowedCertificate { | 51 struct AllowedCertificate { |
52 scoped_refptr<net::X509Certificate> certificate; | 52 scoped_refptr<net::X509Certificate> certificate; |
53 std::string host; | 53 std::string host; |
54 }; | 54 }; |
55 | 55 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } | 173 } |
174 | 174 |
175 - (id)copyWithZone:(NSZone*)zone { | 175 - (id)copyWithZone:(NSZone*)zone { |
176 DCHECK([NSThread isMainThread]); | 176 DCHECK([NSThread isMainThread]); |
177 CRWSessionCertificatePolicyManager* copy = [[[self class] alloc] init]; | 177 CRWSessionCertificatePolicyManager* copy = [[[self class] alloc] init]; |
178 copy->allowed_ = allowed_; | 178 copy->allowed_ = allowed_; |
179 return copy; | 179 return copy; |
180 } | 180 } |
181 | 181 |
182 @end | 182 @end |
OLD | NEW |