Chromium Code Reviews| Index: components/page_load_metrics/browser/page_load_metrics_web_contents_observer.h |
| diff --git a/components/page_load_metrics/browser/page_load_metrics_web_contents_observer.h b/components/page_load_metrics/browser/page_load_metrics_web_contents_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9f4084e3e9592bef3cafd15fdc23fdb3346ac98d |
| --- /dev/null |
| +++ b/components/page_load_metrics/browser/page_load_metrics_web_contents_observer.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2015 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. |
| + |
| +#ifndef COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSERVER_H_ |
| +#define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSERVER_H_ |
| + |
| +#include "base/macros.h" |
| +#include "base/time/time.h" |
| +#include "content/public/browser/web_contents.h" |
| +#include "content/public/browser/web_contents_observer.h" |
| +#include "content/public/browser/web_contents_user_data.h" |
| + |
| +namespace content { |
| +class NavigationHandle; |
| +class RenderFrameHost; |
| +} // namespace content |
| + |
| +namespace IPC { |
| +class Message; |
| +} // namespace IPC |
| + |
| +namespace page_load_metrics { |
| + |
| +struct PageLoadTiming; |
| + |
| +// PageLoadMetricsWebContentsObserver logs page load UMA metrics based on |
| +// IPC messages received from a PageLoadMetricsRenderFrameObserver. |
| +class PageLoadMetricsWebContentsObserver |
| + : public content::WebContentsObserver, |
| + public content::WebContentsUserData<PageLoadMetricsWebContentsObserver> { |
| + public: |
| + ~PageLoadMetricsWebContentsObserver() override; |
| + |
| + // WebContentsObserver implementation |
| + bool OnMessageReceived(const IPC::Message& message, |
| + content::RenderFrameHost* render_frame_host) override; |
| + // TODO: figure out which WebContentsObserver hooks to use to discover when |
| + // a page navigation starts/finishes. |
|
nasko
2015/08/26 17:27:24
Look at https://code.google.com/p/chromium/codesea
Bryan McQuade
2015/08/26 18:28:00
Thanks!
|
| + |
| + private: |
| + explicit PageLoadMetricsWebContentsObserver( |
| + content::WebContents* web_contents); |
| + friend class content::WebContentsUserData<PageLoadMetricsWebContentsObserver>; |
| + friend class PageLoadMetricsWebContentsObserverTest; |
| + |
| + void OnTimingUpdated(const PageLoadTiming& timing); |
| + void RecordTimingHistograms(const PageLoadTiming& timing); |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PageLoadMetricsWebContentsObserver); |
| +}; |
| + |
| +} // namespace page_load_metrics |
| + |
| +#endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSERVER_H_ |