summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorbrettw <brettw@chromium.org>2015-07-16 10:49:29 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-16 17:50:12 +0000
commita7ff1b291cd328e9584779a4bb9101fa9a3c01ad (patch)
treed010374be1ca156ea26405ae7b0aa85e48bb4bba /components
parent7befa9cf85342a0409502ed2c05d7610afec7844 (diff)
downloadchromium_src-a7ff1b291cd328e9584779a4bb9101fa9a3c01ad.zip
chromium_src-a7ff1b291cd328e9584779a4bb9101fa9a3c01ad.tar.gz
chromium_src-a7ff1b291cd328e9584779a4bb9101fa9a3c01ad.tar.bz2
Remove some legacy versions of StartsWith and EndsWith.
This just replaces true -> base::CompareCase::SENSITIVE false -> base::CompareCase::INSENSITIVE_ASCII I checked the insensitive cases to make sure they're not doing anything suspicious. The old version is a sometimes-correct Unicode comparison so converting to INSENSTITIVE_ASCII isn't a no-op. However, generally the prefix/suffix checking is done against a hardcoded string so there were very few cases to actually look at. extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc has a not-quite search-and-replace change where I changed the type of a class variable. BUG=506255 TBR=jam Reland of http://crrev.com/1239493005 Review URL: https://codereview.chromium.org/1233043003 Cr-Commit-Position: refs/heads/master@{#339071}
Diffstat (limited to 'components')
-rw-r--r--components/devtools_http_handler/devtools_http_handler.cc17
-rw-r--r--components/google/core/browser/google_util.cc3
-rw-r--r--components/omnibox/browser/keyword_provider.cc3
-rw-r--r--components/omnibox/browser/search_suggestion_parser.cc3
-rw-r--r--components/pairing/bluetooth_controller_pairing_controller.cc2
-rw-r--r--components/password_manager/core/browser/password_manager.cc3
-rw-r--r--components/plugins/renderer/mobile_youtube_plugin.cc6
-rw-r--r--components/plugins/renderer/plugin_placeholder.cc5
-rw-r--r--components/search/search.cc3
-rw-r--r--components/storage_monitor/volume_mount_watcher_win.cc2
-rw-r--r--components/test_runner/web_test_proxy.cc2
-rw-r--r--components/variations/net/variations_http_header_provider.cc3
-rw-r--r--components/wifi/wifi_service_win.cc3
13 files changed, 35 insertions, 20 deletions
diff --git a/components/devtools_http_handler/devtools_http_handler.cc b/components/devtools_http_handler/devtools_http_handler.cc
index 0080f68..40f7edc 100644
--- a/components/devtools_http_handler/devtools_http_handler.cc
+++ b/components/devtools_http_handler/devtools_http_handler.cc
@@ -359,17 +359,22 @@ static std::string PathWithoutParams(const std::string& path) {
}
static std::string GetMimeType(const std::string& filename) {
- if (base::EndsWith(filename, ".html", false)) {
+ if (base::EndsWith(filename, ".html", base::CompareCase::INSENSITIVE_ASCII)) {
return "text/html";
- } else if (base::EndsWith(filename, ".css", false)) {
+ } else if (base::EndsWith(filename, ".css",
+ base::CompareCase::INSENSITIVE_ASCII)) {
return "text/css";
- } else if (base::EndsWith(filename, ".js", false)) {
+ } else if (base::EndsWith(filename, ".js",
+ base::CompareCase::INSENSITIVE_ASCII)) {
return "application/javascript";
- } else if (base::EndsWith(filename, ".png", false)) {
+ } else if (base::EndsWith(filename, ".png",
+ base::CompareCase::INSENSITIVE_ASCII)) {
return "image/png";
- } else if (base::EndsWith(filename, ".gif", false)) {
+ } else if (base::EndsWith(filename, ".gif",
+ base::CompareCase::INSENSITIVE_ASCII)) {
return "image/gif";
- } else if (base::EndsWith(filename, ".json", false)) {
+ } else if (base::EndsWith(filename, ".json",
+ base::CompareCase::INSENSITIVE_ASCII)) {
return "application/json";
}
LOG(ERROR) << "GetMimeType doesn't know mime type for: "
diff --git a/components/google/core/browser/google_util.cc b/components/google/core/browser/google_util.cc
index 5326502..1eada34 100644
--- a/components/google/core/browser/google_util.cc
+++ b/components/google/core/browser/google_util.cc
@@ -57,7 +57,8 @@ bool IsValidHostName(const std::string& host,
if (base::LowerCaseEqualsASCII(host_minus_tld, domain_in_lower_case.c_str()))
return true;
if (subdomain_permission == google_util::ALLOW_SUBDOMAIN)
- return base::EndsWith(host_minus_tld, "." + domain_in_lower_case, false);
+ return base::EndsWith(host_minus_tld, "." + domain_in_lower_case,
+ base::CompareCase::INSENSITIVE_ASCII);
return base::LowerCaseEqualsASCII(host_minus_tld,
("www." + domain_in_lower_case).c_str());
}
diff --git a/components/omnibox/browser/keyword_provider.cc b/components/omnibox/browser/keyword_provider.cc
index b6f7877..8992f02 100644
--- a/components/omnibox/browser/keyword_provider.cc
+++ b/components/omnibox/browser/keyword_provider.cc
@@ -139,7 +139,8 @@ const TemplateURL* KeywordProvider::GetSubstitutingTemplateURLForInput(
// of the original input.
if (input->cursor_position() != base::string16::npos &&
!remaining_input.empty() &&
- base::EndsWith(input->text(), remaining_input, true)) {
+ base::EndsWith(input->text(), remaining_input,
+ base::CompareCase::SENSITIVE)) {
int offset = input->text().length() - input->cursor_position();
// The cursor should never be past the last character or before the
// first character.
diff --git a/components/omnibox/browser/search_suggestion_parser.cc b/components/omnibox/browser/search_suggestion_parser.cc
index 11fbdbb..30543fc 100644
--- a/components/omnibox/browser/search_suggestion_parser.cc
+++ b/components/omnibox/browser/search_suggestion_parser.cc
@@ -151,7 +151,8 @@ void SearchSuggestionParser::SuggestResult::ClassifyMatchContents(
// contents, and the input text has an overlap with contents.
if (base::StartsWith(suggestion_, input_text,
base::CompareCase::SENSITIVE) &&
- base::EndsWith(suggestion_, match_contents_, true) &&
+ base::EndsWith(suggestion_, match_contents_,
+ base::CompareCase::SENSITIVE) &&
(input_text.length() > contents_index)) {
lookup_text = input_text.substr(contents_index);
}
diff --git a/components/pairing/bluetooth_controller_pairing_controller.cc b/components/pairing/bluetooth_controller_pairing_controller.cc
index b843354..3d8cb6a 100644
--- a/components/pairing/bluetooth_controller_pairing_controller.cc
+++ b/components/pairing/bluetooth_controller_pairing_controller.cc
@@ -71,7 +71,7 @@ void BluetoothControllerPairingController::DeviceFound(
DCHECK_EQ(current_stage_, STAGE_DEVICES_DISCOVERY);
DCHECK(thread_checker_.CalledOnValidThread());
if (base::StartsWith(device->GetName(), base::ASCIIToUTF16(kDeviceNamePrefix),
- false)) {
+ base::CompareCase::INSENSITIVE_ASCII)) {
discovered_devices_.insert(device->GetAddress());
FOR_EACH_OBSERVER(ControllerPairingController::Observer, observers_,
DiscoveredDevicesListChanged());
diff --git a/components/password_manager/core/browser/password_manager.cc b/components/password_manager/core/browser/password_manager.cc
index 078b627..49d8af6 100644
--- a/components/password_manager/core/browser/password_manager.cc
+++ b/components/password_manager/core/browser/password_manager.cc
@@ -477,7 +477,8 @@ void PasswordManager::CreatePendingLoginManagers(
iter != forms.end(); ++iter) {
// Don't involve the password manager if this form corresponds to
// SpdyProxy authentication, as indicated by the realm.
- if (base::EndsWith(iter->signon_realm, kSpdyProxyRealm, true))
+ if (base::EndsWith(iter->signon_realm, kSpdyProxyRealm,
+ base::CompareCase::SENSITIVE))
continue;
bool old_manager_found = false;
for (const auto& old_manager : old_login_managers) {
diff --git a/components/plugins/renderer/mobile_youtube_plugin.cc b/components/plugins/renderer/mobile_youtube_plugin.cc
index af24a2b..7b576df 100644
--- a/components/plugins/renderer/mobile_youtube_plugin.cc
+++ b/components/plugins/renderer/mobile_youtube_plugin.cc
@@ -89,8 +89,10 @@ MobileYouTubePlugin::~MobileYouTubePlugin() {}
bool MobileYouTubePlugin::IsYouTubeURL(const GURL& url,
const std::string& mime_type) {
std::string host = url.host();
- bool is_youtube = base::EndsWith(host, "youtube.com", true) ||
- base::EndsWith(host, "youtube-nocookie.com", true);
+ bool is_youtube =
+ base::EndsWith(host, "youtube.com", base::CompareCase::SENSITIVE) ||
+ base::EndsWith(host, "youtube-nocookie.com",
+ base::CompareCase::SENSITIVE);
return is_youtube && IsValidYouTubeVideo(url.path()) &&
base::LowerCaseEqualsASCII(mime_type,
diff --git a/components/plugins/renderer/plugin_placeholder.cc b/components/plugins/renderer/plugin_placeholder.cc
index 113cf8e..04ceb82 100644
--- a/components/plugins/renderer/plugin_placeholder.cc
+++ b/components/plugins/renderer/plugin_placeholder.cc
@@ -78,14 +78,15 @@ void PluginPlaceholderBase::HidePlugin() {
if (element.hasAttribute("width") && element.hasAttribute("height")) {
std::string width_str("width:[\\s]*");
width_str += element.getAttribute("width").utf8().data();
- if (base::EndsWith(width_str, "px", false)) {
+ if (base::EndsWith(width_str, "px", base::CompareCase::INSENSITIVE_ASCII)) {
width_str = width_str.substr(0, width_str.length() - 2);
}
base::TrimWhitespace(width_str, base::TRIM_TRAILING, &width_str);
width_str += "[\\s]*px";
std::string height_str("height:[\\s]*");
height_str += element.getAttribute("height").utf8().data();
- if (base::EndsWith(height_str, "px", false)) {
+ if (base::EndsWith(height_str, "px",
+ base::CompareCase::INSENSITIVE_ASCII)) {
height_str = height_str.substr(0, height_str.length() - 2);
}
base::TrimWhitespace(height_str, base::TRIM_TRAILING, &height_str);
diff --git a/components/search/search.cc b/components/search/search.cc
index 8c50d16..92b8ccb 100644
--- a/components/search/search.cc
+++ b/components/search/search.cc
@@ -90,7 +90,8 @@ bool GetFieldTrialInfo(FieldTrialFlags* flags) {
kInstantExtendedFieldTrialName);
}
- if (base::EndsWith(group_name, kDisablingSuffix, true))
+ if (base::EndsWith(group_name, kDisablingSuffix,
+ base::CompareCase::SENSITIVE))
return false;
// We have a valid trial that isn't disabled. Extract the flags.
diff --git a/components/storage_monitor/volume_mount_watcher_win.cc b/components/storage_monitor/volume_mount_watcher_win.cc
index 6913f03..168d2eb 100644
--- a/components/storage_monitor/volume_mount_watcher_win.cc
+++ b/components/storage_monitor/volume_mount_watcher_win.cc
@@ -70,7 +70,7 @@ DeviceType GetDeviceType(const base::string16& mount_point) {
// Check device strings of the form "X:" and "\\.\X:"
// For floppy drives, these will return strings like "/Device/Floppy0"
base::string16 device = mount_point;
- if (base::EndsWith(mount_point, L"\\", false))
+ if (base::EndsWith(mount_point, L"\\", base::CompareCase::INSENSITIVE_ASCII))
device = mount_point.substr(0, mount_point.length() - 1);
base::string16 device_path;
base::string16 device_path_slash;
diff --git a/components/test_runner/web_test_proxy.cc b/components/test_runner/web_test_proxy.cc
index 4b2b43a..ad20b1e 100644
--- a/components/test_runner/web_test_proxy.cc
+++ b/components/test_runner/web_test_proxy.cc
@@ -200,7 +200,7 @@ bool IsLocalHost(const std::string& host) {
}
bool IsTestHost(const std::string& host) {
- return base::EndsWith(host, ".test", false);
+ return base::EndsWith(host, ".test", base::CompareCase::INSENSITIVE_ASCII);
}
bool HostIsUsedBySomeTestsToGenerateError(const std::string& host) {
diff --git a/components/variations/net/variations_http_header_provider.cc b/components/variations/net/variations_http_header_provider.cc
index fd7be82..583d77a 100644
--- a/components/variations/net/variations_http_header_provider.cc
+++ b/components/variations/net/variations_http_header_provider.cc
@@ -280,7 +280,8 @@ bool VariationsHttpHeaderProvider::ShouldAppendHeaders(const GURL& url) {
// is very straight forward.
const std::string host = url.host();
for (size_t i = 0; i < arraysize(kSuffixesToSetHeadersFor); ++i) {
- if (base::EndsWith(host, kSuffixesToSetHeadersFor[i], false))
+ if (base::EndsWith(host, kSuffixesToSetHeadersFor[i],
+ base::CompareCase::INSENSITIVE_ASCII))
return true;
}
diff --git a/components/wifi/wifi_service_win.cc b/components/wifi/wifi_service_win.cc
index f20c26e..2716136 100644
--- a/components/wifi/wifi_service_win.cc
+++ b/components/wifi/wifi_service_win.cc
@@ -1154,7 +1154,8 @@ DWORD WiFiServiceImpl::FindAdapterIndexMapByGUID(
if (error == ERROR_SUCCESS) {
for (int adapter = 0; adapter < interface_info->NumAdapters; ++adapter) {
if (base::EndsWith(
- interface_info->Adapter[adapter].Name, guid_string, false)) {
+ interface_info->Adapter[adapter].Name, guid_string,
+ base::CompareCase::INSENSITIVE_ASCII)) {
*adapter_index_map = interface_info->Adapter[adapter];
break;
}