| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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 "extensions/common/ad_injection_constants.h" | |
| 6 | |
| 7 #include "base/strings/string_util.h" | |
| 8 | |
| 9 namespace extensions { | |
| 10 namespace ad_injection_constants { | |
| 11 | |
| 12 namespace keys { | |
| 13 | |
| 14 const char kType[] = "type"; | |
| 15 const char kChildren[] = "children"; | |
| 16 const char kSrc[] = "src"; | |
| 17 const char kHref[] = "href"; | |
| 18 | |
| 19 } // namespace keys | |
| 20 | |
| 21 const char kHtmlIframeSrcApiName[] = "HTMLIFrameElement.src"; | |
| 22 const char kHtmlEmbedSrcApiName[] = "HTMLEmbedElement.src"; | |
| 23 const char kHtmlAnchorHrefApiName[] = "HTMLAnchorElement.href"; | |
| 24 const char kAppendChildApiSuffix[] = "appendChild"; | |
| 25 | |
| 26 // The maximum number of children to check when we examine a newly-added | |
| 27 // element. | |
| 28 extern const size_t kMaximumChildrenToCheck = 10u; | |
| 29 | |
| 30 // The maximum depth to check when we examine a newly-added element. | |
| 31 extern const size_t kMaximumDepthToCheck = 5u; | |
| 32 | |
| 33 bool ApiCanInjectAds(const std::string& api) { | |
| 34 return api == kHtmlIframeSrcApiName || | |
| 35 api == kHtmlEmbedSrcApiName || | |
| 36 api == kHtmlAnchorHrefApiName || | |
| 37 EndsWith(api, kAppendChildApiSuffix, true /* case sensitive */); | |
| 38 } | |
| 39 | |
| 40 } // namespace ad_injection_constants | |
| 41 } // namespace extensions | |
| OLD | NEW |