This patch implements a mechanism for more granular link URL permissions (filtering on scheme/host). This fixes the bug that allowed PDFs to have working links to any "chrome://" URLs.

BUG=528505,226927

Review URL: https://codereview.chromium.org/1362433002

Cr-Commit-Position: refs/heads/master@{#351705}
bool ChildProcessSecurityPolicyImpl::CanRequestURL(
    int child_id, const GURL& url) {
  if (!url.is_valid())
    return false;  // Can't request invalid URLs.

  if (IsPseudoScheme(url.scheme())) {

    if (url.SchemeIs(kViewSourceScheme)) {
      GURL child_url(url.GetContent());
      if (child_url.SchemeIs(kViewSourceScheme) &&
          url.SchemeIs(kViewSourceScheme))
          return false;

      return CanRequestURL(child_id, child_url);
    }

    if (base::LowerCaseEqualsASCII(url.spec(), url::kAboutBlankURL))
      return true;  // Every child process can request <about:blank>.

    return false;
  }

  if (CanCommitURL(child_id, url))
    return true;

  return !GetContentClient()->browser()->IsHandledURL(url) &&
         !net::URLRequest::IsHandledURL(url);
}

bool ChildProcessSecurityPolicyImpl::CanRequestURL(
    int child_id, const GURL& url) {
  if (!url.is_valid())
    return false;  // Can't request invalid URLs.

  if (IsPseudoScheme(url.scheme())) {

    if (url.SchemeIs(kViewSourceScheme)) {
      GURL child_url(url.GetContent());
      if (child_url.SchemeIs(kViewSourceScheme) &&
          url.SchemeIs(kViewSourceScheme))
          return false;

      return CanRequestURL(child_id, child_url);
    }

    if (base::LowerCaseEqualsASCII(url.spec(), url::kAboutBlankURL))
      return true;  // Every child process can request <about:blank>.

    return false;
  }

  if (CanCommitURL(child_id, url))
    return true;

  return !GetContentClient()->browser()->IsHandledURL(url) &&
         !net::URLRequest::IsHandledURL(url);
}
