OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_SSL_POLICY_H_ | 5 #ifndef CHROME_BROWSER_SSL_SSL_POLICY_H_ |
6 #define CHROME_BROWSER_SSL_SSL_POLICY_H_ | 6 #define CHROME_BROWSER_SSL_SSL_POLICY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/ssl/ssl_blocking_page.h" | 10 #include "chrome/browser/ssl/ssl_blocking_page.h" |
11 #include "chrome/common/filter_policy.h" | 11 #include "chrome/common/filter_policy.h" |
(...skipping 10 matching lines...) Expand all Loading... |
22 // SSL trust indicators. It relies on the SSLPolicyBackend to actually enact | 22 // SSL trust indicators. It relies on the SSLPolicyBackend to actually enact |
23 // the decisions it reaches. | 23 // the decisions it reaches. |
24 // | 24 // |
25 class SSLPolicy : public SSLBlockingPage::Delegate { | 25 class SSLPolicy : public SSLBlockingPage::Delegate { |
26 public: | 26 public: |
27 explicit SSLPolicy(SSLPolicyBackend* backend); | 27 explicit SSLPolicy(SSLPolicyBackend* backend); |
28 | 28 |
29 // An error occurred with the certificate in an SSL connection. | 29 // An error occurred with the certificate in an SSL connection. |
30 void OnCertError(SSLCertErrorHandler* handler); | 30 void OnCertError(SSLCertErrorHandler* handler); |
31 | 31 |
32 void DidDisplayInsecureContent(NavigationEntry* entry); | |
33 void DidRunInsecureContent(NavigationEntry* entry, | 32 void DidRunInsecureContent(NavigationEntry* entry, |
34 const std::string& security_origin); | 33 const std::string& security_origin); |
35 | 34 |
36 // We have started a resource request with the given info. | 35 // We have started a resource request with the given info. |
37 void OnRequestStarted(SSLRequestInfo* info); | 36 void OnRequestStarted(SSLRequestInfo* info); |
38 | 37 |
39 // Update the SSL information in |entry| to match the current state. | 38 // Update the SSL information in |entry| to match the current state. |
40 void UpdateEntry(NavigationEntry* entry); | 39 // |tab_contents| is the TabContents associated with this entry. |
| 40 void UpdateEntry(NavigationEntry* entry, TabContents* tab_contents); |
41 | 41 |
42 SSLPolicyBackend* backend() const { return backend_; } | 42 SSLPolicyBackend* backend() const { return backend_; } |
43 | 43 |
44 // SSLBlockingPage::Delegate methods. | 44 // SSLBlockingPage::Delegate methods. |
45 virtual SSLErrorInfo GetSSLErrorInfo(SSLCertErrorHandler* handler); | 45 virtual SSLErrorInfo GetSSLErrorInfo(SSLCertErrorHandler* handler); |
46 virtual void OnDenyCertificate(SSLCertErrorHandler* handler); | 46 virtual void OnDenyCertificate(SSLCertErrorHandler* handler); |
47 virtual void OnAllowCertificate(SSLCertErrorHandler* handler); | 47 virtual void OnAllowCertificate(SSLCertErrorHandler* handler); |
48 | 48 |
49 private: | 49 private: |
50 // Helper method for derived classes handling certificate errors. | 50 // Helper method for derived classes handling certificate errors. |
51 // If the error can be overridden by the user, show a blocking page that | 51 // If the error can be overridden by the user, show a blocking page that |
52 // lets the user continue or cancel the request. | 52 // lets the user continue or cancel the request. |
53 // For fatal certificate errors, show a blocking page that only lets the | 53 // For fatal certificate errors, show a blocking page that only lets the |
54 // user cancel the request. | 54 // user cancel the request. |
55 void OnCertErrorInternal(SSLCertErrorHandler* handler, | 55 void OnCertErrorInternal(SSLCertErrorHandler* handler, |
56 SSLBlockingPage::ErrorLevel error_level); | 56 SSLBlockingPage::ErrorLevel error_level); |
57 | 57 |
58 // If the security style of |entry| has not been initialized, then initialize | 58 // If the security style of |entry| has not been initialized, then initialize |
59 // it with the default style for its URL. | 59 // it with the default style for its URL. |
60 void InitializeEntryIfNeeded(NavigationEntry* entry); | 60 void InitializeEntryIfNeeded(NavigationEntry* entry); |
61 | 61 |
62 // Mark |origin| as containing insecure content in the process with ID |pid|. | 62 // Mark |origin| as having run insecure content in the process with ID |pid|. |
63 void MarkOriginAsBroken(const std::string& origin, int pid); | 63 void OriginRanInsecureContent(const std::string& origin, int pid); |
64 | |
65 // Called after we've decided that |info| represents a request for mixed | |
66 // content. Updates our internal state to reflect that we've loaded |info|. | |
67 void UpdateStateForMixedContent(SSLRequestInfo* info); | |
68 | |
69 // Called after we've decided that |info| represents a request for unsafe | |
70 // content. Updates our internal state to reflect that we've loaded |info|. | |
71 void UpdateStateForUnsafeContent(SSLRequestInfo* info); | |
72 | 64 |
73 // The backend we use to enact our decisions. | 65 // The backend we use to enact our decisions. |
74 SSLPolicyBackend* backend_; | 66 SSLPolicyBackend* backend_; |
75 | 67 |
76 DISALLOW_COPY_AND_ASSIGN(SSLPolicy); | 68 DISALLOW_COPY_AND_ASSIGN(SSLPolicy); |
77 }; | 69 }; |
78 | 70 |
79 #endif // CHROME_BROWSER_SSL_SSL_POLICY_H_ | 71 #endif // CHROME_BROWSER_SSL_SSL_POLICY_H_ |
OLD | NEW |