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

Unified Diff: extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc

Issue 1233043003: Remove some legacy versions of StartsWith and EndsWith. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dbus/string_util.cc ('k') | extensions/browser/api/web_request/web_request_permissions.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc
diff --git a/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc b/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc
index 615090a8aca64bb9f7ae2d1a8d6c383ba3b65fd5..430a05c1bf195207c2ffee64091a66d641725c2c 100644
--- a/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc
+++ b/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc
@@ -330,7 +330,7 @@ class HeaderMatcher {
const std::string data_;
const MatchType type_;
- const bool case_sensitive_;
+ const base::CompareCase case_sensitive_;
DISALLOW_COPY_AND_ASSIGN(StringMatchTest);
};
@@ -422,14 +422,14 @@ bool HeaderMatcher::StringMatchTest::Matches(
const std::string& str) const {
switch (type_) {
case kPrefix:
- return base::StartsWithASCII(str, data_, case_sensitive_);
+ return base::StartsWith(str, data_, case_sensitive_);
case kSuffix:
return base::EndsWith(str, data_, case_sensitive_);
case kEquals:
return str.size() == data_.size() &&
- base::StartsWithASCII(str, data_, case_sensitive_);
+ base::StartsWith(str, data_, case_sensitive_);
case kContains:
- if (!case_sensitive_) {
+ if (case_sensitive_ == base::CompareCase::INSENSITIVE_ASCII) {
return std::search(str.begin(), str.end(), data_.begin(), data_.end(),
CaseInsensitiveCompareASCII<char>()) != str.end();
} else {
@@ -446,7 +446,8 @@ HeaderMatcher::StringMatchTest::StringMatchTest(const std::string& data,
bool case_sensitive)
: data_(data),
type_(type),
- case_sensitive_(case_sensitive) {}
+ case_sensitive_(case_sensitive ? base::CompareCase::SENSITIVE
+ : base::CompareCase::INSENSITIVE_ASCII) {}
// HeaderMatcher::HeaderMatchTest implementation.
« no previous file with comments | « dbus/string_util.cc ('k') | extensions/browser/api/web_request/web_request_permissions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698