Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSE RVER_H_ | |
| 6 #define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSE RVER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/time/time.h" | |
| 10 #include "content/public/browser/web_contents.h" | |
| 11 #include "content/public/browser/web_contents_observer.h" | |
| 12 #include "content/public/browser/web_contents_user_data.h" | |
| 13 | |
| 14 namespace content { | |
| 15 class NavigationHandle; | |
| 16 class RenderFrameHost; | |
| 17 } // namespace content | |
| 18 | |
| 19 namespace IPC { | |
| 20 class Message; | |
| 21 } // namespace IPC | |
| 22 | |
| 23 namespace page_load_metrics { | |
| 24 | |
| 25 struct PageLoadTiming; | |
| 26 | |
| 27 // PageLoadMetricsWebContentsObserver logs page load UMA metrics based on | |
| 28 // IPC messages received from a PageLoadMetricsRenderFrameObserver. | |
| 29 class PageLoadMetricsWebContentsObserver | |
| 30 : public content::WebContentsObserver, | |
| 31 public content::WebContentsUserData<PageLoadMetricsWebContentsObserver> { | |
| 32 public: | |
| 33 ~PageLoadMetricsWebContentsObserver() override; | |
| 34 | |
| 35 // WebContentsObserver implementation | |
| 36 bool OnMessageReceived(const IPC::Message& message, | |
| 37 content::RenderFrameHost* render_frame_host) override; | |
| 38 // TODO: figure out which WebContentsObserver hooks to use to discover when | |
| 39 // 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!
| |
| 40 | |
| 41 private: | |
| 42 explicit PageLoadMetricsWebContentsObserver( | |
| 43 content::WebContents* web_contents); | |
| 44 friend class content::WebContentsUserData<PageLoadMetricsWebContentsObserver>; | |
| 45 friend class PageLoadMetricsWebContentsObserverTest; | |
| 46 | |
| 47 void OnTimingUpdated(const PageLoadTiming& timing); | |
| 48 void RecordTimingHistograms(const PageLoadTiming& timing); | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(PageLoadMetricsWebContentsObserver); | |
| 51 }; | |
| 52 | |
| 53 } // namespace page_load_metrics | |
| 54 | |
| 55 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_O BSERVER_H_ | |
| OLD | NEW |