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

Unified Diff: chrome/browser/page_load_metrics/page_load_metrics_observer.cc

Issue 2909033002: Move UKM PageLoad SourceId generation to PageLoadTracker. (Closed)
Patch Set: address comments 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/page_load_metrics/page_load_metrics_observer.cc
diff --git a/chrome/browser/page_load_metrics/page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/page_load_metrics_observer.cc
index e4cf29d718de9b14c3bf632423da5fc3d176dc63..e41ef15448c77ac0523871789c7c791941273e39 100644
--- a/chrome/browser/page_load_metrics/page_load_metrics_observer.cc
+++ b/chrome/browser/page_load_metrics/page_load_metrics_observer.cc
@@ -21,7 +21,8 @@ PageLoadExtraInfo::PageLoadExtraInfo(
UserInitiatedInfo page_end_user_initiated_info,
const base::Optional<base::TimeDelta>& page_end_time,
const mojom::PageLoadMetadata& main_frame_metadata,
- const mojom::PageLoadMetadata& subframe_metadata)
+ const mojom::PageLoadMetadata& subframe_metadata,
+ ukm::SourceId source_id)
: navigation_start(navigation_start),
first_background_time(first_background_time),
first_foreground_time(first_foreground_time),
@@ -34,7 +35,8 @@ PageLoadExtraInfo::PageLoadExtraInfo(
page_end_user_initiated_info(page_end_user_initiated_info),
page_end_time(page_end_time),
main_frame_metadata(main_frame_metadata),
- subframe_metadata(subframe_metadata) {}
+ subframe_metadata(subframe_metadata),
+ source_id(source_id) {}
PageLoadExtraInfo::PageLoadExtraInfo(const PageLoadExtraInfo& other) = default;
@@ -53,7 +55,7 @@ PageLoadExtraInfo PageLoadExtraInfo::CreateForTesting(
page_load_metrics::END_NONE,
page_load_metrics::UserInitiatedInfo::NotUserInitiated(),
base::TimeDelta(), page_load_metrics::mojom::PageLoadMetadata(),
- page_load_metrics::mojom::PageLoadMetadata());
+ page_load_metrics::mojom::PageLoadMetadata(), 0 /* source_id */);
}
ExtraRequestCompleteInfo::ExtraRequestCompleteInfo(
@@ -102,7 +104,8 @@ PageLoadMetricsObserver::ObservePolicy PageLoadMetricsObserver::OnRedirect(
}
PageLoadMetricsObserver::ObservePolicy PageLoadMetricsObserver::OnCommit(
- content::NavigationHandle* navigation_handle) {
+ content::NavigationHandle* navigation_handle,
+ ukm::SourceId source_id) {
return CONTINUE_OBSERVING;
}
@@ -126,9 +129,14 @@ PageLoadMetricsObserver::FlushMetricsOnAppEnterBackground(
PageLoadMetricsObserver::ObservePolicy
PageLoadMetricsObserver::ShouldObserveMimeType(
const std::string& mime_type) const {
- return mime_type == "text/html" || mime_type == "application/xhtml+xml"
- ? CONTINUE_OBSERVING
- : STOP_OBSERVING;
+ return IsStandardWebPageMimeType(mime_type) ? CONTINUE_OBSERVING
+ : STOP_OBSERVING;
+}
+
+// static
+bool PageLoadMetricsObserver::IsStandardWebPageMimeType(
+ const std::string& mime_type) {
+ return mime_type == "text/html" || mime_type == "application/xhtml+xml";
}
} // namespace page_load_metrics
« no previous file with comments | « chrome/browser/page_load_metrics/page_load_metrics_observer.h ('k') | chrome/browser/page_load_metrics/page_load_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698