| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_SSL_SSL_POLICY_H_ | 5 #ifndef CONTENT_BROWSER_SSL_SSL_POLICY_H_ |
| 6 #define CONTENT_BROWSER_SSL_SSL_POLICY_H_ | 6 #define CONTENT_BROWSER_SSL_SSL_POLICY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "content/public/common/resource_type.h" | 11 #include "content/public/common/resource_type.h" |
| 12 #include "content/public/common/security_style.h" | |
| 13 | |
| 14 class GURL; | |
| 15 | 12 |
| 16 namespace content { | 13 namespace content { |
| 17 class NavigationEntryImpl; | 14 class NavigationEntryImpl; |
| 18 class SSLCertErrorHandler; | 15 class SSLCertErrorHandler; |
| 19 class SSLPolicyBackend; | 16 class SSLPolicyBackend; |
| 20 class SSLRequestInfo; | 17 class SSLRequestInfo; |
| 21 class WebContents; | 18 class WebContentsImpl; |
| 22 struct SSLStatus; | |
| 23 | 19 |
| 24 // SSLPolicy | 20 // SSLPolicy |
| 25 // | 21 // |
| 26 // This class is responsible for making the security decisions that concern the | 22 // This class is responsible for making the security decisions that concern the |
| 27 // SSL trust indicators. It relies on the SSLPolicyBackend to actually enact | 23 // SSL trust indicators. It relies on the SSLPolicyBackend to actually enact |
| 28 // the decisions it reaches. | 24 // the decisions it reaches. |
| 29 // | 25 // |
| 30 class SSLPolicy { | 26 class SSLPolicy { |
| 31 public: | 27 public: |
| 32 explicit SSLPolicy(SSLPolicyBackend* backend); | 28 explicit SSLPolicy(SSLPolicyBackend* backend); |
| 33 | 29 |
| 34 // An error occurred with the certificate in an SSL connection. | 30 // An error occurred with the certificate in an SSL connection. |
| 35 void OnCertError(SSLCertErrorHandler* handler); | 31 void OnCertError(SSLCertErrorHandler* handler); |
| 36 | 32 |
| 37 void DidRunInsecureContent(NavigationEntryImpl* entry, | 33 void DidRunInsecureContent(NavigationEntryImpl* entry, |
| 38 const std::string& security_origin); | 34 const std::string& security_origin); |
| 39 | 35 |
| 40 // We have started a resource request with the given info. | 36 // We have started a resource request with the given info. |
| 41 void OnRequestStarted(SSLRequestInfo* info); | 37 void OnRequestStarted(SSLRequestInfo* info); |
| 42 | 38 |
| 43 // Update the SSL information in |entry| to match the current state. | 39 // Update the SSL information in |entry| to match the current state. |
| 44 // |web_contents| is the WebContents associated with this entry. | 40 // |web_contents| is the WebContentsImpl associated with this entry. |
| 45 void UpdateEntry(NavigationEntryImpl* entry, WebContents* web_contents); | 41 void UpdateEntry(NavigationEntryImpl* entry, |
| 42 WebContentsImpl* web_contents); |
| 46 | 43 |
| 47 SSLPolicyBackend* backend() const { return backend_; } | 44 SSLPolicyBackend* backend() const { return backend_; } |
| 48 | 45 |
| 49 // Returns a security style describing an individual resource. Does | |
| 50 // not take into account any of the page- or host-level state such as | |
| 51 // mixed content or whether the host has run insecure content. | |
| 52 static SecurityStyle GetSecurityStyleForResource(const GURL& url, | |
| 53 const SSLStatus& ssl); | |
| 54 | |
| 55 private: | 46 private: |
| 56 enum OnCertErrorInternalOptionsMask { | 47 enum OnCertErrorInternalOptionsMask { |
| 57 OVERRIDABLE = 1 << 0, | 48 OVERRIDABLE = 1 << 0, |
| 58 STRICT_ENFORCEMENT = 1 << 1, | 49 STRICT_ENFORCEMENT = 1 << 1, |
| 59 EXPIRED_PREVIOUS_DECISION = 1 << 2 | 50 EXPIRED_PREVIOUS_DECISION = 1 << 2 |
| 60 }; | 51 }; |
| 61 | 52 |
| 62 // Callback that the user chose to accept or deny the certificate. | 53 // Callback that the user chose to accept or deny the certificate. |
| 63 void OnAllowCertificate(scoped_refptr<SSLCertErrorHandler> handler, | 54 void OnAllowCertificate(scoped_refptr<SSLCertErrorHandler> handler, |
| 64 bool allow); | 55 bool allow); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 84 | 75 |
| 85 // The backend we use to enact our decisions. | 76 // The backend we use to enact our decisions. |
| 86 SSLPolicyBackend* backend_; | 77 SSLPolicyBackend* backend_; |
| 87 | 78 |
| 88 DISALLOW_COPY_AND_ASSIGN(SSLPolicy); | 79 DISALLOW_COPY_AND_ASSIGN(SSLPolicy); |
| 89 }; | 80 }; |
| 90 | 81 |
| 91 } // namespace content | 82 } // namespace content |
| 92 | 83 |
| 93 #endif // CONTENT_BROWSER_SSL_SSL_POLICY_H_ | 84 #endif // CONTENT_BROWSER_SSL_SSL_POLICY_H_ |
| OLD | NEW |