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 #ifndef CONTENT_PUBLIC_BROWSER_SECURITY_STYLE_EXPLANATIONS_H_
6 #define CONTENT_PUBLIC_BROWSER_SECURITY_STYLE_EXPLANATIONS_H_
7 
8 #include <string>
9 #include <vector>
10 
11 #include "content/common/content_export.h"
12 #include "content/public/browser/security_style_explanation.h"
13 #include "third_party/blink/public/common/security/security_style.h"
14 
15 namespace content {
16 
17 // SecurityStyleExplanations provide context for why the specific security style
18 // was chosen for the page.
19 //
20 // Each page has a single security style, which is chosen based on factors like
21 // whether the page was delivered over HTTPS with a valid certificate, is free
22 // of mixed content, does not use a deprecated protocol, and is not flagged as
23 // dangerous.
24 //
25 // Each factor that impacts the SecurityStyle has an accompanying
26 // SecurityStyleExplanation that contains a human-readable explanation of the
27 // factor. A single page may contain multiple explanations, each of which may
28 // have a different severity level ("secure", "warning", "insecure" and "info").
29 struct CONTENT_EXPORT SecurityStyleExplanations {
30   SecurityStyleExplanations();
31   SecurityStyleExplanations(const SecurityStyleExplanations& other);
32   ~SecurityStyleExplanations();
33 
34   bool scheme_is_cryptographic;
35 
36   // User-visible summary of the security style, set only when
37   // the style cannot be determined from HTTPS status alone.
38   std::string summary;
39 
40   // Explanations corresponding to each security level.
41 
42   // |secure_explanations| explains why the page was marked secure.
43   std::vector<SecurityStyleExplanation> secure_explanations;
44   // |neutral_explanations| explains why the page was marked neutrally: for
45   // example, the page's lock icon was taken away due to mixed content, or the
46   // page was not loaded over HTTPS.
47   std::vector<SecurityStyleExplanation> neutral_explanations;
48   // |insecure_explanations| explains why the page was marked as insecure or
49   // dangerous: for example, the page was loaded with a certificate error.
50   std::vector<SecurityStyleExplanation> insecure_explanations;
51   // |info_explanations| contains information that did not affect the page's
52   // security style, but is still relevant to the page's security state: for
53   // example, an upcoming deprecation that will affect the security style in
54   // future.
55   std::vector<SecurityStyleExplanation> info_explanations;
56 };
57 
58 }  // namespace content
59 
60 #endif  // CONTENT_PUBLIC_BROWSER_SECURITY_STYLE_EXPLANATION_H_
61