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

Side by Side Diff: chrome/common/page_load_metrics/page_tracker_predicate.h

Issue 2331053003: Add common page filtering logic for page load metrics. (Closed)
Patch Set: refine interface 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
« no previous file with comments | « chrome/common/BUILD.gn ('k') | chrome/common/page_load_metrics/page_tracker_predicate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_TRACKER_PREDICATE_H_
6 #define CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_TRACKER_PREDICATE_H_
7
8 #include "base/macros.h"
9
10 namespace page_load_metrics {
11
12 // PageTrackerPredicate is an interface used to determine whether metrics should
13 // be tracked for a given page. Consumers should call ShouldTrackPage() to
14 // determine if a page load should be tracked. Implementers should implement the
15 // pure virtual methods to provide information needed about the current page
16 // load to determine if it should be tracked.
17 class PageTrackerPredicate {
Charlie Harrison 2016/09/13 17:51:04 Calling a class a predicate doesn't really sit wel
Bryan McQuade 2016/09/13 17:59:09 Yeah, I agree - it's not my favorite name either,
18 public:
19 PageTrackerPredicate();
20 virtual ~PageTrackerPredicate();
21
22 // Whether metrics should be tracked for the current page.
23 bool ShouldTrackPage();
24
25 // Whether the navigation for the current page has committed.
26 virtual bool HasCommitted() = 0;
27
28 // Whether the current page's URL is HTTP or HTTPS. Note that the page does
29 // not need to have committed, nor does the URL or hostname of the URL need to
30 // point at a valid web page or host, for this method to return true.
31 virtual bool IsHTTPOrHTTPSUrl() = 0;
32
33 // Whether the current page's URL is for a Chrome new tab page. Note that in
34 // some cases the new tab page is served over the network via https.
35 virtual bool IsNewTabPageUrl() = 0;
36
37 // The methods below can only be called if HasCommitted() returns true.
38
39 // Whether the current page is a Chrome-generated error page. Example error
40 // pages include pages displayed after a network error that did not result in
41 // receiving an HTTP/HTTPS response, such as the 'There is no Internet
42 // connection' page, which is displayed when the user attempts to navigate
43 // without an Internet connection. This method returns false for non-Chrome
44 // generated error pages, such as pages with 4xx/5xx response codes. To
45 // check whether the current page resulted in a 4xx/5xx error, use
46 // IsNetworkErrorPage() instead.
47 virtual bool IsChromeErrorPage() = 0;
48
49 // Whether the current page is an HTTP(S) error page received over the
50 // network, such as a page with a 4xx/5xx response code.
51 virtual bool IsNetworkErrorPage() = 0;
Bryan McQuade 2016/09/13 17:39:21 perhaps this should be called 'IsHTTPErrorPage'? I
Charlie Harrison 2016/09/13 17:51:04 Go with HTTP. You could even be more verbose: "IsH
52
53 // Whether the current page is an HTML or XHTML page.
54 virtual bool IsHTMLOrXHTMLPage() = 0;
55
56 private:
57 DISALLOW_COPY_AND_ASSIGN(PageTrackerPredicate);
58 };
59
60 } // namespace page_load_metrics
61
62 #endif // CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_TRACKER_PREDICATE_H_
OLDNEW
« no previous file with comments | « chrome/common/BUILD.gn ('k') | chrome/common/page_load_metrics/page_tracker_predicate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698