Chromium Code Reviews| Index: chrome/browser/ssl/ssl_error_handler.cc |
| diff --git a/chrome/browser/ssl/ssl_error_handler.cc b/chrome/browser/ssl/ssl_error_handler.cc |
| index c41a7acbaba8984f72d2c70b1e1ea86cfa10395b..d52211d01cf5e0317952b2481a12cde23a9d4b8a 100644 |
| --- a/chrome/browser/ssl/ssl_error_handler.cc |
| +++ b/chrome/browser/ssl/ssl_error_handler.cc |
| @@ -4,9 +4,11 @@ |
| #include "chrome/browser/ssl/ssl_error_handler.h" |
| +#include "base/memory/ref_counted.h" |
| #include "base/metrics/field_trial.h" |
| #include "base/metrics/histogram.h" |
| #include "base/time/time.h" |
| +#include "chrome/browser/net/certificate_error_reporter.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/ssl/ssl_blocking_page.h" |
| #include "content/public/browser/notification_service.h" |
| @@ -88,6 +90,8 @@ void SSLErrorHandler::HandleSSLError( |
| const net::SSLInfo& ssl_info, |
| const GURL& request_url, |
| int options_mask, |
| + const scoped_refptr<chrome_browser_net::CertificateErrorReporter>& |
| + certificate_error_reporter, |
|
Ryan Sleevi
2015/03/14 03:09:42
Rather than require this to be passed, you could d
|
| const base::Callback<void(bool)>& callback) { |
| #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| CaptivePortalTabHelper* captive_portal_tab_helper = |
| @@ -97,10 +101,10 @@ void SSLErrorHandler::HandleSSLError( |
| } |
| #endif |
| DCHECK(!FromWebContents(web_contents)); |
| - web_contents->SetUserData(UserDataKey(), |
| - new SSLErrorHandler(web_contents, cert_error, |
| - ssl_info, request_url, |
| - options_mask, callback)); |
| + web_contents->SetUserData( |
| + UserDataKey(), |
| + new SSLErrorHandler(web_contents, cert_error, ssl_info, request_url, |
| + options_mask, certificate_error_reporter, callback)); |
| SSLErrorHandler* error_handler = |
| SSLErrorHandler::FromWebContents(web_contents); |
| @@ -120,17 +124,21 @@ void SSLErrorHandler::SetInterstitialTimerStartedCallbackForTest( |
| g_timer_started_callback = callback; |
| } |
| -SSLErrorHandler::SSLErrorHandler(content::WebContents* web_contents, |
| - int cert_error, |
| - const net::SSLInfo& ssl_info, |
| - const GURL& request_url, |
| - int options_mask, |
| - const base::Callback<void(bool)>& callback) |
| +SSLErrorHandler::SSLErrorHandler( |
| + content::WebContents* web_contents, |
| + int cert_error, |
| + const net::SSLInfo& ssl_info, |
| + const GURL& request_url, |
| + int options_mask, |
| + scoped_refptr<chrome_browser_net::CertificateErrorReporter> |
| + certificate_error_reporter, |
| + const base::Callback<void(bool)>& callback) |
| : web_contents_(web_contents), |
| cert_error_(cert_error), |
| ssl_info_(ssl_info), |
| request_url_(request_url), |
| options_mask_(options_mask), |
| + certificate_error_reporter_(certificate_error_reporter), |
| callback_(callback) { |
| #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| Profile* profile = Profile::FromBrowserContext( |
| @@ -201,7 +209,7 @@ void SSLErrorHandler::ShowSSLInterstitial() { |
| SHOW_SSL_INTERSTITIAL_NONOVERRIDABLE); |
| (new SSLBlockingPage(web_contents_, cert_error_, ssl_info_, request_url_, |
| options_mask_, base::Time::NowFromSystemTime(), |
| - callback_))->Show(); |
| + certificate_error_reporter_, callback_))->Show(); |
|
Ryan Sleevi
2015/03/14 03:09:42
namespace {
void SendReport(const base::WeakPtr<C
|
| // Once an interstitial is displayed, no need to keep the handler around. |
| // This is the equivalent of "delete this". |
| web_contents_->RemoveUserData(UserDataKey()); |