Chromium Code Reviews| Index: chrome/browser/ssl/ssl_blocking_page.cc |
| diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc |
| index f7cc7d092415a58893f1b63a5193d63126f8e4e6..98eb49e544105f03122b3ff4b92bfa473b82962a 100644 |
| --- a/chrome/browser/ssl/ssl_blocking_page.cc |
| +++ b/chrome/browser/ssl/ssl_blocking_page.cc |
| @@ -46,11 +46,6 @@ |
| #include "ui/base/webui/jstemplate_builder.h" |
| #include "ui/base/webui/web_ui_util.h" |
| -#if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| -#include "chrome/browser/captive_portal/captive_portal_service.h" |
| -#include "chrome/browser/captive_portal/captive_portal_service_factory.h" |
| -#endif |
| - |
| #if defined(OS_WIN) |
| #include "base/base_paths_win.h" |
| #include "base/path_service.h" |
| @@ -126,14 +121,14 @@ enum SSLBlockingPageEvent { |
| SHOW_NEW_SITE, |
| PROCEED_NEW_SITE, |
| PROCEED_MANUAL_NONOVERRIDABLE, |
| - CAPTIVE_PORTAL_DETECTION_ENABLED, |
| - CAPTIVE_PORTAL_DETECTION_ENABLED_OVERRIDABLE, |
| - CAPTIVE_PORTAL_PROBE_COMPLETED, |
| - CAPTIVE_PORTAL_PROBE_COMPLETED_OVERRIDABLE, |
| - CAPTIVE_PORTAL_NO_RESPONSE, |
| - CAPTIVE_PORTAL_NO_RESPONSE_OVERRIDABLE, |
| - CAPTIVE_PORTAL_DETECTED, |
| - CAPTIVE_PORTAL_DETECTED_OVERRIDABLE, |
| + DEPRECATED_CAPTIVE_PORTAL_DETECTION_ENABLED, // Captive Portal errors moved |
| + DEPRECATED_CAPTIVE_PORTAL_DETECTION_ENABLED_OVERRIDABLE, // to |
| + DEPRECATED_CAPTIVE_PORTAL_PROBE_COMPLETED, // ssl_error_classification. |
| + DEPRECATED_CAPTIVE_PORTAL_PROBE_COMPLETED_OVERRIDABLE, |
| + DEPRECATED_CAPTIVE_PORTAL_NO_RESPONSE, |
| + DEPRECATED_CAPTIVE_PORTAL_NO_RESPONSE_OVERRIDABLE, |
| + DEPRECATED_CAPTIVE_PORTAL_DETECTED, |
| + DEPRECATED_CAPTIVE_PORTAL_DETECTED_OVERRIDABLE, |
| UNUSED_BLOCKING_PAGE_EVENT, |
| }; |
| @@ -148,36 +143,9 @@ void RecordSSLBlockingPageDetailedStats( |
| int cert_error, |
| bool overridable, |
| bool internal, |
| - int num_visits, |
| - bool captive_portal_detection_enabled, |
| - bool captive_portal_probe_completed, |
| - bool captive_portal_no_response, |
| - bool captive_portal_detected) { |
| + int num_visits) { |
| UMA_HISTOGRAM_ENUMERATION("interstitial.ssl_error_type", |
| SSLErrorInfo::NetErrorToErrorType(cert_error), SSLErrorInfo::END_OF_ENUM); |
| -#if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| - if (captive_portal_detection_enabled) |
| - RecordSSLBlockingPageEventStats( |
| - overridable ? |
| - CAPTIVE_PORTAL_DETECTION_ENABLED_OVERRIDABLE : |
| - CAPTIVE_PORTAL_DETECTION_ENABLED); |
| - if (captive_portal_probe_completed) |
| - RecordSSLBlockingPageEventStats( |
| - overridable ? |
| - CAPTIVE_PORTAL_PROBE_COMPLETED_OVERRIDABLE : |
| - CAPTIVE_PORTAL_PROBE_COMPLETED); |
| - // Log only one of portal detected and no response results. |
| - if (captive_portal_detected) |
| - RecordSSLBlockingPageEventStats( |
| - overridable ? |
| - CAPTIVE_PORTAL_DETECTED_OVERRIDABLE : |
| - CAPTIVE_PORTAL_DETECTED); |
| - else if (captive_portal_no_response) |
| - RecordSSLBlockingPageEventStats( |
| - overridable ? |
| - CAPTIVE_PORTAL_NO_RESPONSE_OVERRIDABLE : |
| - CAPTIVE_PORTAL_NO_RESPONSE); |
| -#endif |
| if (!overridable) { |
| if (proceed) { |
| RecordSSLBlockingPageEventStats(PROCEED_MANUAL_NONOVERRIDABLE); |
| @@ -321,10 +289,6 @@ SSLBlockingPage::SSLBlockingPage( |
| strict_enforcement_(strict_enforcement), |
| internal_(false), |
| num_visits_(-1), |
| - captive_portal_detection_enabled_(false), |
| - captive_portal_probe_completed_(false), |
| - captive_portal_no_response_(false), |
| - captive_portal_detected_(false), |
| trial_condition_(GetTrialCondition()) { |
| Profile* profile = Profile::FromBrowserContext( |
| web_contents->GetBrowserContext()); |
| @@ -346,20 +310,20 @@ SSLBlockingPage::SSLBlockingPage( |
| &request_tracker_); |
| } |
| } |
| + |
| + SSLErrorClassification ssl_error_classification( |
| + web_contents_, |
| + base::Time::NowFromSystemTime(), |
| + *ssl_info_.cert.get()); |
| if (SSLErrorInfo::NetErrorToErrorType(cert_error_) == |
| SSLErrorInfo::CERT_DATE_INVALID) { |
| - SSLErrorClassification::RecordUMAStatistics(overridable_ && |
| - !strict_enforcement_); |
| + ssl_error_classification.RecordUMAStatistics( |
| + overridable_ && !strict_enforcement_); |
| } |
| #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| - CaptivePortalService* captive_portal_service = |
| - CaptivePortalServiceFactory::GetForProfile(profile); |
| - captive_portal_detection_enabled_ = captive_portal_service ->enabled(); |
| - captive_portal_service ->DetectCaptivePortal(); |
| - registrar_.Add(this, |
| - chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT, |
| - content::Source<Profile>(profile)); |
| + ssl_error_classification.RecordCaptivePortalUMAStatistics( |
| + overridable_ && !strict_enforcement_); |
|
meacer
2014/07/24 00:46:30
Maybe you can add a public method to SSLErrorClass
|
| #endif |
| interstitial_page_ = InterstitialPage::Create( |
| @@ -373,11 +337,7 @@ SSLBlockingPage::~SSLBlockingPage() { |
| cert_error_, |
| overridable_ && !strict_enforcement_, |
| internal_, |
| - num_visits_, |
| - captive_portal_detection_enabled_, |
| - captive_portal_probe_completed_, |
| - captive_portal_no_response_, |
| - captive_portal_detected_); |
| + num_visits_); |
| // The page is closed without the user having chosen what to do, default to |
| // deny. |
| NotifyDenyCertificate(); |
| @@ -595,7 +555,6 @@ std::string SSLBlockingPage::GetHTMLContentsV2() { |
| load_time_data.SetString( |
| "closeDetails", |
| l10n_util::GetStringUTF16(IDS_SSL_V2_CLOSE_DETAILS_BUTTON)); |
| - load_time_data.SetString("errorCode", net::ErrorToString(cert_error_)); |
| if (overridable_ && !strict_enforcement_) { // Overridable. |
| SSLErrorInfo error_info = |
| @@ -642,6 +601,7 @@ std::string SSLBlockingPage::GetHTMLContentsV2() { |
| } |
| load_time_data.SetString( |
| "finalParagraph", l10n_util::GetStringFUTF16(help_string, url)); |
| + load_time_data.SetString("errorCode", net::ErrorToString(cert_error_)); |
| } |
| base::StringPiece html( |
| @@ -716,11 +676,7 @@ void SSLBlockingPage::OnProceed() { |
| cert_error_, |
| overridable_ && !strict_enforcement_, |
| internal_, |
| - num_visits_, |
| - captive_portal_detection_enabled_, |
| - captive_portal_probe_completed_, |
| - captive_portal_no_response_, |
| - captive_portal_detected_); |
| + num_visits_); |
| // Accepting the certificate resumes the loading of the page. |
| NotifyAllowCertificate(); |
| } |
| @@ -730,11 +686,7 @@ void SSLBlockingPage::OnDontProceed() { |
| cert_error_, |
| overridable_ && !strict_enforcement_, |
| internal_, |
| - num_visits_, |
| - captive_portal_detection_enabled_, |
| - captive_portal_probe_completed_, |
| - captive_portal_no_response_, |
| - captive_portal_detected_); |
| + num_visits_); |
| NotifyDenyCertificate(); |
| } |
| @@ -778,35 +730,3 @@ void SSLBlockingPage::OnGotHistoryCount(bool success, |
| base::Time first_visit) { |
| num_visits_ = num_visits; |
| } |
| - |
| -void SSLBlockingPage::Observe( |
| - int type, |
| - const content::NotificationSource& source, |
| - const content::NotificationDetails& details) { |
| -#if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| - // When detection is disabled, captive portal service always sends |
| - // RESULT_INTERNET_CONNECTED. Ignore any probe results in that case. |
| - if (!captive_portal_detection_enabled_) |
| - return; |
| - if (type == chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT) { |
| - captive_portal_probe_completed_ = true; |
| - CaptivePortalService::Results* results = |
| - content::Details<CaptivePortalService::Results>( |
| - details).ptr(); |
| - // If a captive portal was detected at any point when the interstitial was |
| - // displayed, assume that the interstitial was caused by a captive portal. |
| - // Example scenario: |
| - // 1- Interstitial displayed and captive portal detected, setting the flag. |
| - // 2- Captive portal detection automatically opens portal login page. |
| - // 3- User logs in on the portal login page. |
| - // A notification will be received here for RESULT_INTERNET_CONNECTED. Make |
| - // sure we don't clear the captive portal flag, since the interstitial was |
| - // potentially caused by the captive portal. |
| - captive_portal_detected_ = captive_portal_detected_ || |
| - (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); |
| - // Also keep track of non-HTTP portals and error cases. |
| - captive_portal_no_response_ = captive_portal_no_response_ || |
| - (results->result == captive_portal::RESULT_NO_RESPONSE); |
| - } |
| -#endif |
| -} |