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

Side by Side Diff: chrome/common/page_load_metrics/page_track_decider.cc

Issue 2331053003: Add common page filtering logic for page load metrics. (Closed)
Patch Set: fixup Created 4 years, 3 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
OLDNEW
(Empty)
1 // Copyright 2015 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 #include "chrome/common/page_load_metrics/page_track_decider.h"
6
7 namespace page_load_metrics {
8
9 PageTrackDecider::PageTrackDecider() {}
10 PageTrackDecider::~PageTrackDecider() {}
11
12 bool PageTrackDecider::ShouldTrack() {
Charlie Harrison 2016/09/14 13:20:05 I wonder if this is easier to read: if (HasCommit
Bryan McQuade 2016/09/14 15:10:58 We want to run the non-committed checks in either
Charlie Harrison 2016/09/14 16:27:32 SGTM
13 // Ignore non-HTTP schemes (e.g. chrome://).
14 if (!IsHTTPOrHTTPSUrl())
15 return false;
16
17 // Ignore NTP loads.
18 if (IsNewTabPageUrl())
19 return false;
20
21 if (HasCommitted()) {
22 // Ignore Chrome error pages (e.g. No Internet connection).
23 if (IsChromeErrorPage())
24 return false;
25
26 // Ignore network error pages (e.g. 4xx, 5xx).
27 if (IsHTTPErrorPage())
28 return false;
29
30 // Ignore non-HTML documents (e.g. SVG, images).
31 if (!IsHTMLOrXHTMLPage())
32 return false;
33 }
34
35 return true;
36 }
37
38 } // namespace page_load_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698