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..69f91e9962768369ec68ecc4876bff94083c885c 100644 |
| --- a/chrome/browser/ssl/ssl_blocking_page.cc |
| +++ b/chrome/browser/ssl/ssl_blocking_page.cc |
| @@ -18,6 +18,7 @@ |
| #include "base/time/time.h" |
| #include "base/values.h" |
| #include "chrome/browser/chrome_notification_types.h" |
| +#include "chrome/browser/extensions/api/experience_sampling_private/experience_sampling.h" |
| #include "chrome/browser/history/history_service_factory.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/renderer_preferences_util.h" |
| @@ -69,6 +70,7 @@ using base::TimeTicks; |
| using content::InterstitialPage; |
| using content::NavigationController; |
| using content::NavigationEntry; |
| +using extensions::SamplingEvent; |
| namespace { |
| @@ -107,6 +109,11 @@ const char* GetTrialCondition() { |
| return kCondV2; |
| } |
| +// Constants for the Experience Sampling instrumentation. |
| +const char kEventNameBase[] = "ssl_interstitial_"; |
| +const char kEventNotOverridable[] = "notoverridable_"; |
| +const char kEventOverridable[] = "overridable_"; |
| + |
| // Events for UMA. Do not reorder or change! |
| enum SSLBlockingPageEvent { |
| SHOW_ALL, |
| @@ -362,6 +369,19 @@ SSLBlockingPage::SSLBlockingPage( |
| content::Source<Profile>(profile)); |
| #endif |
| + // ExperienceSampling: Set up new sampling event for this interstitial. |
| + std::string event_name(kEventNameBase); |
| + if (overridable_ && !strict_enforcement_) |
| + event_name.append(kEventOverridable); |
| + else |
| + event_name.append(kEventNotOverridable); |
| + event_name.append(net::ErrorToString(cert_error_)); |
| + sampling_event_.reset(new SamplingEvent( |
| + event_name, |
| + request_url_, |
| + web_contents_->GetLastCommittedURL(), |
| + web_contents_->GetBrowserContext())); |
| + |
| interstitial_page_ = InterstitialPage::Create( |
| web_contents_, true, request_url, this); |
| interstitial_page_->Show(); |
| @@ -681,6 +701,7 @@ void SSLBlockingPage::CommandReceived(const std::string& command) { |
| } |
| case CMD_MORE: { |
| RecordSSLBlockingPageEventStats(MORE); |
| + sampling_event_->has_viewed_details = true; |
| break; |
| } |
| case CMD_RELOAD: { |
| @@ -691,6 +712,7 @@ void SSLBlockingPage::CommandReceived(const std::string& command) { |
| case CMD_HELP: { |
| content::NavigationController::LoadURLParams help_page_params(GURL( |
| "https://support.google.com/chrome/answer/4454607")); |
| + sampling_event_->has_viewed_learn_more = true; |
| web_contents_->GetController().LoadURLWithParams(help_page_params); |
| break; |
| } |
| @@ -721,6 +743,8 @@ void SSLBlockingPage::OnProceed() { |
| captive_portal_probe_completed_, |
| captive_portal_no_response_, |
| captive_portal_detected_); |
| + // ExperienceSampling: Notify that user decided to proceed. |
| + sampling_event_->CreateUserDecisionEvent(SamplingEvent::kProceed); |
| // Accepting the certificate resumes the loading of the page. |
| NotifyAllowCertificate(); |
| } |
| @@ -735,6 +759,10 @@ void SSLBlockingPage::OnDontProceed() { |
| captive_portal_probe_completed_, |
| captive_portal_no_response_, |
| captive_portal_detected_); |
| + // ExperienceSampling: Notify that user decided to not proceed. |
| + // This also occurs if the user navigates away or closes the tab. |
| + sampling_event_->CreateUserDecisionEvent(SamplingEvent::kDeny); |
| + |
|
felt
2014/07/25 01:05:51
nit: don't need this empty line
Chris Thompson
2014/07/25 01:21:59
Done.
|
| NotifyDenyCertificate(); |
| } |