Chromium Code Reviews| Index: chrome/browser/page_load_metrics/ads_detection.h |
| diff --git a/chrome/browser/page_load_metrics/ads_detection.h b/chrome/browser/page_load_metrics/ads_detection.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..01cc296ea0d78a93304b978a241961be12361caa |
| --- /dev/null |
| +++ b/chrome/browser/page_load_metrics/ads_detection.h |
| @@ -0,0 +1,32 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_ADS_DETECTION_H_ |
| +#define CHROME_BROWSER_PAGE_LOAD_METRICS_ADS_DETECTION_H_ |
| + |
| +#include <bitset> |
| + |
| +namespace content { |
| +class NavigationHandle; |
| +} // namespace content |
|
jkarlin
2017/07/19 13:32:36
This file should be in the page_load_metrics names
Łukasz Anforowicz
2017/07/19 18:11:29
Done.
|
| + |
| +// The types of ads that one can detect or filter on. |
| +enum AdType { |
| + AD_TYPE_GOOGLE = 0, |
| + AD_TYPE_SUBRESOURCE_FILTER = 1, |
| + AD_TYPE_ALL = 2, |
| + AD_TYPE_MAX = AD_TYPE_ALL |
| +}; |
| +using AdTypes = std::bitset<AD_TYPE_MAX>; |
| + |
| +// Uses heuristics to determine if |navigation_handle| is a navigation for an |
| +// ad. Must be called no earlier than |
| +// NavigationHandleImpl::ReadyToCommitNavigation. |
| +const AdTypes& GetDetectedAdTypes(content::NavigationHandle* navigation_handle); |
| + |
| +// Marks the |navigation_handle| as loading an advertisment of a given |type|. |
| +void SetDetectedAdTypes(content::NavigationHandle* navigation_handle, |
|
jkarlin
2017/07/19 13:32:36
s/SetDetectedAdTypes/SetDetectedAdType/
Łukasz Anforowicz
2017/07/19 18:11:29
Done.
|
| + AdType type); |
| + |
| +#endif // CHROME_BROWSER_PAGE_LOAD_METRICS_ADS_DETECTION_H_ |