summaryrefslogtreecommitdiffstats
path: root/extensions/common/csp_validator.cc
diff options
context:
space:
mode:
authorbrettw <brettw@chromium.org>2015-07-16 16:57:33 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-16 23:58:34 +0000
commit955093110ad64d5ec6f5426991efaa4a680b5d6f (patch)
tree19368cdb8861595640715e1072789959729efc2d /extensions/common/csp_validator.cc
parent387e05a79c7ae346ba7db36977ddfca7ca6f10a3 (diff)
downloadchromium_src-955093110ad64d5ec6f5426991efaa4a680b5d6f.zip
chromium_src-955093110ad64d5ec6f5426991efaa4a680b5d6f.tar.gz
chromium_src-955093110ad64d5ec6f5426991efaa4a680b5d6f.tar.bz2
Remove legacy StartsWithASCII function.
This replaces it with base::StartsWith and the appropriate case flag. Since the existing version only ever did case-insensitive tests in ASCII, there should be no behavior change. BUG=506255 TBR=jam Review URL: https://codereview.chromium.org/1242023005 Cr-Commit-Position: refs/heads/master@{#339175}
Diffstat (limited to 'extensions/common/csp_validator.cc')
-rw-r--r--extensions/common/csp_validator.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/extensions/common/csp_validator.cc b/extensions/common/csp_validator.cc
index a984e3d..1fe2217 100644
--- a/extensions/common/csp_validator.cc
+++ b/extensions/common/csp_validator.cc
@@ -57,7 +57,8 @@ struct DirectiveStatus {
bool isNonWildcardTLD(const std::string& url,
const std::string& scheme_and_separator,
bool should_check_rcd) {
- if (!base::StartsWithASCII(url, scheme_and_separator, true))
+ if (!base::StartsWith(url, scheme_and_separator,
+ base::CompareCase::SENSITIVE))
return false;
size_t start_of_host = scheme_and_separator.length();
@@ -133,14 +134,17 @@ void GetSecureDirectiveValues(const std::string& directive_name,
base::LowerCaseEqualsASCII(source, "blob:") ||
base::LowerCaseEqualsASCII(source, "filesystem:") ||
base::LowerCaseEqualsASCII(source, "http://localhost") ||
- base::StartsWithASCII(source, "http://127.0.0.1:", true) ||
- base::StartsWithASCII(source, "http://localhost:", true) ||
+ base::StartsWith(source, "http://127.0.0.1:",
+ base::CompareCase::SENSITIVE) ||
+ base::StartsWith(source, "http://localhost:",
+ base::CompareCase::SENSITIVE) ||
isNonWildcardTLD(source, "https://", true) ||
isNonWildcardTLD(source, "chrome://", false) ||
isNonWildcardTLD(source, std::string(extensions::kExtensionScheme) +
url::kStandardSchemeSeparator,
false) ||
- base::StartsWithASCII(source, "chrome-extension-resource:", true)) {
+ base::StartsWith(source, "chrome-extension-resource:",
+ base::CompareCase::SENSITIVE)) {
is_secure_csp_token = true;
} else if ((options & OPTIONS_ALLOW_UNSAFE_EVAL) &&
source == "'unsafe-eval'") {