Chromium Code Reviews| Index: components/page_load_metrics/browser/metrics_navigation_throttle.cc |
| diff --git a/components/page_load_metrics/browser/metrics_navigation_throttle.cc b/components/page_load_metrics/browser/metrics_navigation_throttle.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..978c15d6e0d573e4c7e349fa8bf7b6e9cc7eb9bc |
| --- /dev/null |
| +++ b/components/page_load_metrics/browser/metrics_navigation_throttle.cc |
| @@ -0,0 +1,44 @@ |
| +// 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 "components/page_load_metrics/browser/metrics_navigation_throttle.h" |
| + |
| +#include "base/memory/ptr_util.h" |
| +#include "components/page_load_metrics/browser/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) |
|
Bryan McQuade
2016/07/12 16:45:29
just for my own knowledge, are there cases where w
Charlie Harrison
2016/07/12 19:20:22
There are some times when a web contents does not
|
| + observer->WillStartNavigationRequest(navigation_handle()); |
| + return content::NavigationThrottle::PROCEED; |
| +} |
| +content::NavigationThrottle::ThrottleCheckResult |
| +MetricsNavigationThrottle::WillRedirectRequest() { |
|
Bryan McQuade
2016/07/12 16:45:29
looks like the base class implementation is identi
Charlie Harrison
2016/07/12 19:20:22
Done.
|
| + return content::NavigationThrottle::PROCEED; |
| +} |
| + |
| +content::NavigationThrottle::ThrottleCheckResult |
| +MetricsNavigationThrottle::WillProcessResponse() { |
|
Bryan McQuade
2016/07/12 16:45:29
same - can we omit this?
Charlie Harrison
2016/07/12 19:20:22
Done.
|
| + return content::NavigationThrottle::PROCEED; |
| +} |
| + |
| +MetricsNavigationThrottle::MetricsNavigationThrottle( |
| + content::NavigationHandle* handle) |
| + : content::NavigationThrottle(handle) {} |
| + |
| +} // namespace page_load_metrics |