OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_ERROR_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_ |
6 #define CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_ | 6 #define CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // | 55 // |
56 // This class should only be used on the UI thread because its implementation | 56 // This class should only be used on the UI thread because its implementation |
57 // uses captive_portal::CaptivePortalService which can only be accessed on the | 57 // uses captive_portal::CaptivePortalService which can only be accessed on the |
58 // UI thread. | 58 // UI thread. |
59 class SSLErrorHandler : public content::WebContentsUserData<SSLErrorHandler>, | 59 class SSLErrorHandler : public content::WebContentsUserData<SSLErrorHandler>, |
60 public content::WebContentsObserver, | 60 public content::WebContentsObserver, |
61 public content::NotificationObserver { | 61 public content::NotificationObserver { |
62 public: | 62 public: |
63 typedef base::Callback<void(content::WebContents*)> TimerStartedCallback; | 63 typedef base::Callback<void(content::WebContents*)> TimerStartedCallback; |
64 | 64 |
| 65 ~SSLErrorHandler() override; |
| 66 |
65 // Events for UMA. Do not rename or remove values, add new values to the end. | 67 // Events for UMA. Do not rename or remove values, add new values to the end. |
66 // Public for testing. | 68 // Public for testing. |
67 enum UMAEvent { | 69 enum UMAEvent { |
68 HANDLE_ALL = 0, | 70 HANDLE_ALL = 0, |
69 SHOW_CAPTIVE_PORTAL_INTERSTITIAL_NONOVERRIDABLE = 1, | 71 SHOW_CAPTIVE_PORTAL_INTERSTITIAL_NONOVERRIDABLE = 1, |
70 SHOW_CAPTIVE_PORTAL_INTERSTITIAL_OVERRIDABLE = 2, | 72 SHOW_CAPTIVE_PORTAL_INTERSTITIAL_OVERRIDABLE = 2, |
71 SHOW_SSL_INTERSTITIAL_NONOVERRIDABLE = 3, | 73 SHOW_SSL_INTERSTITIAL_NONOVERRIDABLE = 3, |
72 SHOW_SSL_INTERSTITIAL_OVERRIDABLE = 4, | 74 SHOW_SSL_INTERSTITIAL_OVERRIDABLE = 4, |
73 WWW_MISMATCH_FOUND = 5, // Deprecated in M59 by WWW_MISMATCH_FOUND_IN_SAN. | 75 WWW_MISMATCH_FOUND = 5, // Deprecated in M59 by WWW_MISMATCH_FOUND_IN_SAN. |
74 WWW_MISMATCH_URL_AVAILABLE = 6, | 76 WWW_MISMATCH_URL_AVAILABLE = 6, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 SSLErrorHandler( | 138 SSLErrorHandler( |
137 std::unique_ptr<Delegate> delegate, | 139 std::unique_ptr<Delegate> delegate, |
138 content::WebContents* web_contents, | 140 content::WebContents* web_contents, |
139 Profile* profile, | 141 Profile* profile, |
140 int cert_error, | 142 int cert_error, |
141 const net::SSLInfo& ssl_info, | 143 const net::SSLInfo& ssl_info, |
142 const GURL& request_url, | 144 const GURL& request_url, |
143 const base::Callback<void(content::CertificateRequestResultType)>& | 145 const base::Callback<void(content::CertificateRequestResultType)>& |
144 callback); | 146 callback); |
145 | 147 |
146 ~SSLErrorHandler() override; | |
147 | |
148 // Called when an SSL cert error is encountered. Triggers a captive portal | 148 // Called when an SSL cert error is encountered. Triggers a captive portal |
149 // check and fires a one shot timer to wait for a "captive portal detected" | 149 // check and fires a one shot timer to wait for a "captive portal detected" |
150 // result to arrive. Protected for testing. | 150 // result to arrive. Protected for testing. |
151 void StartHandlingError(); | 151 void StartHandlingError(); |
152 | 152 |
153 private: | 153 private: |
154 void ShowCaptivePortalInterstitial(const GURL& landing_url); | 154 void ShowCaptivePortalInterstitial(const GURL& landing_url); |
155 void ShowSSLInterstitial(); | 155 void ShowSSLInterstitial(); |
156 void ShowBadClockInterstitial(const base::Time& now, | 156 void ShowBadClockInterstitial(const base::Time& now, |
157 ssl_errors::ClockState clock_state); | 157 ssl_errors::ClockState clock_state); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 base::OneShotTimer timer_; | 194 base::OneShotTimer timer_; |
195 | 195 |
196 std::unique_ptr<CommonNameMismatchHandler> common_name_mismatch_handler_; | 196 std::unique_ptr<CommonNameMismatchHandler> common_name_mismatch_handler_; |
197 | 197 |
198 base::WeakPtrFactory<SSLErrorHandler> weak_ptr_factory_; | 198 base::WeakPtrFactory<SSLErrorHandler> weak_ptr_factory_; |
199 | 199 |
200 DISALLOW_COPY_AND_ASSIGN(SSLErrorHandler); | 200 DISALLOW_COPY_AND_ASSIGN(SSLErrorHandler); |
201 }; | 201 }; |
202 | 202 |
203 #endif // CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_ | 203 #endif // CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_ |
OLD | NEW |