diff options
author | brettw <brettw@chromium.org> | 2015-08-10 12:07:51 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-10 19:08:31 +0000 |
commit | fce8d19805ad83a006bbdd3ca68fc9d8eca621e6 (patch) | |
tree | 53b8fca581ffa89718788efe7a4295a662554d03 | |
parent | a794ba10af6e3ac6d4661a2edc6f8d60642218af (diff) | |
download | chromium_src-fce8d19805ad83a006bbdd3ca68fc9d8eca621e6.zip chromium_src-fce8d19805ad83a006bbdd3ca68fc9d8eca621e6.tar.gz chromium_src-fce8d19805ad83a006bbdd3ca68fc9d8eca621e6.tar.bz2 |
Replace ToLower calls to the new format
Replaces
base::StringToLowerASCII(string)
with
base::ToLowerASCII(string)
This form is 1:1 search and replace.
A bunch of places did something like this:
std::string foo(something_else);
base::StringToLowerASCII(&foo);
which became:
foo = base::ToLowerASCII(something_else);
A couple places really wanted in-place changing and they became:
foo = base::ToLowerASCII(foo);
There was pretty trivial cleanup in chrome_main_delegate.cc chrome/test/chromedriver/server/http_handler.cc (fix indenting).
There was more cleanup in:
chrome/installer/util/language_selector.cc and components/plugins/renderer/mobile_youtube_plugin.cc
In components/history/core/browser/url_utils.cc I removed the call since it was calling ToLower on the host name out of a GURL, which is already guaranteed to be lower-case.
NOPRESUBMIT=true
(due to touching code with wstrings)
Review URL: https://codereview.chromium.org/1279123004
Cr-Commit-Position: refs/heads/master@{#342659}
72 files changed, 107 insertions, 129 deletions
diff --git a/android_webview/browser/aw_content_browser_client.cc b/android_webview/browser/aw_content_browser_client.cc index efbbdbe..1f59823 100644 --- a/android_webview/browser/aw_content_browser_client.cc +++ b/android_webview/browser/aw_content_browser_client.cc @@ -118,7 +118,7 @@ std::string AwContentBrowserClient::GetAcceptLangsImpl() { // If we're not en-US, add in en-US which will be // used with a lower q-value. - if (base::StringToLowerASCII(langs) != "en-us") { + if (base::ToLowerASCII(langs) != "en-us") { langs += ",en-US"; } return langs; diff --git a/base/command_line.cc b/base/command_line.cc index 95ff644..c2ce33d 100644 --- a/base/command_line.cc +++ b/base/command_line.cc @@ -267,7 +267,7 @@ void CommandLine::SetProgram(const FilePath& program) { } bool CommandLine::HasSwitch(const base::StringPiece& switch_string) const { - DCHECK_EQ(StringToLowerASCII(switch_string.as_string()), switch_string); + DCHECK_EQ(ToLowerASCII(switch_string), switch_string); return switches_by_stringpiece_.find(switch_string) != switches_by_stringpiece_.end(); } @@ -297,7 +297,7 @@ FilePath CommandLine::GetSwitchValuePath( CommandLine::StringType CommandLine::GetSwitchValueNative( const base::StringPiece& switch_string) const { - DCHECK_EQ(StringToLowerASCII(switch_string.as_string()), switch_string); + DCHECK_EQ(ToLowerASCII(switch_string), switch_string); auto result = switches_by_stringpiece_.find(switch_string); return result == switches_by_stringpiece_.end() ? StringType() : *(result->second); @@ -315,7 +315,7 @@ void CommandLine::AppendSwitchPath(const std::string& switch_string, void CommandLine::AppendSwitchNative(const std::string& switch_string, const CommandLine::StringType& value) { #if defined(OS_WIN) - const std::string switch_key = StringToLowerASCII(switch_string); + const std::string switch_key = ToLowerASCII(switch_string); StringType combined_switch_string(ASCIIToUTF16(switch_key)); #elif defined(OS_POSIX) const std::string& switch_key = switch_string; diff --git a/base/i18n/rtl.cc b/base/i18n/rtl.cc index 25a9cfd..93f91c2 100644 --- a/base/i18n/rtl.cc +++ b/base/i18n/rtl.cc @@ -36,11 +36,8 @@ std::string GetLocaleString(const icu::Locale& locale) { result += country; } - if (variant != NULL && *variant != '\0') { - std::string variant_str(variant); - base::StringToLowerASCII(&variant_str); - result += '@' + variant_str; - } + if (variant != NULL && *variant != '\0') + result += '@' + base::ToLowerASCII(variant); return result; } diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc index 031a0a1..254eae0 100644 --- a/chrome/app/chrome_main_delegate.cc +++ b/chrome/app/chrome_main_delegate.cc @@ -152,13 +152,11 @@ namespace { // Early versions of Chrome incorrectly registered a chromehtml: URL handler, // which gives us nothing but trouble. Avoid launching chrome this way since // some apps fail to properly escape arguments. -bool HasDeprecatedArguments(const std::wstring& command_line) { +bool HasDeprecatedArguments(const base::string16& command_line) { const wchar_t kChromeHtml[] = L"chromehtml:"; - std::wstring command_line_lower = command_line; + base::string16 command_line_lower = base::ToLowerASCII(command_line); // We are only searching for ASCII characters so this is OK. - base::StringToLowerASCII(&command_line_lower); - std::wstring::size_type pos = command_line_lower.find(kChromeHtml); - return (pos != std::wstring::npos); + return (command_line_lower.find(kChromeHtml) != base::string16::npos); } // If we try to access a path that is not currently available, we want the call diff --git a/chrome/app/signature_validator_win.cc b/chrome/app/signature_validator_win.cc index e64446d..d4f86f0 100644 --- a/chrome/app/signature_validator_win.cc +++ b/chrome/app/signature_validator_win.cc @@ -39,8 +39,7 @@ bool ExtractPublicKeyHash(const CERT_CONTEXT* cert_context, crypt_blob.pbData), crypt_blob.cbData); crypto::SHA256HashString(key_bytes, hash, crypto::kSHA256Length); - *public_key_hash = - base::StringToLowerASCII(base::HexEncode(hash, arraysize(hash))); + *public_key_hash = base::ToLowerASCII(base::HexEncode(hash, arraysize(hash))); return true; } diff --git a/chrome/app/signature_validator_win_unittest.cc b/chrome/app/signature_validator_win_unittest.cc index 89cbda4..37408a7 100644 --- a/chrome/app/signature_validator_win_unittest.cc +++ b/chrome/app/signature_validator_win_unittest.cc @@ -85,7 +85,7 @@ class SignatureValidatorTest : public testing::Test { crypto::SHA256HashString(key_bytes, hash, crypto::kSHA256Length); std::string public_key_hash = - base::StringToLowerASCII(base::HexEncode(hash, arraysize(hash))); + base::ToLowerASCII(base::HexEncode(hash, arraysize(hash))); expected_hashes_.push_back(public_key_hash); } diff --git a/chrome/browser/chromeos/customization/customization_document.cc b/chrome/browser/chromeos/customization/customization_document.cc index 22e19268..780ba16 100644 --- a/chrome/browser/chromeos/customization/customization_document.cc +++ b/chrome/browser/chromeos/customization/customization_document.cc @@ -514,7 +514,7 @@ void ServicesCustomizationDocument::StartFetching() { &customization_id) && !customization_id.empty()) { url_ = GURL(base::StringPrintf( - kManifestUrl, base::StringToLowerASCII(customization_id).c_str())); + kManifestUrl, base::ToLowerASCII(customization_id).c_str())); } else { // Remember that there is no customization ID in VPD. OnCustomizationNotFound(); diff --git a/chrome/browser/chromeos/file_manager/file_tasks.cc b/chrome/browser/chromeos/file_manager/file_tasks.cc index 73757b3..4a01c08 100644 --- a/chrome/browser/chromeos/file_manager/file_tasks.cc +++ b/chrome/browser/chromeos/file_manager/file_tasks.cc @@ -169,7 +169,7 @@ void UpdateDefaultTask(PrefService* pref_service, iter != suffixes.end(); ++iter) { base::StringValue* value = new base::StringValue(task_id); // Suffixes are case insensitive. - std::string lower_suffix = base::StringToLowerASCII(*iter); + std::string lower_suffix = base::ToLowerASCII(*iter); mime_type_pref->SetWithoutPathExpansion(lower_suffix, value); } } @@ -197,7 +197,7 @@ std::string GetDefaultTaskIdFromPrefs(const PrefService& pref_service, pref_service.GetDictionary(prefs::kDefaultTasksBySuffix); DCHECK(suffix_task_prefs); LOG_IF(ERROR, !suffix_task_prefs) << "Unable to open suffix prefs"; - std::string lower_suffix = base::StringToLowerASCII(suffix); + std::string lower_suffix = base::ToLowerASCII(suffix); if (suffix_task_prefs) suffix_task_prefs->GetStringWithoutPathExpansion(lower_suffix, &task_id); VLOG_IF(1, !task_id.empty()) << "Found suffix default handler: " << task_id; diff --git a/chrome/browser/chromeos/login/session/user_session_manager.cc b/chrome/browser/chromeos/login/session/user_session_manager.cc index 926d0d51..86e899f 100644 --- a/chrome/browser/chromeos/login/session/user_session_manager.cc +++ b/chrome/browser/chromeos/login/session/user_session_manager.cc @@ -1145,7 +1145,7 @@ void UserSessionManager::InitializeStartUrls() const { const char* url = kChromeVoxTutorialURLPattern; PrefService* prefs = g_browser_process->local_state(); const std::string current_locale = - base::StringToLowerASCII(prefs->GetString(prefs::kApplicationLocale)); + base::ToLowerASCII(prefs->GetString(prefs::kApplicationLocale)); std::string vox_url = base::StringPrintf(url, current_locale.c_str()); start_urls.push_back(vox_url); can_show_getstarted_guide = false; diff --git a/chrome/browser/chromeos/login/supervised/supervised_user_authentication.cc b/chrome/browser/chromeos/login/supervised/supervised_user_authentication.cc index b4a64a3..389dcc5 100644 --- a/chrome/browser/chromeos/login/supervised/supervised_user_authentication.cc +++ b/chrome/browser/chromeos/login/supervised/supervised_user_authentication.cc @@ -40,9 +40,8 @@ const int kMasterKeySize = 32; std::string CreateSalt() { char result[kSaltSize]; crypto::RandBytes(&result, sizeof(result)); - return base::StringToLowerASCII(base::HexEncode( - reinterpret_cast<const void*>(result), - sizeof(result))); + return base::ToLowerASCII( + base::HexEncode(reinterpret_cast<const void*>(result), sizeof(result))); } std::string BuildRawHMACKey() { @@ -164,7 +163,7 @@ bool SupervisedUserAuthentication::FillDataForNewUser( std::string SupervisedUserAuthentication::GenerateMasterKey() { char master_key_bytes[kMasterKeySize]; crypto::RandBytes(&master_key_bytes, sizeof(master_key_bytes)); - return base::StringToLowerASCII( + return base::ToLowerASCII( base::HexEncode(reinterpret_cast<const void*>(master_key_bytes), sizeof(master_key_bytes))); } diff --git a/chrome/browser/chromeos/power/peripheral_battery_observer.cc b/chrome/browser/chromeos/power/peripheral_battery_observer.cc index 1ef701e2..7867495 100644 --- a/chrome/browser/chromeos/power/peripheral_battery_observer.cc +++ b/chrome/browser/chromeos/power/peripheral_battery_observer.cc @@ -61,8 +61,8 @@ std::string ExtractBluetoothAddress(const std::string& path) { int key_len = path.size() - header_size - end_size; if (key_len <= 0) return std::string(); - std::string reverse_address = path.substr(header_size, key_len); - base::StringToLowerASCII(&reverse_address); + std::string reverse_address = + base::ToLowerASCII(path.substr(header_size, key_len)); std::vector<std::string> result = base::SplitString( reverse_address, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); std::reverse(result.begin(), result.end()); @@ -181,8 +181,7 @@ void PeripheralBatteryObserver::InitializeOnBluetoothReady( void PeripheralBatteryObserver::RemoveBattery(const std::string& address) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - std::string address_lowercase = address; - base::StringToLowerASCII(&address_lowercase); + std::string address_lowercase = base::ToLowerASCII(address); std::map<std::string, BatteryInfo>::iterator it = batteries_.find(address_lowercase); if (it != batteries_.end()) { diff --git a/chrome/browser/chromeos/settings/token_encryptor.cc b/chrome/browser/chromeos/settings/token_encryptor.cc index 28bc6a7..dbe26c5 100644 --- a/chrome/browser/chromeos/settings/token_encryptor.cc +++ b/chrome/browser/chromeos/settings/token_encryptor.cc @@ -88,9 +88,9 @@ std::string CryptohomeTokenEncryptor::EncryptTokenWithKey( return std::string(); } - return base::StringToLowerASCII(base::HexEncode( - reinterpret_cast<const void*>(encoded_token.data()), - encoded_token.size())); + return base::ToLowerASCII( + base::HexEncode(reinterpret_cast<const void*>(encoded_token.data()), + encoded_token.size())); } std::string CryptohomeTokenEncryptor::DecryptTokenWithKey( diff --git a/chrome/browser/component_updater/supervised_user_whitelist_installer_unittest.cc b/chrome/browser/component_updater/supervised_user_whitelist_installer_unittest.cc index dad559f..48b0b97 100644 --- a/chrome/browser/component_updater/supervised_user_whitelist_installer_unittest.cc +++ b/chrome/browser/component_updater/supervised_user_whitelist_installer_unittest.cc @@ -259,7 +259,7 @@ TEST_F(SupervisedUserWhitelistInstallerTest, GetHashFromCrxId) { { std::string extension_id = "aBcDeFgHiJkLmNoPpOnMlKjIhGfEdCbA"; - ASSERT_EQ(base::StringToLowerASCII(extension_id), + ASSERT_EQ(base::ToLowerASCII(extension_id), CrxIdToHashToCrxId(extension_id)); } diff --git a/chrome/browser/enumerate_modules_model_win.cc b/chrome/browser/enumerate_modules_model_win.cc index 6786fb3..a940c2e 100644 --- a/chrome/browser/enumerate_modules_model_win.cc +++ b/chrome/browser/enumerate_modules_model_win.cc @@ -349,7 +349,7 @@ static void GenerateHash(const std::string& input, std::string* output) { uint8 hash[4]; crypto::SHA256HashString(input, hash, sizeof(hash)); - *output = base::StringToLowerASCII(base::HexEncode(hash, sizeof(hash))); + *output = base::ToLowerASCII(base::HexEncode(hash, sizeof(hash))); } // ----------------------------------------------------------------------------- diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc index 3f033d4..58e9bfb 100644 --- a/chrome/browser/extensions/api/file_system/file_system_api.cc +++ b/chrome/browser/extensions/api/file_system/file_system_api.cc @@ -151,8 +151,7 @@ bool GetFileTypesFromAcceptOption( for (std::vector<std::string>::const_iterator iter = list->begin(); iter != list->end(); ++iter) { std::vector<base::FilePath::StringType> inner; - std::string accept_type = *iter; - base::StringToLowerASCII(&accept_type); + std::string accept_type = base::ToLowerASCII(*iter); net::GetExtensionsForMimeType(accept_type, &inner); if (inner.empty()) continue; @@ -176,8 +175,7 @@ bool GetFileTypesFromAcceptOption( std::vector<std::string>* list = accept_option.extensions.get(); for (std::vector<std::string>::const_iterator iter = list->begin(); iter != list->end(); ++iter) { - std::string extension = *iter; - base::StringToLowerASCII(&extension); + std::string extension = base::ToLowerASCII(*iter); #if defined(OS_WIN) extension_set.insert(base::UTF8ToWide(*iter)); #else diff --git a/chrome/browser/extensions/api/gcm/gcm_api.cc b/chrome/browser/extensions/api/gcm/gcm_api.cc index ba76151..60dd292 100644 --- a/chrome/browser/extensions/api/gcm/gcm_api.cc +++ b/chrome/browser/extensions/api/gcm/gcm_api.cc @@ -67,7 +67,7 @@ const char* GcmResultToError(gcm::GCMClient::Result result) { } bool IsMessageKeyValid(const std::string& key) { - std::string lower = base::StringToLowerASCII(key); + std::string lower = base::ToLowerASCII(key); return !key.empty() && key.compare(0, arraysize(kCollapseKey) - 1, kCollapseKey) != 0 && lower.compare(0, diff --git a/chrome/browser/extensions/api/music_manager_private/device_id.cc b/chrome/browser/extensions/api/music_manager_private/device_id.cc index b72b805..b0391ba 100644 --- a/chrome/browser/extensions/api/music_manager_private/device_id.cc +++ b/chrome/browser/extensions/api/music_manager_private/device_id.cc @@ -24,7 +24,7 @@ bool ComputeHmacSha256(const std::string& key, bool result = hmac.Init(key) && hmac.Sign(text, &digest[0], digest.size()); if (result) { - *signature_return = base::StringToLowerASCII( + *signature_return = base::ToLowerASCII( base::HexEncode(digest.data(), digest.size())); } return result; diff --git a/chrome/browser/extensions/api/music_manager_private/device_id_linux.cc b/chrome/browser/extensions/api/music_manager_private/device_id_linux.cc index bb65b59..e334706 100644 --- a/chrome/browser/extensions/api/music_manager_private/device_id_linux.cc +++ b/chrome/browser/extensions/api/music_manager_private/device_id_linux.cc @@ -124,7 +124,7 @@ class MacAddressProcessor { // Got one! found_mac_address_ = - base::StringToLowerASCII(base::HexEncode(mac_address, MAC_LENGTH)); + base::ToLowerASCII(base::HexEncode(mac_address, MAC_LENGTH)); return false; } diff --git a/chrome/browser/extensions/api/music_manager_private/device_id_mac.cc b/chrome/browser/extensions/api/music_manager_private/device_id_mac.cc index c6664bf..06a3ba7 100644 --- a/chrome/browser/extensions/api/music_manager_private/device_id_mac.cc +++ b/chrome/browser/extensions/api/music_manager_private/device_id_mac.cc @@ -133,7 +133,7 @@ class MacAddressProcessor { if (!is_valid_mac_address_.Run(mac_address, mac_address_size)) return keep_going; - std::string mac_address_string = base::StringToLowerASCII(base::HexEncode( + std::string mac_address_string = base::ToLowerASCII(base::HexEncode( mac_address, mac_address_size)); base::ScopedCFTypeRef<CFStringRef> provider_class( diff --git a/chrome/browser/extensions/api/music_manager_private/device_id_win.cc b/chrome/browser/extensions/api/music_manager_private/device_id_win.cc index 1ea8b8d..c418624 100644 --- a/chrome/browser/extensions/api/music_manager_private/device_id_win.cc +++ b/chrome/browser/extensions/api/music_manager_private/device_id_win.cc @@ -76,7 +76,7 @@ class MacAddressProcessor { if (!is_valid_mac_address_.Run(bytes, size)) return; - found_mac_address_ = base::StringToLowerASCII(base::HexEncode(bytes, size)); + found_mac_address_ = base::ToLowerASCII(base::HexEncode(bytes, size)); found_index_ = index; } diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index 88b0a12..3ed9706 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -2116,7 +2116,7 @@ void ExtensionService::TerminateExtension(const std::string& extension_id) { } void ExtensionService::UntrackTerminatedExtension(const std::string& id) { - std::string lowercase_id = base::StringToLowerASCII(id); + std::string lowercase_id = base::ToLowerASCII(id); const Extension* extension = registry_->terminated_extensions().GetByID(lowercase_id); registry_->RemoveTerminated(lowercase_id); diff --git a/chrome/browser/extensions/external_registry_loader_win.cc b/chrome/browser/extensions/external_registry_loader_win.cc index a1c2893..0b5a67f 100644 --- a/chrome/browser/extensions/external_registry_loader_win.cc +++ b/chrome/browser/extensions/external_registry_loader_win.cc @@ -98,8 +98,7 @@ void ExternalRegistryLoader::LoadOnFileThread() { continue; } - std::string id = base::UTF16ToASCII(*it); - base::StringToLowerASCII(&id); + std::string id = base::ToLowerASCII(base::UTF16ToASCII(*it)); if (!crx_file::id_util::IdIsValid(id)) { LOG(ERROR) << "Invalid id value " << id << " for key " << key_path << "."; diff --git a/chrome/browser/extensions/updater/local_extension_cache.cc b/chrome/browser/extensions/updater/local_extension_cache.cc index 14273a8..e265b8c 100644 --- a/chrome/browser/extensions/updater/local_extension_cache.cc +++ b/chrome/browser/extensions/updater/local_extension_cache.cc @@ -75,7 +75,7 @@ LocalExtensionCache::CacheMap::iterator LocalExtensionCache::FindExtension( const std::string& expected_hash) { CacheHit hit = cache.equal_range(id); CacheMap::iterator empty_hash = cache.end(); - std::string hash = base::StringToLowerASCII(expected_hash); + std::string hash = base::ToLowerASCII(expected_hash); for (CacheMap::iterator it = hit.first; it != hit.second; ++it) { if (expected_hash.empty() || it->second.expected_hash == hash) { return it; @@ -437,7 +437,7 @@ void LocalExtensionCache::BackendCheckCacheContentsInternal( } // Enforce a lower-case id. - id = base::StringToLowerASCII(id); + id = base::ToLowerASCII(id); if (!crx_file::id_util::IdIsValid(id)) { LOG(ERROR) << "Bad extension id in cache: " << id; id.clear(); @@ -486,7 +486,7 @@ std::string LocalExtensionCache::ExtensionFileName( const std::string& expected_hash) { std::string filename = id + "-" + version; if (!expected_hash.empty()) - filename += "-" + base::StringToLowerASCII(expected_hash); + filename += "-" + base::ToLowerASCII(expected_hash); filename += kCRXFileExtension; return filename; } @@ -612,7 +612,7 @@ LocalExtensionCache::CacheItemInfo::CacheItemInfo( uint64 size, const base::FilePath& file_path) : version(version), - expected_hash(base::StringToLowerASCII(expected_hash)), + expected_hash(base::ToLowerASCII(expected_hash)), last_used(last_used), size(size), file_path(file_path) { diff --git a/chrome/browser/extensions/updater/local_extension_cache_unittest.cc b/chrome/browser/extensions/updater/local_extension_cache_unittest.cc index 4113060..3fe8a2b 100644 --- a/chrome/browser/extensions/updater/local_extension_cache_unittest.cc +++ b/chrome/browser/extensions/updater/local_extension_cache_unittest.cc @@ -105,7 +105,7 @@ class LocalExtensionCacheTest : public testing::Test { uint8 output[crypto::kSHA256Length]; hash->Finish(output, sizeof(output)); const std::string hex_hash = - base::StringToLowerASCII(base::HexEncode(output, sizeof(output))); + base::ToLowerASCII(base::HexEncode(output, sizeof(output))); delete hash; const base::FilePath file = diff --git a/chrome/browser/file_select_helper.cc b/chrome/browser/file_select_helper.cc index 6d88afb..bbfae1b 100644 --- a/chrome/browser/file_select_helper.cc +++ b/chrome/browser/file_select_helper.cc @@ -565,7 +565,7 @@ bool FileSelectHelper::IsAcceptTypeValid(const std::string& accept_type) { // of an extension or a "/" in the case of a MIME type). std::string unused; if (accept_type.length() <= 1 || - base::StringToLowerASCII(accept_type) != accept_type || + base::ToLowerASCII(accept_type) != accept_type || base::TrimWhitespaceASCII(accept_type, base::TRIM_ALL, &unused) != base::TRIM_NONE) { return false; diff --git a/chrome/browser/icon_loader_chromeos.cc b/chrome/browser/icon_loader_chromeos.cc index 8a2e378..603b2ff 100644 --- a/chrome/browser/icon_loader_chromeos.cc +++ b/chrome/browser/icon_loader_chromeos.cc @@ -183,7 +183,7 @@ int IconSizeToDIPSize(IconLoader::IconSize size) { // static IconGroupID IconLoader::ReadGroupIDFromFilepath( const base::FilePath& filepath) { - return base::StringToLowerASCII(filepath.Extension()); + return base::ToLowerASCII(filepath.Extension()); } // static diff --git a/chrome/browser/importer/in_process_importer_bridge.cc b/chrome/browser/importer/in_process_importer_bridge.cc index ccf8a33..4098109 100644 --- a/chrome/browser/importer/in_process_importer_bridge.cc +++ b/chrome/browser/importer/in_process_importer_bridge.cc @@ -78,7 +78,7 @@ class FirefoxURLParameterFilter : public TemplateURLParser::ParameterFilter { // TemplateURLParser::ParameterFilter method. bool KeepParameter(const std::string& key, const std::string& value) override { - std::string low_value = base::StringToLowerASCII(value); + std::string low_value = base::ToLowerASCII(value); if (low_value.find("mozilla") != std::string::npos || low_value.find("firefox") != std::string::npos || low_value.find("moz:") != std::string::npos) { diff --git a/chrome/browser/install_verification/win/module_verification_common.cc b/chrome/browser/install_verification/win/module_verification_common.cc index 0d28858..e249491 100644 --- a/chrome/browser/install_verification/win/module_verification_common.cc +++ b/chrome/browser/install_verification/win/module_verification_common.cc @@ -13,7 +13,7 @@ #include "chrome/browser/install_verification/win/module_list.h" std::string CalculateModuleNameDigest(const base::string16& module_name) { - return base::MD5String(base::StringToLowerASCII(base::UTF16ToUTF8( + return base::MD5String(base::ToLowerASCII(base::UTF16ToUTF8( base::FilePath(module_name).BaseName().value()))); } diff --git a/chrome/browser/media_galleries/fileapi/media_path_filter.cc b/chrome/browser/media_galleries/fileapi/media_path_filter.cc index 5b27f10..d7d41e6 100644 --- a/chrome/browser/media_galleries/fileapi/media_path_filter.cc +++ b/chrome/browser/media_galleries/fileapi/media_path_filter.cc @@ -152,8 +152,7 @@ bool MediaPathFilter::Match(const base::FilePath& path) { MediaGalleryScanFileType MediaPathFilter::GetType(const base::FilePath& path) { EnsureInitialized(); MediaFileExtensionMap::const_iterator it = - media_file_extensions_map_.find( - base::StringToLowerASCII(path.Extension())); + media_file_extensions_map_.find(base::ToLowerASCII(path.Extension())); if (it == media_file_extensions_map_.end()) return MEDIA_GALLERY_SCAN_FILE_TYPE_UNKNOWN; return static_cast<MediaGalleryScanFileType>(it->second); diff --git a/chrome/browser/profile_resetter/automatic_profile_resetter_delegate.cc b/chrome/browser/profile_resetter/automatic_profile_resetter_delegate.cc index b120f7c..b74329f 100644 --- a/chrome/browser/profile_resetter/automatic_profile_resetter_delegate.cc +++ b/chrome/browser/profile_resetter/automatic_profile_resetter_delegate.cc @@ -113,7 +113,7 @@ void ExtractLoadedModuleNameDigests( std::string module_name; if (!module_dictionary->GetString("name", &module_name)) continue; - base::StringToLowerASCII(&module_name); + module_name = base::ToLowerASCII(module_name); module_name_digests->AppendString(base::MD5String(module_name)); } } diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index 614c0cb..0c9bcdd 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc @@ -697,7 +697,7 @@ ProfileIOData* ProfileIOData::FromResourceContext( // static bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { - DCHECK_EQ(scheme, base::StringToLowerASCII(scheme)); + DCHECK_EQ(scheme, base::ToLowerASCII(scheme)); static const char* const kProtocolList[] = { url::kFileScheme, content::kChromeDevToolsScheme, diff --git a/chrome/browser/renderer_host/pepper/device_id_fetcher.cc b/chrome/browser/renderer_host/pepper/device_id_fetcher.cc index b859d22..3ec5777 100644 --- a/chrome/browser/renderer_host/pepper/device_id_fetcher.cc +++ b/chrome/browser/renderer_host/pepper/device_id_fetcher.cc @@ -159,13 +159,13 @@ void DeviceIDFetcher::ComputeOnUIThread(const std::string& salt, input.append(kDRMIdentifierFile); input.append(salt_bytes.begin(), salt_bytes.end()); crypto::SHA256HashString(input, &id_buf, sizeof(id_buf)); - std::string id = base::StringToLowerASCII( + std::string id = base::ToLowerASCII( base::HexEncode(reinterpret_cast<const void*>(id_buf), sizeof(id_buf))); input = machine_id; input.append(kDRMIdentifierFile); input.append(id); crypto::SHA256HashString(input, &id_buf, sizeof(id_buf)); - id = base::StringToLowerASCII( + id = base::ToLowerASCII( base::HexEncode(reinterpret_cast<const void*>(id_buf), sizeof(id_buf))); RunCallbackOnIOThread(id, PP_OK); diff --git a/chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyzer_win.cc b/chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyzer_win.cc index 65ee030..1b64370 100644 --- a/chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyzer_win.cc +++ b/chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyzer_win.cc @@ -34,7 +34,7 @@ bool GetLoadedBlacklistedModules(std::vector<base::string16>* module_names) { std::set<ModuleInfo>::const_iterator module_iter(module_info_set.begin()); for (; module_iter != module_info_set.end(); ++module_iter) { - base::string16 module_file_name(base::StringToLowerASCII( + base::string16 module_file_name(base::ToLowerASCII( base::FilePath(module_iter->name).BaseName().value())); if (blacklist::GetBlacklistIndex(module_file_name.c_str()) != -1) { module_names->push_back(module_iter->name); diff --git a/chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyzer_win_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyzer_win_unittest.cc index 6edafbf..b15549e 100644 --- a/chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyzer_win_unittest.cc +++ b/chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyzer_win_unittest.cc @@ -44,7 +44,7 @@ TEST(BlacklistLoadAnalyzer, TestBlacklistBypass) { EXPECT_TRUE(GetLoadedBlacklistedModules(&module_names)); ASSERT_EQ(1, module_names.size()); EXPECT_STREQ(kTestDllName, - base::StringToLowerASCII( + base::ToLowerASCII( base::FilePath(module_names[0]).BaseName().value()).c_str()); } diff --git a/chrome/browser/search/hotword_service.cc b/chrome/browser/search/hotword_service.cc index 30d12f0..3611432 100644 --- a/chrome/browser/search/hotword_service.cc +++ b/chrome/browser/search/hotword_service.cc @@ -268,8 +268,7 @@ class HotwordNotificationDelegate : public NotificationDelegate { // static bool HotwordService::DoesHotwordSupportLanguage(Profile* profile) { std::string normalized_locale = - l10n_util::NormalizeLocale(GetCurrentLocale(profile)); - base::StringToLowerASCII(&normalized_locale); + base::ToLowerASCII(l10n_util::NormalizeLocale(GetCurrentLocale(profile))); // For M43, we are limiting always-on to en_us only. // TODO(kcarattini): Remove this once diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc index 860c239..a8e4e5c 100644 --- a/chrome/browser/shell_integration_win.cc +++ b/chrome/browser/shell_integration_win.cc @@ -386,7 +386,7 @@ bool ShellIntegration::IsFirefoxDefaultBrowser() { base::string16 app_cmd; if (key.Valid() && (key.ReadValue(L"", &app_cmd) == ERROR_SUCCESS) && base::string16::npos != - base::StringToLowerASCII(app_cmd).find(L"firefox")) + base::ToLowerASCII(app_cmd).find(L"firefox")) ff_default = true; } return ff_default; diff --git a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc index 9a538d4..5463f40 100644 --- a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc +++ b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc @@ -228,7 +228,7 @@ GURL SpellcheckHunspellDictionary::GetDictionaryURL() { DCHECK(!bdict_file.empty()); return GURL(std::string(kDownloadServerUrl) + - base::StringToLowerASCII(bdict_file)); + base::ToLowerASCII(bdict_file)); } void SpellcheckHunspellDictionary::DownloadDictionary(GURL url) { diff --git a/chrome/browser/ui/webui/extensions/extension_icon_source.cc b/chrome/browser/ui/webui/extensions/extension_icon_source.cc index 2b40ccd..a2218eb 100644 --- a/chrome/browser/ui/webui/extensions/extension_icon_source.cc +++ b/chrome/browser/ui/webui/extensions/extension_icon_source.cc @@ -277,7 +277,7 @@ bool ExtensionIconSource::ParseData( int request_id, const content::URLDataSource::GotDataCallback& callback) { // Extract the parameters from the path by lower casing and splitting. - std::string path_lower = base::StringToLowerASCII(path); + std::string path_lower = base::ToLowerASCII(path); std::vector<std::string> path_parts = base::SplitString( path_lower, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); if (path_lower.empty() || path_parts.size() < 3) diff --git a/chrome/common/custom_handlers/protocol_handler.cc b/chrome/common/custom_handlers/protocol_handler.cc index 8ede72d..75fc274 100644 --- a/chrome/common/custom_handlers/protocol_handler.cc +++ b/chrome/common/custom_handlers/protocol_handler.cc @@ -18,7 +18,7 @@ ProtocolHandler::ProtocolHandler(const std::string& protocol, ProtocolHandler ProtocolHandler::CreateProtocolHandler( const std::string& protocol, const GURL& url) { - std::string lower_protocol = base::StringToLowerASCII(protocol); + std::string lower_protocol = base::ToLowerASCII(protocol); return ProtocolHandler(lower_protocol, url); } diff --git a/chrome/common/extensions/api/file_browser_handlers/file_browser_handler.cc b/chrome/common/extensions/api/file_browser_handlers/file_browser_handler.cc index 9ec60f0..f0508a9 100644 --- a/chrome/common/extensions/api/file_browser_handlers/file_browser_handler.cc +++ b/chrome/common/extensions/api/file_browser_handlers/file_browser_handler.cc @@ -199,7 +199,7 @@ FileBrowserHandler* LoadFileBrowserHandler( errors::kInvalidFileFilterValue, base::IntToString(i)); return NULL; } - base::StringToLowerASCII(&filter); + filter = base::ToLowerASCII(filter); if (!base::StartsWith(filter, std::string(url::kFileSystemScheme) + ':', base::CompareCase::SENSITIVE)) { *error = extensions::ErrorUtils::FormatErrorMessageUTF16( diff --git a/chrome/common/importer/firefox_importer_utils.cc b/chrome/common/importer/firefox_importer_utils.cc index 3b74d6f..4dfb76e 100644 --- a/chrome/common/importer/firefox_importer_utils.cc +++ b/chrome/common/importer/firefox_importer_utils.cc @@ -319,7 +319,7 @@ base::string16 GetFirefoxImporterName(const base::FilePath& app_path) { } } - base::StringToLowerASCII(&branding_name); + branding_name = base::ToLowerASCII(branding_name); if (branding_name.find("iceweasel") != std::string::npos) return l10n_util::GetStringUTF16(IDS_IMPORT_FROM_ICEWEASEL); return l10n_util::GetStringUTF16(IDS_IMPORT_FROM_FIREFOX); diff --git a/chrome/installer/util/language_selector.cc b/chrome/installer/util/language_selector.cc index 1c1a582..aa8555f 100644 --- a/chrome/installer/util/language_selector.cc +++ b/chrome/installer/util/language_selector.cc @@ -243,13 +243,9 @@ bool LanguageSelector::SelectIf(const std::vector<std::wstring>& candidates, SelectPred_Fn select_predicate, std::wstring* matched_name, int* matched_offset) { - std::wstring candidate; - for (std::vector<std::wstring>::const_iterator scan = candidates.begin(), - end = candidates.end(); scan != end; ++scan) { - candidate.assign(*scan); - base::StringToLowerASCII(&candidate); - if (select_predicate(candidate, matched_offset)) { - matched_name->assign(*scan); + for (const std::wstring& scan : candidates) { + if (select_predicate(base::ToLowerASCII(scan), matched_offset)) { + matched_name->assign(scan); return true; } } diff --git a/chrome/renderer/pepper/pepper_flash_renderer_host.cc b/chrome/renderer/pepper/pepper_flash_renderer_host.cc index 63a0533..1fccbff 100644 --- a/chrome/renderer/pepper/pepper_flash_renderer_host.cc +++ b/chrome/renderer/pepper/pepper_flash_renderer_host.cc @@ -315,7 +315,7 @@ int32_t PepperFlashRendererHost::OnNavigate( bool rejected = false; while (header_iter.GetNext()) { std::string lower_case_header_name = - base::StringToLowerASCII(header_iter.name()); + base::ToLowerASCII(header_iter.name()); if (!IsSimpleHeader(lower_case_header_name, header_iter.values())) { rejected = true; diff --git a/chrome/renderer/plugins/plugin_uma.cc b/chrome/renderer/plugins/plugin_uma.cc index 4040f63..9272d3c 100644 --- a/chrome/renderer/plugins/plugin_uma.cc +++ b/chrome/renderer/plugins/plugin_uma.cc @@ -106,7 +106,7 @@ void PluginUMAReporter::ExtractFileExtension(const GURL& src, extension->clear(); } - base::StringToLowerASCII(extension); + *extension = base::ToLowerASCII(*extension); } PluginUMAReporter::PluginType PluginUMAReporter::GetPluginType( @@ -115,7 +115,7 @@ PluginUMAReporter::PluginType PluginUMAReporter::GetPluginType( // If we know plugin's mime type, we use it to determine plugin's type. Else, // we try to determine plugin type using plugin source's extension. if (!plugin_mime_type.empty()) - return MimeTypeToPluginType(base::StringToLowerASCII(plugin_mime_type)); + return MimeTypeToPluginType(base::ToLowerASCII(plugin_mime_type)); return SrcToPluginType(plugin_src); } diff --git a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc index f47a186..d5bda8e 100644 --- a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc +++ b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc @@ -327,8 +327,7 @@ void PhishingDOMFeatureExtractor::HandleInput( // Note that we use the attribute value rather than // WebFormControlElement::formControlType() for consistency with the // way the phishing classification model is created. - std::string type = element.getAttribute("type").utf8(); - base::StringToLowerASCII(&type); + std::string type = base::ToLowerASCII(element.getAttribute("type").utf8()); if (type == "password") { ++page_feature_state_->num_pswd_inputs; } else if (type == "radio") { diff --git a/chrome/test/chromedriver/capabilities.cc b/chrome/test/chromedriver/capabilities.cc index bc5bbbb..e4ba863 100644 --- a/chrome/test/chromedriver/capabilities.cc +++ b/chrome/test/chromedriver/capabilities.cc @@ -211,7 +211,7 @@ Status ParseProxy(const base::Value& option, Capabilities* capabilities) { std::string proxy_type; if (!proxy_dict->GetString("proxyType", &proxy_type)) return Status(kUnknownError, "'proxyType' must be a string"); - proxy_type = base::StringToLowerASCII(proxy_type); + proxy_type = base::ToLowerASCII(proxy_type); if (proxy_type == "direct") { capabilities->switches.SetSwitch("no-proxy-server"); } else if (proxy_type == "system") { diff --git a/chrome/test/chromedriver/chrome_launcher.cc b/chrome/test/chromedriver/chrome_launcher.cc index cb77dc1..90ddede 100644 --- a/chrome/test/chromedriver/chrome_launcher.cc +++ b/chrome/test/chromedriver/chrome_launcher.cc @@ -573,8 +573,7 @@ void ConvertHexadecimalToIDAlphabet(std::string* id) { std::string GenerateExtensionId(const std::string& input) { uint8 hash[16]; crypto::SHA256HashString(input, hash, sizeof(hash)); - std::string output = - base::StringToLowerASCII(base::HexEncode(hash, sizeof(hash))); + std::string output = base::ToLowerASCII(base::HexEncode(hash, sizeof(hash))); ConvertHexadecimalToIDAlphabet(&output); return output; } diff --git a/chrome/test/chromedriver/server/http_handler.cc b/chrome/test/chromedriver/server/http_handler.cc index 63c0a95..c3941b0 100644 --- a/chrome/test/chromedriver/server/http_handler.cc +++ b/chrome/test/chromedriver/server/http_handler.cc @@ -722,14 +722,14 @@ namespace internal { const char kNewSessionPathPattern[] = "session"; bool MatchesMethod(HttpMethod command_method, const std::string& method) { - std::string lower_method = base::StringToLowerASCII(method); + std::string lower_method = base::ToLowerASCII(method); switch (command_method) { - case kGet: - return lower_method == "get"; - case kPost: - return lower_method == "post" || lower_method == "put"; - case kDelete: - return lower_method == "delete"; + case kGet: + return lower_method == "get"; + case kPost: + return lower_method == "post" || lower_method == "put"; + case kDelete: + return lower_method == "delete"; } return false; } diff --git a/chromeos/cryptohome/system_salt_getter.cc b/chromeos/cryptohome/system_salt_getter.cc index 9c2e244..b0bbc9e 100644 --- a/chromeos/cryptohome/system_salt_getter.cc +++ b/chromeos/cryptohome/system_salt_getter.cc @@ -95,8 +95,8 @@ SystemSaltGetter* SystemSaltGetter::Get() { // static std::string SystemSaltGetter::ConvertRawSaltToHexString( const std::vector<uint8>& salt) { - return base::StringToLowerASCII(base::HexEncode( - reinterpret_cast<const void*>(salt.data()), salt.size())); + return base::ToLowerASCII( + base::HexEncode(reinterpret_cast<const void*>(salt.data()), salt.size())); } } // namespace chromeos diff --git a/chromeos/login/auth/key.cc b/chromeos/login/auth/key.cc index 01c3bcf..fe3ec86 100644 --- a/chromeos/login/auth/key.cc +++ b/chromeos/login/auth/key.cc @@ -84,7 +84,7 @@ void Key::Transform(KeyType target_key_type, const std::string& salt) { // Keep only the first half of the hash for 'weak' hashing so that the // plain text secret cannot be reconstructed even if the hashing is // reversed. - secret_ = base::StringToLowerASCII(base::HexEncode( + secret_ = base::ToLowerASCII(base::HexEncode( reinterpret_cast<const void*>(hash), sizeof(hash) / 2)); break; } diff --git a/cloud_print/gcp20/prototype/print_job_handler.cc b/cloud_print/gcp20/prototype/print_job_handler.cc index 557aa2e..d76114b 100644 --- a/cloud_print/gcp20/prototype/print_job_handler.cc +++ b/cloud_print/gcp20/prototype/print_job_handler.cc @@ -35,7 +35,7 @@ bool ValidateTicket(const std::string& ticket) { } std::string GenerateId() { - return base::StringToLowerASCII(base::GenerateGUID()); + return base::ToLowerASCII(base::GenerateGUID()); } } // namespace diff --git a/components/audio_modem/modem_impl.cc b/components/audio_modem/modem_impl.cc index 23d75d0..480204d 100644 --- a/components/audio_modem/modem_impl.cc +++ b/components/audio_modem/modem_impl.cc @@ -62,7 +62,7 @@ std::string AudioTypeToString(AudioType audio_type) { } bool ReadBooleanFlag(const std::string& flag, bool default_value) { - const std::string flag_value = base::StringToLowerASCII( + const std::string flag_value = base::ToLowerASCII( base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(flag)); if (flag_value == "true" || flag_value == "1") return true; diff --git a/components/autofill/content/browser/wallet/required_action.cc b/components/autofill/content/browser/wallet/required_action.cc index 9516f50..444d91f 100644 --- a/components/autofill/content/browser/wallet/required_action.cc +++ b/components/autofill/content/browser/wallet/required_action.cc @@ -35,7 +35,7 @@ bool ActionAppliesToWalletItems(RequiredAction action) { RequiredAction ParseRequiredActionFromString(const std::string& str) { std::string str_lower; - base::TrimWhitespaceASCII(base::StringToLowerASCII(str), base::TRIM_ALL, + base::TrimWhitespaceASCII(base::ToLowerASCII(str), base::TRIM_ALL, &str_lower); if (str_lower == "setup_wallet") diff --git a/components/autofill/core/browser/form_structure.cc b/components/autofill/core/browser/form_structure.cc index 526848f..1b97561 100644 --- a/components/autofill/core/browser/form_structure.cc +++ b/components/autofill/core/browser/form_structure.cc @@ -1105,7 +1105,7 @@ void FormStructure::ParseFieldTypesFromAutocompleteAttributes( // non-space characters (e.g. tab) to spaces, and converting to lowercase. std::string autocomplete_attribute = base::CollapseWhitespaceASCII(field->autocomplete_attribute, false); - autocomplete_attribute = base::StringToLowerASCII(autocomplete_attribute); + autocomplete_attribute = base::ToLowerASCII(autocomplete_attribute); // The autocomplete attribute is overloaded: it can specify either a field // type hint or whether autocomplete should be enabled at all. Ignore the diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc index 2e643a8..870b1f6 100644 --- a/components/autofill/core/browser/personal_data_manager.cc +++ b/components/autofill/core/browser/personal_data_manager.cc @@ -1061,23 +1061,22 @@ bool PersonalDataManager::IsCountryOfInterest(const std::string& country_code) const std::vector<AutofillProfile*>& profiles = web_profiles(); std::list<std::string> country_codes; for (size_t i = 0; i < profiles.size(); ++i) { - country_codes.push_back(base::StringToLowerASCII(base::UTF16ToASCII( + country_codes.push_back(base::ToLowerASCII(base::UTF16ToASCII( profiles[i]->GetRawInfo(ADDRESS_HOME_COUNTRY)))); } std::string timezone_country = CountryCodeForCurrentTimezone(); if (!timezone_country.empty()) - country_codes.push_back(base::StringToLowerASCII(timezone_country)); + country_codes.push_back(base::ToLowerASCII(timezone_country)); // Only take the locale into consideration if all else fails. if (country_codes.empty()) { - country_codes.push_back(base::StringToLowerASCII( + country_codes.push_back(base::ToLowerASCII( AutofillCountry::CountryCodeForLocale(app_locale()))); } return std::find(country_codes.begin(), country_codes.end(), - base::StringToLowerASCII(country_code)) != - country_codes.end(); + base::ToLowerASCII(country_code)) != country_codes.end(); } const std::string& PersonalDataManager::GetDefaultCountryCodeForNewAddress() diff --git a/components/autofill/core/common/save_password_progress_logger.cc b/components/autofill/core/common/save_password_progress_logger.cc index cfa3a58..456289b 100644 --- a/components/autofill/core/common/save_password_progress_logger.cc +++ b/components/autofill/core/common/save_password_progress_logger.cc @@ -43,7 +43,7 @@ bool IsUnwantedInElementID(char c) { std::string ScrubElementID8Bit(std::string element_id) { std::replace_if( element_id.begin(), element_id.end(), IsUnwantedInElementID, ' '); - return base::StringToLowerASCII(element_id); + return base::ToLowerASCII(element_id); } SavePasswordProgressLogger::StringID FormSchemeToStringID( diff --git a/components/content_settings/core/common/content_settings_pattern.cc b/components/content_settings/core/common/content_settings_pattern.cc index 634e487..1b49ba6 100644 --- a/components/content_settings/core/common/content_settings_pattern.cc +++ b/components/content_settings/core/common/content_settings_pattern.cc @@ -211,7 +211,7 @@ ContentSettingsPattern ContentSettingsPattern::Builder::Build() { // static bool ContentSettingsPattern::Builder::Canonicalize(PatternParts* parts) { // Canonicalize the scheme part. - const std::string scheme(base::StringToLowerASCII(parts->scheme)); + const std::string scheme(base::ToLowerASCII(parts->scheme)); parts->scheme = scheme; if (parts->scheme == std::string(url::kFileScheme) && diff --git a/components/crx_file/crx_file.cc b/components/crx_file/crx_file.cc index b081fec..ace6ee1 100644 --- a/components/crx_file/crx_file.cc +++ b/components/crx_file/crx_file.cc @@ -61,7 +61,7 @@ CrxFile::ValidateError FinalizeHash(const std::string& extension_id, uint8 output[crypto::kSHA256Length] = {}; hash->Finish(output, sizeof(output)); std::string hash_base64 = - base::StringToLowerASCII(base::HexEncode(output, sizeof(output))); + base::ToLowerASCII(base::HexEncode(output, sizeof(output))); if (hash_base64 != expected_hash) { LOG(ERROR) << "Hash check failed for extension: " << extension_id << ", expected " << expected_hash << ", got " << hash_base64; diff --git a/components/crx_file/id_util.cc b/components/crx_file/id_util.cc index 6209cb4..d628aa1 100644 --- a/components/crx_file/id_util.cc +++ b/components/crx_file/id_util.cc @@ -40,7 +40,7 @@ std::string GenerateId(const std::string& input) { uint8 hash[kIdSize]; crypto::SHA256HashString(input, hash, sizeof(hash)); std::string output = - base::StringToLowerASCII(base::HexEncode(hash, sizeof(hash))); + base::ToLowerASCII(base::HexEncode(hash, sizeof(hash))); ConvertHexadecimalToIDAlphabet(&output); return output; @@ -83,7 +83,7 @@ bool IdIsValid(const std::string& id) { // We only support lowercase IDs, because IDs can be used as URL components // (where GURL will lowercase it). - std::string temp = base::StringToLowerASCII(id); + std::string temp = base::ToLowerASCII(id); for (size_t i = 0; i < temp.size(); i++) if (temp[i] < 'a' || temp[i] > 'p') return false; diff --git a/components/device_event_log/device_event_log_impl.cc b/components/device_event_log/device_event_log_impl.cc index 7b339b5..94ee5fd 100644 --- a/components/device_event_log/device_event_log_impl.cc +++ b/components/device_event_log/device_event_log_impl.cc @@ -220,7 +220,7 @@ void GetFormat(const std::string& format_string, } LogType LogTypeFromString(const std::string& desc) { - std::string desc_lc = base::StringToLowerASCII(desc); + std::string desc_lc = base::ToLowerASCII(desc); if (desc_lc == "network") return LOG_TYPE_NETWORK; if (desc_lc == "power") diff --git a/components/history/core/browser/url_utils.cc b/components/history/core/browser/url_utils.cc index 54dc5a9..522af9b 100644 --- a/components/history/core/browser/url_utils.cc +++ b/components/history/core/browser/url_utils.cc @@ -88,7 +88,6 @@ GURL ToggleHTTPAndHTTPS(const GURL& url) { std::string HostForTopHosts(const GURL& url) { std::string host = url.host(); - base::StringToLowerASCII(&host); if (base::StartsWith(host, "www.", base::CompareCase::SENSITIVE)) host.assign(host, 4, std::string::npos); return host; diff --git a/components/language_usage_metrics/language_usage_metrics.cc b/components/language_usage_metrics/language_usage_metrics.cc index 190507f..ac44499 100644 --- a/components/language_usage_metrics/language_usage_metrics.cc +++ b/components/language_usage_metrics/language_usage_metrics.cc @@ -42,8 +42,7 @@ int LanguageUsageMetrics::ToLanguageCode(const std::string& locale) { if (!parts.GetNext()) return 0; - std::string language_part = parts.token(); - base::StringToLowerASCII(&language_part); + std::string language_part = base::ToLowerASCII(parts.token()); int language_code = 0; for (std::string::iterator it = language_part.begin(); diff --git a/components/mime_util/mime_util.cc b/components/mime_util/mime_util.cc index 49bf49d..6c51a9e 100644 --- a/components/mime_util/mime_util.cc +++ b/components/mime_util/mime_util.cc @@ -151,8 +151,7 @@ MimeUtil::MimeUtil() { } bool MimeUtil::IsSupportedImageMimeType(const std::string& mime_type) const { - return image_types_.find(base::StringToLowerASCII(mime_type)) != - image_types_.end(); + return image_types_.find(base::ToLowerASCII(mime_type)) != image_types_.end(); } bool MimeUtil::IsSupportedNonImageMimeType(const std::string& mime_type) const { diff --git a/components/nacl/renderer/nexe_load_manager.cc b/components/nacl/renderer/nexe_load_manager.cc index b7c9968..2494820 100644 --- a/components/nacl/renderer/nexe_load_manager.cc +++ b/components/nacl/renderer/nexe_load_manager.cc @@ -343,7 +343,7 @@ void NexeLoadManager::InitializePlugin( } // Store mime_type_ at initialization time since we make it lowercase. - mime_type_ = base::StringToLowerASCII(LookupAttribute(args_, kTypeAttribute)); + mime_type_ = base::ToLowerASCII(LookupAttribute(args_, kTypeAttribute)); } void NexeLoadManager::ReportStartupOverhead() const { diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc index d9edcb2..dde4ef8 100644 --- a/components/nacl/renderer/ppb_nacl_private_impl.cc +++ b/components/nacl/renderer/ppb_nacl_private_impl.cc @@ -1559,7 +1559,7 @@ class PexeDownloader : public blink::WebURLLoaderClient { for (const std::string& cur : base::SplitString( cache_control, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { - if (base::StringToLowerASCII(cur) == "no-store") + if (base::ToLowerASCII(cur) == "no-store") has_no_store_header = true; } diff --git a/components/os_crypt/ie7_password_win.cc b/components/os_crypt/ie7_password_win.cc index a2691f9..eebd57b 100644 --- a/components/os_crypt/ie7_password_win.cc +++ b/components/os_crypt/ie7_password_win.cc @@ -95,7 +95,7 @@ bool GetUserPassFromData(const std::vector<unsigned char>& data, } std::wstring GetUrlHash(const std::wstring& url) { - std::wstring lower_case_url = base::StringToLowerASCII(url); + std::wstring lower_case_url = base::ToLowerASCII(url); // Get a data buffer out of our std::wstring to pass to SHA1HashString. std::string url_buffer( reinterpret_cast<const char*>(lower_case_url.c_str()), @@ -121,7 +121,7 @@ std::wstring GetUrlHash(const std::wstring& url) { bool DecryptPasswords(const std::wstring& url, const std::vector<unsigned char>& data, std::vector<DecryptedCredentials>* credentials) { - std::wstring lower_case_url = base::StringToLowerASCII(url); + std::wstring lower_case_url = base::ToLowerASCII(url); DATA_BLOB input = {0}; DATA_BLOB output = {0}; DATA_BLOB url_key = {0}; diff --git a/components/plugins/renderer/mobile_youtube_plugin.cc b/components/plugins/renderer/mobile_youtube_plugin.cc index 7b576df..563ec26 100644 --- a/components/plugins/renderer/mobile_youtube_plugin.cc +++ b/components/plugins/renderer/mobile_youtube_plugin.cc @@ -49,15 +49,16 @@ bool IsValidYouTubeVideo(const std::string& path) { if (path.length() <= len) return false; - std::string str = base::StringToLowerASCII(path); // Youtube flash url can start with /v/ or /e/. - if (strncmp(str.data(), kSlashVSlash, len) != 0 && - strncmp(str.data(), kSlashESlash, len) != 0) + if (!base::StartsWith(path, kSlashVSlash, + base::CompareCase::INSENSITIVE_ASCII) || + !base::StartsWith(path, kSlashESlash, + base::CompareCase::INSENSITIVE_ASCII)) return false; // Start after /v/ for (unsigned i = len; i < path.length(); i++) { - char c = str[i]; + char c = path[i]; if (isalpha(c) || isdigit(c) || c == '_' || c == '-') continue; // The url can have more parameters such as &hl=en after the video id. diff --git a/components/policy/core/common/preg_parser_win.cc b/components/policy/core/common/preg_parser_win.cc index 08e4fa2..abdf371 100644 --- a/components/policy/core/common/preg_parser_win.cc +++ b/components/policy/core/common/preg_parser_win.cc @@ -186,7 +186,7 @@ void HandleRecord(const base::string16& key_name, return; } - std::string action_trigger(base::StringToLowerASCII(value_name.substr( + std::string action_trigger(base::ToLowerASCII(value_name.substr( arraysize(kActionTriggerPrefix) - 1))); if (action_trigger == kActionTriggerDeleteValues) { for (const std::string& value : diff --git a/components/query_parser/snippet_unittest.cc b/components/query_parser/snippet_unittest.cc index c560d58..727734a 100644 --- a/components/query_parser/snippet_unittest.cc +++ b/components/query_parser/snippet_unittest.cc @@ -96,7 +96,7 @@ base::string16 BuildSnippet(const std::string& document, // |document|. We need to add more test cases and change this function // to be more generic depending on how we deal with 'folding for match' // in history. - const std::string document_folded = base::StringToLowerASCII(document); + const std::string document_folded = base::ToLowerASCII(document); // Manually construct match_positions of the document. Snippet::MatchPositions match_positions; diff --git a/components/signin/core/browser/signin_internals_util.cc b/components/signin/core/browser/signin_internals_util.cc index 5eb9e5b..fa9d492 100644 --- a/components/signin/core/browser/signin_internals_util.cc +++ b/components/signin/core/browser/signin_internals_util.cc @@ -68,7 +68,7 @@ std::string GetTruncatedHash(const std::string& str) { const int kTruncateSize = kTruncateTokenStringLength / 2; char hash_val[kTruncateSize]; crypto::SHA256HashString(str, &hash_val[0], kTruncateSize); - return base::StringToLowerASCII(base::HexEncode(&hash_val[0], kTruncateSize)); + return base::ToLowerASCII(base::HexEncode(&hash_val[0], kTruncateSize)); } } // namespace signin_internals_util diff --git a/components/storage_monitor/media_storage_util.cc b/components/storage_monitor/media_storage_util.cc index 45dbdf7..13cbdce 100644 --- a/components/storage_monitor/media_storage_util.cc +++ b/components/storage_monitor/media_storage_util.cc @@ -99,7 +99,7 @@ bool MediaStorageUtil::HasDcim(const base::FilePath& mount_point) { if (!base::DirectoryExists(mount_point.Append(dcim_dir))) { // Check for lowercase 'dcim' as well. base::FilePath dcim_path_lower( - mount_point.Append(base::StringToLowerASCII(dcim_dir))); + mount_point.Append(base::ToLowerASCII(dcim_dir))); if (!base::DirectoryExists(dcim_path_lower)) return false; } diff --git a/components/user_prefs/tracked/pref_hash_calculator.cc b/components/user_prefs/tracked/pref_hash_calculator.cc index 6034262..3d5b7fa 100644 --- a/components/user_prefs/tracked/pref_hash_calculator.cc +++ b/components/user_prefs/tracked/pref_hash_calculator.cc @@ -85,7 +85,7 @@ std::string GenerateDeviceIdLikePrefMetricsServiceDid( const std::string& original_device_id) { if (original_device_id.empty()) return std::string(); - return base::StringToLowerASCII( + return base::ToLowerASCII( GetDigestString(original_device_id, "PrefMetricsService")); } |