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

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

Issue 1465533002: (Merging on behalf of mdw@) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2564
Patch Set: 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 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_)

Powered by Google App Engine
This is Rietveld 408576698