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

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

Issue 2350473002: [page_load_metrics] Add support for chrome:// urls and add extensions observer (Closed)
Patch Set: use url constant 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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_COMMON_PAGE_LOAD_METRICS_PAGE_TRACK_DECIDER_H_ 5 #ifndef CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_TRACK_DECIDER_H_
6 #define CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_TRACK_DECIDER_H_ 6 #define CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_TRACK_DECIDER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 9
10 namespace page_load_metrics { 10 namespace page_load_metrics {
11 11
12 // PageTrackDecider is an interface used to determine whether metrics should be 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 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 14 // tracking infrastructure in both the browser and render processes so policy
15 // decisions about which page loads to track are consistent across processes. 15 // decisions about which page loads to track are consistent across processes.
16 class PageTrackDecider { 16 class PageTrackDecider {
17 public: 17 public:
18 PageTrackDecider(); 18 PageTrackDecider();
19 virtual ~PageTrackDecider(); 19 virtual ~PageTrackDecider();
20 20
21 // Whether metrics should be tracked for the current page. This method invokes 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. 22 // the pure virtual methods below to decide whether metrics should be tracked.
23 bool ShouldTrack(); 23 bool ShouldTrack();
24 24
25 // Whether the navigation for the current page has committed. 25 // Whether the navigation for the current page has committed.
26 virtual bool HasCommitted() = 0; 26 virtual bool HasCommitted() = 0;
27 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 28 // 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. 29 // some cases the new tab page is served over the network via https.
35 virtual bool IsNewTabPageUrl() = 0; 30 virtual bool IsNewTabPageUrl() = 0;
36 31
32 virtual bool IsAboutBlankUrl() = 0;
33
37 // The methods below can only be called if HasCommitted() returns true. 34 // The methods below can only be called if HasCommitted() returns true.
38 35
39 // Whether the current page is a Chrome-generated error page. Example error 36 // 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 37 // 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 38 // receiving an HTTP/HTTPS response, such as the 'There is no Internet
42 // connection' page, which is displayed when the user attempts to navigate 39 // connection' page, which is displayed when the user attempts to navigate
43 // without an Internet connection. This method returns false for non-Chrome 40 // without an Internet connection. This method returns false for non-Chrome
44 // generated error pages, such as pages with 4xx/5xx response codes. To 41 // 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 42 // check whether the current page resulted in a 4xx/5xx error, use
46 // IsHTTPErrorPage() instead. 43 // IsHTTPErrorPage() instead.
47 virtual bool IsChromeErrorPage() = 0; 44 virtual bool IsChromeErrorPage() = 0;
48 45
49 // Returns the HTTP status code for the current page, or -1 if no status code 46 // Returns the HTTP status code for the current page, or -1 if no status code
50 // is available. 47 // is available.
51 virtual int GetHttpStatusCode() = 0; 48 virtual int GetHttpStatusCode() = 0;
52 49
53 // Whether the current page is an HTML or XHTML page. 50 // Whether the current page is an HTML or XHTML page.
54 virtual bool IsHtmlOrXhtmlPage() = 0; 51 virtual bool IsHtmlOrXhtmlPage() = 0;
55 52
56 private: 53 private:
57 DISALLOW_COPY_AND_ASSIGN(PageTrackDecider); 54 DISALLOW_COPY_AND_ASSIGN(PageTrackDecider);
58 }; 55 };
59 56
60 } // namespace page_load_metrics 57 } // namespace page_load_metrics
61 58
62 #endif // CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_TRACK_DECIDER_H_ 59 #endif // CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_TRACK_DECIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698