summaryrefslogtreecommitdiff
path: root/chromium/components/subresource_filter/content/common/subresource_filter_utils.cc
blob: a84ae2a2d6e2c31da074da6597a35deaf4b8eb50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// 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.

#include "components/subresource_filter/content/common/subresource_filter_utils.h"

#include "content/public/common/browser_side_navigation_policy.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/url_utils.h"
#include "url/gurl.h"

namespace subresource_filter {

bool ShouldUseParentActivation(const GURL& url) {
  if (content::IsBrowserSideNavigationEnabled())
    return !content::IsURLHandledByNetworkStack(url);

  // TODO(csharrison): It is not always true that a data URL can use its
  // parent's activation in OOPIF mode, where the resulting data frame will
  // be same-process to its initiator. See crbug.com/739777 for more
  // information.
  return (url.SchemeIs(url::kDataScheme) || url == url::kAboutBlankURL ||
          url == content::kAboutSrcDocURL);
}

}  // namespace subresource_filter