| 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_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_SSL_SSL_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_SSL_SSL_MANAGER_H_ | 6 #define CONTENT_BROWSER_SSL_SSL_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 net::CertStatus ssl_cert_status); | 77 net::CertStatus ssl_cert_status); |
| 78 | 78 |
| 79 // The following methods are called when a page includes insecure | 79 // The following methods are called when a page includes insecure |
| 80 // content. These methods update the SSLStatus on the NavigationEntry | 80 // content. These methods update the SSLStatus on the NavigationEntry |
| 81 // appropriately. If the result could change the visible SSL state, | 81 // appropriately. If the result could change the visible SSL state, |
| 82 // they notify the WebContents of the change via | 82 // they notify the WebContents of the change via |
| 83 // DidChangeVisibleSecurityState(); | 83 // DidChangeVisibleSecurityState(); |
| 84 void DidDisplayMixedContent(); | 84 void DidDisplayMixedContent(); |
| 85 void DidDisplayContentWithCertErrors(); | 85 void DidDisplayContentWithCertErrors(); |
| 86 void DidShowPasswordInputOnHttp(); | 86 void DidShowPasswordInputOnHttp(); |
| 87 void DidHideAllPasswordInputsOnHttp(); |
| 87 void DidShowCreditCardInputOnHttp(); | 88 void DidShowCreditCardInputOnHttp(); |
| 88 void DidRunMixedContent(const GURL& security_origin); | 89 void DidRunMixedContent(const GURL& security_origin); |
| 89 void DidRunContentWithCertErrors(const GURL& security_origin); | 90 void DidRunContentWithCertErrors(const GURL& security_origin); |
| 90 | 91 |
| 91 // An error occurred with the certificate in an SSL connection. | 92 // An error occurred with the certificate in an SSL connection. |
| 92 void OnCertError(std::unique_ptr<SSLErrorHandler> handler); | 93 void OnCertError(std::unique_ptr<SSLErrorHandler> handler); |
| 93 | 94 |
| 94 private: | 95 private: |
| 95 enum OnCertErrorInternalOptionsMask { | 96 enum OnCertErrorInternalOptionsMask { |
| 96 OVERRIDABLE = 1 << 0, | 97 OVERRIDABLE = 1 << 0, |
| 97 STRICT_ENFORCEMENT = 1 << 1, | 98 STRICT_ENFORCEMENT = 1 << 1, |
| 98 EXPIRED_PREVIOUS_DECISION = 1 << 2 | 99 EXPIRED_PREVIOUS_DECISION = 1 << 2 |
| 99 }; | 100 }; |
| 100 | 101 |
| 101 // Helper method for handling certificate errors. | 102 // Helper method for handling certificate errors. |
| 102 // | 103 // |
| 103 // Options should be a bitmask combination of OnCertErrorInternalOptionsMask. | 104 // Options should be a bitmask combination of OnCertErrorInternalOptionsMask. |
| 104 // OVERRIDABLE indicates whether or not the user could (assuming perfect | 105 // OVERRIDABLE indicates whether or not the user could (assuming perfect |
| 105 // knowledge) successfully override the error and still get the security | 106 // knowledge) successfully override the error and still get the security |
| 106 // guarantees of TLS. STRICT_ENFORCEMENT indicates whether or not the site the | 107 // guarantees of TLS. STRICT_ENFORCEMENT indicates whether or not the site the |
| 107 // user is trying to connect to has requested strict enforcement of | 108 // user is trying to connect to has requested strict enforcement of |
| 108 // certificate validation (e.g. with HTTP Strict-Transport-Security). | 109 // certificate validation (e.g. with HTTP Strict-Transport-Security). |
| 109 // EXPIRED_PREVIOUS_DECISION indicates whether a user decision had been | 110 // EXPIRED_PREVIOUS_DECISION indicates whether a user decision had been |
| 110 // previously made but the decision has expired. | 111 // previously made but the decision has expired. |
| 111 void OnCertErrorInternal(std::unique_ptr<SSLErrorHandler> handler, | 112 void OnCertErrorInternal(std::unique_ptr<SSLErrorHandler> handler, |
| 112 int options_mask); | 113 int options_mask); |
| 113 | 114 |
| 114 // Updates the NavigationEntry's |content_status| flags according to | 115 // Updates the NavigationEntry's |content_status| flags according to |
| 115 // state in |ssl_host_state_delegate| and | 116 // state in |ssl_host_state_delegate|. |add_content_status_flags| and |
| 116 // |additional_content_status_flags|, a bitmask of | 117 // |remove_content_status_flags| are bitmasks of |
| 117 // SSLStatus::ContentStatusFlags. (Pass 0 to set no additional content | 118 // SSLStatus::ContentStatusFlags that will be added or removed from |
| 118 // status flags.) This will notify the WebContents of an SSL state | 119 // the |content_status| field. (Pass 0 to add/remove no content status |
| 120 // flags.) This method will notify the WebContents of an SSL state |
| 119 // change if a change was actually made. | 121 // change if a change was actually made. |
| 120 void UpdateEntry(NavigationEntryImpl* entry, | 122 void UpdateEntry(NavigationEntryImpl* entry, |
| 121 int additional_content_status_flags); | 123 int add_content_status_flags, |
| 124 int remove_content_status_flags); |
| 122 | 125 |
| 123 // Helper function for UpdateEntry(). | 126 // Helper function for UpdateEntry(). |
| 124 void UpdateLastCommittedEntry(int additional_content_status_flags); | 127 void UpdateLastCommittedEntry(int add_content_status_flags, |
| 128 int remove_content_status_flags); |
| 125 | 129 |
| 126 // Notifies the WebContents that the SSL state changed. | 130 // Notifies the WebContents that the SSL state changed. |
| 127 void NotifyDidChangeVisibleSSLState(); | 131 void NotifyDidChangeVisibleSSLState(); |
| 128 | 132 |
| 129 // Updates the last committed entries of all |context|'s | 133 // Updates the last committed entries of all |context|'s |
| 130 // SSLManagers. Notifies each WebContents of visible SSL state changes | 134 // SSLManagers. Notifies each WebContents of visible SSL state changes |
| 131 // if necessary. | 135 // if necessary. |
| 132 static void NotifySSLInternalStateChanged(BrowserContext* context); | 136 static void NotifySSLInternalStateChanged(BrowserContext* context); |
| 133 | 137 |
| 134 // The NavigationController that owns this SSLManager. We are responsible | 138 // The NavigationController that owns this SSLManager. We are responsible |
| 135 // for the security UI of this tab. | 139 // for the security UI of this tab. |
| 136 NavigationControllerImpl* controller_; | 140 NavigationControllerImpl* controller_; |
| 137 | 141 |
| 138 // Delegate that manages SSL state specific to each host. | 142 // Delegate that manages SSL state specific to each host. |
| 139 SSLHostStateDelegate* ssl_host_state_delegate_; | 143 SSLHostStateDelegate* ssl_host_state_delegate_; |
| 140 | 144 |
| 141 DISALLOW_COPY_AND_ASSIGN(SSLManager); | 145 DISALLOW_COPY_AND_ASSIGN(SSLManager); |
| 142 }; | 146 }; |
| 143 | 147 |
| 144 } // namespace content | 148 } // namespace content |
| 145 | 149 |
| 146 #endif // CONTENT_BROWSER_SSL_SSL_MANAGER_H_ | 150 #endif // CONTENT_BROWSER_SSL_SSL_MANAGER_H_ |
| OLD | NEW |