Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: chrome/browser/page_load_metrics/observers/google_captcha_observer.cc

Issue 1913693002: Histogram the amount of time spent on HTTP(S) page loads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/page_load_metrics/observers/google_captcha_observer.h" 5 #include "chrome/browser/page_load_metrics/observers/google_captcha_observer.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "components/page_load_metrics/browser/page_load_metrics_util.h" 9 #include "components/page_load_metrics/browser/page_load_metrics_util.h"
10 #include "components/page_load_metrics/common/page_load_timing.h" 10 #include "components/page_load_metrics/common/page_load_timing.h"
(...skipping 27 matching lines...) Expand all
38 base::CompareCase::SENSITIVE) 38 base::CompareCase::SENSITIVE)
39 || base::StartsWith(url.host_piece(), "ipv6.google.", 39 || base::StartsWith(url.host_piece(), "ipv6.google.",
40 base::CompareCase::SENSITIVE)) 40 base::CompareCase::SENSITIVE))
41 && base::StartsWith(url.path_piece(), "/sorry", 41 && base::StartsWith(url.path_piece(), "/sorry",
42 base::CompareCase::SENSITIVE); 42 base::CompareCase::SENSITIVE);
43 } 43 }
44 44
45 GoogleCaptchaObserver::GoogleCaptchaObserver() : saw_solution_(false) {} 45 GoogleCaptchaObserver::GoogleCaptchaObserver() : saw_solution_(false) {}
46 46
47 void GoogleCaptchaObserver::OnCommit( 47 void GoogleCaptchaObserver::OnCommit(
48 content::NavigationHandle* navigation_handle) { 48 content::NavigationHandle* navigation_handle,
49 bool started_in_foreground) {
49 if (!navigation_handle->IsSamePage() 50 if (!navigation_handle->IsSamePage()
50 && IsGoogleCaptcha(navigation_handle->GetURL())) { 51 && IsGoogleCaptcha(navigation_handle->GetURL())) {
51 RecordGoogleCaptchaEvent(GOOGLE_CAPTCHA_SHOWN); 52 RecordGoogleCaptchaEvent(GOOGLE_CAPTCHA_SHOWN);
52 } 53 }
53 } 54 }
54 55
55 void GoogleCaptchaObserver::OnRedirect( 56 void GoogleCaptchaObserver::OnRedirect(
56 content::NavigationHandle* navigation_handle) { 57 content::NavigationHandle* navigation_handle) {
57 if (IsGoogleCaptcha(navigation_handle->GetReferrer().url) && !saw_solution_) { 58 if (IsGoogleCaptcha(navigation_handle->GetReferrer().url) && !saw_solution_) {
58 RecordGoogleCaptchaEvent(GOOGLE_CAPTCHA_SOLVED); 59 RecordGoogleCaptchaEvent(GOOGLE_CAPTCHA_SOLVED);
59 saw_solution_ = true; 60 saw_solution_ = true;
60 } 61 }
61 } 62 }
62 63
63 } // namespace google_captcha_observer 64 } // namespace google_captcha_observer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698