Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: chrome/browser/page_load_metrics/observers/amp_page_load_metrics_observer.h

Issue 2880323003: Various cleaups for AMP page load metrics. (Closed)
Patch Set: address comment Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/page_load_metrics/observers/amp_page_load_metrics_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_AMP_PAGE_LOAD_METRICS_OBSERVE R_H_ 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_AMP_PAGE_LOAD_METRICS_OBSERVE R_H_
6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_AMP_PAGE_LOAD_METRICS_OBSERVE R_H_ 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_AMP_PAGE_LOAD_METRICS_OBSERVE R_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" 9 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h"
10 10
11 namespace content { 11 namespace content {
12 class NavigationHandle; 12 class NavigationHandle;
13 } 13 }
14 14
15 namespace page_load_metrics { 15 namespace page_load_metrics {
16 struct PageLoadExtraInfo; 16 struct PageLoadExtraInfo;
17 struct PageLoadTiming; 17 struct PageLoadTiming;
18 } 18 }
19 19
20 // Observer responsible for recording page load metrics relevant to page served 20 // Observer responsible for recording page load metrics relevant to page served
21 // from the AMP cache. When AMP pages are served in a same page navigation, UMA 21 // from the AMP cache. When AMP pages are served in a same page navigation, UMA
22 // is not recorded; this is typical for AMP pages navigated to from google.com. 22 // is not recorded; this is typical for AMP pages navigated to from google.com.
23 // Navigations to AMP pages from the google search app or directly to the amp 23 // Navigations to AMP pages from the google search app or directly to the amp
24 // cache page will be tracked. Refreshing an AMP page served from google.com 24 // cache page will be tracked. Refreshing an AMP page served from google.com
25 // will be tracked. 25 // will be tracked.
26 class AMPPageLoadMetricsObserver 26 class AMPPageLoadMetricsObserver
27 : public page_load_metrics::PageLoadMetricsObserver { 27 : public page_load_metrics::PageLoadMetricsObserver {
28 public: 28 public:
29 enum class AMPViewType {
30 NONE,
31 AMP_CACHE,
32 GOOGLE_SEARCH_AMP_VIEWER,
33 GOOGLE_NEWS_AMP_VIEWER,
34 };
35
36 static AMPViewType GetAMPViewType(const GURL& url);
37
29 AMPPageLoadMetricsObserver(); 38 AMPPageLoadMetricsObserver();
30 ~AMPPageLoadMetricsObserver() override; 39 ~AMPPageLoadMetricsObserver() override;
31 40
32 // page_load_metrics::PageLoadMetricsObserver: 41 // page_load_metrics::PageLoadMetricsObserver:
33 ObservePolicy OnCommit(content::NavigationHandle* navigation_handle) override; 42 ObservePolicy OnCommit(content::NavigationHandle* navigation_handle) override;
34 void OnDomContentLoadedEventStart( 43 void OnDomContentLoadedEventStart(
35 const page_load_metrics::PageLoadTiming& timing, 44 const page_load_metrics::PageLoadTiming& timing,
36 const page_load_metrics::PageLoadExtraInfo& info) override; 45 const page_load_metrics::PageLoadExtraInfo& info) override;
37 void OnLoadEventStart( 46 void OnLoadEventStart(
38 const page_load_metrics::PageLoadTiming& timing, 47 const page_load_metrics::PageLoadTiming& timing,
39 const page_load_metrics::PageLoadExtraInfo& info) override; 48 const page_load_metrics::PageLoadExtraInfo& info) override;
40 void OnFirstLayout(const page_load_metrics::PageLoadTiming& timing, 49 void OnFirstLayout(const page_load_metrics::PageLoadTiming& timing,
41 const page_load_metrics::PageLoadExtraInfo& info) override; 50 const page_load_metrics::PageLoadExtraInfo& info) override;
42 void OnFirstContentfulPaintInPage( 51 void OnFirstContentfulPaintInPage(
43 const page_load_metrics::PageLoadTiming& timing, 52 const page_load_metrics::PageLoadTiming& timing,
44 const page_load_metrics::PageLoadExtraInfo& info) override; 53 const page_load_metrics::PageLoadExtraInfo& info) override;
45 void OnParseStart(const page_load_metrics::PageLoadTiming& timing, 54 void OnParseStart(const page_load_metrics::PageLoadTiming& timing,
46 const page_load_metrics::PageLoadExtraInfo& info) override; 55 const page_load_metrics::PageLoadExtraInfo& info) override;
47 56
48 private: 57 private:
58 AMPViewType view_type_ = AMPViewType::NONE;
59
49 DISALLOW_COPY_AND_ASSIGN(AMPPageLoadMetricsObserver); 60 DISALLOW_COPY_AND_ASSIGN(AMPPageLoadMetricsObserver);
50 }; 61 };
51 62
52 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_AMP_PAGE_LOAD_METRICS_OBSE RVER_H_ 63 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_AMP_PAGE_LOAD_METRICS_OBSE RVER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/page_load_metrics/observers/amp_page_load_metrics_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698