diff --git a/chrome/browser/page_load_metrics/observers/google_captcha_observer.cc b/chrome/browser/page_load_metrics/observers/google_captcha_observer.cc index 960cc3420b8d7..c961d9cdc7435 100644 --- a/chrome/browser/page_load_metrics/observers/google_captcha_observer.cc +++ b/chrome/browser/page_load_metrics/observers/google_captcha_observer.cc @@ -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() { diff --git a/chrome/browser/page_load_metrics/observers/google_captcha_observer.h b/chrome/browser/page_load_metrics/observers/google_captcha_observer.h index 4b0cfc520445e..473b9e95d0612 100644 --- a/chrome/browser/page_load_metrics/observers/google_captcha_observer.h +++ b/chrome/browser/page_load_metrics/observers/google_captcha_observer.h @@ -25,6 +25,7 @@ class GoogleCaptchaObserver void OnPageLoadMetricsGoingAway() override; private: + bool saw_solution_; page_load_metrics::PageLoadMetricsObservable* const metrics_; DISALLOW_COPY_AND_ASSIGN(GoogleCaptchaObserver);