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

Unified Diff: components/page_load_metrics/browser/metrics_web_contents_observer.cc

Issue 1441393002: Add UMA to count the number of Google CAPTCHA pages shown and solved by users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small fix Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: components/page_load_metrics/browser/metrics_web_contents_observer.cc
diff --git a/components/page_load_metrics/browser/metrics_web_contents_observer.cc b/components/page_load_metrics/browser/metrics_web_contents_observer.cc
index 7f304bb4657ed4be237c1eb6f605eeafcb82d6e3..6e2feb758577de6ff83b3cc02179315f5fd6f57c 100644
--- a/components/page_load_metrics/browser/metrics_web_contents_observer.cc
+++ b/components/page_load_metrics/browser/metrics_web_contents_observer.cc
@@ -7,6 +7,7 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
+#include "base/metrics/user_metrics.h"
#include "components/page_load_metrics/browser/page_load_metrics_macros.h"
#include "components/page_load_metrics/common/page_load_metrics_messages.h"
#include "components/page_load_metrics/common/page_load_timing.h"
@@ -159,6 +160,11 @@ void PageLoadTracker::Commit(content::NavigationHandle* navigation_handle) {
OnCommit(navigation_handle));
}
+void PageLoadTracker::Redirect(content::NavigationHandle* navigation_handle) {
+ FOR_EACH_OBSERVER(PageLoadMetricsObserver, *observers_,
+ OnRedirect(navigation_handle));
+}
+
bool PageLoadTracker::UpdateTiming(const PageLoadTiming& new_timing) {
// Throw away IPCs that are not relevant to the current navigation.
// Two timing structures cannot refer to the same navigation if they indicate
@@ -471,6 +477,16 @@ void MetricsWebContentsObserver::DidFinishNavigation(
committed_load_->Commit(navigation_handle);
}
+void MetricsWebContentsObserver::DidRedirectNavigation(
+ content::NavigationHandle* navigation_handle) {
+ if (!navigation_handle->IsInMainFrame())
+ return;
+ auto it = provisional_loads_.find(navigation_handle);
+ if (it == provisional_loads_.end())
+ return;
+ it->second->Redirect(navigation_handle);
+}
+
void MetricsWebContentsObserver::WasShown() {
in_foreground_ = true;
if (committed_load_)

Powered by Google App Engine
This is Rietveld 408576698