Skip to content

Commit

Permalink
[base] Replace Contains{Key,Value} with Contains in //url
Browse files Browse the repository at this point in the history
This change replaces usages of base::ContainsKey() and base::ContainsValue()
with base::Contains() in //url.

Reproduction:
 - sed -i 's/\bbase::ContainsKey\b/base::Contains/g'
 - sed -i 's/\bbase::ContainsValue\b/base::Contains/g'
 - git cl format

This CL was uploaded by git cl split.

TBR=mkwst@chromium.org

Bug: 970209
Change-Id: I0602149ee280aeae164231006d29a4935ffba656
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1648252
Reviewed-by: Jan Wilken Dörrie <jdoerrie@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Auto-Submit: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#667445}
  • Loading branch information
jdoerrie authored and Commit Bot committed Jun 8, 2019
1 parent d0fa09e commit 848fd17
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions url/origin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Origin Origin::Create(const GURL& url) {
// It's SchemeHostPort's responsibility to filter out unrecognized schemes;
// sanity check that this is happening.
DCHECK(tuple.IsInvalid() || url.IsStandard() ||
base::ContainsValue(GetLocalSchemes(), url.scheme_piece()) ||
base::Contains(GetLocalSchemes(), url.scheme_piece()) ||
AllowNonStandardSchemesForAndroidWebView());
}

Expand Down Expand Up @@ -162,7 +162,7 @@ bool Origin::CanBeDerivedFrom(const GURL& url) const {
// For "no access" schemes, blink's SecurityOrigin will always create an
// opaque unique one. However, about: scheme is also registered as such but
// does not behave this way, therefore exclude it from this check.
if (base::ContainsValue(url::GetNoAccessSchemes(), url.scheme()) &&
if (base::Contains(url::GetNoAccessSchemes(), url.scheme()) &&
!url.SchemeIs(kAboutScheme)) {
// If |this| is not opaque, definitely return false as the expectation
// is for opaque origin.
Expand Down
3 changes: 1 addition & 2 deletions url/scheme_host_port.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ bool IsValidInput(const base::StringPiece& scheme,
//
// TODO: Migrate "content:" and "externalfile:" to be standard schemes, and
// remove this local scheme exception.
if (base::ContainsValue(GetLocalSchemes(), scheme) && host.empty() &&
port == 0)
if (base::Contains(GetLocalSchemes(), scheme) && host.empty() && port == 0)
return true;

// Otherwise, allow non-standard schemes only if the Android WebView
Expand Down

0 comments on commit 848fd17

Please sign in to comment.