OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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_BROWSER_PAGE_LOAD_METRICS_ADS_DETECTION_H_ |
| 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_ADS_DETECTION_H_ |
| 7 |
| 8 #include <bitset> |
| 9 |
| 10 namespace content { |
| 11 class NavigationHandle; |
| 12 } // namespace content |
| 13 |
| 14 namespace page_load_metrics { |
| 15 |
| 16 // The types of ads that one can detect or filter on. |
| 17 enum AdType { |
| 18 AD_TYPE_GOOGLE = 0, |
| 19 AD_TYPE_SUBRESOURCE_FILTER = 1, |
| 20 AD_TYPE_ALL = 2, |
| 21 AD_TYPE_MAX = AD_TYPE_ALL |
| 22 }; |
| 23 using AdTypes = std::bitset<AD_TYPE_MAX>; |
| 24 |
| 25 // Uses heuristics to determine if |navigation_handle| is a navigation for an |
| 26 // ad. Must be called no earlier than |
| 27 // NavigationHandleImpl::ReadyToCommitNavigation. |
| 28 const AdTypes& GetDetectedAdTypes(content::NavigationHandle* navigation_handle); |
| 29 |
| 30 // Marks the |navigation_handle| as loading an advertisment of a given |type|. |
| 31 void SetDetectedAdType(content::NavigationHandle* navigation_handle, |
| 32 AdType type); |
| 33 |
| 34 } // namespace page_load_metrics |
| 35 |
| 36 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_ADS_DETECTION_H_ |
OLD | NEW |