OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bad_clock_blocking_page.h" | 5 #include "chrome/browser/ssl/bad_clock_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/build_time.h" | 9 #include "base/build_time.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 const GURL& request_url, | 176 const GURL& request_url, |
177 const base::Time& time_triggered, | 177 const base::Time& time_triggered, |
178 const base::Callback<void(bool)>& callback) | 178 const base::Callback<void(bool)>& callback) |
179 : SecurityInterstitialPage(web_contents, request_url), | 179 : SecurityInterstitialPage(web_contents, request_url), |
180 callback_(callback), | 180 callback_(callback), |
181 cert_error_(cert_error), | 181 cert_error_(cert_error), |
182 ssl_info_(ssl_info), | 182 ssl_info_(ssl_info), |
183 time_triggered_(time_triggered) { | 183 time_triggered_(time_triggered) { |
184 security_interstitials::MetricsHelper::ReportDetails reporting_info; | 184 security_interstitials::MetricsHelper::ReportDetails reporting_info; |
185 reporting_info.metric_prefix = kMetricsName; | 185 reporting_info.metric_prefix = kMetricsName; |
186 set_metrics_helper(new ChromeMetricsHelper(web_contents, request_url, | 186 scoped_ptr<ChromeMetricsHelper> chrome_metrics_helper(new ChromeMetricsHelper( |
187 reporting_info, kMetricsName)); | 187 web_contents, request_url, reporting_info, kMetricsName)); |
188 chrome_metrics_helper->StartRecordingCaptivePortalMetrics(false); | |
estark
2015/09/25 23:53:35
For the sake of my understanding: is this measurin
felt
2015/09/27 20:08:15
Yes. I suppose we don't need to, although we alway
| |
189 set_metrics_helper(chrome_metrics_helper.Pass()); | |
188 metrics_helper()->RecordUserInteraction( | 190 metrics_helper()->RecordUserInteraction( |
189 security_interstitials::MetricsHelper::TOTAL_VISITS); | 191 security_interstitials::MetricsHelper::TOTAL_VISITS); |
190 | 192 |
191 // TODO(felt): Separate the clock statistics from the main ssl statistics. | 193 // TODO(felt): Separate the clock statistics from the main ssl statistics. |
192 scoped_ptr<SSLErrorClassification> classifier( | 194 SSLErrorClassification classifier(time_triggered_, request_url, cert_error_, |
193 new SSLErrorClassification(web_contents, time_triggered_, request_url, | 195 *ssl_info_.cert.get()); |
194 cert_error_, *ssl_info_.cert.get())); | 196 classifier.RecordUMAStatistics(false); |
195 classifier->RecordUMAStatistics(false); | |
196 } | 197 } |
197 | 198 |
198 bool BadClockBlockingPage::ShouldCreateNewNavigation() const { | 199 bool BadClockBlockingPage::ShouldCreateNewNavigation() const { |
199 return true; | 200 return true; |
200 } | 201 } |
201 | 202 |
202 InterstitialPageDelegate::TypeID BadClockBlockingPage::GetTypeForTesting() | 203 InterstitialPageDelegate::TypeID BadClockBlockingPage::GetTypeForTesting() |
203 const { | 204 const { |
204 return BadClockBlockingPage::kTypeForTesting; | 205 return BadClockBlockingPage::kTypeForTesting; |
205 } | 206 } |
206 | 207 |
207 BadClockBlockingPage::~BadClockBlockingPage() { | 208 BadClockBlockingPage::~BadClockBlockingPage() { |
209 metrics_helper()->RecordShutdownMetrics(); | |
208 if (!callback_.is_null()) { | 210 if (!callback_.is_null()) { |
209 // Deny when the page is closed. | 211 // Deny when the page is closed. |
210 NotifyDenyCertificate(); | 212 NotifyDenyCertificate(); |
211 } | 213 } |
212 } | 214 } |
213 | 215 |
214 void BadClockBlockingPage::PopulateInterstitialStrings( | 216 void BadClockBlockingPage::PopulateInterstitialStrings( |
215 base::DictionaryValue* load_time_data) { | 217 base::DictionaryValue* load_time_data) { |
216 CHECK(load_time_data); | 218 CHECK(load_time_data); |
217 base::string16 url(GetFormattedHostName()); | 219 base::string16 url(GetFormattedHostName()); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
354 | 356 |
355 void BadClockBlockingPage::NotifyDenyCertificate() { | 357 void BadClockBlockingPage::NotifyDenyCertificate() { |
356 // It's possible that callback_ may not exist if the user clicks "Proceed" | 358 // It's possible that callback_ may not exist if the user clicks "Proceed" |
357 // followed by pressing the back button before the interstitial is hidden. | 359 // followed by pressing the back button before the interstitial is hidden. |
358 // In that case the certificate will still be treated as allowed. | 360 // In that case the certificate will still be treated as allowed. |
359 if (callback_.is_null()) | 361 if (callback_.is_null()) |
360 return; | 362 return; |
361 | 363 |
362 base::ResetAndReturn(&callback_).Run(false); | 364 base::ResetAndReturn(&callback_).Run(false); |
363 } | 365 } |
OLD | NEW |