OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef IOS_WEB_PUBLIC_SSL_STATUS_H_ | 5 #ifndef IOS_WEB_PUBLIC_SSL_STATUS_H_ |
6 #define IOS_WEB_PUBLIC_SSL_STATUS_H_ | 6 #define IOS_WEB_PUBLIC_SSL_STATUS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ios/web/public/security_style.h" | 10 #include "ios/web/public/security_style.h" |
11 #include "net/cert/cert_status_flags.h" | 11 #include "net/cert/cert_status_flags.h" |
12 #include "net/cert/x509_certificate.h" | |
12 | 13 |
13 namespace web { | 14 namespace web { |
14 | 15 |
15 // Collects the SSL information for this NavigationItem. | 16 // Collects the SSL information for this NavigationItem. |
16 struct SSLStatus { | 17 struct SSLStatus { |
17 // Flags used for the page security content status. | 18 // Flags used for the page security content status. |
18 enum ContentStatusFlags { | 19 enum ContentStatusFlags { |
19 // HTTP page, or HTTPS page with no insecure content. | 20 // HTTP page, or HTTPS page with no insecure content. |
20 NORMAL_CONTENT = 0, | 21 NORMAL_CONTENT = 0, |
21 | 22 |
22 // HTTPS page containing "displayed" HTTP resources (e.g. images, CSS). | 23 // HTTPS page containing "displayed" HTTP resources (e.g. images, CSS). |
23 DISPLAYED_INSECURE_CONTENT = 1 << 0, | 24 DISPLAYED_INSECURE_CONTENT = 1 << 0, |
24 | 25 |
25 // The RAN_INSECURE_CONTENT flag is intentionally omitted on iOS because | 26 // The RAN_INSECURE_CONTENT flag is intentionally omitted on iOS because |
26 // there is no way to tell when insecure content is run in a web view. | 27 // there is no way to tell when insecure content is run in a web view. |
27 }; | 28 }; |
28 | 29 |
29 SSLStatus(); | 30 SSLStatus(); |
31 SSLStatus(const SSLStatus& other); | |
30 ~SSLStatus(); | 32 ~SSLStatus(); |
31 | 33 |
32 bool Equals(const SSLStatus& status) const { | 34 bool Equals(const SSLStatus& status) const { |
33 return security_style == status.security_style && | 35 return security_style == status.security_style && |
34 cert_id == status.cert_id && | 36 !!certificate.get() == !!status.certificate.get() && |
37 (certificate.get() ? certificate->Equals(status.certificate.get()) | |
Eugene But (OOO till 7-30)
2016/09/08 16:57:46
Should this return false if |certificate| is null
jam
2016/09/08 17:03:24
Yes that should return false since the certificate
| |
38 : true) && | |
35 cert_status == status.cert_status && | 39 cert_status == status.cert_status && |
36 security_bits == status.security_bits && | 40 security_bits == status.security_bits && |
37 content_status == status.content_status; | 41 content_status == status.content_status; |
38 // |cert_status_host| is not used for comparison intentionally. | 42 // |cert_status_host| is not used for comparison intentionally. |
39 } | 43 } |
40 | 44 |
41 web::SecurityStyle security_style; | 45 web::SecurityStyle security_style; |
42 int cert_id; | 46 scoped_refptr<net::X509Certificate> certificate; |
43 net::CertStatus cert_status; | 47 net::CertStatus cert_status; |
44 int security_bits; | 48 int security_bits; |
45 int connection_status; | 49 int connection_status; |
46 // A combination of the ContentStatusFlags above. | 50 // A combination of the ContentStatusFlags above. |
47 int content_status; | 51 int content_status; |
48 // Host which was used for |cert_status| calculation. It is not an actual part | 52 // Host which was used for |cert_status| calculation. It is not an actual part |
49 // of SSL status, hence it's not taken into account in |Equals| method. | 53 // of SSL status, hence it's not taken into account in |Equals| method. |
50 // Used to check if |cert_status| is still valid or needs to be recalculated | 54 // Used to check if |cert_status| is still valid or needs to be recalculated |
51 // (e.g. after redirect). | 55 // (e.g. after redirect). |
52 std::string cert_status_host; | 56 std::string cert_status_host; |
53 }; | 57 }; |
54 | 58 |
55 } // namespace web | 59 } // namespace web |
56 | 60 |
57 #endif // IOS_WEB_PUBLIC_SSL_STATUS_H_ | 61 #endif // IOS_WEB_PUBLIC_SSL_STATUS_H_ |
OLD | NEW |