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

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: Addressing 2 more CR comments from csharrison@. 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..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_

Powered by Google App Engine
This is Rietveld 408576698