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 #include "chrome/browser/page_load_metrics/observers/ads_detection.h" | |
6 | |
7 #include "base/strings/string_util.h" | |
8 #include "url/gurl.h" | |
9 | |
10 bool IsAdFrame(base::StringPiece frame_name, const GURL& frame_url) { | |
11 // Google ads are prevalent and easy to track, so we'll start by tracking | |
12 // those. Note that the frame name can be very large, so be careful to avoid | |
13 // full string searches if possible. | |
14 // TODO(jkarlin): Track other ad networks that are easy to identify. | |
15 | |
16 if (base::StartsWith(frame_name, "google_ads_iframe", | |
Charlie Reis
2017/06/30 23:28:45
Sanity check: Any page can trigger TDI by naming i
Łukasz Anforowicz
2017/07/01 00:10:53
Correct. Thanks for raising this angle - I honest
| |
17 base::CompareCase::SENSITIVE) || | |
18 base::StartsWith(frame_name, "google_ads_frame", | |
19 base::CompareCase::SENSITIVE)) { | |
20 return true; | |
21 } | |
22 | |
23 if (frame_url.host_piece() == "tpc.googlesyndication.com" && | |
24 base::StartsWith(frame_url.path_piece(), "/safeframe", | |
25 base::CompareCase::SENSITIVE)) { | |
26 return true; | |
27 } | |
28 | |
29 return false; | |
30 } | |
OLD | NEW |