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

Side by Side Diff: content/browser/frame_host/mixed_content_navigation_throttle.cc

Issue 2956643002: Add GURL::HostNoBracketsPiece() (Closed)
Patch Set: Simplify test 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 unified diff | Download patch
« no previous file with comments | « components/payments/content/origin_security_checker.cc ('k') | content/common/origin_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/frame_host/mixed_content_navigation_throttle.h" 5 #include "content/browser/frame_host/mixed_content_navigation_throttle.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "content/browser/frame_host/frame_tree.h" 9 #include "content/browser/frame_host/frame_tree.h"
10 #include "content/browser/frame_host/frame_tree_node.h" 10 #include "content/browser/frame_host/frame_tree_node.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // blob: and filesystem: URLs never hit the network, and access is restricted 63 // blob: and filesystem: URLs never hit the network, and access is restricted
64 // to same-origin contexts, so they are not blocked. 64 // to same-origin contexts, so they are not blocked.
65 bool is_secure = 65 bool is_secure =
66 url.SchemeIs(url::kBlobScheme) || url.SchemeIs(url::kFileSystemScheme) || 66 url.SchemeIs(url::kBlobScheme) || url.SchemeIs(url::kFileSystemScheme) ||
67 IsOriginSecure(url) || IsPotentiallyTrustworthyOrigin(url::Origin(url)); 67 IsOriginSecure(url) || IsPotentiallyTrustworthyOrigin(url::Origin(url));
68 68
69 // TODO(mkwst): Remove this once the following draft is implemented: 69 // TODO(mkwst): Remove this once the following draft is implemented:
70 // https://tools.ietf.org/html/draft-west-let-localhost-be-localhost-03. See: 70 // https://tools.ietf.org/html/draft-west-let-localhost-be-localhost-03. See:
71 // https://crbug.com/691930. 71 // https://crbug.com/691930.
72 if (is_secure && url.SchemeIs(url::kHttpScheme) && 72 if (is_secure && url.SchemeIs(url::kHttpScheme) &&
73 net::IsLocalHostname(url.HostNoBrackets(), nullptr)) { 73 net::IsLocalHostname(url.HostNoBracketsPiece(), nullptr)) {
74 is_secure = false; 74 is_secure = false;
75 } 75 }
76 76
77 return is_secure; 77 return is_secure;
78 } 78 }
79 79
80 // This method should return the same results as 80 // This method should return the same results as
81 // SchemeRegistry::shouldTreatURLSchemeAsRestrictingMixedContent. 81 // SchemeRegistry::shouldTreatURLSchemeAsRestrictingMixedContent.
82 bool DoesOriginSchemeRestrictMixedContent(const url::Origin& origin) { 82 bool DoesOriginSchemeRestrictMixedContent(const url::Origin& origin) {
83 return origin.scheme() == url::kHttpsScheme; 83 return origin.scheme() == url::kHttpsScheme;
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 // static 358 // static
359 bool MixedContentNavigationThrottle::IsMixedContentForTesting( 359 bool MixedContentNavigationThrottle::IsMixedContentForTesting(
360 const GURL& origin_url, 360 const GURL& origin_url,
361 const GURL& url) { 361 const GURL& url) {
362 const url::Origin origin(origin_url); 362 const url::Origin origin(origin_url);
363 return !IsUrlPotentiallySecure(url) && 363 return !IsUrlPotentiallySecure(url) &&
364 DoesOriginSchemeRestrictMixedContent(origin); 364 DoesOriginSchemeRestrictMixedContent(origin);
365 } 365 }
366 366
367 } // namespace content 367 } // namespace content
OLDNEW
« no previous file with comments | « components/payments/content/origin_security_checker.cc ('k') | content/common/origin_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698