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

Unified Diff: chrome/browser/page_load_metrics/metrics_web_contents_observer.h

Issue 2823523003: [Page Load Metrics] PageLoadMetrics Mojofication. (Closed)
Patch Set: Addressed comments, remove unnecessary RunUntilIdle, call OnTimingUpdated directly in unit tests Created 3 years, 8 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_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 9b14bef9e1d04f7f85e3784e421422fc3b0dc93e..562c6c7a9cd192e81d25d94ad78d3a15aef17670 100644
--- a/chrome/browser/page_load_metrics/metrics_web_contents_observer.h
+++ b/chrome/browser/page_load_metrics/metrics_web_contents_observer.h
@@ -12,13 +12,16 @@
#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 "components/data_reduction_proxy/core/browser/data_reduction_proxy_data.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 {
@@ -41,7 +44,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(
@@ -109,8 +113,20 @@ 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;
+ friend class MetricsWebContentsObserverTest;
+ friend class PageLoadMetricsObserverTestHarness;
+
+ // page_load_metrics::mojom::PageLoadMetrics implementation.
+ void UpdateTiming(const PageLoadTiming& timing,
+ const PageLoadMetadata& metadata) override;
void HandleFailedNavigationForTrackedLoad(
content::NavigationHandle* navigation_handle,
@@ -182,6 +198,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);
};

Powered by Google App Engine
This is Rietveld 408576698