| 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 RenderFrameHost; |
| 16 } // namespace content |
| 17 |
| 18 namespace IPC { |
| 19 class Message; |
| 20 } // namespace IPC |
| 21 |
| 22 namespace page_load_metrics { |
| 23 |
| 24 // PageLoadMetricsWebContentsObserver logs page load UMA metrics based on |
| 25 // IPC messages received from a PageLoadMetricsRenderFrameObserver. |
| 26 class PageLoadMetricsWebContentsObserver |
| 27 : public content::WebContentsObserver, |
| 28 public content::WebContentsUserData<PageLoadMetricsWebContentsObserver> { |
| 29 public: |
| 30 ~PageLoadMetricsWebContentsObserver() override; |
| 31 |
| 32 bool OnMessageReceived(const IPC::Message& message, |
| 33 content::RenderFrameHost* render_frame_host) override; |
| 34 |
| 35 private: |
| 36 explicit PageLoadMetricsWebContentsObserver( |
| 37 content::WebContents* web_contents); |
| 38 friend class content::WebContentsUserData<PageLoadMetricsWebContentsObserver>; |
| 39 friend class PageLoadMetricsWebContentsObserverTest; |
| 40 |
| 41 void OnDOMContentLoadedEvent(base::TimeDelta dom_content_loaded); |
| 42 void OnLoadEvent(base::TimeDelta loaded); |
| 43 void OnFirstLayout(base::TimeDelta first_layout); |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(PageLoadMetricsWebContentsObserver); |
| 46 }; |
| 47 |
| 48 } // namespace page_load_metrics |
| 49 |
| 50 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_O
BSERVER_H_ |
| OLD | NEW |