| 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 COMPONENTS_SECURITY_STATE_SECURITY_STATE_MODEL_H_ | 5 #ifndef COMPONENTS_SECURITY_STATE_SECURITY_STATE_MODEL_H_ |
| 6 #define COMPONENTS_SECURITY_STATE_SECURITY_STATE_MODEL_H_ | 6 #define COMPONENTS_SECURITY_STATE_SECURITY_STATE_MODEL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <memory> |
| 9 | 10 |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "net/cert/cert_status_flags.h" | 12 #include "net/cert/cert_status_flags.h" |
| 12 #include "net/cert/sct_status_flags.h" | 13 #include "net/cert/sct_status_flags.h" |
| 13 #include "net/cert/x509_certificate.h" | 14 #include "net/cert/x509_certificate.h" |
| 14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 15 | 16 |
| 16 namespace security_state { | 17 namespace security_state { |
| 17 | 18 |
| 18 class SecurityStateModelClient; | 19 // Returns true if the given |url|'s origin should be considered secure. |
| 20 bool IsOriginSecure(const GURL& url); |
| 19 | 21 |
| 20 // SecurityStateModel provides high-level security information about a | 22 // SecurityStateModel provides high-level security information about a |
| 21 // page or request. | 23 // page or request. |
| 22 // | 24 // |
| 23 // SecurityStateModel::SecurityInfo is the main data structure computed | 25 // SecurityStateModel::SecurityInfo is the main data structure computed |
| 24 // by a SecurityStateModel. SecurityInfo contains a SecurityLevel (which | 26 // by a SecurityStateModel. SecurityInfo contains a SecurityLevel (which |
| 25 // is a single value describing the overall security state) along with | 27 // is a single value describing the overall security state) along with |
| 26 // information that a consumer might want to display in UI to explain or | 28 // information that a consumer might want to display in UI to explain or |
| 27 // elaborate on the SecurityLevel. | 29 // elaborate on the SecurityLevel. |
| 28 class SecurityStateModel { | 30 class SecurityStateModel { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // True if pinning was bypassed due to a local trust anchor. | 139 // True if pinning was bypassed due to a local trust anchor. |
| 138 bool pkp_bypassed; | 140 bool pkp_bypassed; |
| 139 | 141 |
| 140 // True if the page displayed sensitive user data inputs (like a | 142 // True if the page displayed sensitive user data inputs (like a |
| 141 // password or credit card) on an HTTP page. | 143 // password or credit card) on an HTTP page. |
| 142 bool displayed_private_user_data_input_on_http; | 144 bool displayed_private_user_data_input_on_http; |
| 143 }; | 145 }; |
| 144 | 146 |
| 145 // Contains the security state relevant to computing the SecurityInfo | 147 // Contains the security state relevant to computing the SecurityInfo |
| 146 // for a page. This is the input to GetSecurityInfo() provided by the | 148 // for a page. This is the input to GetSecurityInfo() provided by the |
| 147 // model's client. | 149 // model's user. |
| 148 struct VisibleSecurityState { | 150 struct VisibleSecurityState { |
| 149 VisibleSecurityState(); | 151 VisibleSecurityState(); |
| 150 ~VisibleSecurityState(); | 152 ~VisibleSecurityState(); |
| 151 bool operator==(const VisibleSecurityState& other) const; | 153 bool operator==(const VisibleSecurityState& other) const; |
| 152 GURL url; | 154 GURL url; |
| 153 | 155 |
| 154 // True if the page fails the browser's malware or phishing checks. | 156 // True if the page fails the browser's malware or phishing checks. |
| 155 bool fails_malware_check; | 157 bool fails_malware_check; |
| 156 | 158 |
| 157 // CONNECTION SECURITY FIELDS | 159 // CONNECTION SECURITY FIELDS |
| (...skipping 30 matching lines...) Expand all Loading... |
| 188 // These security levels describe the treatment given to pages that | 190 // These security levels describe the treatment given to pages that |
| 189 // display and run mixed content. They are used to coordinate the | 191 // display and run mixed content. They are used to coordinate the |
| 190 // treatment of mixed content with other security UI elements. | 192 // treatment of mixed content with other security UI elements. |
| 191 static const SecurityLevel kDisplayedInsecureContentLevel; | 193 static const SecurityLevel kDisplayedInsecureContentLevel; |
| 192 static const SecurityLevel kRanInsecureContentLevel; | 194 static const SecurityLevel kRanInsecureContentLevel; |
| 193 | 195 |
| 194 SecurityStateModel(); | 196 SecurityStateModel(); |
| 195 virtual ~SecurityStateModel(); | 197 virtual ~SecurityStateModel(); |
| 196 | 198 |
| 197 // Populates |result| to describe the current page. | 199 // Populates |result| to describe the current page. |
| 198 void GetSecurityInfo(SecurityInfo* result) const; | 200 // |visible_security_state| contains the relevant security state. |
| 199 | 201 // |used_policy_installed_certificate| indicates whether the page or request |
| 200 void SetClient(SecurityStateModelClient* client); | 202 // is known to be loaded with a certificate installed by the system admin. |
| 203 void GetSecurityInfo( |
| 204 SecurityInfo* result, |
| 205 std::unique_ptr<VisibleSecurityState> visible_security_state, |
| 206 bool used_policy_installed_certificate) const; |
| 201 | 207 |
| 202 private: | 208 private: |
| 203 SecurityStateModelClient* client_; | |
| 204 | |
| 205 DISALLOW_COPY_AND_ASSIGN(SecurityStateModel); | 209 DISALLOW_COPY_AND_ASSIGN(SecurityStateModel); |
| 206 }; | 210 }; |
| 207 | 211 |
| 208 } // namespace security_state | 212 } // namespace security_state |
| 209 | 213 |
| 210 #endif // COMPONENTS_SECURITY_STATE_SECURITY_STATE_MODEL_H_ | 214 #endif // COMPONENTS_SECURITY_STATE_SECURITY_STATE_MODEL_H_ |
| OLD | NEW |