OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
jkarlin
2017/07/18 17:34:44
I'm not sure that this utility file belongs in thi
Charlie Harrison
2017/07/18 18:11:30
I would slightly prefer it to be in chrome/browser
Łukasz Anforowicz
2017/07/18 19:06:11
sgtm - I've moved ads_detection.h/.cc to chrome/br
Charlie Harrison
2017/07/18 19:24:41
Yeah, it would take some maneuvering to put it in
| |
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_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_ADS_DETECTION_H_ | |
6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_ADS_DETECTION_H_ | |
7 | |
8 #include <bitset> | |
9 #include <string> | |
10 | |
11 #include "base/strings/string_piece_forward.h" | |
12 | |
13 namespace content { | |
14 class NavigationHandle; | |
15 } // namespace content | |
16 | |
17 // The types of ads that one can detect or filter on. | |
18 enum AdType { | |
19 AD_TYPE_GOOGLE = 0, | |
20 AD_TYPE_SUBRESOURCE_FILTER = 1, | |
21 AD_TYPE_ALL = 2, | |
22 AD_TYPE_MAX = AD_TYPE_ALL | |
23 }; | |
24 using AdTypes = std::bitset<AD_TYPE_MAX>; | |
25 | |
26 // Uses various heuristics to determine if a given navigation tries to load an | |
27 // advertisment. For some ad types the results depend on | |
28 // SetNavigationAdHeuristics, but some ad types can be detected based on the | |
29 // basic navigation properties (like URL and/or name of the frame being | |
30 // navigated). | |
jkarlin
2017/07/18 17:34:44
Discussion about the SetNavigationAdHeuristics stu
Łukasz Anforowicz
2017/07/18 19:06:11
Done.
| |
31 AdTypes GetAdDetectionHeuristics(content::NavigationHandle* navigation_handle); | |
jkarlin
2017/07/18 17:34:44
GetAdDetectionHeuristics sounds like it's returnin
Łukasz Anforowicz
2017/07/18 19:06:11
Done.
| |
32 | |
33 // Marks the |navigation_handle| as loading an advertisment of a given |type|. | |
34 void SetAdDetectionHeuristics(content::NavigationHandle* navigation_handle, | |
jkarlin
2017/07/18 17:34:44
Likewise, I much prefer SetDetectedAdType.
Łukasz Anforowicz
2017/07/18 19:06:11
Done.
| |
35 AdType type); | |
36 | |
37 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_ADS_DETECTION_H_ | |
OLD | NEW |