Skip to content

Commit

Permalink
Clean up recurrent interstitial metrics
Browse files Browse the repository at this point in the history
This has some style cleanups following up from
https://chromium-review.googlesource.com/c/chromium/src/+/1071069.

Bug: 839969
Change-Id: I3aed16eb21a4f5d4b4bc6a86d4c28d196f5d3adc
Reviewed-on: https://chromium-review.googlesource.com/1074147
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Commit-Queue: Emily Stark <estark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#562074}
  • Loading branch information
estark37 authored and Commit Bot committed May 26, 2018
1 parent 7704172 commit c47789a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions chrome/browser/ssl/ssl_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7944,7 +7944,7 @@ IN_PROC_BROWSER_TEST_P(RecurrentInterstitialBrowserTest,
histograms.ExpectBucketCount(kRecurrentInterstitialHistogram, true, 1);
histograms.ExpectUniqueSample(
kRecurrentInterstitialActionHistogram,
SSLErrorControllerClient::RECURRENT_ERROR_ACTION_SHOW, 1);
SSLErrorControllerClient::RecurrentErrorAction::kShow, 1);

// Proceed through the interstitial and observe that the histogram is
// recorded correctly.
Expand All @@ -7963,7 +7963,7 @@ IN_PROC_BROWSER_TEST_P(RecurrentInterstitialBrowserTest,
nav_observer.Wait();
histograms.ExpectBucketCount(
kRecurrentInterstitialActionHistogram,
SSLErrorControllerClient::RECURRENT_ERROR_ACTION_PROCEED, 1);
SSLErrorControllerClient::RecurrentErrorAction::kProceed, 1);
}
}

Expand Down
13 changes: 7 additions & 6 deletions chrome/browser/ssl/ssl_error_controller_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ using content::Referrer;

namespace {

void RecordRecurrentErrorAction(
SSLErrorControllerClient::RecurrentErrorAction action) {
UMA_HISTOGRAM_ENUMERATION("interstitial.ssl_recurrent_error.action", action);
}

bool HasSeenRecurrentErrorInternal(content::WebContents* web_contents,
int cert_error) {
ChromeSSLHostStateDelegate* state =
Expand Down Expand Up @@ -159,9 +164,7 @@ SSLErrorControllerClient::SSLErrorControllerClient(
request_url_(request_url),
cert_error_(cert_error) {
if (HasSeenRecurrentErrorInternal(web_contents_, cert_error_)) {
UMA_HISTOGRAM_ENUMERATION("interstitial.ssl_recurrent_error.action",
RECURRENT_ERROR_ACTION_SHOW,
RECURRENT_ERROR_ACTION_MAX);
RecordRecurrentErrorAction(RecurrentErrorAction::kShow);
}
}

Expand All @@ -178,9 +181,7 @@ void SSLErrorControllerClient::GoBack() {

void SSLErrorControllerClient::Proceed() {
if (HasSeenRecurrentErrorInternal(web_contents_, cert_error_)) {
UMA_HISTOGRAM_ENUMERATION("interstitial.ssl_recurrent_error.action",
RECURRENT_ERROR_ACTION_PROCEED,
RECURRENT_ERROR_ACTION_MAX);
RecordRecurrentErrorAction(RecurrentErrorAction::kProceed);
}

MaybeTriggerSecurityInterstitialProceededEvent(web_contents_, request_url_,
Expand Down
8 changes: 4 additions & 4 deletions chrome/browser/ssl/ssl_error_controller_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class SSLErrorControllerClient
// Actions recorded on recurrent error interstitials. This enum is
// histogrammed, so do not add, reorder, or remove values. Exposed for
// testing.
enum RecurrentErrorActions {
RECURRENT_ERROR_ACTION_SHOW = 0,
RECURRENT_ERROR_ACTION_PROCEED,
RECURRENT_ERROR_ACTION_MAX
enum class RecurrentErrorAction {
kShow,
kProceed,
kMaxValue = kProceed,
};

SSLErrorControllerClient(
Expand Down

0 comments on commit c47789a

Please sign in to comment.