OLD | NEW |
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_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "chrome/browser/page_load_metrics/page_load_metrics_util.h" | 9 #include "chrome/browser/page_load_metrics/page_load_metrics_util.h" |
10 #include "chrome/common/page_load_metrics/page_load_timing.h" | 10 #include "chrome/common/page_load_metrics/page_load_timing.h" |
(...skipping 28 matching lines...) Expand all Loading... |
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() {} | 45 GoogleCaptchaObserver::GoogleCaptchaObserver() {} |
46 | 46 |
47 page_load_metrics::PageLoadMetricsObserver::ObservePolicy | 47 page_load_metrics::PageLoadMetricsObserver::ObservePolicy |
48 GoogleCaptchaObserver::OnCommit(content::NavigationHandle* navigation_handle) { | 48 GoogleCaptchaObserver::OnCommit(content::NavigationHandle* navigation_handle) { |
49 if (!navigation_handle->IsSamePage() | 49 if (!navigation_handle->IsSameDocument() && |
50 && IsGoogleCaptcha(navigation_handle->GetURL())) { | 50 IsGoogleCaptcha(navigation_handle->GetURL())) { |
51 RecordGoogleCaptchaEvent(GOOGLE_CAPTCHA_SHOWN); | 51 RecordGoogleCaptchaEvent(GOOGLE_CAPTCHA_SHOWN); |
52 } | 52 } |
53 return CONTINUE_OBSERVING; | 53 return CONTINUE_OBSERVING; |
54 } | 54 } |
55 | 55 |
56 page_load_metrics::PageLoadMetricsObserver::ObservePolicy | 56 page_load_metrics::PageLoadMetricsObserver::ObservePolicy |
57 GoogleCaptchaObserver::OnRedirect( | 57 GoogleCaptchaObserver::OnRedirect( |
58 content::NavigationHandle* navigation_handle) { | 58 content::NavigationHandle* navigation_handle) { |
59 if (IsGoogleCaptcha(navigation_handle->GetReferrer().url)) { | 59 if (IsGoogleCaptcha(navigation_handle->GetReferrer().url)) { |
60 RecordGoogleCaptchaEvent(GOOGLE_CAPTCHA_SOLVED); | 60 RecordGoogleCaptchaEvent(GOOGLE_CAPTCHA_SOLVED); |
61 return STOP_OBSERVING; | 61 return STOP_OBSERVING; |
62 } | 62 } |
63 return CONTINUE_OBSERVING; | 63 return CONTINUE_OBSERVING; |
64 } | 64 } |
65 | 65 |
66 } // namespace google_captcha_observer | 66 } // namespace google_captcha_observer |
OLD | NEW |