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

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

Issue 2747173003: UKM: log PageTransition and failed provisional load info (Closed)
Patch Set: fix comment Created 3 years, 9 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/ukm_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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_UKM_PAGE_LOAD_METRICS_OBSERVE R_H_ 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_UKM_PAGE_LOAD_METRICS_OBSERVE R_H_
6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_UKM_PAGE_LOAD_METRICS_OBSERVE R_H_ 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_UKM_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 #include "net/nqe/network_quality_estimator.h" 10 #include "net/nqe/network_quality_estimator.h"
11 #include "ui/base/page_transition_types.h"
11 12
12 namespace content { 13 namespace content {
13 class WebContents; 14 class WebContents;
14 } 15 }
15 16
16 namespace internal { 17 namespace internal {
17 18
18 // Name constants are exposed here so they can be referenced from tests. 19 // Name constants are exposed here so they can be referenced from tests.
19 extern const char kUkmPageLoadEventName[]; 20 extern const char kUkmPageLoadEventName[];
20 extern const char kUkmParseStartName[]; 21 extern const char kUkmParseStartName[];
21 extern const char kUkmDomContentLoadedName[]; 22 extern const char kUkmDomContentLoadedName[];
22 extern const char kUkmLoadEventName[]; 23 extern const char kUkmLoadEventName[];
23 extern const char kUkmFirstContentfulPaintName[]; 24 extern const char kUkmFirstContentfulPaintName[];
24 extern const char kUkmFirstMeaningfulPaintName[]; 25 extern const char kUkmFirstMeaningfulPaintName[];
25 extern const char kUkmForegroundDurationName[]; 26 extern const char kUkmForegroundDurationName[];
27 extern const char kUkmFailedProvisionaLoadName[];
28 extern const char kUkmNetErrorCode[];
26 extern const char kUkmEffectiveConnectionType[]; 29 extern const char kUkmEffectiveConnectionType[];
30 extern const char kUkmPageTransition[];
27 31
28 } // namespace internal 32 } // namespace internal
29 33
30 // If URL-Keyed-Metrics (UKM) is enabled in the system, this is used to 34 // If URL-Keyed-Metrics (UKM) is enabled in the system, this is used to
31 // populate it with top-level page-load metrics. 35 // populate it with top-level page-load metrics.
32 class UkmPageLoadMetricsObserver 36 class UkmPageLoadMetricsObserver
33 : public page_load_metrics::PageLoadMetricsObserver { 37 : public page_load_metrics::PageLoadMetricsObserver {
34 public: 38 public:
35 // Returns a UkmPageLoadMetricsObserver, or nullptr if it is not needed. 39 // Returns a UkmPageLoadMetricsObserver, or nullptr if it is not needed.
36 static std::unique_ptr<page_load_metrics::PageLoadMetricsObserver> 40 static std::unique_ptr<page_load_metrics::PageLoadMetricsObserver>
37 CreateIfNeeded(content::WebContents* web_contents); 41 CreateIfNeeded(content::WebContents* web_contents);
38 42
39 explicit UkmPageLoadMetricsObserver( 43 explicit UkmPageLoadMetricsObserver(
40 net::NetworkQualityEstimator::NetworkQualityProvider* 44 net::NetworkQualityEstimator::NetworkQualityProvider*
41 network_quality_provider); 45 network_quality_provider);
42 ~UkmPageLoadMetricsObserver() override; 46 ~UkmPageLoadMetricsObserver() override;
43 47
44 // page_load_metrics::PageLoadMetricsObserver implementation: 48 // page_load_metrics::PageLoadMetricsObserver implementation:
45 ObservePolicy OnStart(content::NavigationHandle* navigation_handle, 49 ObservePolicy OnStart(content::NavigationHandle* navigation_handle,
46 const GURL& currently_committed_url, 50 const GURL& currently_committed_url,
47 bool started_in_foreground) override; 51 bool started_in_foreground) override;
48 52
53 ObservePolicy OnCommit(content::NavigationHandle* navigation_handle) override;
54
49 ObservePolicy FlushMetricsOnAppEnterBackground( 55 ObservePolicy FlushMetricsOnAppEnterBackground(
50 const page_load_metrics::PageLoadTiming& timing, 56 const page_load_metrics::PageLoadTiming& timing,
51 const page_load_metrics::PageLoadExtraInfo& info) override; 57 const page_load_metrics::PageLoadExtraInfo& info) override;
52 58
53 ObservePolicy OnHidden( 59 ObservePolicy OnHidden(
54 const page_load_metrics::PageLoadTiming& timing, 60 const page_load_metrics::PageLoadTiming& timing,
55 const page_load_metrics::PageLoadExtraInfo& info) override; 61 const page_load_metrics::PageLoadExtraInfo& info) override;
56 62
57 void OnFailedProvisionalLoad( 63 void OnFailedProvisionalLoad(
58 const page_load_metrics::FailedProvisionalLoadInfo& failed_load_info, 64 const page_load_metrics::FailedProvisionalLoadInfo& failed_load_info,
(...skipping 16 matching lines...) Expand all
75 81
76 net::NetworkQualityEstimator::NetworkQualityProvider* const 82 net::NetworkQualityEstimator::NetworkQualityProvider* const
77 network_quality_provider_; 83 network_quality_provider_;
78 84
79 // Unique UKM identifier for the page load we are recording metrics for. 85 // Unique UKM identifier for the page load we are recording metrics for.
80 const int32_t source_id_; 86 const int32_t source_id_;
81 87
82 net::EffectiveConnectionType effective_connection_type_ = 88 net::EffectiveConnectionType effective_connection_type_ =
83 net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN; 89 net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN;
84 90
91 // PAGE_TRANSITION_LINK is the default PageTransition value.
92 ui::PageTransition page_transition_ = ui::PAGE_TRANSITION_LINK;
93
85 DISALLOW_COPY_AND_ASSIGN(UkmPageLoadMetricsObserver); 94 DISALLOW_COPY_AND_ASSIGN(UkmPageLoadMetricsObserver);
86 }; 95 };
87 96
88 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_UKM_PAGE_LOAD_METRICS_OBSE RVER_H_ 97 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_UKM_PAGE_LOAD_METRICS_OBSE RVER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/page_load_metrics/observers/ukm_page_load_metrics_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698