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 7e753bca1f0afdd942bc7622778c8b8fac1957f0..42503e2d1edbeb4b72f9fbdcd1acbc700b669d7c 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" |
@@ -160,6 +161,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 |
@@ -487,6 +493,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_) |