| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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 CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_PREVIEWS_PAGE_LOAD_METRICS_OB
SERVER_H_ |
| 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_PREVIEWS_PAGE_LOAD_METRICS_OB
SERVER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" |
| 10 |
| 11 namespace content { |
| 12 class NavigationHandle; |
| 13 class WebContents; |
| 14 } |
| 15 |
| 16 namespace page_load_metrics { |
| 17 struct PageLoadExtraInfo; |
| 18 struct PageLoadTiming; |
| 19 } |
| 20 |
| 21 namespace previews { |
| 22 |
| 23 namespace internal { |
| 24 |
| 25 // Various UMA histogram names for Previews core page load metrics. |
| 26 extern const char kHistogramOfflinePreviewsDOMContentLoadedEventFired[]; |
| 27 extern const char kHistogramOfflinePreviewsFirstLayout[]; |
| 28 extern const char kHistogramOfflinePreviewsLoadEventFired[]; |
| 29 extern const char kHistogramOfflinePreviewsFirstContentfulPaint[]; |
| 30 extern const char kHistogramOfflinePreviewsParseStart[]; |
| 31 |
| 32 } // namespace internal |
| 33 |
| 34 // Observer responsible for recording core page load metrics relevant to |
| 35 // Previews. |
| 36 class PreviewsPageLoadMetricsObserver |
| 37 : public page_load_metrics::PageLoadMetricsObserver { |
| 38 public: |
| 39 PreviewsPageLoadMetricsObserver(); |
| 40 ~PreviewsPageLoadMetricsObserver() override; |
| 41 |
| 42 // page_load_metrics::PageLoadMetricsObserver: |
| 43 void OnCommit(content::NavigationHandle* navigation_handle) override; |
| 44 void OnDomContentLoadedEventStart( |
| 45 const page_load_metrics::PageLoadTiming& timing, |
| 46 const page_load_metrics::PageLoadExtraInfo& info) override; |
| 47 void OnLoadEventStart( |
| 48 const page_load_metrics::PageLoadTiming& timing, |
| 49 const page_load_metrics::PageLoadExtraInfo& info) override; |
| 50 void OnFirstLayout(const page_load_metrics::PageLoadTiming& timing, |
| 51 const page_load_metrics::PageLoadExtraInfo& info) override; |
| 52 void OnFirstContentfulPaint( |
| 53 const page_load_metrics::PageLoadTiming& timing, |
| 54 const page_load_metrics::PageLoadExtraInfo& info) override; |
| 55 void OnParseStart(const page_load_metrics::PageLoadTiming& timing, |
| 56 const page_load_metrics::PageLoadExtraInfo& info) override; |
| 57 |
| 58 private: |
| 59 // Whether |web_contents| is showing an offline pages preview. Overridden in |
| 60 // testing. |
| 61 virtual bool IsOfflinePreview(content::WebContents* web_contents) const; |
| 62 |
| 63 // Whether this page load was an offline pages preview. |
| 64 bool is_offline_preview_; |
| 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(PreviewsPageLoadMetricsObserver); |
| 67 }; |
| 68 |
| 69 } // namespace previews |
| 70 |
| 71 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_PREVIEWS_PAGE_LOAD_METRICS
_OBSERVER_H_ |
| OLD | NEW |