Chromium Code Reviews| Index: chrome/browser/page_load_metrics/metrics_web_contents_observer.h |
| diff --git a/chrome/browser/page_load_metrics/metrics_web_contents_observer.h b/chrome/browser/page_load_metrics/metrics_web_contents_observer.h |
| index f9e958702bcd34efc90548c611844af484391cc6..f0fe61f32109952ba36163de1bfb49a41d045185 100644 |
| --- a/chrome/browser/page_load_metrics/metrics_web_contents_observer.h |
| +++ b/chrome/browser/page_load_metrics/metrics_web_contents_observer.h |
| @@ -12,12 +12,15 @@ |
| #include "base/macros.h" |
| #include "base/time/time.h" |
| #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" |
| +#include "chrome/common/page_load_metrics/page_load_metrics.mojom.h" |
| #include "chrome/common/page_load_metrics/page_load_timing.h" |
| #include "content/public/browser/render_widget_host.h" |
| #include "content/public/browser/web_contents.h" |
| +#include "content/public/browser/web_contents_binding_set.h" |
| #include "content/public/browser/web_contents_observer.h" |
| #include "content/public/browser/web_contents_user_data.h" |
| #include "content/public/common/resource_type.h" |
| +#include "mojo/public/cpp/bindings/binding_set.h" |
| #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| namespace content { |
| @@ -40,7 +43,8 @@ class PageLoadTracker; |
| class MetricsWebContentsObserver |
| : public content::WebContentsObserver, |
| public content::WebContentsUserData<MetricsWebContentsObserver>, |
| - public content::RenderWidgetHost::InputEventObserver { |
| + public content::RenderWidgetHost::InputEventObserver, |
| + public mojom::PageLoadMetrics { |
| public: |
| // Note that the returned metrics is owned by the web contents. |
| static MetricsWebContentsObserver* CreateForWebContents( |
| @@ -100,8 +104,18 @@ class MetricsWebContentsObserver |
| // This getter function is required for testing. |
| const PageLoadExtraInfo GetPageLoadExtraInfoForCommittedLoad(); |
| + content::WebContentsFrameBindingSet<mojom::PageLoadMetrics>& |
| + page_load_metrics_binding_for_testing() { |
| + return page_load_metrics_binding_; |
| + } |
| + |
| private: |
| friend class content::WebContentsUserData<MetricsWebContentsObserver>; |
| + friend class FakePageLoadMetrics; |
|
Bryan McQuade
2017/04/25 15:41:13
i'm a bit uncomfortable about this - i need to see
|
| + |
| + // page_load_metrics::mojom::PageLoadMetrics implementation. |
| + void UpdateTiming(const PageLoadTiming& timing, |
| + const PageLoadMetadata& metadata) override; |
| void HandleFailedNavigationForTrackedLoad( |
| content::NavigationHandle* navigation_handle, |
| @@ -173,6 +187,9 @@ class MetricsWebContentsObserver |
| // Has the MWCO observed at least one navigation? |
| bool has_navigated_; |
| + content::WebContentsFrameBindingSet<mojom::PageLoadMetrics> |
| + page_load_metrics_binding_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver); |
| }; |