Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1810)

Unified Diff: chrome/browser/ssl/security_state_model.h

Issue 1440303002: Componentize SecurityStateModel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android/cros fixes Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ssl/security_state_model.h
diff --git a/chrome/browser/ssl/security_state_model.h b/chrome/browser/ssl/security_state_model.h
index 8989efb676d4dc249f84dd745deebe3db9b9db4d..5317ffd56f493c5d36f933357aba5cc63447785d 100644
--- a/chrome/browser/ssl/security_state_model.h
+++ b/chrome/browser/ssl/security_state_model.h
@@ -5,38 +5,14 @@
#ifndef CHROME_BROWSER_SSL_SECURITY_STATE_MODEL_H_
#define CHROME_BROWSER_SSL_SECURITY_STATE_MODEL_H_
-#include "base/macros.h"
-#include "content/public/browser/web_contents_user_data.h"
-#include "content/public/common/security_style.h"
-#include "content/public/common/ssl_status.h"
-#include "net/cert/cert_status_flags.h"
-#include "net/cert/sct_status_flags.h"
-#include "net/cert/x509_certificate.h"
+#include "components/security_state/security_state_model.h"
-namespace content {
-class NavigationHandle;
-class WebContents;
-} // namespace content
-
-class Profile;
-
-// SecurityStateModel provides high-level security information about a
-// page or request. It is attached to a WebContents and will provide the
-// security info for that WebContents.
-//
-// SecurityStateModel::SecurityInfo is the main data structure computed
-// by a SecurityStateModel. SecurityInfo contains a SecurityLevel (which
-// is a single value describing the overall security state) along with
-// information that a consumer might want to display in UI to explain or
-// elaborate on the SecurityLevel.
-class SecurityStateModel
- : public content::WebContentsUserData<SecurityStateModel> {
+// TODO(estark): This class is a temporary wrapper around types defined
+// in the security_state component. This is to avoid changing a whole
+// bunch of users of these types in the same CL that lands the
+// component. https://crbug.com/515071
+class SecurityStateModel {
public:
- // Describes the overall security state of the page.
- //
- // If you reorder, add, or delete values from this enum, you must also
- // update the UI icons in ToolbarModelImpl::GetIconForSecurityLevel.
- //
// A Java counterpart will be generated for this enum.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.ssl
// GENERATED_JAVA_CLASS_NAME_OVERRIDE: ConnectionSecurityLevel
@@ -63,94 +39,11 @@ class SecurityStateModel
SECURITY_ERROR,
};
- // Describes how the SHA1 deprecation policy applies to an HTTPS
- // connection.
- enum SHA1DeprecationStatus {
- // No SHA1 deprecation policy applies.
- NO_DEPRECATED_SHA1,
- // The connection used a certificate with a SHA1 signature in the
- // chain, and policy says that the connection should be treated with a
- // warning.
- DEPRECATED_SHA1_MINOR,
- // The connection used a certificate with a SHA1 signature in the
- // chain, and policy says that the connection should be treated as
- // broken HTTPS.
- DEPRECATED_SHA1_MAJOR,
- };
-
- // Describes the type of mixed content (if any) that a site
- // displayed/ran.
- enum MixedContentStatus {
- NO_MIXED_CONTENT,
- // The site displayed insecure resources (passive mixed content).
- DISPLAYED_MIXED_CONTENT,
- // The site ran insecure code (active mixed content).
- RAN_MIXED_CONTENT,
- // The site both ran and displayed insecure resources.
- RAN_AND_DISPLAYED_MIXED_CONTENT,
- };
-
- // Describes the security status of a page or request. This is the
- // main data structure provided by this class.
- struct SecurityInfo {
- SecurityInfo();
- ~SecurityInfo();
- SecurityLevel security_level;
- SHA1DeprecationStatus sha1_deprecation_status;
- MixedContentStatus mixed_content_status;
- // The verification statuses of the signed certificate timestamps
- // for the connection.
- std::vector<net::ct::SCTVerifyStatus> sct_verify_statuses;
- bool scheme_is_cryptographic;
- net::CertStatus cert_status;
- int cert_id;
- // The security strength, in bits, of the SSL cipher suite. In late
- // 2015, 128 is considered the minimum.
- // 0 means the connection is not encrypted.
- // -1 means the security strength is unknown.
- int security_bits;
- // Information about the SSL connection, such as protocol and
- // ciphersuite. See ssl_connection_flags.h in net.
- int connection_status;
- // True if the protocol version and ciphersuite for the connection
- // are considered secure.
- bool is_secure_protocol_and_ciphersuite;
- };
-
- // These security styles describe the treatment given to pages that
- // display and run mixed content. They are used to coordinate the
- // treatment of mixed content with other security UI elements.
- static const content::SecurityStyle kDisplayedInsecureContentStyle;
- static const content::SecurityStyle kRanInsecureContentStyle;
-
- ~SecurityStateModel() override;
-
- // Returns a SecurityInfo describing the current page. Results are
- // cached so that computation is only done once per visible
- // NavigationEntry.
- const SecurityInfo& GetSecurityInfo() const;
-
- // Returns a SecurityInfo describing an individual request for the
- // given |profile|.
- static void SecurityInfoForRequest(const GURL& url,
- const content::SSLStatus& ssl,
- Profile* profile,
- SecurityInfo* security_info);
+ typedef security_state::SecurityInfo SecurityInfo;
private:
- explicit SecurityStateModel(content::WebContents* web_contents);
- friend class content::WebContentsUserData<SecurityStateModel>;
-
- // The WebContents for which this class describes the security status.
- content::WebContents* web_contents_;
-
- // These data members cache the SecurityInfo for the visible
- // NavigationEntry. They are marked mutable so that the const accessor
- // GetSecurityInfo() can update the cache.
- mutable SecurityInfo security_info_;
- mutable GURL visible_url_;
- mutable content::SSLStatus visible_ssl_status_;
-
+ SecurityStateModel() {}
+ ~SecurityStateModel() {}
DISALLOW_COPY_AND_ASSIGN(SecurityStateModel);
};
« no previous file with comments | « chrome/browser/ssl/chrome_security_state_model_delegate_browser_tests.cc ('k') | chrome/browser/ssl/security_state_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698