Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Fix to Google CAPTCHA UMA collection to avoid double-counting solutions.
Browse files Browse the repository at this point in the history
In some cases, a CAPTCHA solution will itself redirect (e.g., from
http:// to https://). This CL fixes the double-counting problem.

BUG=560470

Review URL: https://codereview.chromium.org/1465313003

Cr-Commit-Position: refs/heads/master@{#362156}
  • Loading branch information
mdw authored and Commit bot committed Nov 30, 2015
1 parent debce12 commit 6bbab2e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,22 @@ bool IsGoogleCaptcha(const GURL& url) {

GoogleCaptchaObserver::GoogleCaptchaObserver(
page_load_metrics::PageLoadMetricsObservable* metrics)
: metrics_(metrics) {}
: saw_solution_(false), metrics_(metrics) {}

void GoogleCaptchaObserver::OnCommit(
content::NavigationHandle* navigation_handle) {
if (IsGoogleCaptcha(navigation_handle->GetURL()))
RecordGoogleCaptchaEvent(GOOGLE_CAPTCHA_SHOWN);
if (saw_solution_) {
RecordGoogleCaptchaEvent(GOOGLE_CAPTCHA_SOLVED);
saw_solution_ = false;
}
}

void GoogleCaptchaObserver::OnRedirect(
content::NavigationHandle* navigation_handle) {
if (IsGoogleCaptcha(navigation_handle->GetReferrer().url))
RecordGoogleCaptchaEvent(GOOGLE_CAPTCHA_SOLVED);
saw_solution_ = true;
}

void GoogleCaptchaObserver::OnPageLoadMetricsGoingAway() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class GoogleCaptchaObserver
void OnPageLoadMetricsGoingAway() override;

private:
bool saw_solution_;
page_load_metrics::PageLoadMetricsObservable* const metrics_;
DISALLOW_COPY_AND_ASSIGN(GoogleCaptchaObserver);

Expand Down

0 comments on commit 6bbab2e

Please sign in to comment.