| 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 "webkit/glue/resource_type.h" | 11 #include "webkit/glue/resource_type.h" |
| 12 | 12 |
| 13 class SSLCertErrorHandler; | 13 class SSLCertErrorHandler; |
| 14 class SSLPolicyBackend; | 14 class SSLPolicyBackend; |
| 15 class SSLRequestInfo; | 15 class SSLRequestInfo; |
| 16 class WebContentsImpl; | |
| 17 | 16 |
| 18 namespace content { | 17 namespace content { |
| 19 class NavigationEntryImpl; | 18 class NavigationEntryImpl; |
| 19 class WebContentsImpl; |
| 20 } | 20 } |
| 21 | 21 |
| 22 // SSLPolicy | 22 // SSLPolicy |
| 23 // | 23 // |
| 24 // This class is responsible for making the security decisions that concern the | 24 // This class is responsible for making the security decisions that concern the |
| 25 // SSL trust indicators. It relies on the SSLPolicyBackend to actually enact | 25 // SSL trust indicators. It relies on the SSLPolicyBackend to actually enact |
| 26 // the decisions it reaches. | 26 // the decisions it reaches. |
| 27 // | 27 // |
| 28 class SSLPolicy { | 28 class SSLPolicy { |
| 29 public: | 29 public: |
| 30 explicit SSLPolicy(SSLPolicyBackend* backend); | 30 explicit SSLPolicy(SSLPolicyBackend* backend); |
| 31 | 31 |
| 32 // An error occurred with the certificate in an SSL connection. | 32 // An error occurred with the certificate in an SSL connection. |
| 33 void OnCertError(SSLCertErrorHandler* handler); | 33 void OnCertError(SSLCertErrorHandler* handler); |
| 34 | 34 |
| 35 void DidRunInsecureContent(content::NavigationEntryImpl* entry, | 35 void DidRunInsecureContent(content::NavigationEntryImpl* entry, |
| 36 const std::string& security_origin); | 36 const std::string& security_origin); |
| 37 | 37 |
| 38 // We have started a resource request with the given info. | 38 // We have started a resource request with the given info. |
| 39 void OnRequestStarted(SSLRequestInfo* info); | 39 void OnRequestStarted(SSLRequestInfo* info); |
| 40 | 40 |
| 41 // Update the SSL information in |entry| to match the current state. | 41 // Update the SSL information in |entry| to match the current state. |
| 42 // |web_contents| is the WebContentsImpl associated with this entry. | 42 // |web_contents| is the WebContentsImpl associated with this entry. |
| 43 void UpdateEntry(content::NavigationEntryImpl* entry, | 43 void UpdateEntry(content::NavigationEntryImpl* entry, |
| 44 WebContentsImpl* web_contents); | 44 content::WebContentsImpl* web_contents); |
| 45 | 45 |
| 46 SSLPolicyBackend* backend() const { return backend_; } | 46 SSLPolicyBackend* backend() const { return backend_; } |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 // Callback that the user chose to accept or deny the certificate. | 49 // Callback that the user chose to accept or deny the certificate. |
| 50 void OnAllowCertificate(scoped_refptr<SSLCertErrorHandler> handler, | 50 void OnAllowCertificate(scoped_refptr<SSLCertErrorHandler> handler, |
| 51 bool allow); | 51 bool allow); |
| 52 | 52 |
| 53 // Helper method for derived classes handling certificate errors. | 53 // Helper method for derived classes handling certificate errors. |
| 54 // | 54 // |
| (...skipping 13 matching lines...) Expand all Loading... |
| 68 // Mark |origin| as having run insecure content in the process with ID |pid|. | 68 // Mark |origin| as having run insecure content in the process with ID |pid|. |
| 69 void OriginRanInsecureContent(const std::string& origin, int pid); | 69 void OriginRanInsecureContent(const std::string& origin, int pid); |
| 70 | 70 |
| 71 // The backend we use to enact our decisions. | 71 // The backend we use to enact our decisions. |
| 72 SSLPolicyBackend* backend_; | 72 SSLPolicyBackend* backend_; |
| 73 | 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(SSLPolicy); | 74 DISALLOW_COPY_AND_ASSIGN(SSLPolicy); |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 #endif // CONTENT_BROWSER_SSL_SSL_POLICY_H_ | 77 #endif // CONTENT_BROWSER_SSL_SSL_POLICY_H_ |
| OLD | NEW |