OLD | NEW |
---|---|
(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_TRACK_DECIDER_H_ | |
6 #define CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_TRACK_DECIDER_H_ | |
7 | |
8 #include "base/macros.h" | |
9 | |
10 namespace page_load_metrics { | |
11 | |
12 // PageTrackDecider is an interface used to determine whether metrics should be | |
13 // tracked for a given page. This class is used by the core page load metrics | |
14 // tracking infrastructure in both the browser and render processes so policy | |
15 // decisions about which page loads to track are consistent across processes. | |
16 class PageTrackDecider { | |
17 public: | |
18 PageTrackDecider(); | |
19 virtual ~PageTrackDecider(); | |
20 | |
21 // Whether metrics should be tracked for the current page. This method invokes | |
22 // the pure virtual methods below to decide whether metrics should be tracked. | |
23 bool ShouldTrack(); | |
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; | |
Charlie Harrison
2016/09/14 13:20:05
I think this should this be "HttpOrHttps".
Bryan McQuade
2016/09/14 15:10:58
Yeah, I prefer the style you note as well, however
Charlie Harrison
2016/09/14 16:27:32
The new style guide recommends this in new code:
h
Bryan McQuade
2016/09/15 22:28:10
Ah, great, thanks! I updated the code to use Http
| |
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 // IsHTTPErrorPage() 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 IsHTTPErrorPage() = 0; | |
Charlie Harrison
2016/09/14 13:20:05
Is there any reason you didn't want to go with "Is
Bryan McQuade
2016/09/14 15:10:58
My concern with that is that it may be overly desc
Charlie Harrison
2016/09/14 16:27:32
Your change sounds good. This makes it easier for
| |
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(PageTrackDecider); | |
58 }; | |
59 | |
60 } // namespace page_load_metrics | |
61 | |
62 #endif // CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_TRACK_DECIDER_H_ | |
OLD | NEW |