diff options
author | brettw <brettw@chromium.org> | 2015-07-16 16:57:33 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-16 23:58:34 +0000 |
commit | 955093110ad64d5ec6f5426991efaa4a680b5d6f (patch) | |
tree | 19368cdb8861595640715e1072789959729efc2d | |
parent | 387e05a79c7ae346ba7db36977ddfca7ca6f10a3 (diff) | |
download | chromium_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}
110 files changed, 323 insertions, 218 deletions
diff --git a/android_webview/native/android_protocol_handler.cc b/android_webview/native/android_protocol_handler.cc index aaadb14..b9f795a 100644 --- a/android_webview/native/android_protocol_handler.cc +++ b/android_webview/native/android_protocol_handler.cc @@ -252,8 +252,8 @@ bool AssetFileRequestInterceptor::ShouldHandleRequest( return false; const std::string& url = request->url().spec(); - if (!base::StartsWithASCII(url, asset_prefix_, /*case_sensitive=*/ true) && - !base::StartsWithASCII(url, resource_prefix_, /*case_sensitive=*/ true)) { + if (!base::StartsWith(url, asset_prefix_, base::CompareCase::SENSITIVE) && + !base::StartsWith(url, resource_prefix_, base::CompareCase::SENSITIVE)) { return false; } diff --git a/android_webview/native/aw_media_url_interceptor.cc b/android_webview/native/aw_media_url_interceptor.cc index 39e9b54..fd85ffc 100644 --- a/android_webview/native/aw_media_url_interceptor.cc +++ b/android_webview/native/aw_media_url_interceptor.cc @@ -20,7 +20,7 @@ bool AwMediaUrlInterceptor::Intercept(const std::string& url, asset_file_prefix.append(url::kStandardSchemeSeparator); asset_file_prefix.append(android_webview::kAndroidAssetPath); - if (base::StartsWithASCII(url, asset_file_prefix, true)) { + if (base::StartsWith(url, asset_file_prefix, base::CompareCase::SENSITIVE)) { std::string filename(url); base::ReplaceFirstSubstringAfterOffset( &filename, 0, asset_file_prefix, "assets/"); diff --git a/ash/wm/lock_state_controller.cc b/ash/wm/lock_state_controller.cc index 9a9d520..f87498f 100644 --- a/ash/wm/lock_state_controller.cc +++ b/ash/wm/lock_state_controller.cc @@ -493,9 +493,9 @@ void LockStateController::PreLockAnimationFinished(bool request_lock) { // Increase lock timeout for slower hardware, see http://crbug.com/350628 const std::string board = base::SysInfo::GetLsbReleaseBoard(); if (board == "x86-mario" || - base::StartsWithASCII(board, "x86-alex", true /* case_sensitive */) || - base::StartsWithASCII(board, "x86-zgb", true /* case_sensitive */) || - base::StartsWithASCII(board, "daisy", true /* case_sensitive */)) { + base::StartsWith(board, "x86-alex", base::CompareCase::SENSITIVE) || + base::StartsWith(board, "x86-zgb", base::CompareCase::SENSITIVE) || + base::StartsWith(board, "daisy", base::CompareCase::SENSITIVE)) { timeout *= 2; } // Times out on ASAN bots. diff --git a/base/files/file_path.cc b/base/files/file_path.cc index 51656d2..18775ed 100644 --- a/base/files/file_path.cc +++ b/base/files/file_path.cc @@ -1314,7 +1314,7 @@ FilePath FilePath::NormalizePathSeparatorsTo(CharType separator) const { #if defined(OS_ANDROID) bool FilePath::IsContentUri() const { - return StartsWithASCII(path_, "content://", false /*case_sensitive*/); + return StartsWith(path_, "content://", base::CompareCase::INSENSITIVE_ASCII); } #endif diff --git a/base/strings/string_util.h b/base/strings/string_util.h index 755215c..4f113ed 100644 --- a/base/strings/string_util.h +++ b/base/strings/string_util.h @@ -372,16 +372,6 @@ BASE_EXPORT bool EndsWith(StringPiece16 str, StringPiece16 search_for, CompareCase case_sensitivity); -// DEPRECATED. Returns true if str starts/ends with search, or false otherwise. -// TODO(brettw) remove in favor of the "enum" versions above. -inline bool StartsWithASCII(const std::string& str, - const std::string& search, - bool case_sensitive) { - return StartsWith(StringPiece(str), StringPiece(search), - case_sensitive ? CompareCase::SENSITIVE - : CompareCase::INSENSITIVE_ASCII); -} - // Determines the type of ASCII character, independent of locale (the C // library versions will change based on locale). template <typename Char> diff --git a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc index 3a080a5..0db2f9e 100644 --- a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc +++ b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc @@ -256,7 +256,8 @@ void InterstitialHTMLSource::StartDataRequest( interstitial_delegate.reset(CreateSafeBrowsingBlockingPage(web_contents_)); } #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) - else if (base::StartsWithASCII(path, "captiveportal", true)) + else if (base::StartsWith(path, "captiveportal", + base::CompareCase::SENSITIVE)) { interstitial_delegate.reset(CreateCaptivePortalBlockingPage(web_contents_)); } diff --git a/chromeos/dbus/bluetooth_gatt_characteristic_service_provider.cc b/chromeos/dbus/bluetooth_gatt_characteristic_service_provider.cc index d4e4c38..545880a 100644 --- a/chromeos/dbus/bluetooth_gatt_characteristic_service_provider.cc +++ b/chromeos/dbus/bluetooth_gatt_characteristic_service_provider.cc @@ -52,8 +52,9 @@ class BluetoothGattCharacteristicServiceProviderImpl DCHECK(!uuid_.empty()); DCHECK(object_path_.IsValid()); DCHECK(service_path_.IsValid()); - DCHECK(base::StartsWithASCII(object_path_.value(), - service_path_.value() + "/", true)); + DCHECK(base::StartsWith(object_path_.value(), + service_path_.value() + "/", + base::CompareCase::SENSITIVE)); exported_object_ = bus_->GetExportedObject(object_path_); diff --git a/chromeos/dbus/bluetooth_gatt_descriptor_service_provider.cc b/chromeos/dbus/bluetooth_gatt_descriptor_service_provider.cc index d09fd5e..3ed39b9 100644 --- a/chromeos/dbus/bluetooth_gatt_descriptor_service_provider.cc +++ b/chromeos/dbus/bluetooth_gatt_descriptor_service_provider.cc @@ -50,8 +50,9 @@ class BluetoothGattDescriptorServiceProviderImpl DCHECK(!uuid_.empty()); DCHECK(object_path_.IsValid()); DCHECK(characteristic_path_.IsValid()); - DCHECK(base::StartsWithASCII(object_path_.value(), - characteristic_path_.value() + "/", true)); + DCHECK(base::StartsWith(object_path_.value(), + characteristic_path_.value() + "/", + base::CompareCase::SENSITIVE)); exported_object_ = bus_->GetExportedObject(object_path_); diff --git a/chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc b/chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc index d77dc711..5a548de 100644 --- a/chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc +++ b/chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc @@ -29,8 +29,9 @@ FakeBluetoothGattCharacteristicServiceProvider:: DCHECK(service_path_.IsValid()); DCHECK(!uuid.empty()); DCHECK(delegate_); - DCHECK(base::StartsWithASCII(object_path_.value(), - service_path_.value() + "/", true)); + DCHECK(base::StartsWith(object_path_.value(), + service_path_.value() + "/", + base::CompareCase::SENSITIVE)); // TODO(armansito): Do something with |flags| and |permissions|. diff --git a/chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc b/chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc index bb4c55e..9779c3a 100644 --- a/chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc +++ b/chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc @@ -29,8 +29,9 @@ FakeBluetoothGattDescriptorServiceProvider:: DCHECK(characteristic_path_.IsValid()); DCHECK(!uuid.empty()); DCHECK(delegate_); - DCHECK(base::StartsWithASCII(object_path_.value(), - characteristic_path_.value() + "/", true)); + DCHECK(base::StartsWith(object_path_.value(), + characteristic_path_.value() + "/", + base::CompareCase::SENSITIVE)); // TODO(armansito): Do something with |permissions|. diff --git a/chromeos/dbus/fake_shill_service_client.cc b/chromeos/dbus/fake_shill_service_client.cc index 990a37b..f0cf5ad 100644 --- a/chromeos/dbus/fake_shill_service_client.cc +++ b/chromeos/dbus/fake_shill_service_client.cc @@ -407,16 +407,16 @@ bool FakeShillServiceClient::SetServiceProperty(const std::string& service_path, base::DictionaryValue new_properties; std::string changed_property; - bool case_sensitive = true; - if (base::StartsWithASCII(property, "Provider.", case_sensitive) || - base::StartsWithASCII(property, "OpenVPN.", case_sensitive) || - base::StartsWithASCII(property, "L2TPIPsec.", case_sensitive)) { + base::CompareCase case_sensitive = base::CompareCase::SENSITIVE; + if (base::StartsWith(property, "Provider.", case_sensitive) || + base::StartsWith(property, "OpenVPN.", case_sensitive) || + base::StartsWith(property, "L2TPIPsec.", case_sensitive)) { // These properties are only nested within the Provider dictionary if read // from Shill. Properties that start with "Provider" need to have that // stripped off, other properties are nested in the "Provider" dictionary // as-is. std::string key = property; - if (base::StartsWithASCII(property, "Provider.", case_sensitive)) + if (base::StartsWith(property, "Provider.", case_sensitive)) key = property.substr(strlen("Provider.")); base::DictionaryValue* provider = new base::DictionaryValue; provider->SetWithoutPathExpansion(key, value.DeepCopy()); diff --git a/chromeos/dbus/session_manager_client.cc b/chromeos/dbus/session_manager_client.cc index 395631c..438ec05 100644 --- a/chromeos/dbus/session_manager_client.cc +++ b/chromeos/dbus/session_manager_client.cc @@ -565,7 +565,8 @@ class SessionManagerClientImpl : public SessionManagerClient { LOG(ERROR) << "Invalid signal: " << signal->ToString(); return; } - const bool success = base::StartsWithASCII(result_string, "success", false); + const bool success = base::StartsWith(result_string, "success", + base::CompareCase::INSENSITIVE_ASCII); FOR_EACH_OBSERVER(Observer, observers_, OwnerKeySet(success)); } @@ -577,7 +578,8 @@ class SessionManagerClientImpl : public SessionManagerClient { LOG(ERROR) << "Invalid signal: " << signal->ToString(); return; } - const bool success = base::StartsWithASCII(result_string, "success", false); + const bool success = base::StartsWith(result_string, "success", + base::CompareCase::INSENSITIVE_ASCII); FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(success)); } diff --git a/chromeos/disks/disk_mount_manager.cc b/chromeos/disks/disk_mount_manager.cc index a046b21..ed2c597 100644 --- a/chromeos/disks/disk_mount_manager.cc +++ b/chromeos/disks/disk_mount_manager.cc @@ -276,8 +276,8 @@ class DiskMountManagerImpl : public DiskMountManager { for (MountPointMap::iterator it = mount_points_.begin(); it != mount_points_.end(); ++it) { - if (base::StartsWithASCII(it->second.source_path, mount_path, - true /*case sensitive*/)) { + if (base::StartsWith(it->second.source_path, mount_path, + base::CompareCase::SENSITIVE)) { // TODO(tbarzic): Handle the case where this fails. UnmountPath(it->second.mount_path, UNMOUNT_OPTIONS_NONE, @@ -606,7 +606,7 @@ class DiskMountManagerImpl : public DiskMountManager { it != system_path_prefixes_.end(); ++it) { const std::string& prefix = *it; - if (base::StartsWithASCII(system_path, prefix, true)) + if (base::StartsWith(system_path, prefix, base::CompareCase::SENSITIVE)) return prefix; } return base::EmptyString(); diff --git a/chromeos/settings/cros_settings_provider.cc b/chromeos/settings/cros_settings_provider.cc index dceed62..d6e9014 100644 --- a/chromeos/settings/cros_settings_provider.cc +++ b/chromeos/settings/cros_settings_provider.cc @@ -27,7 +27,7 @@ void CrosSettingsProvider::Set(const std::string& path, // It should not reach here from UI in the guest mode, but just in case. if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kGuestSession) && - !::base::StartsWithASCII(path, "cros.session.", true)) { + !base::StartsWith(path, "cros.session.", base::CompareCase::SENSITIVE)) { LOG(ERROR) << "Ignoring the guest request to change: " << path; return; } diff --git a/chromeos/system/version_loader.cc b/chromeos/system/version_loader.cc index 4e6272c..a5604d8 100644 --- a/chromeos/system/version_loader.cc +++ b/chromeos/system/version_loader.cc @@ -78,7 +78,8 @@ std::string ParseFirmware(const std::string& contents) { std::vector<std::string> lines; base::SplitString(contents, '\n', &lines); for (size_t i = 0; i < lines.size(); ++i) { - if (base::StartsWithASCII(lines[i], kFirmwarePrefix, false)) { + if (base::StartsWith(lines[i], kFirmwarePrefix, + base::CompareCase::INSENSITIVE_ASCII)) { std::string str = lines[i].substr(std::string(kFirmwarePrefix).size()); size_t found = str.find_first_not_of("| "); if (found != std::string::npos) diff --git a/components/autofill/content/renderer/form_autofill_util.cc b/components/autofill/content/renderer/form_autofill_util.cc index b2259ed..b6c54ac 100644 --- a/components/autofill/content/renderer/form_autofill_util.cc +++ b/components/autofill/content/renderer/form_autofill_util.cc @@ -1312,7 +1312,8 @@ bool UnownedFormElementsAndFieldSetsToFormData( std::string lang; if (!html_element.isNull()) lang = html_element.getAttribute("lang").utf8(); - if ((lang.empty() || base::StartsWithASCII(lang, "en", false)) && + if ((lang.empty() || + base::StartsWith(lang, "en", base::CompareCase::INSENSITIVE_ASCII)) && !MatchesPattern(document.title(), base::UTF8ToUTF16("payment|checkout|address|delivery|shipping"))) { return false; diff --git a/components/autofill/core/browser/autofill_download_manager.cc b/components/autofill/core/browser/autofill_download_manager.cc index efcabc7..c92217a 100644 --- a/components/autofill/core/browser/autofill_download_manager.cc +++ b/components/autofill/core/browser/autofill_download_manager.cc @@ -272,9 +272,9 @@ void AutofillDownloadManager::OnURLFetchComplete( case kHttpBadGateway: if (!source->GetResponseHeaders()->EnumerateHeader(NULL, "server", &server_header) || - base::StartsWithASCII(server_header.c_str(), - kAutofillQueryServerNameStartInHeader, - false) != 0) + base::StartsWith(server_header.c_str(), + kAutofillQueryServerNameStartInHeader, + base::CompareCase::INSENSITIVE_ASCII) != 0) break; // Bad gateway was received from Autofill servers. Fall through to back // off. diff --git a/components/autofill/core/browser/form_structure.cc b/components/autofill/core/browser/form_structure.cc index bb7889e..07f579f 100644 --- a/components/autofill/core/browser/form_structure.cc +++ b/components/autofill/core/browser/form_structure.cc @@ -72,7 +72,7 @@ const int kNumberOfMismatchesThreshold = 3; bool IsAutofillFieldMetadataEnabled() { const std::string group_name = base::FieldTrialList::FindFullName("AutofillFieldMetadata"); - return base::StartsWithASCII(group_name, "Enabled", true); + return base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE); } // Helper for |EncodeUploadRequest()| that creates a bit field corresponding to @@ -1151,7 +1151,8 @@ void FormStructure::ParseFieldTypesFromAutocompleteAttributes( // The preceding token, if any, may be a named section. const std::string kSectionPrefix = "section-"; if (!tokens.empty() && - base::StartsWithASCII(tokens.back(), kSectionPrefix, true)) { + base::StartsWith(tokens.back(), kSectionPrefix, + base::CompareCase::SENSITIVE)) { // Prepend this section name to the suffix set in the preceding block. section = tokens.back().substr(kSectionPrefix.size()) + section; tokens.pop_back(); diff --git a/components/cloud_devices/common/cloud_devices_urls.cc b/components/cloud_devices/common/cloud_devices_urls.cc index beaf705..5a9a15e4 100644 --- a/components/cloud_devices/common/cloud_devices_urls.cc +++ b/components/cloud_devices/common/cloud_devices_urls.cc @@ -85,7 +85,8 @@ bool IsCloudPrintURL(const GURL& url) { GURL cloud_print_url = GetCloudPrintURL(); return url.host() == cloud_print_url.host() && url.scheme() == cloud_print_url.scheme() && - base::StartsWithASCII(url.path(), cloud_print_url.path(), true); + base::StartsWith(url.path(), cloud_print_url.path(), + base::CompareCase::SENSITIVE); } GURL GetCloudPrintEnableURL(const std::string& proxy_id) { diff --git a/components/content_settings/core/common/content_settings_pattern_parser.cc b/components/content_settings/core/common/content_settings_pattern_parser.cc index cbdd260..7a5ca79 100644 --- a/components/content_settings/core/common/content_settings_pattern_parser.cc +++ b/components/content_settings/core/common/content_settings_pattern_parser.cc @@ -130,7 +130,8 @@ void PatternParser::Parse(const std::string& pattern_spec, host_component.len); if (host == kHostWildcard) { builder->WithDomainWildcard(); - } else if (base::StartsWithASCII(host, kDomainWildcard, true)) { + } else if (base::StartsWith(host, kDomainWildcard, + base::CompareCase::SENSITIVE)) { host = host.substr(kDomainWildcardLength); builder->WithDomainWildcard(); builder->WithHost(host); diff --git a/components/cronet/android/test/native_test_server.cc b/components/cronet/android/test/native_test_server.cc index 022b1c5..908ddb0 100644 --- a/components/cronet/android/test/native_test_server.cc +++ b/components/cronet/android/test/native_test_server.cc @@ -102,7 +102,8 @@ scoped_ptr<net::test_server::HttpResponse> NativeTestServerRequestHandler( return response.Pass(); } - if (base::StartsWithASCII(request.relative_url, kEchoHeaderPath, true)) { + if (base::StartsWith(request.relative_url, kEchoHeaderPath, + base::CompareCase::SENSITIVE)) { GURL url = g_test_server->GetURL(request.relative_url); auto it = request.headers.find(url.query()); if (it != request.headers.end()) { @@ -141,7 +142,8 @@ scoped_ptr<net::test_server::HttpResponse> SdchRequestHandler( DCHECK(get_data_dir); dir_path = dir_path.Append(FILE_PATH_LITERAL("test")); - if (base::StartsWithASCII(request.relative_url, kSdchPath, true)) { + if (base::StartsWith(request.relative_url, kSdchPath, + base::CompareCase::SENSITIVE)) { base::FilePath file_path = dir_path.Append("sdch/index"); scoped_ptr<CustomHttpResponse> response = ConstructResponseBasedOnFile(file_path).Pass(); @@ -162,7 +164,8 @@ scoped_ptr<net::test_server::HttpResponse> SdchRequestHandler( return response.Pass(); } - if (base::StartsWithASCII(request.relative_url, kSdchTestPath, true)) { + if (base::StartsWith(request.relative_url, kSdchTestPath, + base::CompareCase::SENSITIVE)) { auto avail_dictionary_header = request.headers.find("Avail-Dictionary"); if (avail_dictionary_header != request.headers.end()) { base::FilePath file_path = dir_path.Append( diff --git a/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc b/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc index 15e9dfe..d953a27 100644 --- a/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc +++ b/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc @@ -369,7 +369,8 @@ TEST_F(EnhancedBookmarkModelTest, TestDoubleEncodeDecode) { TEST_F(EnhancedBookmarkModelTest, TestRemoteId) { const BookmarkNode* node = AddBookmark(); // Verify that the remote id starts with the correct prefix. - EXPECT_TRUE(base::StartsWithASCII(model_->GetRemoteId(node), "ebc_", true)); + EXPECT_TRUE(base::StartsWith(model_->GetRemoteId(node), "ebc_", + base::CompareCase::SENSITIVE)); // Getting the remote id for nodes that don't have them should return the // empty string. diff --git a/components/favicon/core/favicon_driver_impl.cc b/components/favicon/core/favicon_driver_impl.cc index 9007569..bd22f7b 100644 --- a/components/favicon/core/favicon_driver_impl.cc +++ b/components/favicon/core/favicon_driver_impl.cc @@ -30,7 +30,7 @@ bool IsIconNTPEnabled() { if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableIconNtp)) return true; - return base::StartsWithASCII(group_name, "Enabled", true); + return base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE); } #if defined(OS_ANDROID) || defined(OS_IOS) diff --git a/components/gcm_driver/registration_info.cc b/components/gcm_driver/registration_info.cc index 90bf4e34..6fd9266 100644 --- a/components/gcm_driver/registration_info.cc +++ b/components/gcm_driver/registration_info.cc @@ -22,8 +22,8 @@ scoped_ptr<RegistrationInfo> RegistrationInfo::BuildFromString( std::string* registration_id) { scoped_ptr<RegistrationInfo> registration; - if (base::StartsWithASCII(serialzied_key, kInsanceIDSerializationPrefix, - true)) + if (base::StartsWith(serialzied_key, kInsanceIDSerializationPrefix, + base::CompareCase::SENSITIVE)) registration.reset(new InstanceIDTokenInfo); else registration.reset(new GCMRegistrationInfo); @@ -184,8 +184,8 @@ bool InstanceIDTokenInfo::Deserialize( if (serialized_key.empty() || serialized_value.empty()) return false; - if (!base::StartsWithASCII(serialized_key, kInsanceIDSerializationPrefix, - true)) + if (!base::StartsWith(serialized_key, kInsanceIDSerializationPrefix, + base::CompareCase::SENSITIVE)) return false; std::vector<std::string> fields = base::SplitString( diff --git a/components/google/core/browser/google_url_tracker.cc b/components/google/core/browser/google_url_tracker.cc index 770c9af..2ead364 100644 --- a/components/google/core/browser/google_url_tracker.cc +++ b/components/google/core/browser/google_url_tracker.cc @@ -97,7 +97,8 @@ void GoogleURLTracker::OnURLFetchComplete(const net::URLFetcher* source) { std::string url_str; source->GetResponseAsString(&url_str); base::TrimWhitespace(url_str, base::TRIM_ALL, &url_str); - if (!base::StartsWithASCII(url_str, ".google.", false)) + if (!base::StartsWith(url_str, ".google.", + base::CompareCase::INSENSITIVE_ASCII)) return; GURL url("https://www" + url_str); if (!url.is_valid() || (url.path().length() > 1) || url.has_query() || diff --git a/components/google/core/browser/google_util.cc b/components/google/core/browser/google_util.cc index 1eada34..2cdfe05 100644 --- a/components/google/core/browser/google_util.cc +++ b/components/google/core/browser/google_util.cc @@ -163,8 +163,8 @@ GURL CommandLineGoogleBaseURL() { bool StartsWithCommandLineGoogleBaseURL(const GURL& url) { GURL base_url(CommandLineGoogleBaseURL()); return base_url.is_valid() && - base::StartsWithASCII(url.possibly_invalid_spec(), base_url.spec(), - true); + base::StartsWith(url.possibly_invalid_spec(), base_url.spec(), + base::CompareCase::SENSITIVE); } bool IsGoogleHostname(const std::string& host, @@ -190,7 +190,8 @@ bool IsGoogleHomePageUrl(const GURL& url) { // Make sure the path is a known home page path. std::string path(url.path()); - return IsPathHomePageBase(path) || base::StartsWithASCII(path, "/ig", false); + return IsPathHomePageBase(path) || + base::StartsWith(path, "/ig", base::CompareCase::INSENSITIVE_ASCII); } bool IsGoogleSearchUrl(const GURL& url) { diff --git a/components/html_viewer/web_mime_registry_impl.cc b/components/html_viewer/web_mime_registry_impl.cc index a050693..caed089 100644 --- a/components/html_viewer/web_mime_registry_impl.cc +++ b/components/html_viewer/web_mime_registry_impl.cc @@ -44,7 +44,8 @@ WebMimeRegistryImpl::supportsImagePrefixedMIMEType( const blink::WebString& mime_type) { std::string ascii_mime_type = ToASCIIOrEmpty(mime_type); return (mime_util::IsSupportedImageMimeType(ascii_mime_type) || - (base::StartsWithASCII(ascii_mime_type, "image/", true) && + (base::StartsWith(ascii_mime_type, "image/", + base::CompareCase::SENSITIVE) && mime_util::IsSupportedNonImageMimeType(ascii_mime_type))) ? WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported; diff --git a/components/html_viewer/web_url_loader_impl.cc b/components/html_viewer/web_url_loader_impl.cc index 48d291f..0fa6b8e 100644 --- a/components/html_viewer/web_url_loader_impl.cc +++ b/components/html_viewer/web_url_loader_impl.cc @@ -30,10 +30,12 @@ blink::WebURLResponse::HTTPVersion StatusLineToHTTPVersion( if (status_line.is_null()) return blink::WebURLResponse::HTTP_0_9; - if (base::StartsWithASCII(status_line, "HTTP/1.0", true)) + if (base::StartsWith(status_line.get(), "HTTP/1.0", + base::CompareCase::SENSITIVE)) return blink::WebURLResponse::HTTP_1_0; - if (base::StartsWithASCII(status_line, "HTTP/1.1", true)) + if (base::StartsWith(status_line.get(), "HTTP/1.1", + base::CompareCase::SENSITIVE)) return blink::WebURLResponse::HTTP_1_1; return blink::WebURLResponse::Unknown; diff --git a/components/invalidation/impl/gcm_network_channel_unittest.cc b/components/invalidation/impl/gcm_network_channel_unittest.cc index 8efb2f47..e07788e 100644 --- a/components/invalidation/impl/gcm_network_channel_unittest.cc +++ b/components/invalidation/impl/gcm_network_channel_unittest.cc @@ -233,7 +233,8 @@ void TestNetworkChannelURLFetcher::AddExtraRequestHeader( net::FakeURLFetcher::AddExtraRequestHeader(header_line); std::string header_name("echo-token: "); std::string echo_token; - if (base::StartsWithASCII(header_line, header_name, false)) { + if (base::StartsWith(header_line, header_name, + base::CompareCase::INSENSITIVE_ASCII)) { echo_token = header_line; base::ReplaceFirstSubstringAfterOffset( &echo_token, 0, header_name, std::string()); diff --git a/components/mime_util/mime_util.cc b/components/mime_util/mime_util.cc index ef5e0da..49bf49d 100644 --- a/components/mime_util/mime_util.cc +++ b/components/mime_util/mime_util.cc @@ -161,10 +161,11 @@ bool MimeUtil::IsSupportedNonImageMimeType(const std::string& mime_type) const { #if !defined(OS_IOS) media::IsSupportedMediaMimeType(mime_type) || #endif - (base::StartsWithASCII(mime_type, "text/", - false /* case insensitive */) && + (base::StartsWith(mime_type, "text/", + base::CompareCase::INSENSITIVE_ASCII) && !IsUnsupportedTextMimeType(mime_type)) || - (base::StartsWithASCII(mime_type, "application/", false) && + (base::StartsWith(mime_type, "application/", + base::CompareCase::INSENSITIVE_ASCII) && net::MatchesMimeType("application/*+json", mime_type)); } @@ -179,7 +180,8 @@ bool MimeUtil::IsSupportedJavascriptMimeType( } bool MimeUtil::IsSupportedMimeType(const std::string& mime_type) const { - return (base::StartsWithASCII(mime_type, "image/", false) && + return (base::StartsWith(mime_type, "image/", + base::CompareCase::INSENSITIVE_ASCII) && IsSupportedImageMimeType(mime_type)) || IsSupportedNonImageMimeType(mime_type); } diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc index e40bdd3..3d67fc701 100644 --- a/components/nacl/renderer/ppb_nacl_private_impl.cc +++ b/components/nacl/renderer/ppb_nacl_private_impl.cc @@ -610,7 +610,8 @@ std::string PnaclComponentURLToFilename(const std::string& url) { // generated from ManifestResolveKey or PnaclResources::ReadResourceInfo. // So, it's safe to just use string parsing operations here instead of // URL-parsing ones. - DCHECK(base::StartsWithASCII(url, kPNaClTranslatorBaseUrl, true)); + DCHECK(base::StartsWith(url, kPNaClTranslatorBaseUrl, + base::CompareCase::SENSITIVE)); std::string r = url.substr(std::string(kPNaClTranslatorBaseUrl).length()); // Use white-listed-chars. diff --git a/components/password_manager/core/browser/affiliation_utils.cc b/components/password_manager/core/browser/affiliation_utils.cc index bd4bc5b..2b16e8b 100644 --- a/components/password_manager/core/browser/affiliation_utils.cc +++ b/components/password_manager/core/browser/affiliation_utils.cc @@ -302,7 +302,8 @@ bool IsAffiliationBasedMatchingEnabled(const base::CommandLine& command_line) { return false; if (command_line.HasSwitch(switches::kEnableAffiliationBasedMatching)) return true; - return base::StartsWithASCII(group_name, "Enabled", /*case_sensitive=*/false); + return base::StartsWith(group_name, "Enabled", + base::CompareCase::INSENSITIVE_ASCII); } bool IsPropagatingPasswordChangesToWebCredentialsEnabled( diff --git a/components/password_manager/core/browser/password_form_manager.cc b/components/password_manager/core/browser/password_form_manager.cc index 7815782..f6738f8 100644 --- a/components/password_manager/core/browser/password_form_manager.cc +++ b/components/password_manager/core/browser/password_form_manager.cc @@ -170,7 +170,7 @@ PasswordFormManager::MatchResultMask PasswordFormManager::DoesManage( origins_match = observed_form_.origin.host() == form.origin.host() && observed_form_.origin.port() == form.origin.port() && - base::StartsWithASCII(new_path, old_path, /*case_sensitive=*/true); + base::StartsWith(new_path, old_path, base::CompareCase::SENSITIVE); } if (!origins_match) @@ -400,7 +400,8 @@ void PasswordFormManager::OnRequestDone( // instead of explicitly handling empty path matches. bool is_credential_protected = observed_form_.scheme == PasswordForm::SCHEME_HTML && - base::StartsWithASCII("/", login->origin.path(), true) && + base::StartsWith("/", login->origin.path(), + base::CompareCase::SENSITIVE) && credential_scores[i] > 0 && !login->blacklisted_by_user; // Passwords generated on a signup form must show on a login form even if // there are better-matching saved credentials. TODO(gcasto): We don't diff --git a/components/proximity_auth/cryptauth/fake_secure_message_delegate.cc b/components/proximity_auth/cryptauth/fake_secure_message_delegate.cc index d05361c..4251e19 100644 --- a/components/proximity_auth/cryptauth/fake_secure_message_delegate.cc +++ b/components/proximity_auth/cryptauth/fake_secure_message_delegate.cc @@ -76,7 +76,8 @@ bool Verify(const std::string& signature, signing_key = key; } else { std::string prefix = kPrivateKeyPrefix; - bool is_private_key = base::StartsWithASCII(key, prefix, true); + bool is_private_key = + base::StartsWith(key, prefix, base::CompareCase::SENSITIVE); signing_key = is_private_key ? key.substr(prefix.size()) : prefix + key; } @@ -113,7 +114,7 @@ void FakeSecureMessageDelegate::DeriveKey(const std::string& private_key, // private key so it is equal to its corresponding public key. std::string prefix(kPrivateKeyPrefix); std::string normalized_private_key = - base::StartsWithASCII(private_key, prefix, true) + base::StartsWith(private_key, prefix, base::CompareCase::SENSITIVE) ? private_key.substr(prefix.size()) : private_key; diff --git a/components/suggestions/suggestions_service.cc b/components/suggestions/suggestions_service.cc index ee9e9d2..2cac424 100644 --- a/components/suggestions/suggestions_service.cc +++ b/components/suggestions/suggestions_service.cc @@ -178,8 +178,9 @@ void SuggestionsService::UndoBlacklistURL( // static bool SuggestionsService::GetBlacklistedUrl(const net::URLFetcher& request, GURL* url) { - bool is_blacklist_request = base::StartsWithASCII( - request.GetOriginalURL().spec(), kSuggestionsBlacklistURLPrefix, true); + bool is_blacklist_request = base::StartsWith( + request.GetOriginalURL().spec(), kSuggestionsBlacklistURLPrefix, + base::CompareCase::SENSITIVE); if (!is_blacklist_request) return false; // Extract the blacklisted URL from the blacklist request. diff --git a/components/translate/core/browser/translate_prefs.cc b/components/translate/core/browser/translate_prefs.cc index 24547005..571241a 100644 --- a/components/translate/core/browser/translate_prefs.cc +++ b/components/translate/core/browser/translate_prefs.cc @@ -511,7 +511,8 @@ void TranslatePrefs::CreateBlockedLanguages( TranslateDownloadManager::GetInstance()->application_locale(); std::string ui_lang = TranslateDownloadManager::GetLanguageCode(app_locale); bool is_ui_english = - ui_lang == "en" || base::StartsWithASCII(ui_lang, "en-", false); + ui_lang == "en" || + base::StartsWith(ui_lang, "en-", base::CompareCase::INSENSITIVE_ASCII); for (std::vector<std::string>::const_iterator it = accept_languages.begin(); it != accept_languages.end(); ++it) { diff --git a/components/translate/core/language_detection/language_detection_util.cc b/components/translate/core/language_detection/language_detection_util.cc index 1440714..fe2befe 100644 --- a/components/translate/core/language_detection/language_detection_util.cc +++ b/components/translate/core/language_detection/language_detection_util.cc @@ -198,7 +198,8 @@ bool CanCLDComplementSubCode( // which dialect is used, CLD language has priority. // TODO(hajimehoshi): How about the other dialects like zh-MO? return page_language == "zh" && - base::StartsWithASCII(cld_language, "zh-", false); + base::StartsWith(cld_language, "zh-", + base::CompareCase::INSENSITIVE_ASCII); } } // namespace @@ -381,7 +382,8 @@ bool IsSameOrSimilarLanguages(const std::string& page_language, bool MaybeServerWrongConfiguration(const std::string& page_language, const std::string& cld_language) { // If |page_language| is not "en-*", respect it and just return false here. - if (!base::StartsWithASCII(page_language, "en", false)) + if (!base::StartsWith(page_language, "en", + base::CompareCase::INSENSITIVE_ASCII)) return false; // A server provides a language meta information representing "en-*". But it diff --git a/components/url_fixer/url_fixer.cc b/components/url_fixer/url_fixer.cc index 7c04272..c34ac90 100644 --- a/components/url_fixer/url_fixer.cc +++ b/components/url_fixer/url_fixer.cc @@ -436,8 +436,9 @@ std::string SegmentURLInternal(std::string* text, url::Parsed* parts) { if (!found_scheme) { // Couldn't determine the scheme, so just pick one. parts->scheme.reset(); - scheme = base::StartsWithASCII(*text, "ftp.", false) ? url::kFtpScheme - : url::kHttpScheme; + scheme = base::StartsWith(*text, "ftp.", + base::CompareCase::INSENSITIVE_ASCII) ? + url::kFtpScheme : url::kHttpScheme; } } @@ -528,7 +529,8 @@ GURL url_fixer::FixupURL(const std::string& text, if (scheme == kViewSourceScheme) { // Reject "view-source:view-source:..." to avoid deep recursion. std::string view_source(kViewSourceScheme + std::string(":")); - if (!base::StartsWithASCII(text, view_source + view_source, false)) { + if (!base::StartsWith(text, view_source + view_source, + base::CompareCase::INSENSITIVE_ASCII)) { return GURL(kViewSourceScheme + std::string(":") + FixupURL(trimmed.substr(scheme.length() + 1), desired_tld) .possibly_invalid_spec()); diff --git a/components/user_manager/user_image/default_user_images.cc b/components/user_manager/user_image/default_user_images.cc index d4edf09..58ceacb 100644 --- a/components/user_manager/user_image/default_user_images.cc +++ b/components/user_manager/user_image/default_user_images.cc @@ -79,7 +79,7 @@ bool IsDefaultImageString(const std::string& s, const std::string& prefix, int* image_id) { DCHECK(image_id); - if (!base::StartsWithASCII(s, prefix, true)) + if (!base::StartsWith(s, prefix, base::CompareCase::SENSITIVE)) return false; int image_index = -1; diff --git a/components/variations/net/variations_http_header_provider.cc b/components/variations/net/variations_http_header_provider.cc index 583d77a..f94ad2c 100644 --- a/components/variations/net/variations_http_header_provider.cc +++ b/components/variations/net/variations_http_header_provider.cc @@ -97,7 +97,7 @@ bool VariationsHttpHeaderProvider::SetDefaultVariationIds( default_trigger_id_set_.clear(); return false; } - bool trigger_id = base::StartsWithASCII(*it, "t", true); + bool trigger_id = base::StartsWith(*it, "t", base::CompareCase::SENSITIVE); // Remove the "t" prefix if it's there. std::string entry = trigger_id ? it->substr(1) : *it; diff --git a/content/browser/accessibility/dump_accessibility_browsertest_base.cc b/content/browser/accessibility/dump_accessibility_browsertest_base.cc index 2a9a1ef..f86f5d4 100644 --- a/content/browser/accessibility/dump_accessibility_browsertest_base.cc +++ b/content/browser/accessibility/dump_accessibility_browsertest_base.cc @@ -102,19 +102,23 @@ void DumpAccessibilityTestBase::ParseHtmlForExtraDirectives( const std::string& deny_str = AccessibilityTreeFormatter::GetDenyString(); const std::string& wait_str = "@WAIT-FOR:"; - if (base::StartsWithASCII(line, allow_empty_str, true)) { + if (base::StartsWith(line, allow_empty_str, + base::CompareCase::SENSITIVE)) { filters->push_back( Filter(base::UTF8ToUTF16(line.substr(allow_empty_str.size())), Filter::ALLOW_EMPTY)); - } else if (base::StartsWithASCII(line, allow_str, true)) { + } else if (base::StartsWith(line, allow_str, + base::CompareCase::SENSITIVE)) { filters->push_back(Filter(base::UTF8ToUTF16( line.substr(allow_str.size())), Filter::ALLOW)); - } else if (base::StartsWithASCII(line, deny_str, true)) { + } else if (base::StartsWith(line, deny_str, + base::CompareCase::SENSITIVE)) { filters->push_back(Filter(base::UTF8ToUTF16( line.substr(deny_str.size())), Filter::DENY)); - } else if (base::StartsWithASCII(line, wait_str, true)) { + } else if (base::StartsWith(line, wait_str, + base::CompareCase::SENSITIVE)) { *wait_for = line.substr(wait_str.size()); } } diff --git a/content/browser/download/download_stats.cc b/content/browser/download/download_stats.cc index cc14b38..248ece0 100644 --- a/content/browser/download/download_stats.cc +++ b/content/browser/download/download_stats.cc @@ -481,14 +481,18 @@ void RecordDownloadMimeType(const std::string& mime_type_string) { // Do partial matches. if (download_content == DOWNLOAD_CONTENT_UNRECOGNIZED) { - if (base::StartsWithASCII(mime_type_string, "text/", true)) { + if (base::StartsWith(mime_type_string, "text/", + base::CompareCase::SENSITIVE)) { download_content = DOWNLOAD_CONTENT_TEXT; - } else if (base::StartsWithASCII(mime_type_string, "image/", true)) { + } else if (base::StartsWith(mime_type_string, "image/", + base::CompareCase::SENSITIVE)) { download_content = DOWNLOAD_CONTENT_IMAGE; RecordDownloadImageType(mime_type_string); - } else if (base::StartsWithASCII(mime_type_string, "audio/", true)) { + } else if (base::StartsWith(mime_type_string, "audio/", + base::CompareCase::SENSITIVE)) { download_content = DOWNLOAD_CONTENT_AUDIO; - } else if (base::StartsWithASCII(mime_type_string, "video/", true)) { + } else if (base::StartsWith(mime_type_string, "video/", + base::CompareCase::SENSITIVE)) { download_content = DOWNLOAD_CONTENT_VIDEO; } } diff --git a/content/browser/fileapi/fileapi_message_filter.cc b/content/browser/fileapi/fileapi_message_filter.cc index 0541c3a..1babfd5 100644 --- a/content/browser/fileapi/fileapi_message_filter.cc +++ b/content/browser/fileapi/fileapi_message_filter.cc @@ -597,8 +597,8 @@ void FileAPIMessageFilter::OnStartBuildingStream( const GURL& url, const std::string& content_type) { DCHECK_CURRENTLY_ON(BrowserThread::IO); // Only an internal Blob URL is expected here. See the BlobURL of the Blink. - if (!base::StartsWithASCII(url.path(), "blobinternal%3A///", - true /* case_sensitive */)) { + if (!base::StartsWith(url.path(), "blobinternal%3A///", + base::CompareCase::SENSITIVE)) { NOTREACHED() << "Malformed Stream URL: " << url.spec(); bad_message::ReceivedBadMessage(this, bad_message::FAMF_MALFORMED_STREAM_URL); diff --git a/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc b/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc index 7470d4f..5441452 100644 --- a/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc +++ b/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc @@ -42,7 +42,8 @@ bool IsGamepad(udev_device* dev, int* index, std::string* path) { return false; static const char kJoystickRoot[] = "/dev/input/js"; - bool is_gamepad = base::StartsWithASCII(node_path, kJoystickRoot, true); + bool is_gamepad = base::StartsWith(node_path, kJoystickRoot, + base::CompareCase::SENSITIVE); if (!is_gamepad) return false; diff --git a/content/browser/media/capture/web_contents_capture_util.cc b/content/browser/media/capture/web_contents_capture_util.cc index 508c3df..0edaf4a 100644 --- a/content/browser/media/capture/web_contents_capture_util.cc +++ b/content/browser/media/capture/web_contents_capture_util.cc @@ -22,7 +22,8 @@ bool WebContentsCaptureUtil::ExtractTabCaptureTarget( int* render_process_id, int* main_render_frame_id) { static const char kDeviceScheme[] = "web-contents-media-stream://"; - if (!base::StartsWithASCII(device_id_param, kDeviceScheme, true)) + if (!base::StartsWith(device_id_param, kDeviceScheme, + base::CompareCase::SENSITIVE)) return false; const std::string device_id = device_id_param.substr( diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index b060993..6fb58a9 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -2991,7 +2991,8 @@ extern NSString *NSTextInputReplacementRangeAttributeName; // We ignore commands that insert characters, because this was causing // strange behavior (e.g. tab always inserted a tab rather than moving to // the next field on the page). - if (!base::StartsWithASCII(command, "insert", false)) + if (!base::StartsWith(command, "insert", + base::CompareCase::INSENSITIVE_ASCII)) editCommands_.push_back(EditCommand(command, "")); } else { RenderWidgetHostImpl* rwh = renderWidgetHostView_->render_widget_host_; diff --git a/content/browser/service_worker/service_worker_database.cc b/content/browser/service_worker/service_worker_database.cc index 8e3c99a..ddfcb74 100644 --- a/content/browser/service_worker/service_worker_database.cc +++ b/content/browser/service_worker/service_worker_database.cc @@ -122,7 +122,7 @@ base::LazyInstance<ServiceWorkerEnv>::Leaky g_service_worker_env = bool RemovePrefix(const std::string& str, const std::string& prefix, std::string* out) { - if (!base::StartsWithASCII(str, prefix, true)) + if (!base::StartsWith(str, prefix, base::CompareCase::SENSITIVE)) return false; if (out) *out = str.substr(prefix.size()); diff --git a/content/browser/service_worker/service_worker_utils.cc b/content/browser/service_worker/service_worker_utils.cc index 7cfacce..71ddc61 100644 --- a/content/browser/service_worker/service_worker_utils.cc +++ b/content/browser/service_worker/service_worker_utils.cc @@ -36,7 +36,8 @@ bool PathContainsDisallowedCharacter(const GURL& url) { bool ServiceWorkerUtils::ScopeMatches(const GURL& scope, const GURL& url) { DCHECK(!scope.has_ref()); DCHECK(!url.has_ref()); - return base::StartsWithASCII(url.spec(), scope.spec(), true); + return base::StartsWith(url.spec(), scope.spec(), + base::CompareCase::SENSITIVE); } // static @@ -69,7 +70,8 @@ bool ServiceWorkerUtils::IsPathRestrictionSatisfied( } std::string scope_string = scope.path(); - if (!base::StartsWithASCII(scope_string, max_scope_string, true)) { + if (!base::StartsWith(scope_string, max_scope_string, + base::CompareCase::SENSITIVE)) { *error_message = "The path of the provided scope ('"; error_message->append(scope_string); error_message->append("') is not under the max scope allowed ("); diff --git a/content/browser/session_history_browsertest.cc b/content/browser/session_history_browsertest.cc index 263d66d..6578676 100644 --- a/content/browser/session_history_browsertest.cc +++ b/content/browser/session_history_browsertest.cc @@ -28,7 +28,8 @@ namespace { scoped_ptr<net::test_server::HttpResponse> HandleEchoTitleRequest( const std::string& echotitle_path, const net::test_server::HttpRequest& request) { - if (!base::StartsWithASCII(request.relative_url, echotitle_path, true)) + if (!base::StartsWith(request.relative_url, echotitle_path, + base::CompareCase::SENSITIVE)) return scoped_ptr<net::test_server::HttpResponse>(); scoped_ptr<net::test_server::BasicHttpResponse> http_response( diff --git a/content/browser/tracing/tracing_ui.cc b/content/browser/tracing/tracing_ui.cc index 1afff96..b83376d 100644 --- a/content/browser/tracing/tracing_ui.cc +++ b/content/browser/tracing/tracing_ui.cc @@ -207,7 +207,8 @@ bool OnBeginJSONRequest(const std::string& path, } const char* beginRecordingPath = "json/begin_recording?"; - if (base::StartsWithASCII(path, beginRecordingPath, true)) { + if (base::StartsWith(path, beginRecordingPath, + base::CompareCase::SENSITIVE)) { std::string data = path.substr(strlen(beginRecordingPath)); return BeginRecording(data, callback); } @@ -253,7 +254,7 @@ bool OnBeginJSONRequest(const std::string& path, bool OnTracingRequest(const std::string& path, const WebUIDataSource::GotDataCallback& callback) { - if (base::StartsWithASCII(path, "json/", true)) { + if (base::StartsWith(path, "json/", base::CompareCase::SENSITIVE)) { if (!OnBeginJSONRequest(path, callback)) { std::string error("##ERROR##"); callback.Run(base::RefCountedString::TakeString(&error)); diff --git a/content/browser/webui/shared_resources_data_source.cc b/content/browser/webui/shared_resources_data_source.cc index 95b4c21..32dc6c6 100644 --- a/content/browser/webui/shared_resources_data_source.cc +++ b/content/browser/webui/shared_resources_data_source.cc @@ -47,7 +47,8 @@ const ResourcesMap* CreateResourcesMap() { const int resource_id = kWebuiResources[i].value; AddResource(resource_name, resource_id, result); for (const char* (&alias)[2]: kPathAliases) { - if (base::StartsWithASCII(resource_name, alias[0], true)) { + if (base::StartsWith(resource_name, alias[0], + base::CompareCase::SENSITIVE)) { AddResource(alias[1] + resource_name.substr(strlen(alias[0])), resource_id, result); } diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc index 41f46d4..eb0c624 100644 --- a/content/child/blink_platform_impl.cc +++ b/content/child/blink_platform_impl.cc @@ -1074,8 +1074,8 @@ WebData BlinkPlatformImpl::loadResource(const char* name) { return WebData(); // Check the name prefix to see if it's an audio resource. - if (base::StartsWithASCII(name, "IRC_Composite", true) || - base::StartsWithASCII(name, "Composite", true)) + if (base::StartsWith(name, "IRC_Composite", base::CompareCase::SENSITIVE) || + base::StartsWith(name, "Composite", base::CompareCase::SENSITIVE)) return loadAudioSpatializationResource(name); // TODO(flackr): We should use a better than linear search here, a trie would diff --git a/content/child/multipart_response_delegate.cc b/content/child/multipart_response_delegate.cc index 2904d86..ecf7669 100644 --- a/content/child/multipart_response_delegate.cc +++ b/content/child/multipart_response_delegate.cc @@ -71,7 +71,7 @@ MultipartResponseDelegate::MultipartResponseDelegate( stop_sending_(false), has_sent_first_response_(false) { // Some servers report a boundary prefixed with "--". See bug 5786. - if (base::StartsWithASCII(boundary, "--", true)) { + if (base::StartsWith(boundary, "--", base::CompareCase::SENSITIVE)) { boundary_.assign(boundary); } else { boundary_.append(boundary); diff --git a/content/child/npapi/plugin_host.cc b/content/child/npapi/plugin_host.cc index e201ffb..e9cdb4a 100644 --- a/content/child/npapi/plugin_host.cc +++ b/content/child/npapi/plugin_host.cc @@ -464,7 +464,8 @@ static NPError PostURLNotify(NPP id, std::string file_path_ascii(buf); base::FilePath file_path; static const char kFileUrlPrefix[] = "file:"; - if (base::StartsWithASCII(file_path_ascii, kFileUrlPrefix, false)) { + if (base::StartsWith(file_path_ascii, kFileUrlPrefix, + base::CompareCase::INSENSITIVE_ASCII)) { GURL file_url(file_path_ascii); DCHECK(file_url.SchemeIsFile()); net::FileURLToFilePath(file_url, &file_path); diff --git a/content/child/simple_webmimeregistry_impl.cc b/content/child/simple_webmimeregistry_impl.cc index 68d8755..a25e2ae 100644 --- a/content/child/simple_webmimeregistry_impl.cc +++ b/content/child/simple_webmimeregistry_impl.cc @@ -42,7 +42,8 @@ WebMimeRegistry::SupportsType const WebString& mime_type) { std::string ascii_mime_type = ToASCIIOrEmpty(mime_type); return (mime_util::IsSupportedImageMimeType(ascii_mime_type) || - (base::StartsWithASCII(ascii_mime_type, "image/", true) && + (base::StartsWith(ascii_mime_type, "image/", + base::CompareCase::SENSITIVE) && mime_util::IsSupportedNonImageMimeType(ascii_mime_type))) ? WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported; diff --git a/content/common/appcache_interfaces.cc b/content/common/appcache_interfaces.cc index 5cb1064..af0d8c1 100644 --- a/content/common/appcache_interfaces.cc +++ b/content/common/appcache_interfaces.cc @@ -108,7 +108,8 @@ bool AppCacheNamespace::IsMatch(const GURL& url) const { base::ReplaceSubstringsAfterOffset(&pattern, 0, "?", "\\?"); return base::MatchPattern(url.spec(), pattern); } - return base::StartsWithASCII(url.spec(), namespace_url.spec(), true); + return base::StartsWith(url.spec(), namespace_url.spec(), + base::CompareCase::SENSITIVE); } bool IsSchemeSupportedForAppCache(const GURL& url) { diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc index 8d380a5..e1ddc2d 100644 --- a/content/public/test/browser_test_utils.cc +++ b/content/public/test/browser_test_utils.cc @@ -234,7 +234,8 @@ scoped_ptr<net::test_server::HttpResponse> CrossSiteRedirectResponseHandler( const GURL& server_base_url, const net::test_server::HttpRequest& request) { std::string prefix("/cross-site/"); - if (!base::StartsWithASCII(request.relative_url, prefix, true)) + if (!base::StartsWith(request.relative_url, prefix, + base::CompareCase::SENSITIVE)) return scoped_ptr<net::test_server::HttpResponse>(); std::string params = request.relative_url.substr(prefix.length()); diff --git a/content/public/test/test_launcher.cc b/content/public/test/test_launcher.cc index 187de3e..596a125 100644 --- a/content/public/test/test_launcher.cc +++ b/content/public/test/test_launcher.cc @@ -183,12 +183,14 @@ bool WrapperTestLauncherDelegate::ShouldRunTest( const std::string& test_name) { all_test_names_.insert(test_case_name + "." + test_name); - if (base::StartsWithASCII(test_name, kManualTestPrefix, true) && + if (base::StartsWith(test_name, kManualTestPrefix, + base::CompareCase::SENSITIVE) && !base::CommandLine::ForCurrentProcess()->HasSwitch(kRunManualTestsFlag)) { return false; } - if (base::StartsWithASCII(test_name, kPreTestPrefix, true)) { + if (base::StartsWith(test_name, kPreTestPrefix, + base::CompareCase::SENSITIVE)) { // We will actually run PRE_ tests, but to ensure they run on the same shard // as dependent tests, handle all these details internally. return false; diff --git a/content/renderer/savable_resources.cc b/content/renderer/savable_resources.cc index 933ce96..b5fdf8e 100644 --- a/content/renderer/savable_resources.cc +++ b/content/renderer/savable_resources.cc @@ -180,7 +180,8 @@ WebString GetSubResourceLinkFromElement(const WebElement& element) { // If value has content and not start with "javascript:" then return it, // otherwise return NULL. if (!value.isNull() && !value.isEmpty() && - !base::StartsWithASCII(value.utf8(), "javascript:", false)) + !base::StartsWith(value.utf8(), "javascript:", + base::CompareCase::INSENSITIVE_ASCII)) return value; return WebString(); diff --git a/extensions/browser/api/cast_channel/logger.cc b/extensions/browser/api/cast_channel/logger.cc index 38d8e61..9eb80db 100644 --- a/extensions/browser/api/cast_channel/logger.cc +++ b/extensions/browser/api/cast_channel/logger.cc @@ -251,7 +251,8 @@ void Logger::LogSocketEventForMessage(int channel_id, DCHECK(thread_checker_.CalledOnValidThread()); SocketEvent event = CreateEvent(event_type); - if (base::StartsWithASCII(message_namespace, kInternalNamespacePrefix, false)) + if (base::StartsWith(message_namespace, kInternalNamespacePrefix, + base::CompareCase::INSENSITIVE_ASCII)) event.set_message_namespace(message_namespace); event.set_details(details); diff --git a/extensions/browser/api/web_request/web_request_api.cc b/extensions/browser/api/web_request/web_request_api.cc index 1290440..8821232 100644 --- a/extensions/browser/api/web_request/web_request_api.cc +++ b/extensions/browser/api/web_request/web_request_api.cc @@ -137,8 +137,9 @@ int GetFrameId(bool is_main_frame, int frame_id) { bool IsWebRequestEvent(const std::string& event_name) { std::string web_request_event_name(event_name); - if (base::StartsWithASCII(web_request_event_name, - webview::kWebViewEventPrefix, true)) { + if (base::StartsWith(web_request_event_name, + webview::kWebViewEventPrefix, + base::CompareCase::SENSITIVE)) { web_request_event_name.replace( 0, strlen(webview::kWebViewEventPrefix), kWebRequestEventPrefix); } diff --git a/extensions/browser/guest_view/web_view/web_view_apitest.cc b/extensions/browser/guest_view/web_view/web_view_apitest.cc index 46744af..0e1b24e 100644 --- a/extensions/browser/guest_view/web_view/web_view_apitest.cc +++ b/extensions/browser/guest_view/web_view/web_view_apitest.cc @@ -59,13 +59,14 @@ static scoped_ptr<net::test_server::HttpResponse> UserAgentResponseHandler( const std::string& path, const GURL& redirect_target, const net::test_server::HttpRequest& request) { - if (!base::StartsWithASCII(path, request.relative_url, true)) + if (!base::StartsWith(path, request.relative_url, + base::CompareCase::SENSITIVE)) return scoped_ptr<net::test_server::HttpResponse>(); std::map<std::string, std::string>::const_iterator it = request.headers.find("User-Agent"); EXPECT_TRUE(it != request.headers.end()); - if (!base::StartsWithASCII("foobar", it->second, true)) + if (!base::StartsWith("foobar", it->second, base::CompareCase::SENSITIVE)) return scoped_ptr<net::test_server::HttpResponse>(); scoped_ptr<net::test_server::BasicHttpResponse> http_response( @@ -104,7 +105,8 @@ scoped_ptr<net::test_server::HttpResponse> RedirectResponseHandler( const std::string& path, const GURL& redirect_target, const net::test_server::HttpRequest& request) { - if (!base::StartsWithASCII(path, request.relative_url, true)) + if (!base::StartsWith(path, request.relative_url, + base::CompareCase::SENSITIVE)) return scoped_ptr<net::test_server::HttpResponse>(); scoped_ptr<net::test_server::BasicHttpResponse> http_response( @@ -118,7 +120,8 @@ scoped_ptr<net::test_server::HttpResponse> RedirectResponseHandler( scoped_ptr<net::test_server::HttpResponse> EmptyResponseHandler( const std::string& path, const net::test_server::HttpRequest& request) { - if (base::StartsWithASCII(path, request.relative_url, true)) { + if (base::StartsWith(path, request.relative_url, + base::CompareCase::SENSITIVE)) { return scoped_ptr<net::test_server::HttpResponse>(new EmptyHttpResponse); } diff --git a/extensions/browser/guest_view/web_view/web_view_guest.cc b/extensions/browser/guest_view/web_view/web_view_guest.cc index 1ee9252..a71fda9 100644 --- a/extensions/browser/guest_view/web_view/web_view_guest.cc +++ b/extensions/browser/guest_view/web_view/web_view_guest.cc @@ -153,7 +153,8 @@ void ParsePartitionParam(const base::DictionaryValue& create_params, // UTF-8 encoded |partition_id|. If the prefix is a match, we can safely // remove the prefix without splicing in the middle of a multi-byte codepoint. // We can use the rest of the string as UTF-8 encoded one. - if (base::StartsWithASCII(partition_str, "persist:", true)) { + if (base::StartsWith(partition_str, "persist:", + base::CompareCase::SENSITIVE)) { size_t index = partition_str.find(":"); CHECK(index != std::string::npos); // It is safe to do index + 1, since we tested for the full prefix above. diff --git a/extensions/browser/warning_set.cc b/extensions/browser/warning_set.cc index 5cd7190..453c1c5 100644 --- a/extensions/browser/warning_set.cc +++ b/extensions/browser/warning_set.cc @@ -195,7 +195,7 @@ std::string Warning::GetLocalizedMessage(const ExtensionSet* extensions) const { std::vector<base::string16> final_parameters; for (size_t i = 0; i < message_parameters_.size(); ++i) { std::string message = message_parameters_[i]; - if (base::StartsWithASCII(message, kTranslate, true)) { + if (base::StartsWith(message, kTranslate, base::CompareCase::SENSITIVE)) { std::string extension_id = message.substr(sizeof(kTranslate) - 1); const extensions::Extension* extension = extensions->GetByID(extension_id); 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'") { diff --git a/extensions/common/extension.cc b/extensions/common/extension.cc index d42fce6..b680385 100644 --- a/extensions/common/extension.cc +++ b/extensions/common/extension.cc @@ -154,7 +154,8 @@ GURL Extension::GetResourceURL(const GURL& extension_url, path = relative_path.substr(1); GURL ret_val = GURL(extension_url.spec() + path); - DCHECK(base::StartsWithASCII(ret_val.spec(), extension_url.spec(), false)); + DCHECK(base::StartsWith(ret_val.spec(), extension_url.spec(), + base::CompareCase::INSENSITIVE_ASCII)); return ret_val; } @@ -205,7 +206,8 @@ bool Extension::ParsePEMKeyBytes(const std::string& input, return false; std::string working = input; - if (base::StartsWithASCII(working, kKeyBeginHeaderMarker, true)) { + if (base::StartsWith(working, kKeyBeginHeaderMarker, + base::CompareCase::SENSITIVE)) { working = base::CollapseWhitespaceASCII(working, true); size_t header_pos = working.find(kKeyInfoEndMarker, sizeof(kKeyBeginHeaderMarker) - 1); diff --git a/extensions/common/permissions/permissions_info.cc b/extensions/common/permissions/permissions_info.cc index ad64fd5c..e83fb2e 100644 --- a/extensions/common/permissions/permissions_info.cc +++ b/extensions/common/permissions/permissions_info.cc @@ -64,7 +64,7 @@ APIPermissionSet PermissionsInfo::GetAllByName( bool PermissionsInfo::HasChildPermissions(const std::string& name) const { NameMap::const_iterator i = name_map_.lower_bound(name + '.'); if (i == name_map_.end()) return false; - return base::StartsWithASCII(i->first, name + '.', true); + return base::StartsWith(i->first, name + '.', base::CompareCase::SENSITIVE); } PermissionsInfo::PermissionsInfo() diff --git a/extensions/shell/common/shell_content_client_unittest.cc b/extensions/shell/common/shell_content_client_unittest.cc index eb9694d..ba1540b 100644 --- a/extensions/shell/common/shell_content_client_unittest.cc +++ b/extensions/shell/common/shell_content_client_unittest.cc @@ -20,7 +20,8 @@ TEST_F(ShellContentClientTest, UserAgentFormat) { std::string user_agent = client.GetUserAgent(); // Must start with the usual Mozilla-compatibility string. - EXPECT_TRUE(base::StartsWithASCII(user_agent, "Mozilla/5.0", false)) + EXPECT_TRUE(base::StartsWith(user_agent, "Mozilla/5.0", + base::CompareCase::INSENSITIVE_ASCII)) << user_agent; // Must contain a substring like "Chrome/1.2.3.4". diff --git a/google_apis/drive/test_util.cc b/google_apis/drive/test_util.cc index f74c794..aa2d9eb 100644 --- a/google_apis/drive/test_util.cc +++ b/google_apis/drive/test_util.cc @@ -26,7 +26,7 @@ namespace test_util { bool RemovePrefix(const std::string& input, const std::string& prefix, std::string* output) { - if (!base::StartsWithASCII(input, prefix, true /* case sensitive */)) + if (!base::StartsWith(input, prefix, base::CompareCase::SENSITIVE)) return false; *output = input.substr(prefix.size()); diff --git a/google_apis/gaia/fake_gaia.cc b/google_apis/gaia/fake_gaia.cc index 7c73dd8..2d3ff92 100644 --- a/google_apis/gaia/fake_gaia.cc +++ b/google_apis/gaia/fake_gaia.cc @@ -102,8 +102,8 @@ bool GetAccessToken(const HttpRequest& request, std::map<std::string, std::string>::const_iterator auth_header_entry = request.headers.find("Authorization"); if (auth_header_entry != request.headers.end()) { - if (base::StartsWithASCII(auth_header_entry->second, auth_token_prefix, - true)) { + if (base::StartsWith(auth_header_entry->second, auth_token_prefix, + base::CompareCase::SENSITIVE)) { *access_token = auth_header_entry->second.substr( strlen(auth_token_prefix)); return true; diff --git a/google_apis/gaia/gaia_auth_fetcher.cc b/google_apis/gaia/gaia_auth_fetcher.cc index 9175bd2..04ebd6e 100644 --- a/google_apis/gaia/gaia_auth_fetcher.cc +++ b/google_apis/gaia/gaia_auth_fetcher.cc @@ -519,8 +519,8 @@ bool GaiaAuthFetcher::ParseClientLoginToOAuth2Cookie(const std::string& cookie, std::vector<std::string>::const_iterator iter; for (iter = parts.begin(); iter != parts.end(); ++iter) { const std::string& part = *iter; - if (base::StartsWithASCII(part, kClientLoginToOAuth2CookiePartCodePrefix, - false)) { + if (base::StartsWith(part, kClientLoginToOAuth2CookiePartCodePrefix, + base::CompareCase::INSENSITIVE_ASCII)) { auth_code->assign(part.substr( kClientLoginToOAuth2CookiePartCodePrefixLength)); return true; @@ -1051,8 +1051,9 @@ void GaiaAuthFetcher::DispatchFetchedRequest( OnClientLoginFetched(data, status, response_code); } else if (url == issue_auth_token_gurl_) { OnIssueAuthTokenFetched(data, status, response_code); - } else if (base::StartsWithASCII(url.spec(), - client_login_to_oauth2_gurl_.spec(), true)) { + } else if (base::StartsWith(url.spec(), + client_login_to_oauth2_gurl_.spec(), + base::CompareCase::SENSITIVE)) { OnClientLoginToOAuth2Fetched(data, cookies, status, response_code); } else if (url == oauth2_token_gurl_) { OnOAuth2TokenPairFetched(data, status, response_code); diff --git a/google_apis/gcm/engine/gcm_store_impl.cc b/google_apis/gcm/engine/gcm_store_impl.cc index a4cbfe2..8ac2521 100644 --- a/google_apis/gcm/engine/gcm_store_impl.cc +++ b/google_apis/gcm/engine/gcm_store_impl.cc @@ -357,7 +357,8 @@ void GCMStoreImpl::Backend::Load(StoreOpenMode open_mode, int gcm_registration_count = 0; int instance_id_token_count = 0; for (const auto& registration : result->registrations) { - if (base::StartsWithASCII(registration.first, "iid-", true)) + if (base::StartsWith(registration.first, "iid-", + base::CompareCase::SENSITIVE)) instance_id_token_count++; else gcm_registration_count++; diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc index 276cb7d..66da950 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc @@ -63,7 +63,8 @@ void NormalizeInitState(gpu::gles2::GLES2DecoderTestBase::InitState* init) { return; if (!init->extensions.empty()) init->extensions += " "; - if (base::StartsWithASCII(init->gl_version, "opengl es", false)) { + if (base::StartsWith(init->gl_version, "opengl es", + base::CompareCase::INSENSITIVE_ASCII)) { init->extensions += kVAOExtensions[0]; } else { #if !defined(OS_MACOSX) diff --git a/gpu/config/gpu_control_list.cc b/gpu/config/gpu_control_list.cc index e187b5f..401379d 100644 --- a/gpu/config/gpu_control_list.cc +++ b/gpu/config/gpu_control_list.cc @@ -1029,7 +1029,8 @@ bool GpuControlList::GpuControlListEntry::GLVersionInfoMismatch( gl_type = kGLTypeGLES; if (segments.size() > 3 && - base::StartsWithASCII(segments[3], "(ANGLE", false)) { + base::StartsWith(segments[3], "(ANGLE", + base::CompareCase::INSENSITIVE_ASCII)) { gl_type = kGLTypeANGLE; } } else { diff --git a/gpu/config/gpu_info_collector_linux.cc b/gpu/config/gpu_info_collector_linux.cc index 413e949..976aff6 100644 --- a/gpu/config/gpu_info_collector_linux.cc +++ b/gpu/config/gpu_info_collector_linux.cc @@ -56,7 +56,8 @@ std::string CollectDriverVersionATI() { base::StringTokenizer t(contents, "\r\n"); while (t.GetNext()) { std::string line = t.token(); - if (base::StartsWithASCII(line, "ReleaseVersion=", true)) { + if (base::StartsWith(line, "ReleaseVersion=", + base::CompareCase::SENSITIVE)) { size_t begin = line.find_first_of("0123456789"); if (begin != std::string::npos) { size_t end = line.find_first_not_of("0123456789.", begin); @@ -244,7 +245,7 @@ CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) { DCHECK(gpu_info); std::string gl_version = gpu_info->gl_version; - if (base::StartsWithASCII(gl_version, "OpenGL ES", true)) + if (base::StartsWith(gl_version, "OpenGL ES", base::CompareCase::SENSITIVE)) gl_version = gl_version.substr(10); std::vector<std::string> pieces; base::SplitStringAlongWhitespace(gl_version, &pieces); diff --git a/gpu/config/gpu_test_expectations_parser.cc b/gpu/config/gpu_test_expectations_parser.cc index ca4031d..11aa471 100644 --- a/gpu/config/gpu_test_expectations_parser.cc +++ b/gpu/config/gpu_test_expectations_parser.cc @@ -131,9 +131,9 @@ const char* kErrorMessage[] = { }; Token ParseToken(const std::string& word) { - if (base::StartsWithASCII(word, "//", false)) + if (base::StartsWith(word, "//", base::CompareCase::INSENSITIVE_ASCII)) return kTokenComment; - if (base::StartsWithASCII(word, "0x", false)) + if (base::StartsWith(word, "0x", base::CompareCase::INSENSITIVE_ASCII)) return kConfigGPUDeviceID; for (int32 i = 0; i < kNumberOfExactMatchTokens; ++i) { diff --git a/ios/chrome/app/safe_mode_util_unittest.cc b/ios/chrome/app/safe_mode_util_unittest.cc index 1c9de67..c5f1d5b 100644 --- a/ios/chrome/app/safe_mode_util_unittest.cc +++ b/ios/chrome/app/safe_mode_util_unittest.cc @@ -27,7 +27,8 @@ TEST_F(SafeModeUtilTest, GetAllImages) { string lib_system_prefix("libSystem"); for (size_t i = 0; i < images.size(); ++i) { string base_name = base::FilePath(images[i]).BaseName().value(); - if (base::StartsWithASCII(base_name, lib_system_prefix, true)) { + if (base::StartsWith(base_name, lib_system_prefix, + base::CompareCase::SENSITIVE)) { found_lib_system = true; break; } diff --git a/ios/chrome/browser/experimental_flags.mm b/ios/chrome/browser/experimental_flags.mm index 79718eb..a44cfeb 100644 --- a/ios/chrome/browser/experimental_flags.mm +++ b/ios/chrome/browser/experimental_flags.mm @@ -71,7 +71,8 @@ bool IsWKWebViewEnabled() { } // Check if the finch experiment is turned on. - return base::StartsWithASCII(group_name, "Enabled", false); + return base::StartsWith(group_name, "Enabled", + base::CompareCase::INSENSITIVE_ASCII); } size_t MemoryWedgeSizeInMB() { diff --git a/ios/net/clients/crn_forwarding_network_client_factory_unittest.mm b/ios/net/clients/crn_forwarding_network_client_factory_unittest.mm index 4364cdb..89c713b 100644 --- a/ios/net/clients/crn_forwarding_network_client_factory_unittest.mm +++ b/ios/net/clients/crn_forwarding_network_client_factory_unittest.mm @@ -142,7 +142,8 @@ TEST_F(ForwardingNetworkClientFactoryTest, TestSubclassImplementations) { for (NSInteger i = 0; i < class_count; i++) { std::string class_name = class_getName(classes[i]); // Skip the test classes defined above. - if (base::StartsWithASCII(class_name, "TestFactory", false)) + if (base::StartsWith(class_name, "TestFactory", + base::CompareCase::INSENSITIVE_ASCII)) continue; Class subclass_super = classes[i]; diff --git a/media/base/android/media_codec_bridge.cc b/media/base/android/media_codec_bridge.cc index 3d22752..f076b21 100644 --- a/media/base/android/media_codec_bridge.cc +++ b/media/base/android/media_codec_bridge.cc @@ -246,10 +246,14 @@ bool MediaCodecBridge::IsKnownUnaccelerated(const std::string& mime_type, // devices while HW decoder video freezes and distortions are // investigated - http://crbug.com/446974. if (codec_name.length() > 0) { - return (base::StartsWithASCII(codec_name, "OMX.google.", true) || - base::StartsWithASCII(codec_name, "OMX.SEC.", true) || - base::StartsWithASCII(codec_name, "OMX.MTK.", true) || - base::StartsWithASCII(codec_name, "OMX.Exynos.", true)); + return (base::StartsWith(codec_name, "OMX.google.", + base::CompareCase::SENSITIVE) || + base::StartsWith(codec_name, "OMX.SEC.", + base::CompareCase::SENSITIVE) || + base::StartsWith(codec_name, "OMX.MTK.", + base::CompareCase::SENSITIVE) || + base::StartsWith(codec_name, "OMX.Exynos.", + base::CompareCase::SENSITIVE)); } return true; } diff --git a/media/base/android/media_player_bridge.cc b/media/base/android/media_player_bridge.cc index 5cc8b39..ad95c530 100644 --- a/media/base/android/media_player_bridge.cc +++ b/media/base/android/media_player_bridge.cc @@ -160,7 +160,7 @@ void MediaPlayerBridge::SetDataSource(const std::string& url) { DCHECK(j_context); const std::string data_uri_prefix("data:"); - if (base::StartsWithASCII(url, data_uri_prefix, true)) { + if (base::StartsWith(url, data_uri_prefix, base::CompareCase::SENSITIVE)) { if (!Java_MediaPlayerBridge_setDataUriDataSource( env, j_media_player_bridge_.obj(), j_context, j_url_string.obj())) { OnMediaError(MEDIA_ERROR_FORMAT); diff --git a/media/base/key_systems.cc b/media/base/key_systems.cc index 32fa1c7..78029e1 100644 --- a/media/base/key_systems.cc +++ b/media/base/key_systems.cc @@ -674,12 +674,14 @@ EmeConfigRule KeySystemsImpl::GetContentTypeConfigRule( SupportedCodecs media_type_codec_mask = EME_CODEC_NONE; switch (media_type) { case EmeMediaType::AUDIO: - if (!base::StartsWithASCII(container_mime_type, "audio/", true)) + if (!base::StartsWith(container_mime_type, "audio/", + base::CompareCase::SENSITIVE)) return EmeConfigRule::NOT_SUPPORTED; media_type_codec_mask = audio_codec_mask_; break; case EmeMediaType::VIDEO: - if (!base::StartsWithASCII(container_mime_type, "video/", true)) + if (!base::StartsWith(container_mime_type, "video/", + base::CompareCase::SENSITIVE)) return EmeConfigRule::NOT_SUPPORTED; media_type_codec_mask = video_codec_mask_; break; diff --git a/media/base/mime_util.cc b/media/base/mime_util.cc index 535837c..8878edd 100644 --- a/media/base/mime_util.cc +++ b/media/base/mime_util.cc @@ -528,8 +528,8 @@ static bool ParseH264CodecID(const std::string& codec_id, bool* is_ambiguous) { // Make sure we have avc1.xxxxxx or avc3.xxxxxx if (codec_id.size() != 11 || - (!base::StartsWithASCII(codec_id, "avc1.", true) && - !base::StartsWithASCII(codec_id, "avc3.", true))) { + (!base::StartsWith(codec_id, "avc1.", base::CompareCase::SENSITIVE) && + !base::StartsWith(codec_id, "avc3.", base::CompareCase::SENSITIVE))) { return false; } diff --git a/media/renderers/video_renderer_impl.cc b/media/renderers/video_renderer_impl.cc index 4922582..1160b65 100644 --- a/media/renderers/video_renderer_impl.cc +++ b/media/renderers/video_renderer_impl.cc @@ -37,7 +37,8 @@ static bool ShouldUseVideoRenderingPath() { base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableNewVideoRenderer); return !disabled_via_cli && - !base::StartsWithASCII(group_name, "Disabled", true); + !base::StartsWith(group_name, "Disabled", + base::CompareCase::SENSITIVE); } VideoRendererImpl::VideoRendererImpl( diff --git a/media/video/capture/win/video_capture_device_factory_win.cc b/media/video/capture/win/video_capture_device_factory_win.cc index 1c1dd3d..96b11de 100644 --- a/media/video/capture/win/video_capture_device_factory_win.cc +++ b/media/video/capture/win/video_capture_device_factory_win.cc @@ -108,7 +108,8 @@ static bool IsDeviceBlackListed(const std::string& name) { DCHECK_EQ(BLACKLISTED_CAMERA_MAX + 1, static_cast<int>(arraysize(kBlacklistedCameraNames))); for (size_t i = 0; i < arraysize(kBlacklistedCameraNames); ++i) { - if (base::StartsWithASCII(name, kBlacklistedCameraNames[i], false)) { + if (base::StartsWith(name, kBlacklistedCameraNames[i], + base::CompareCase::INSENSITIVE_ASCII)) { DVLOG(1) << "Enumerated blacklisted device: " << name; UMA_HISTOGRAM_ENUMERATION("Media.VideoCapture.BlacklistedDevice", i, BLACKLISTED_CAMERA_MAX + 1); diff --git a/mojo/runner/shell_apptest.cc b/mojo/runner/shell_apptest.cc index 2a943d6..13ddf36 100644 --- a/mojo/runner/shell_apptest.cc +++ b/mojo/runner/shell_apptest.cc @@ -42,7 +42,8 @@ class GetHandler : public http_server::HttpHandler { http_server::HttpRequestPtr request, const Callback<void(http_server::HttpResponsePtr)>& callback) override { http_server::HttpResponsePtr response; - if (base::StartsWithASCII(request->relative_url, "/app", true)) { + if (base::StartsWith(request->relative_url, "/app", + base::CompareCase::SENSITIVE)) { response = http_server::CreateHttpResponse( 200, std::string(kPingable.data, kPingable.size)); response->content_type = "application/octet-stream"; diff --git a/pdf/document_loader.cc b/pdf/document_loader.cc index 28a6ee4..a156cbe 100644 --- a/pdf/document_loader.cc +++ b/pdf/document_loader.cc @@ -29,7 +29,8 @@ bool GetByteRange(const std::string& headers, uint32_t* start, uint32_t* end) { while (it.GetNext()) { if (base::LowerCaseEqualsASCII(it.name(), "content-range")) { std::string range = it.values().c_str(); - if (base::StartsWithASCII(range, "bytes", false)) { + if (base::StartsWith(range, "bytes", + base::CompareCase::INSENSITIVE_ASCII)) { range = range.substr(strlen("bytes")); std::string::size_type pos = range.find('-'); std::string range_end; @@ -53,7 +54,7 @@ std::string GetMultiPartBoundary(const std::string& headers) { while (it.GetNext()) { if (base::LowerCaseEqualsASCII(it.name(), "content-type")) { std::string type = base::StringToLowerASCII(it.values()); - if (base::StartsWithASCII(type, "multipart/", true)) { + if (base::StartsWith(type, "multipart/", base::CompareCase::SENSITIVE)) { const char* boundary = strstr(type.c_str(), "boundary="); if (!boundary) { NOTREACHED(); @@ -121,8 +122,10 @@ bool DocumentLoader::Init(const pp::URLLoader& loader, // This happens for PDFs not loaded from http(s) sources. if (response_headers == "Content-Type: text/plain") { - if (!base::StartsWithASCII(url, "http://", false) && - !base::StartsWithASCII(url, "https://", false)) { + if (!base::StartsWith(url, "http://", + base::CompareCase::INSENSITIVE_ASCII) && + !base::StartsWith(url, "https://", + base::CompareCase::INSENSITIVE_ASCII)) { type = "application/pdf"; } } @@ -150,7 +153,8 @@ bool DocumentLoader::Init(const pp::URLLoader& loader, } if (!type.empty() && !IsValidContentType(type)) return false; - if (base::StartsWithASCII(disposition, "attachment", false)) + if (base::StartsWith(disposition, "attachment", + base::CompareCase::INSENSITIVE_ASCII)) return false; if (content_length > 0) diff --git a/remoting/host/it2me/it2me_native_messaging_host.cc b/remoting/host/it2me/it2me_native_messaging_host.cc index ddd58d3..1bf175e 100644 --- a/remoting/host/it2me/it2me_native_messaging_host.cc +++ b/remoting/host/it2me/it2me_native_messaging_host.cc @@ -168,8 +168,8 @@ void It2MeNativeMessagingHost::ProcessConnect( // the authServiceWithToken field. But auth service part is always expected to // be set to oauth2. const char kOAuth2ServicePrefix[] = "oauth2:"; - if (!base::StartsWithASCII(auth_service_with_token, kOAuth2ServicePrefix, - true)) { + if (!base::StartsWith(auth_service_with_token, kOAuth2ServicePrefix, + base::CompareCase::SENSITIVE)) { SendErrorAndExit(response.Pass(), "Invalid 'authServiceWithToken': " + auth_service_with_token); return; diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc index 0970feb..7658bd0 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc @@ -1134,7 +1134,8 @@ void HostProcess::ApplyUsernamePolicy() { std::string username = GetUsername(); bool shutdown = username.empty() || - !base::StartsWithASCII(host_owner_, username + std::string("@"), false); + !base::StartsWith(host_owner_, username + std::string("@"), + base::CompareCase::INSENSITIVE_ASCII); #if defined(OS_MACOSX) // On Mac, we run as root at the login screen, so the username won't match. diff --git a/remoting/protocol/me2me_host_authenticator_factory.cc b/remoting/protocol/me2me_host_authenticator_factory.cc index abf8541..4b07d83 100644 --- a/remoting/protocol/me2me_host_authenticator_factory.cc +++ b/remoting/protocol/me2me_host_authenticator_factory.cc @@ -129,7 +129,8 @@ scoped_ptr<Authenticator> Me2MeHostAuthenticatorFactory::CreateAuthenticator( // Verify that the client's jid is an ASCII string, and then check that the // client JID has the expected prefix. Comparison is case insensitive. if (!base::IsStringASCII(remote_jid) || - !base::StartsWithASCII(remote_jid, remote_jid_prefix + '/', false)) { + !base::StartsWith(remote_jid, remote_jid_prefix + '/', + base::CompareCase::INSENSITIVE_ASCII)) { LOG(ERROR) << "Rejecting incoming connection from " << remote_jid; return make_scoped_ptr(new RejectingAuthenticator()); } diff --git a/rlz/lib/rlz_lib.cc b/rlz/lib/rlz_lib.cc index 4a3cfde..c5403f6 100644 --- a/rlz/lib/rlz_lib.cc +++ b/rlz/lib/rlz_lib.cc @@ -422,7 +422,8 @@ bool IsPingResponseValid(const char* response, int* checksum_idx) { return false; } else { checksum_param = "crc32: "; // Empty response case. - if (!base::StartsWithASCII(response_string, checksum_param, true)) + if (!base::StartsWith(response_string, checksum_param, + base::CompareCase::SENSITIVE)) return false; checksum_index = 0; @@ -534,8 +535,8 @@ bool ParsePingResponse(Product product, const char* response) { std::string response_line; response_line = response_string.substr(line_begin, line_end - line_begin); - if (base::StartsWithASCII(response_line, kRlzCgiVariable, - true)) { // An RLZ. + if (base::StartsWith(response_line, kRlzCgiVariable, + base::CompareCase::SENSITIVE)) { // An RLZ. int separator_index = -1; if ((separator_index = response_line.find(": ")) < 0) continue; // Not a valid key-value pair. @@ -561,7 +562,8 @@ bool ParsePingResponse(Product product, const char* response) { if (IsAccessPointSupported(point)) SetAccessPointRlz(point, rlz_value.substr(0, rlz_length).c_str()); - } else if (base::StartsWithASCII(response_line, events_variable, true)) { + } else if (base::StartsWith(response_line, events_variable, + base::CompareCase::SENSITIVE)) { // Clear events which server parsed. std::vector<ReturnedEvent> event_array; GetEventsFromResponseString(response_line, events_variable, &event_array); @@ -569,8 +571,8 @@ bool ParsePingResponse(Product product, const char* response) { ClearProductEvent(product, event_array[i].access_point, event_array[i].event_type); } - } else if (base::StartsWithASCII(response_line, stateful_events_variable, - true)) { + } else if (base::StartsWith(response_line, stateful_events_variable, + base::CompareCase::SENSITIVE)) { // Record any stateful events the server send over. std::vector<ReturnedEvent> event_array; GetEventsFromResponseString(response_line, stateful_events_variable, diff --git a/rlz/win/lib/machine_deal.cc b/rlz/win/lib/machine_deal.cc index 7c8bbaa..8d6d369e 100644 --- a/rlz/win/lib/machine_deal.cc +++ b/rlz/win/lib/machine_deal.cc @@ -103,7 +103,8 @@ bool GetResponseValue(const std::string& response_line, value->clear(); - if (!base::StartsWithASCII(response_line, response_key, true)) + if (!base::StartsWith(response_line, response_key, + base::CompareCase::SENSITIVE)) return false; std::vector<std::string> tokens; diff --git a/sandbox/linux/services/yama_unittests.cc b/sandbox/linux/services/yama_unittests.cc index 398eafe..0e8355d 100644 --- a/sandbox/linux/services/yama_unittests.cc +++ b/sandbox/linux/services/yama_unittests.cc @@ -31,8 +31,9 @@ bool HasLinux32Bug() { bool is_kernel_64bit = base::SysInfo::OperatingSystemArchitecture() == "x86_64"; bool is_linux = base::SysInfo::OperatingSystemName() == "Linux"; - bool is_3_dot_2 = base::StartsWithASCII( - base::SysInfo::OperatingSystemVersion(), "3.2", /*case_sensitive=*/false); + bool is_3_dot_2 = base::StartsWith( + base::SysInfo::OperatingSystemVersion(), "3.2", + base::CompareCase::INSENSITIVE_ASCII); if (is_kernel_64bit && is_linux && is_3_dot_2) return true; #endif // defined(__i386__) diff --git a/storage/browser/blob/blob_url_request_job_factory.cc b/storage/browser/blob/blob_url_request_job_factory.cc index 7efe280..feb5df0 100644 --- a/storage/browser/blob/blob_url_request_job_factory.cc +++ b/storage/browser/blob/blob_url_request_job_factory.cc @@ -78,7 +78,8 @@ scoped_ptr<BlobDataSnapshot> BlobProtocolHandler::LookupBlobData( // TODO(michaeln): Replace this use case and others like it with a BlobReader // impl that does not depend on urlfetching to perform this function. const std::string kPrefix("blob:uuid/"); - if (!base::StartsWithASCII(request->url().spec(), kPrefix, true)) + if (!base::StartsWith(request->url().spec(), kPrefix, + base::CompareCase::SENSITIVE)) return NULL; std::string uuid = request->url().spec().substr(kPrefix.length()); scoped_ptr<BlobDataHandle> handle = context_->GetBlobDataFromUUID(uuid); diff --git a/storage/browser/fileapi/obfuscated_file_util.cc b/storage/browser/fileapi/obfuscated_file_util.cc index 34c0718..d46078e 100644 --- a/storage/browser/fileapi/obfuscated_file_util.cc +++ b/storage/browser/fileapi/obfuscated_file_util.cc @@ -901,7 +901,8 @@ void ObfuscatedFileUtil::CloseFileSystemForOriginAndType( const std::string key_prefix = GetDirectoryDatabaseKey(origin, type_string); for (DirectoryMap::iterator iter = directories_.lower_bound(key_prefix); iter != directories_.end();) { - if (!base::StartsWithASCII(iter->first, key_prefix, true)) + if (!base::StartsWith(iter->first, key_prefix, + base::CompareCase::SENSITIVE)) break; DCHECK(type_string.empty() || iter->first == key_prefix); scoped_ptr<SandboxDirectoryDatabase> database(iter->second); @@ -925,7 +926,8 @@ void ObfuscatedFileUtil::DestroyDirectoryDatabase( const std::string key_prefix = GetDirectoryDatabaseKey(origin, type_string); for (DirectoryMap::iterator iter = directories_.lower_bound(key_prefix); iter != directories_.end();) { - if (!base::StartsWithASCII(iter->first, key_prefix, true)) + if (!base::StartsWith(iter->first, key_prefix, + base::CompareCase::SENSITIVE)) break; DCHECK(type_string.empty() || iter->first == key_prefix); scoped_ptr<SandboxDirectoryDatabase> database(iter->second); diff --git a/storage/browser/fileapi/sandbox_directory_database.cc b/storage/browser/fileapi/sandbox_directory_database.cc index 7f7a707..39f1d53 100644 --- a/storage/browser/fileapi/sandbox_directory_database.cc +++ b/storage/browser/fileapi/sandbox_directory_database.cc @@ -204,7 +204,8 @@ bool DatabaseCheckHelper::ScanDatabase() { scoped_ptr<leveldb::Iterator> itr(db_->NewIterator(leveldb::ReadOptions())); for (itr->SeekToFirst(); itr->Valid(); itr->Next()) { std::string key = itr->key().ToString(); - if (base::StartsWithASCII(key, kChildLookupPrefix, true)) { + if (base::StartsWith(key, kChildLookupPrefix, + base::CompareCase::SENSITIVE)) { // key: "CHILD_OF:<parent_id>:<name>" // value: "<child_id>" ++num_hierarchy_links_in_db_; @@ -479,8 +480,9 @@ bool SandboxDirectoryDatabase::ListChildren( scoped_ptr<leveldb::Iterator> iter(db_->NewIterator(leveldb::ReadOptions())); iter->Seek(child_key_prefix); children->clear(); - while (iter->Valid() && base::StartsWithASCII(iter->key().ToString(), - child_key_prefix, true)) { + while (iter->Valid() && base::StartsWith(iter->key().ToString(), + child_key_prefix, + base::CompareCase::SENSITIVE)) { std::string child_id_string = iter->value().ToString(); FileId child_id; if (!base::StringToInt64(child_id_string, &child_id)) { diff --git a/storage/browser/fileapi/sandbox_origin_database.cc b/storage/browser/fileapi/sandbox_origin_database.cc index 1a91b10..024e13e 100644 --- a/storage/browser/fileapi/sandbox_origin_database.cc +++ b/storage/browser/fileapi/sandbox_origin_database.cc @@ -291,8 +291,9 @@ bool SandboxOriginDatabase::ListAllOrigins( std::string origin_key_prefix = OriginToOriginKey(std::string()); iter->Seek(origin_key_prefix); origins->clear(); - while (iter->Valid() && base::StartsWithASCII(iter->key().ToString(), - origin_key_prefix, true)) { + while (iter->Valid() && base::StartsWith(iter->key().ToString(), + origin_key_prefix, + base::CompareCase::SENSITIVE)) { std::string origin = iter->key().ToString().substr(origin_key_prefix.length()); base::FilePath path = StringToFilePath(iter->value().ToString()); diff --git a/third_party/zlib/google/zip_reader.cc b/third_party/zlib/google/zip_reader.cc index e0871c8..83086a3 100644 --- a/third_party/zlib/google/zip_reader.cc +++ b/third_party/zlib/google/zip_reader.cc @@ -147,7 +147,8 @@ ZipReader::EntryInfo::EntryInfo(const std::string& file_name_in_zip, // We also consider that the file name is unsafe, if it's absolute. // On Windows, IsAbsolute() returns false for paths starting with "/". if (file_path_.IsAbsolute() || - base::StartsWithASCII(file_name_in_zip, "/", false)) + base::StartsWith(file_name_in_zip, "/", + base::CompareCase::INSENSITIVE_ASCII)) is_unsafe_ = true; // Construct the last modified time. The timezone info is not present in diff --git a/tools/gn/filesystem_utils.cc b/tools/gn/filesystem_utils.cc index 42736c9f..663e6ac 100644 --- a/tools/gn/filesystem_utils.cc +++ b/tools/gn/filesystem_utils.cc @@ -748,7 +748,8 @@ OutputFile GetOutputDirForSourceDirAsOutputFile(const Settings* settings, const std::string& build_dir = settings->build_settings()->build_dir().value(); - if (base::StartsWithASCII(source_dir.value(), build_dir, true)) { + if (base::StartsWith(source_dir.value(), build_dir, + base::CompareCase::SENSITIVE)) { size_t build_dir_size = build_dir.size(); result.value().append(&source_dir.value()[build_dir_size], source_dir.value().size() - build_dir_size); diff --git a/tools/gn/header_checker.cc b/tools/gn/header_checker.cc index 1141e6e..b15b4fa 100644 --- a/tools/gn/header_checker.cc +++ b/tools/gn/header_checker.cc @@ -37,7 +37,8 @@ struct PublicGeneratedPair { SourceFile RemoveRootGenDirFromFile(const Target* target, const SourceFile& file) { const SourceDir& gen = target->settings()->toolchain_gen_dir(); - if (!gen.is_null() && base::StartsWithASCII(file.value(), gen.value(), true)) + if (!gen.is_null() && base::StartsWith(file.value(), gen.value(), + base::CompareCase::SENSITIVE)) return SourceFile("//" + file.value().substr(gen.value().size())); return file; } diff --git a/tools/gn/input_conversion.cc b/tools/gn/input_conversion.cc index e4c20a0..fbde6f6 100644 --- a/tools/gn/input_conversion.cc +++ b/tools/gn/input_conversion.cc @@ -116,7 +116,8 @@ Value DoConvertInputToValue(const Settings* settings, return Value(); // Empty string means discard the result. const char kTrimPrefix[] = "trim "; - if (base::StartsWithASCII(input_conversion, kTrimPrefix, true)) { + if (base::StartsWith(input_conversion, kTrimPrefix, + base::CompareCase::SENSITIVE)) { std::string trimmed; base::TrimWhitespaceASCII(input, base::TRIM_ALL, &trimmed); diff --git a/tools/gn/target.cc b/tools/gn/target.cc index a7a3d07..71488cb 100644 --- a/tools/gn/target.cc +++ b/tools/gn/target.cc @@ -219,7 +219,8 @@ std::string Target::GetComputedOutputName(bool include_prefix) const { const Tool* tool = toolchain_->GetToolForTargetFinalOutput(this); if (tool) { // Only add the prefix if the name doesn't already have it. - if (!base::StartsWithASCII(name, tool->output_prefix(), true)) + if (!base::StartsWith(name, tool->output_prefix(), + base::CompareCase::SENSITIVE)) result = tool->output_prefix(); } } diff --git a/ui/base/ime/chromeos/component_extension_ime_manager.cc b/ui/base/ime/chromeos/component_extension_ime_manager.cc index 0f3d95b..69f1d88 100644 --- a/ui/base/ime/chromeos/component_extension_ime_manager.cc +++ b/ui/base/ime/chromeos/component_extension_ime_manager.cc @@ -65,12 +65,12 @@ const char* kLoginLayoutWhitelist[] = { int GetInputMethodCategory(const std::string& id) { const std::string engine_id = chromeos::extension_ime_util::GetComponentIDByInputMethodID(id); - if (base::StartsWithASCII(engine_id, "xkb:", true)) + if (base::StartsWith(engine_id, "xkb:", base::CompareCase::SENSITIVE)) return 0; - if (base::StartsWithASCII(engine_id, "vkd_", true)) + if (base::StartsWith(engine_id, "vkd_", base::CompareCase::SENSITIVE)) return 1; if (engine_id.find("-t-i0-") != std::string::npos && - !base::StartsWithASCII(engine_id, "zh-", true)) { + !base::StartsWith(engine_id, "zh-", base::CompareCase::SENSITIVE)) { return 2; } return 3; diff --git a/ui/base/ime/chromeos/extension_ime_util.cc b/ui/base/ime/chromeos/extension_ime_util.cc index f6960d4..71440a1 100644 --- a/ui/base/ime/chromeos/extension_ime_util.cc +++ b/ui/base/ime/chromeos/extension_ime_util.cc @@ -61,28 +61,31 @@ std::string GetComponentIDByInputMethodID(const std::string& input_method_id) { } std::string GetInputMethodIDByEngineID(const std::string& engine_id) { - if (base::StartsWithASCII(engine_id, kComponentExtensionIMEPrefix, true) || - base::StartsWithASCII(engine_id, kExtensionIMEPrefix, true)) { + if (base::StartsWith(engine_id, kComponentExtensionIMEPrefix, + base::CompareCase::SENSITIVE) || + base::StartsWith(engine_id, kExtensionIMEPrefix, + base::CompareCase::SENSITIVE)) { return engine_id; } - if (base::StartsWithASCII(engine_id, "xkb:", true)) + if (base::StartsWith(engine_id, "xkb:", base::CompareCase::SENSITIVE)) return GetComponentInputMethodID(kXkbExtensionId, engine_id); - if (base::StartsWithASCII(engine_id, "vkd_", true)) + if (base::StartsWith(engine_id, "vkd_", base::CompareCase::SENSITIVE)) return GetComponentInputMethodID(kM17nExtensionId, engine_id); - if (base::StartsWithASCII(engine_id, "nacl_mozc_", true)) + if (base::StartsWith(engine_id, "nacl_mozc_", base::CompareCase::SENSITIVE)) return GetComponentInputMethodID(kMozcExtensionId, engine_id); - if (base::StartsWithASCII(engine_id, "hangul_", true)) + if (base::StartsWith(engine_id, "hangul_", + base::CompareCase::SENSITIVE)) return GetComponentInputMethodID(kHangulExtensionId, engine_id); - if (base::StartsWithASCII(engine_id, "zh-", true) && + if (base::StartsWith(engine_id, "zh-", base::CompareCase::SENSITIVE) && engine_id.find("pinyin") != std::string::npos) { return GetComponentInputMethodID(kChinesePinyinExtensionId, engine_id); } - if (base::StartsWithASCII(engine_id, "zh-", true) && + if (base::StartsWith(engine_id, "zh-", base::CompareCase::SENSITIVE) && engine_id.find("zhuyin") != std::string::npos) { return GetComponentInputMethodID(kChineseZhuyinExtensionId, engine_id); } - if (base::StartsWithASCII(engine_id, "zh-", true) && + if (base::StartsWith(engine_id, "zh-", base::CompareCase::SENSITIVE) && engine_id.find("cangjie") != std::string::npos) { return GetComponentInputMethodID(kChineseCangjieExtensionId, engine_id); } @@ -93,30 +96,30 @@ std::string GetInputMethodIDByEngineID(const std::string& engine_id) { } bool IsExtensionIME(const std::string& input_method_id) { - return base::StartsWithASCII(input_method_id, kExtensionIMEPrefix, - true /* Case sensitive */) && + return base::StartsWith(input_method_id, kExtensionIMEPrefix, + base::CompareCase::SENSITIVE) && input_method_id.size() > kExtensionIMEPrefixLength + kExtensionIdLength; } bool IsComponentExtensionIME(const std::string& input_method_id) { - return base::StartsWithASCII(input_method_id, kComponentExtensionIMEPrefix, - true /* Case sensitive */) && + return base::StartsWith(input_method_id, kComponentExtensionIMEPrefix, + base::CompareCase::SENSITIVE) && input_method_id.size() > kComponentExtensionIMEPrefixLength + kExtensionIdLength; } bool IsMemberOfExtension(const std::string& input_method_id, const std::string& extension_id) { - return base::StartsWithASCII(input_method_id, - kExtensionIMEPrefix + extension_id, - true /* Case sensitive */); + return base::StartsWith(input_method_id, + kExtensionIMEPrefix + extension_id, + base::CompareCase::SENSITIVE); } bool IsKeyboardLayoutExtension(const std::string& input_method_id) { if (IsComponentExtensionIME(input_method_id)) - return base::StartsWithASCII(GetComponentIDByInputMethodID(input_method_id), - "xkb:", true); + return base::StartsWith(GetComponentIDByInputMethodID(input_method_id), + "xkb:", base::CompareCase::SENSITIVE); return false; } diff --git a/ui/base/l10n/l10n_util.cc b/ui/base/l10n/l10n_util.cc index 010dbde..35b81aa 100644 --- a/ui/base/l10n/l10n_util.cc +++ b/ui/base/l10n/l10n_util.cc @@ -540,7 +540,7 @@ base::string16 GetDisplayNameForLocale(const std::string& locale, // zh-Hant because the current Android Java API doesn't support scripts. // TODO(wangxianzhu): remove the special handling of zh-Hans and zh-Hant once // Android Java API supports scripts. - if (!base::StartsWithASCII(locale_code, "zh-Han", true)) { + if (!base::StartsWith(locale_code, "zh-Han", base::CompareCase::SENSITIVE)) { display_name = GetDisplayNameForLocale(locale_code, display_locale); } else #endif diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc index a8a3214..abc3b5d 100644 --- a/ui/base/x/x11_util.cc +++ b/ui/base/x/x11_util.cc @@ -1251,7 +1251,7 @@ WindowManagerName GuessWindowManager() { return WM_FLUXBOX; if (name == "i3") return WM_I3; - if (base::StartsWithASCII(name, "IceWM", true)) + if (base::StartsWith(name, "IceWM", base::CompareCase::SENSITIVE)) return WM_ICE_WM; if (name == "ion3") return WM_ION3; diff --git a/ui/events/devices/device_util_linux.cc b/ui/events/devices/device_util_linux.cc index e53a1e4..9f1f632 100644 --- a/ui/events/devices/device_util_linux.cc +++ b/ui/events/devices/device_util_linux.cc @@ -17,7 +17,9 @@ namespace ui { InputDeviceType GetInputDeviceTypeFromPath(const base::FilePath& path) { DCHECK(!base::MessageLoopForUI::IsCurrent()); std::string event_node = path.BaseName().value(); - if (event_node.empty() || !base::StartsWithASCII(event_node, "event", false)) + if (event_node.empty() || + !base::StartsWith(event_node, "event", + base::CompareCase::INSENSITIVE_ASCII)) return InputDeviceType::INPUT_DEVICE_UNKNOWN; // Find sysfs device path for this device. diff --git a/ui/events/ozone/device/udev/device_manager_udev.cc b/ui/events/ozone/device/udev/device_manager_udev.cc index ca7daa2..f05695b 100644 --- a/ui/events/ozone/device/udev/device_manager_udev.cc +++ b/ui/events/ozone/device/udev/device_manager_udev.cc @@ -162,10 +162,11 @@ scoped_ptr<DeviceEvent> DeviceManagerUdev::ProcessMessage(udev_device* device) { DeviceEvent::DeviceType device_type; if (!strcmp(subsystem, "input") && - base::StartsWithASCII(path, "/dev/input/event", true)) + base::StartsWith(path, "/dev/input/event", base::CompareCase::SENSITIVE)) device_type = DeviceEvent::INPUT; else if (!strcmp(subsystem, "drm") && - base::StartsWithASCII(path, "/dev/dri/card", true)) + base::StartsWith(path, "/dev/dri/card", + base::CompareCase::SENSITIVE)) device_type = DeviceEvent::DISPLAY; else return nullptr; diff --git a/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc b/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc index 45cd381..64e0696 100644 --- a/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc +++ b/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc @@ -505,7 +505,7 @@ bool IsMatchTypeSupported(const std::string& match_type) { // Check if a match criteria is a device type one. bool IsMatchDeviceType(const std::string& match_type) { - return base::StartsWithASCII(match_type, "MatchIs", true); + return base::StartsWith(match_type, "MatchIs", base::CompareCase::SENSITIVE); } // Parse a boolean value keyword (e.g., on/off, true/false). diff --git a/ui/gl/gl_version_info.cc b/ui/gl/gl_version_info.cc index 5eff43a..c3cec4d 100644 --- a/ui/gl/gl_version_info.cc +++ b/ui/gl/gl_version_info.cc @@ -50,7 +50,8 @@ GLVersionInfo::GLVersionInfo(const char* version_str, const char* renderer_str) &is_es, &is_es3); } if (renderer_str) { - is_angle = base::StartsWithASCII(renderer_str, "ANGLE", true); + is_angle = base::StartsWith(renderer_str, "ANGLE", + base::CompareCase::SENSITIVE); } } |