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_SECURITY_STATE_MODEL_H_ | 5 #ifndef CHROME_BROWSER_SSL_SECURITY_STATE_MODEL_H_ |
| 6 #define CHROME_BROWSER_SSL_SECURITY_STATE_MODEL_H_ | 6 #define CHROME_BROWSER_SSL_SECURITY_STATE_MODEL_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "content/public/browser/web_contents_user_data.h" | 9 #include "content/public/browser/web_contents_user_data.h" |
| 10 #include "content/public/common/security_style.h" | 10 #include "content/public/common/security_style.h" |
| 11 #include "content/public/common/ssl_status.h" | 11 #include "content/public/common/ssl_status.h" |
| 12 #include "net/cert/cert_status_flags.h" | 12 #include "net/cert/cert_status_flags.h" |
| 13 #include "net/cert/sct_status_flags.h" | 13 #include "net/cert/sct_status_flags.h" |
| 14 #include "net/cert/x509_certificate.h" | 14 #include "net/cert/x509_certificate.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 class NavigationHandle; | 17 class NavigationHandle; |
| 18 class WebContents; | 18 class WebContents; |
| 19 } // namespace content | 19 } // namespace content |
| 20 | 20 |
| 21 class Profile; | 21 class Profile; |
| 22 class SecurityStateModelDelegate; | |
| 22 | 23 |
| 23 // SecurityStateModel provides high-level security information about a | 24 // SecurityStateModel provides high-level security information about a |
| 24 // page or request. It is attached to a WebContents and will provide the | 25 // page or request. It is attached to a WebContents and will provide the |
| 25 // security info for that WebContents. | 26 // security info for that WebContents. |
| 26 // | 27 // |
| 27 // SecurityStateModel::SecurityInfo is the main data structure computed | 28 // SecurityStateModel::SecurityInfo is the main data structure computed |
| 28 // by a SecurityStateModel. SecurityInfo contains a SecurityLevel (which | 29 // by a SecurityStateModel. SecurityInfo contains a SecurityLevel (which |
| 29 // is a single value describing the overall security state) along with | 30 // is a single value describing the overall security state) along with |
| 30 // information that a consumer might want to display in UI to explain or | 31 // information that a consumer might want to display in UI to explain or |
| 31 // elaborate on the SecurityLevel. | 32 // elaborate on the SecurityLevel. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 | 128 |
| 128 // Returns a SecurityInfo describing the current page. Results are | 129 // Returns a SecurityInfo describing the current page. Results are |
| 129 // cached so that computation is only done once per visible | 130 // cached so that computation is only done once per visible |
| 130 // NavigationEntry. | 131 // NavigationEntry. |
| 131 const SecurityInfo& GetSecurityInfo() const; | 132 const SecurityInfo& GetSecurityInfo() const; |
| 132 | 133 |
| 133 // Returns a SecurityInfo describing an individual request for the | 134 // Returns a SecurityInfo describing an individual request for the |
| 134 // given |profile|. | 135 // given |profile|. |
| 135 static void SecurityInfoForRequest(const GURL& url, | 136 static void SecurityInfoForRequest(const GURL& url, |
| 136 const content::SSLStatus& ssl, | 137 const content::SSLStatus& ssl, |
| 137 Profile* profile, | 138 Profile* prfoile, |
|
blundell
2015/11/23 16:06:17
nit: I liked the spelling better before ;).
estark
2015/11/23 16:23:39
Doh. Done.
| |
| 139 bool used_known_mitm_certificate, | |
| 138 SecurityInfo* security_info); | 140 SecurityInfo* security_info); |
| 139 | 141 |
| 140 private: | 142 private: |
| 141 explicit SecurityStateModel(content::WebContents* web_contents); | 143 explicit SecurityStateModel(content::WebContents* web_contents); |
| 142 friend class content::WebContentsUserData<SecurityStateModel>; | 144 friend class content::WebContentsUserData<SecurityStateModel>; |
| 143 | 145 |
| 144 // The WebContents for which this class describes the security status. | 146 // The WebContents for which this class describes the security status. |
| 145 content::WebContents* web_contents_; | 147 content::WebContents* web_contents_; |
| 146 | 148 |
| 147 // These data members cache the SecurityInfo for the visible | 149 // These data members cache the SecurityInfo for the visible |
| 148 // NavigationEntry. They are marked mutable so that the const accessor | 150 // NavigationEntry. They are marked mutable so that the const accessor |
| 149 // GetSecurityInfo() can update the cache. | 151 // GetSecurityInfo() can update the cache. |
| 150 mutable SecurityInfo security_info_; | 152 mutable SecurityInfo security_info_; |
| 151 mutable GURL visible_url_; | 153 mutable GURL visible_url_; |
| 152 mutable content::SSLStatus visible_ssl_status_; | 154 mutable content::SSLStatus visible_ssl_status_; |
| 153 | 155 |
| 156 scoped_ptr<SecurityStateModelDelegate> delegate_; | |
|
blundell
2015/11/23 16:06:17
nit: Let's add a comment here explaining how this
estark
2015/11/23 16:23:40
Done.
| |
| 157 | |
| 154 DISALLOW_COPY_AND_ASSIGN(SecurityStateModel); | 158 DISALLOW_COPY_AND_ASSIGN(SecurityStateModel); |
| 155 }; | 159 }; |
| 156 | 160 |
| 157 #endif // CHROME_BROWSER_SSL_SECURITY_STATE_MODEL_H_ | 161 #endif // CHROME_BROWSER_SSL_SECURITY_STATE_MODEL_H_ |
| OLD | NEW |