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

Unified Diff: chrome/browser/page_load_metrics/metrics_navigation_throttle.cc

Issue 2132603002: [page_load_metrics] Add a NavigationThrottle for richer abort metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nasko@ nits Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/page_load_metrics/metrics_navigation_throttle.cc
diff --git a/chrome/browser/page_load_metrics/metrics_navigation_throttle.cc b/chrome/browser/page_load_metrics/metrics_navigation_throttle.cc
new file mode 100644
index 0000000000000000000000000000000000000000..09e2f61e8a3ac324f71323ce849aed9ece1d5545
--- /dev/null
+++ b/chrome/browser/page_load_metrics/metrics_navigation_throttle.cc
@@ -0,0 +1,35 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/page_load_metrics/metrics_navigation_throttle.h"
+
+#include "base/memory/ptr_util.h"
+#include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h"
+#include "content/public/browser/navigation_handle.h"
+
+namespace page_load_metrics {
+
+// static
+std::unique_ptr<content::NavigationThrottle> MetricsNavigationThrottle::Create(
+ content::NavigationHandle* handle) {
+ return base::WrapUnique(new MetricsNavigationThrottle(handle));
+}
+
+MetricsNavigationThrottle::~MetricsNavigationThrottle() {}
+
+content::NavigationThrottle::ThrottleCheckResult
+MetricsNavigationThrottle::WillStartRequest() {
+ MetricsWebContentsObserver* observer =
+ MetricsWebContentsObserver::FromWebContents(
+ navigation_handle()->GetWebContents());
+ if (observer)
+ observer->WillStartNavigationRequest(navigation_handle());
+ return content::NavigationThrottle::PROCEED;
+}
+
+MetricsNavigationThrottle::MetricsNavigationThrottle(
+ content::NavigationHandle* handle)
+ : content::NavigationThrottle(handle) {}
+
+} // namespace page_load_metrics

Powered by Google App Engine
This is Rietveld 408576698