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

Unified Diff: chrome/browser/page_load_metrics/ads_detection.h

Issue 2946113002: Use FrameIsAd to decide whether to isolate a frame in TopDocumentIsolation mode. (Closed)
Patch Set: Rebasing... Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
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..3cdaad8d7a9e59ae5c6f64d7dc1f2937e41f0ee3
--- /dev/null
+++ b/chrome/browser/page_load_metrics/ads_detection.h
@@ -0,0 +1,36 @@
+// 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
+
+namespace page_load_metrics {
+
+// 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 SetDetectedAdType(content::NavigationHandle* navigation_handle,
+ AdType type);
+
+} // namespace page_load_metrics
+
+#endif // CHROME_BROWSER_PAGE_LOAD_METRICS_ADS_DETECTION_H_

Powered by Google App Engine
This is Rietveld 408576698