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