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.
5 #ifndef CHROME_BROWSER_SSL_CONNECTION_SECURITY_H_
6 #define CHROME_BROWSER_SSL_CONNECTION_SECURITY_H_
8 #include "base/macros.h"
9 #include "content/public/common/security_style.h"
10 #include "net/cert/cert_status_flags.h"
14 } // namespace content
16 // This namespace contains functions responsible for computing the
17 // connection security status of a page.
18 namespace connection_security
{
20 // TODO(wtc): unify this enum with SecurityStyle. We
21 // don't need two sets of security UI levels. SECURITY_STYLE_AUTHENTICATED
22 // needs to be refined into three levels: warning, standard, and EV.
23 // See crbug.com/425728
25 // If you reorder, add, or delete values from this enum, you must also
26 // update the UI icons in ToolbarModelImpl::GetIconForSecurityLevel.
28 // A Java counterpart will be generated for this enum.
29 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.ssl
30 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: ConnectionSecurityLevel
35 // HTTPS with valid EV cert
41 // HTTPS, but unable to check certificate revocation status or with insecure
42 // content on the page
45 // HTTPS, but the certificate verification chain is anchored on a
46 // certificate that was installed by the system administrator
47 SECURITY_POLICY_WARNING
,
49 // Attempted HTTPS and failed, page not authenticated
53 // Describes how the SHA1 deprecation policy applies to an HTTPS
55 enum SHA1DeprecationStatus
{
56 // No SHA1 deprecation policy applies.
58 // The connection used a certificate with a SHA1 signature in the
59 // chain, and policy says that the connection should be treated as
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
65 DEPRECATED_SHA1_WARNING
,
68 // Describes the type of mixed content (if any) that a site
70 enum MixedContentStatus
{
72 // The site displayed nonsecure resources (passive mixed content).
73 DISPLAYED_MIXED_CONTENT
,
74 // The site ran nonsecure resources (active mixed content).
78 // Contains information about a page's security status, including a
79 // SecurityStyle and the information that was used to decide which
80 // SecurityStyle to assign.
82 content::SecurityStyle security_style
;
83 SHA1DeprecationStatus sha1_deprecation_status
;
84 MixedContentStatus mixed_content_status
;
85 net::CertStatus cert_status
;
88 // Returns a security level describing the overall security state of
89 // the given |WebContents|.
90 SecurityLevel
GetSecurityLevelForWebContents(
91 const content::WebContents
* 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.
97 // Note: This is a lossy operation. Not all of the policies
98 // that can be expressed by a SecurityLevel (a //chrome concept) can
99 // be expressed by a content::SecurityStyle.
100 // In general, code in //chrome should prefer to use
101 // GetSecurityLevelForWebContents() to determine security policy, and
102 // only use this function when policy needs to be supplied back to
103 // layers in //content.
104 void GetSecurityInfoForWebContents(const content::WebContents
* web_contents
,
105 SecurityInfo
* security_info
);
107 } // namespace connection_security
109 #endif // CHROME_BROWSER_SSL_CONNECTION_SECURITY_H_