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 #include "chrome/browser/ssl/ssl_blocking_page.h" | 5 #include "chrome/browser/ssl/ssl_blocking_page.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 danger_overridable_(DoesPolicyAllowDangerOverride( | 136 danger_overridable_(DoesPolicyAllowDangerOverride( |
137 Profile::FromBrowserContext(web_contents->GetBrowserContext()))), | 137 Profile::FromBrowserContext(web_contents->GetBrowserContext()))), |
138 strict_enforcement_((options_mask & STRICT_ENFORCEMENT) != 0), | 138 strict_enforcement_((options_mask & STRICT_ENFORCEMENT) != 0), |
139 expired_but_previously_allowed_( | 139 expired_but_previously_allowed_( |
140 (options_mask & EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0), | 140 (options_mask & EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0), |
141 time_triggered_(time_triggered) { | 141 time_triggered_(time_triggered) { |
142 security_interstitials::MetricsHelper::ReportDetails reporting_info; | 142 security_interstitials::MetricsHelper::ReportDetails reporting_info; |
143 reporting_info.metric_prefix = GetUmaHistogramPrefix(); | 143 reporting_info.metric_prefix = GetUmaHistogramPrefix(); |
144 reporting_info.rappor_prefix = kSSLRapporPrefix; | 144 reporting_info.rappor_prefix = kSSLRapporPrefix; |
145 reporting_info.rappor_report_type = rappor::UMA_RAPPOR_TYPE; | 145 reporting_info.rappor_report_type = rappor::UMA_RAPPOR_TYPE; |
146 set_metrics_helper(new ChromeMetricsHelper( | 146 scoped_ptr<ChromeMetricsHelper> chrome_metrics_helper(new ChromeMetricsHelper( |
147 web_contents, request_url, reporting_info, GetSamplingEventName())); | 147 web_contents, request_url, reporting_info, GetSamplingEventName())); |
| 148 chrome_metrics_helper->StartRecordingCaptivePortalMetrics(overridable_); |
| 149 set_metrics_helper(chrome_metrics_helper.Pass()); |
148 metrics_helper()->RecordUserDecision( | 150 metrics_helper()->RecordUserDecision( |
149 security_interstitials::MetricsHelper::SHOW); | 151 security_interstitials::MetricsHelper::SHOW); |
150 metrics_helper()->RecordUserInteraction( | 152 metrics_helper()->RecordUserInteraction( |
151 security_interstitials::MetricsHelper::TOTAL_VISITS); | 153 security_interstitials::MetricsHelper::TOTAL_VISITS); |
152 | 154 |
153 cert_report_helper_.reset(new CertReportHelper( | 155 cert_report_helper_.reset(new CertReportHelper( |
154 ssl_cert_reporter.Pass(), web_contents, request_url, ssl_info, | 156 ssl_cert_reporter.Pass(), web_contents, request_url, ssl_info, |
155 certificate_reporting::ErrorReport::INTERSTITIAL_SSL, overridable_, | 157 certificate_reporting::ErrorReport::INTERSTITIAL_SSL, overridable_, |
156 metrics_helper())); | 158 metrics_helper())); |
157 | 159 |
158 ssl_error_classification_.reset(new SSLErrorClassification( | 160 SSLErrorClassification error_classification( |
159 web_contents, | 161 time_triggered_, request_url, cert_error_, *ssl_info_.cert.get()); |
160 time_triggered_, | 162 error_classification.RecordUMAStatistics(overridable_); |
161 request_url, | |
162 cert_error_, | |
163 *ssl_info_.cert.get())); | |
164 ssl_error_classification_->RecordUMAStatistics(overridable_); | |
165 | 163 |
166 // Creating an interstitial without showing (e.g. from chrome://interstitials) | 164 // Creating an interstitial without showing (e.g. from chrome://interstitials) |
167 // it leaks memory, so don't create it here. | 165 // it leaks memory, so don't create it here. |
168 } | 166 } |
169 | 167 |
170 bool SSLBlockingPage::ShouldCreateNewNavigation() const { | 168 bool SSLBlockingPage::ShouldCreateNewNavigation() const { |
171 return true; | 169 return true; |
172 } | 170 } |
173 | 171 |
174 InterstitialPageDelegate::TypeID SSLBlockingPage::GetTypeForTesting() const { | 172 InterstitialPageDelegate::TypeID SSLBlockingPage::GetTypeForTesting() const { |
175 return SSLBlockingPage::kTypeForTesting; | 173 return SSLBlockingPage::kTypeForTesting; |
176 } | 174 } |
177 | 175 |
178 SSLBlockingPage::~SSLBlockingPage() { | 176 SSLBlockingPage::~SSLBlockingPage() { |
179 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) | 177 metrics_helper()->RecordShutdownMetrics(); |
180 // Captive portal detection results can arrive anytime during the interstitial | |
181 // is being displayed, so record it when the interstitial is going away. | |
182 ssl_error_classification_->RecordCaptivePortalUMAStatistics(overridable_); | |
183 #endif | |
184 if (!callback_.is_null()) { | 178 if (!callback_.is_null()) { |
185 // The page is closed without the user having chosen what to do, default to | 179 // The page is closed without the user having chosen what to do, default to |
186 // deny. | 180 // deny. |
187 metrics_helper()->RecordUserDecision( | 181 metrics_helper()->RecordUserDecision( |
188 security_interstitials::MetricsHelper::DONT_PROCEED); | 182 security_interstitials::MetricsHelper::DONT_PROCEED); |
189 RecordSSLExpirationPageEventState( | 183 RecordSSLExpirationPageEventState( |
190 expired_but_previously_allowed_, false, overridable_); | 184 expired_but_previously_allowed_, false, overridable_); |
191 NotifyDenyCertificate(); | 185 NotifyDenyCertificate(); |
192 } | 186 } |
193 } | 187 } |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT) && | 449 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT) && |
456 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); | 450 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); |
457 return is_overridable; | 451 return is_overridable; |
458 } | 452 } |
459 | 453 |
460 // static | 454 // static |
461 bool SSLBlockingPage::DoesPolicyAllowDangerOverride( | 455 bool SSLBlockingPage::DoesPolicyAllowDangerOverride( |
462 const Profile* const profile) { | 456 const Profile* const profile) { |
463 return profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); | 457 return profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); |
464 } | 458 } |
OLD | NEW |