Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_SSL_CONNECTION_SECURITY_H_ | 5 #ifndef CHROME_BROWSER_SSL_CONNECTION_SECURITY_H_ |
| 6 #define CHROME_BROWSER_SSL_CONNECTION_SECURITY_H_ | 6 #define CHROME_BROWSER_SSL_CONNECTION_SECURITY_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "content/public/common/security_style.h" | 9 #include "content/public/common/security_style.h" |
| 10 #include "net/cert/cert_status_flags.h" | |
| 10 | 11 |
| 11 namespace content { | 12 namespace content { |
| 12 class WebContents; | 13 class WebContents; |
| 13 } // namespace content | 14 } // namespace content |
| 14 | 15 |
| 15 // This namespace contains functions responsible for computing the | 16 // This namespace contains functions responsible for computing the |
| 16 // connection security status of a page. | 17 // connection security status of a page. |
| 17 namespace connection_security { | 18 namespace connection_security { |
| 18 | 19 |
| 19 // TODO(wtc): unify this enum with SecurityStyle. We | 20 // TODO(wtc): unify this enum with SecurityStyle. We |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 42 SECURITY_WARNING, | 43 SECURITY_WARNING, |
| 43 | 44 |
| 44 // HTTPS, but the certificate verification chain is anchored on a | 45 // HTTPS, but the certificate verification chain is anchored on a |
| 45 // certificate that was installed by the system administrator | 46 // certificate that was installed by the system administrator |
| 46 SECURITY_POLICY_WARNING, | 47 SECURITY_POLICY_WARNING, |
| 47 | 48 |
| 48 // Attempted HTTPS and failed, page not authenticated | 49 // Attempted HTTPS and failed, page not authenticated |
| 49 SECURITY_ERROR, | 50 SECURITY_ERROR, |
| 50 }; | 51 }; |
| 51 | 52 |
| 53 // Describes how the SHA1 deprecation policy applies to an HTTPS | |
| 54 // connection. | |
| 55 enum SHA1DeprecationStatus { | |
| 56 // No SHA1 deprecation policy applies. | |
| 57 NO_DEPRECATED_SHA1, | |
| 58 // The connection used a certificate with a SHA1 signature in the | |
| 59 // chain, and policy says that the connection should be treated as | |
| 60 // broken HTTPS. | |
| 61 DEPRECATED_SHA1_BROKEN, | |
| 62 // The connection used a certificate with a SHA1 signature in the | |
| 63 // chain, and policy says that the connection should be treated with a | |
| 64 // warning. | |
| 65 DEPRECATED_SHA1_WARNING | |
|
Peter Kasting
2015/06/16 06:29:11
Nit: Trailing comma, for consistency with the exis
estark
2015/06/16 15:32:34
Done.
| |
| 66 }; | |
| 67 | |
| 68 // Describes the type of mixed content (if any) that a site | |
| 69 // displayed/ran. | |
| 70 enum MixedContentStatus { | |
| 71 NO_MIXED_CONTENT, | |
| 72 // The site displayed nonsecure resources (passive mixed content). | |
| 73 DISPLAYED_MIXED_CONTENT, | |
| 74 // The site ran nonsecure resources (active mixed content). | |
| 75 RAN_MIXED_CONTENT | |
| 76 }; | |
| 77 | |
| 78 // Contains information about a page's security status, including a | |
| 79 // |SecurityStyle| and the information that was used to decide which | |
|
Peter Kasting
2015/06/16 06:29:11
Nit: No || on type names (just variable names) (2
estark
2015/06/16 15:32:34
Done.
| |
| 80 // |SecurityStyle| to assign. | |
| 81 struct SecurityInfo { | |
| 82 content::SecurityStyle security_style; | |
| 83 SHA1DeprecationStatus sha1_deprecation_status; | |
| 84 MixedContentStatus mixed_content_status; | |
| 85 net::CertStatus cert_status; | |
| 86 }; | |
| 87 | |
| 52 // Returns a security level describing the overall security state of | 88 // Returns a security level describing the overall security state of |
| 53 // the given |WebContents|. | 89 // the given |WebContents|. |
| 54 SecurityLevel GetSecurityLevelForWebContents( | 90 SecurityLevel GetSecurityLevelForWebContents( |
| 55 const content::WebContents* web_contents); | 91 const content::WebContents* web_contents); |
| 56 | 92 |
| 57 // Returns the content::SecurityStyle for the given |web_contents|. | 93 // Populates |security_info| with information describing the given |
| 94 // |web_contents|, including a content::SecurityStyle value and security | |
| 95 // properties that caused that value to be chosen. | |
| 96 // | |
| 58 // Note: This is a lossy operation. Not all of the policies | 97 // Note: This is a lossy operation. Not all of the policies |
| 59 // that can be expressed by a SecurityLevel (a //chrome concept) can | 98 // that can be expressed by a SecurityLevel (a //chrome concept) can |
| 60 // be expressed by a content::SecurityStyle. | 99 // be expressed by a content::SecurityStyle. |
| 61 // In general, code in //chrome should prefer to use | 100 // In general, code in //chrome should prefer to use |
| 62 // GetSecurityLevelForWebContents() to determine security policy, and | 101 // GetSecurityLevelForWebContents() to determine security policy, and |
| 63 // only use this function when policy needs to be supplied back to | 102 // only use this function when policy needs to be supplied back to |
| 64 // layers in //content. | 103 // layers in //content. |
| 65 content::SecurityStyle GetSecurityStyleForWebContents( | 104 void GetSecurityInfoForWebContents(const content::WebContents* web_contents, |
| 66 const content::WebContents* web_contents); | 105 SecurityInfo* security_info); |
| 67 | 106 |
| 68 } // namespace connection_security | 107 } // namespace connection_security |
| 69 | 108 |
| 70 #endif // CHROME_BROWSER_SSL_CONNECTION_SECURITY_H_ | 109 #endif // CHROME_BROWSER_SSL_CONNECTION_SECURITY_H_ |
| OLD | NEW |