0

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}
This commit is contained in:
brettw
2015-08-10 12:07:51 -07:00
committed by Commit bot
parent a794ba10af
commit fce8d19805
72 changed files with 107 additions and 129 deletions
android_webview/browser
base
chrome
app
browser
common
custom_handlers
extensions
api
file_browser_handlers
importer
installer
renderer
test
chromeos
cryptohome
login
auth
cloud_print/gcp20/prototype
components

@@ -118,7 +118,7 @@ std::string AwContentBrowserClient::GetAcceptLangsImpl() {
// If we're not en-US, add in en-US which will be // If we're not en-US, add in en-US which will be
// used with a lower q-value. // used with a lower q-value.
if (base::StringToLowerASCII(langs) != "en-us") { if (base::ToLowerASCII(langs) != "en-us") {
langs += ",en-US"; langs += ",en-US";
} }
return langs; return langs;

@@ -267,7 +267,7 @@ void CommandLine::SetProgram(const FilePath& program) {
} }
bool CommandLine::HasSwitch(const base::StringPiece& switch_string) const { 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) != return switches_by_stringpiece_.find(switch_string) !=
switches_by_stringpiece_.end(); switches_by_stringpiece_.end();
} }
@@ -297,7 +297,7 @@ FilePath CommandLine::GetSwitchValuePath(
CommandLine::StringType CommandLine::GetSwitchValueNative( CommandLine::StringType CommandLine::GetSwitchValueNative(
const base::StringPiece& switch_string) const { 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); auto result = switches_by_stringpiece_.find(switch_string);
return result == switches_by_stringpiece_.end() ? StringType() return result == switches_by_stringpiece_.end() ? StringType()
: *(result->second); : *(result->second);
@@ -315,7 +315,7 @@ void CommandLine::AppendSwitchPath(const std::string& switch_string,
void CommandLine::AppendSwitchNative(const std::string& switch_string, void CommandLine::AppendSwitchNative(const std::string& switch_string,
const CommandLine::StringType& value) { const CommandLine::StringType& value) {
#if defined(OS_WIN) #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)); StringType combined_switch_string(ASCIIToUTF16(switch_key));
#elif defined(OS_POSIX) #elif defined(OS_POSIX)
const std::string& switch_key = switch_string; const std::string& switch_key = switch_string;

@@ -36,11 +36,8 @@ std::string GetLocaleString(const icu::Locale& locale) {
result += country; result += country;
} }
if (variant != NULL && *variant != '\0') { if (variant != NULL && *variant != '\0')
std::string variant_str(variant); result += '@' + base::ToLowerASCII(variant);
base::StringToLowerASCII(&variant_str);
result += '@' + variant_str;
}
return result; return result;
} }

@@ -152,13 +152,11 @@ namespace {
// Early versions of Chrome incorrectly registered a chromehtml: URL handler, // Early versions of Chrome incorrectly registered a chromehtml: URL handler,
// which gives us nothing but trouble. Avoid launching chrome this way since // which gives us nothing but trouble. Avoid launching chrome this way since
// some apps fail to properly escape arguments. // 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:"; 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. // We are only searching for ASCII characters so this is OK.
base::StringToLowerASCII(&command_line_lower); return (command_line_lower.find(kChromeHtml) != base::string16::npos);
std::wstring::size_type pos = command_line_lower.find(kChromeHtml);
return (pos != std::wstring::npos);
} }
// If we try to access a path that is not currently available, we want the call // If we try to access a path that is not currently available, we want the call

@@ -39,8 +39,7 @@ bool ExtractPublicKeyHash(const CERT_CONTEXT* cert_context,
crypt_blob.pbData), crypt_blob.cbData); crypt_blob.pbData), crypt_blob.cbData);
crypto::SHA256HashString(key_bytes, hash, crypto::kSHA256Length); crypto::SHA256HashString(key_bytes, hash, crypto::kSHA256Length);
*public_key_hash = *public_key_hash = base::ToLowerASCII(base::HexEncode(hash, arraysize(hash)));
base::StringToLowerASCII(base::HexEncode(hash, arraysize(hash)));
return true; return true;
} }

@@ -85,7 +85,7 @@ class SignatureValidatorTest : public testing::Test {
crypto::SHA256HashString(key_bytes, hash, crypto::kSHA256Length); crypto::SHA256HashString(key_bytes, hash, crypto::kSHA256Length);
std::string public_key_hash = 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); expected_hashes_.push_back(public_key_hash);
} }

@@ -514,7 +514,7 @@ void ServicesCustomizationDocument::StartFetching() {
&customization_id) && &customization_id) &&
!customization_id.empty()) { !customization_id.empty()) {
url_ = GURL(base::StringPrintf( url_ = GURL(base::StringPrintf(
kManifestUrl, base::StringToLowerASCII(customization_id).c_str())); kManifestUrl, base::ToLowerASCII(customization_id).c_str()));
} else { } else {
// Remember that there is no customization ID in VPD. // Remember that there is no customization ID in VPD.
OnCustomizationNotFound(); OnCustomizationNotFound();

@@ -169,7 +169,7 @@ void UpdateDefaultTask(PrefService* pref_service,
iter != suffixes.end(); ++iter) { iter != suffixes.end(); ++iter) {
base::StringValue* value = new base::StringValue(task_id); base::StringValue* value = new base::StringValue(task_id);
// Suffixes are case insensitive. // 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); mime_type_pref->SetWithoutPathExpansion(lower_suffix, value);
} }
} }
@@ -197,7 +197,7 @@ std::string GetDefaultTaskIdFromPrefs(const PrefService& pref_service,
pref_service.GetDictionary(prefs::kDefaultTasksBySuffix); pref_service.GetDictionary(prefs::kDefaultTasksBySuffix);
DCHECK(suffix_task_prefs); DCHECK(suffix_task_prefs);
LOG_IF(ERROR, !suffix_task_prefs) << "Unable to open suffix 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) if (suffix_task_prefs)
suffix_task_prefs->GetStringWithoutPathExpansion(lower_suffix, &task_id); suffix_task_prefs->GetStringWithoutPathExpansion(lower_suffix, &task_id);
VLOG_IF(1, !task_id.empty()) << "Found suffix default handler: " << task_id; VLOG_IF(1, !task_id.empty()) << "Found suffix default handler: " << task_id;

@@ -1145,7 +1145,7 @@ void UserSessionManager::InitializeStartUrls() const {
const char* url = kChromeVoxTutorialURLPattern; const char* url = kChromeVoxTutorialURLPattern;
PrefService* prefs = g_browser_process->local_state(); PrefService* prefs = g_browser_process->local_state();
const std::string current_locale = 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()); std::string vox_url = base::StringPrintf(url, current_locale.c_str());
start_urls.push_back(vox_url); start_urls.push_back(vox_url);
can_show_getstarted_guide = false; can_show_getstarted_guide = false;

@@ -40,9 +40,8 @@ const int kMasterKeySize = 32;
std::string CreateSalt() { std::string CreateSalt() {
char result[kSaltSize]; char result[kSaltSize];
crypto::RandBytes(&result, sizeof(result)); crypto::RandBytes(&result, sizeof(result));
return base::StringToLowerASCII(base::HexEncode( return base::ToLowerASCII(
reinterpret_cast<const void*>(result), base::HexEncode(reinterpret_cast<const void*>(result), sizeof(result)));
sizeof(result)));
} }
std::string BuildRawHMACKey() { std::string BuildRawHMACKey() {
@@ -164,7 +163,7 @@ bool SupervisedUserAuthentication::FillDataForNewUser(
std::string SupervisedUserAuthentication::GenerateMasterKey() { std::string SupervisedUserAuthentication::GenerateMasterKey() {
char master_key_bytes[kMasterKeySize]; char master_key_bytes[kMasterKeySize];
crypto::RandBytes(&master_key_bytes, sizeof(master_key_bytes)); crypto::RandBytes(&master_key_bytes, sizeof(master_key_bytes));
return base::StringToLowerASCII( return base::ToLowerASCII(
base::HexEncode(reinterpret_cast<const void*>(master_key_bytes), base::HexEncode(reinterpret_cast<const void*>(master_key_bytes),
sizeof(master_key_bytes))); sizeof(master_key_bytes)));
} }

@@ -61,8 +61,8 @@ std::string ExtractBluetoothAddress(const std::string& path) {
int key_len = path.size() - header_size - end_size; int key_len = path.size() - header_size - end_size;
if (key_len <= 0) if (key_len <= 0)
return std::string(); return std::string();
std::string reverse_address = path.substr(header_size, key_len); std::string reverse_address =
base::StringToLowerASCII(&reverse_address); base::ToLowerASCII(path.substr(header_size, key_len));
std::vector<std::string> result = base::SplitString( std::vector<std::string> result = base::SplitString(
reverse_address, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); reverse_address, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
std::reverse(result.begin(), result.end()); std::reverse(result.begin(), result.end());
@@ -181,8 +181,7 @@ void PeripheralBatteryObserver::InitializeOnBluetoothReady(
void PeripheralBatteryObserver::RemoveBattery(const std::string& address) { void PeripheralBatteryObserver::RemoveBattery(const std::string& address) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
std::string address_lowercase = address; std::string address_lowercase = base::ToLowerASCII(address);
base::StringToLowerASCII(&address_lowercase);
std::map<std::string, BatteryInfo>::iterator it = std::map<std::string, BatteryInfo>::iterator it =
batteries_.find(address_lowercase); batteries_.find(address_lowercase);
if (it != batteries_.end()) { if (it != batteries_.end()) {

@@ -88,9 +88,9 @@ std::string CryptohomeTokenEncryptor::EncryptTokenWithKey(
return std::string(); return std::string();
} }
return base::StringToLowerASCII(base::HexEncode( return base::ToLowerASCII(
reinterpret_cast<const void*>(encoded_token.data()), base::HexEncode(reinterpret_cast<const void*>(encoded_token.data()),
encoded_token.size())); encoded_token.size()));
} }
std::string CryptohomeTokenEncryptor::DecryptTokenWithKey( std::string CryptohomeTokenEncryptor::DecryptTokenWithKey(

@@ -259,7 +259,7 @@ TEST_F(SupervisedUserWhitelistInstallerTest, GetHashFromCrxId) {
{ {
std::string extension_id = "aBcDeFgHiJkLmNoPpOnMlKjIhGfEdCbA"; std::string extension_id = "aBcDeFgHiJkLmNoPpOnMlKjIhGfEdCbA";
ASSERT_EQ(base::StringToLowerASCII(extension_id), ASSERT_EQ(base::ToLowerASCII(extension_id),
CrxIdToHashToCrxId(extension_id)); CrxIdToHashToCrxId(extension_id));
} }

@@ -349,7 +349,7 @@ static void GenerateHash(const std::string& input, std::string* output) {
uint8 hash[4]; uint8 hash[4];
crypto::SHA256HashString(input, hash, sizeof(hash)); crypto::SHA256HashString(input, hash, sizeof(hash));
*output = base::StringToLowerASCII(base::HexEncode(hash, sizeof(hash))); *output = base::ToLowerASCII(base::HexEncode(hash, sizeof(hash)));
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

@@ -151,8 +151,7 @@ bool GetFileTypesFromAcceptOption(
for (std::vector<std::string>::const_iterator iter = list->begin(); for (std::vector<std::string>::const_iterator iter = list->begin();
iter != list->end(); ++iter) { iter != list->end(); ++iter) {
std::vector<base::FilePath::StringType> inner; std::vector<base::FilePath::StringType> inner;
std::string accept_type = *iter; std::string accept_type = base::ToLowerASCII(*iter);
base::StringToLowerASCII(&accept_type);
net::GetExtensionsForMimeType(accept_type, &inner); net::GetExtensionsForMimeType(accept_type, &inner);
if (inner.empty()) if (inner.empty())
continue; continue;
@@ -176,8 +175,7 @@ bool GetFileTypesFromAcceptOption(
std::vector<std::string>* list = accept_option.extensions.get(); std::vector<std::string>* list = accept_option.extensions.get();
for (std::vector<std::string>::const_iterator iter = list->begin(); for (std::vector<std::string>::const_iterator iter = list->begin();
iter != list->end(); ++iter) { iter != list->end(); ++iter) {
std::string extension = *iter; std::string extension = base::ToLowerASCII(*iter);
base::StringToLowerASCII(&extension);
#if defined(OS_WIN) #if defined(OS_WIN)
extension_set.insert(base::UTF8ToWide(*iter)); extension_set.insert(base::UTF8ToWide(*iter));
#else #else

@@ -67,7 +67,7 @@ const char* GcmResultToError(gcm::GCMClient::Result result) {
} }
bool IsMessageKeyValid(const std::string& key) { bool IsMessageKeyValid(const std::string& key) {
std::string lower = base::StringToLowerASCII(key); std::string lower = base::ToLowerASCII(key);
return !key.empty() && return !key.empty() &&
key.compare(0, arraysize(kCollapseKey) - 1, kCollapseKey) != 0 && key.compare(0, arraysize(kCollapseKey) - 1, kCollapseKey) != 0 &&
lower.compare(0, lower.compare(0,

@@ -24,7 +24,7 @@ bool ComputeHmacSha256(const std::string& key,
bool result = hmac.Init(key) && bool result = hmac.Init(key) &&
hmac.Sign(text, &digest[0], digest.size()); hmac.Sign(text, &digest[0], digest.size());
if (result) { if (result) {
*signature_return = base::StringToLowerASCII( *signature_return = base::ToLowerASCII(
base::HexEncode(digest.data(), digest.size())); base::HexEncode(digest.data(), digest.size()));
} }
return result; return result;

@@ -124,7 +124,7 @@ class MacAddressProcessor {
// Got one! // Got one!
found_mac_address_ = found_mac_address_ =
base::StringToLowerASCII(base::HexEncode(mac_address, MAC_LENGTH)); base::ToLowerASCII(base::HexEncode(mac_address, MAC_LENGTH));
return false; return false;
} }

@@ -133,7 +133,7 @@ class MacAddressProcessor {
if (!is_valid_mac_address_.Run(mac_address, mac_address_size)) if (!is_valid_mac_address_.Run(mac_address, mac_address_size))
return keep_going; 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)); mac_address, mac_address_size));
base::ScopedCFTypeRef<CFStringRef> provider_class( base::ScopedCFTypeRef<CFStringRef> provider_class(

@@ -76,7 +76,7 @@ class MacAddressProcessor {
if (!is_valid_mac_address_.Run(bytes, size)) if (!is_valid_mac_address_.Run(bytes, size))
return; return;
found_mac_address_ = base::StringToLowerASCII(base::HexEncode(bytes, size)); found_mac_address_ = base::ToLowerASCII(base::HexEncode(bytes, size));
found_index_ = index; found_index_ = index;
} }

@@ -2116,7 +2116,7 @@ void ExtensionService::TerminateExtension(const std::string& extension_id) {
} }
void ExtensionService::UntrackTerminatedExtension(const std::string& 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 = const Extension* extension =
registry_->terminated_extensions().GetByID(lowercase_id); registry_->terminated_extensions().GetByID(lowercase_id);
registry_->RemoveTerminated(lowercase_id); registry_->RemoveTerminated(lowercase_id);

@@ -98,8 +98,7 @@ void ExternalRegistryLoader::LoadOnFileThread() {
continue; continue;
} }
std::string id = base::UTF16ToASCII(*it); std::string id = base::ToLowerASCII(base::UTF16ToASCII(*it));
base::StringToLowerASCII(&id);
if (!crx_file::id_util::IdIsValid(id)) { if (!crx_file::id_util::IdIsValid(id)) {
LOG(ERROR) << "Invalid id value " << id LOG(ERROR) << "Invalid id value " << id
<< " for key " << key_path << "."; << " for key " << key_path << ".";

@@ -75,7 +75,7 @@ LocalExtensionCache::CacheMap::iterator LocalExtensionCache::FindExtension(
const std::string& expected_hash) { const std::string& expected_hash) {
CacheHit hit = cache.equal_range(id); CacheHit hit = cache.equal_range(id);
CacheMap::iterator empty_hash = cache.end(); 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) { for (CacheMap::iterator it = hit.first; it != hit.second; ++it) {
if (expected_hash.empty() || it->second.expected_hash == hash) { if (expected_hash.empty() || it->second.expected_hash == hash) {
return it; return it;
@@ -437,7 +437,7 @@ void LocalExtensionCache::BackendCheckCacheContentsInternal(
} }
// Enforce a lower-case id. // Enforce a lower-case id.
id = base::StringToLowerASCII(id); id = base::ToLowerASCII(id);
if (!crx_file::id_util::IdIsValid(id)) { if (!crx_file::id_util::IdIsValid(id)) {
LOG(ERROR) << "Bad extension id in cache: " << id; LOG(ERROR) << "Bad extension id in cache: " << id;
id.clear(); id.clear();
@@ -486,7 +486,7 @@ std::string LocalExtensionCache::ExtensionFileName(
const std::string& expected_hash) { const std::string& expected_hash) {
std::string filename = id + "-" + version; std::string filename = id + "-" + version;
if (!expected_hash.empty()) if (!expected_hash.empty())
filename += "-" + base::StringToLowerASCII(expected_hash); filename += "-" + base::ToLowerASCII(expected_hash);
filename += kCRXFileExtension; filename += kCRXFileExtension;
return filename; return filename;
} }
@@ -612,7 +612,7 @@ LocalExtensionCache::CacheItemInfo::CacheItemInfo(
uint64 size, uint64 size,
const base::FilePath& file_path) const base::FilePath& file_path)
: version(version), : version(version),
expected_hash(base::StringToLowerASCII(expected_hash)), expected_hash(base::ToLowerASCII(expected_hash)),
last_used(last_used), last_used(last_used),
size(size), size(size),
file_path(file_path) { file_path(file_path) {

@@ -105,7 +105,7 @@ class LocalExtensionCacheTest : public testing::Test {
uint8 output[crypto::kSHA256Length]; uint8 output[crypto::kSHA256Length];
hash->Finish(output, sizeof(output)); hash->Finish(output, sizeof(output));
const std::string hex_hash = const std::string hex_hash =
base::StringToLowerASCII(base::HexEncode(output, sizeof(output))); base::ToLowerASCII(base::HexEncode(output, sizeof(output)));
delete hash; delete hash;
const base::FilePath file = const base::FilePath file =

@@ -565,7 +565,7 @@ bool FileSelectHelper::IsAcceptTypeValid(const std::string& accept_type) {
// of an extension or a "/" in the case of a MIME type). // of an extension or a "/" in the case of a MIME type).
std::string unused; std::string unused;
if (accept_type.length() <= 1 || 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::TrimWhitespaceASCII(accept_type, base::TRIM_ALL, &unused) !=
base::TRIM_NONE) { base::TRIM_NONE) {
return false; return false;

@@ -183,7 +183,7 @@ int IconSizeToDIPSize(IconLoader::IconSize size) {
// static // static
IconGroupID IconLoader::ReadGroupIDFromFilepath( IconGroupID IconLoader::ReadGroupIDFromFilepath(
const base::FilePath& filepath) { const base::FilePath& filepath) {
return base::StringToLowerASCII(filepath.Extension()); return base::ToLowerASCII(filepath.Extension());
} }
// static // static

@@ -78,7 +78,7 @@ class FirefoxURLParameterFilter : public TemplateURLParser::ParameterFilter {
// TemplateURLParser::ParameterFilter method. // TemplateURLParser::ParameterFilter method.
bool KeepParameter(const std::string& key, bool KeepParameter(const std::string& key,
const std::string& value) override { 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 || if (low_value.find("mozilla") != std::string::npos ||
low_value.find("firefox") != std::string::npos || low_value.find("firefox") != std::string::npos ||
low_value.find("moz:") != std::string::npos) { low_value.find("moz:") != std::string::npos) {

@@ -13,7 +13,7 @@
#include "chrome/browser/install_verification/win/module_list.h" #include "chrome/browser/install_verification/win/module_list.h"
std::string CalculateModuleNameDigest(const base::string16& module_name) { 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()))); base::FilePath(module_name).BaseName().value())));
} }

@@ -152,8 +152,7 @@ bool MediaPathFilter::Match(const base::FilePath& path) {
MediaGalleryScanFileType MediaPathFilter::GetType(const base::FilePath& path) { MediaGalleryScanFileType MediaPathFilter::GetType(const base::FilePath& path) {
EnsureInitialized(); EnsureInitialized();
MediaFileExtensionMap::const_iterator it = MediaFileExtensionMap::const_iterator it =
media_file_extensions_map_.find( media_file_extensions_map_.find(base::ToLowerASCII(path.Extension()));
base::StringToLowerASCII(path.Extension()));
if (it == media_file_extensions_map_.end()) if (it == media_file_extensions_map_.end())
return MEDIA_GALLERY_SCAN_FILE_TYPE_UNKNOWN; return MEDIA_GALLERY_SCAN_FILE_TYPE_UNKNOWN;
return static_cast<MediaGalleryScanFileType>(it->second); return static_cast<MediaGalleryScanFileType>(it->second);

@@ -113,7 +113,7 @@ void ExtractLoadedModuleNameDigests(
std::string module_name; std::string module_name;
if (!module_dictionary->GetString("name", &module_name)) if (!module_dictionary->GetString("name", &module_name))
continue; continue;
base::StringToLowerASCII(&module_name); module_name = base::ToLowerASCII(module_name);
module_name_digests->AppendString(base::MD5String(module_name)); module_name_digests->AppendString(base::MD5String(module_name));
} }
} }

@@ -697,7 +697,7 @@ ProfileIOData* ProfileIOData::FromResourceContext(
// static // static
bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { bool ProfileIOData::IsHandledProtocol(const std::string& scheme) {
DCHECK_EQ(scheme, base::StringToLowerASCII(scheme)); DCHECK_EQ(scheme, base::ToLowerASCII(scheme));
static const char* const kProtocolList[] = { static const char* const kProtocolList[] = {
url::kFileScheme, url::kFileScheme,
content::kChromeDevToolsScheme, content::kChromeDevToolsScheme,

@@ -159,13 +159,13 @@ void DeviceIDFetcher::ComputeOnUIThread(const std::string& salt,
input.append(kDRMIdentifierFile); input.append(kDRMIdentifierFile);
input.append(salt_bytes.begin(), salt_bytes.end()); input.append(salt_bytes.begin(), salt_bytes.end());
crypto::SHA256HashString(input, &id_buf, sizeof(id_buf)); 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))); base::HexEncode(reinterpret_cast<const void*>(id_buf), sizeof(id_buf)));
input = machine_id; input = machine_id;
input.append(kDRMIdentifierFile); input.append(kDRMIdentifierFile);
input.append(id); input.append(id);
crypto::SHA256HashString(input, &id_buf, sizeof(id_buf)); 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))); base::HexEncode(reinterpret_cast<const void*>(id_buf), sizeof(id_buf)));
RunCallbackOnIOThread(id, PP_OK); RunCallbackOnIOThread(id, PP_OK);

@@ -34,7 +34,7 @@ bool GetLoadedBlacklistedModules(std::vector<base::string16>* module_names) {
std::set<ModuleInfo>::const_iterator module_iter(module_info_set.begin()); std::set<ModuleInfo>::const_iterator module_iter(module_info_set.begin());
for (; module_iter != module_info_set.end(); ++module_iter) { 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())); base::FilePath(module_iter->name).BaseName().value()));
if (blacklist::GetBlacklistIndex(module_file_name.c_str()) != -1) { if (blacklist::GetBlacklistIndex(module_file_name.c_str()) != -1) {
module_names->push_back(module_iter->name); module_names->push_back(module_iter->name);

@@ -44,7 +44,7 @@ TEST(BlacklistLoadAnalyzer, TestBlacklistBypass) {
EXPECT_TRUE(GetLoadedBlacklistedModules(&module_names)); EXPECT_TRUE(GetLoadedBlacklistedModules(&module_names));
ASSERT_EQ(1, module_names.size()); ASSERT_EQ(1, module_names.size());
EXPECT_STREQ(kTestDllName, EXPECT_STREQ(kTestDllName,
base::StringToLowerASCII( base::ToLowerASCII(
base::FilePath(module_names[0]).BaseName().value()).c_str()); base::FilePath(module_names[0]).BaseName().value()).c_str());
} }

@@ -268,8 +268,7 @@ class HotwordNotificationDelegate : public NotificationDelegate {
// static // static
bool HotwordService::DoesHotwordSupportLanguage(Profile* profile) { bool HotwordService::DoesHotwordSupportLanguage(Profile* profile) {
std::string normalized_locale = std::string normalized_locale =
l10n_util::NormalizeLocale(GetCurrentLocale(profile)); base::ToLowerASCII(l10n_util::NormalizeLocale(GetCurrentLocale(profile)));
base::StringToLowerASCII(&normalized_locale);
// For M43, we are limiting always-on to en_us only. // For M43, we are limiting always-on to en_us only.
// TODO(kcarattini): Remove this once // TODO(kcarattini): Remove this once

@@ -386,7 +386,7 @@ bool ShellIntegration::IsFirefoxDefaultBrowser() {
base::string16 app_cmd; base::string16 app_cmd;
if (key.Valid() && (key.ReadValue(L"", &app_cmd) == ERROR_SUCCESS) && if (key.Valid() && (key.ReadValue(L"", &app_cmd) == ERROR_SUCCESS) &&
base::string16::npos != base::string16::npos !=
base::StringToLowerASCII(app_cmd).find(L"firefox")) base::ToLowerASCII(app_cmd).find(L"firefox"))
ff_default = true; ff_default = true;
} }
return ff_default; return ff_default;

@@ -228,7 +228,7 @@ GURL SpellcheckHunspellDictionary::GetDictionaryURL() {
DCHECK(!bdict_file.empty()); DCHECK(!bdict_file.empty());
return GURL(std::string(kDownloadServerUrl) + return GURL(std::string(kDownloadServerUrl) +
base::StringToLowerASCII(bdict_file)); base::ToLowerASCII(bdict_file));
} }
void SpellcheckHunspellDictionary::DownloadDictionary(GURL url) { void SpellcheckHunspellDictionary::DownloadDictionary(GURL url) {

@@ -277,7 +277,7 @@ bool ExtensionIconSource::ParseData(
int request_id, int request_id,
const content::URLDataSource::GotDataCallback& callback) { const content::URLDataSource::GotDataCallback& callback) {
// Extract the parameters from the path by lower casing and splitting. // 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( std::vector<std::string> path_parts = base::SplitString(
path_lower, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); path_lower, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (path_lower.empty() || path_parts.size() < 3) if (path_lower.empty() || path_parts.size() < 3)

@@ -18,7 +18,7 @@ ProtocolHandler::ProtocolHandler(const std::string& protocol,
ProtocolHandler ProtocolHandler::CreateProtocolHandler( ProtocolHandler ProtocolHandler::CreateProtocolHandler(
const std::string& protocol, const std::string& protocol,
const GURL& url) { const GURL& url) {
std::string lower_protocol = base::StringToLowerASCII(protocol); std::string lower_protocol = base::ToLowerASCII(protocol);
return ProtocolHandler(lower_protocol, url); return ProtocolHandler(lower_protocol, url);
} }

@@ -199,7 +199,7 @@ FileBrowserHandler* LoadFileBrowserHandler(
errors::kInvalidFileFilterValue, base::IntToString(i)); errors::kInvalidFileFilterValue, base::IntToString(i));
return NULL; return NULL;
} }
base::StringToLowerASCII(&filter); filter = base::ToLowerASCII(filter);
if (!base::StartsWith(filter, std::string(url::kFileSystemScheme) + ':', if (!base::StartsWith(filter, std::string(url::kFileSystemScheme) + ':',
base::CompareCase::SENSITIVE)) { base::CompareCase::SENSITIVE)) {
*error = extensions::ErrorUtils::FormatErrorMessageUTF16( *error = extensions::ErrorUtils::FormatErrorMessageUTF16(

@@ -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) if (branding_name.find("iceweasel") != std::string::npos)
return l10n_util::GetStringUTF16(IDS_IMPORT_FROM_ICEWEASEL); return l10n_util::GetStringUTF16(IDS_IMPORT_FROM_ICEWEASEL);
return l10n_util::GetStringUTF16(IDS_IMPORT_FROM_FIREFOX); return l10n_util::GetStringUTF16(IDS_IMPORT_FROM_FIREFOX);

@@ -243,13 +243,9 @@ bool LanguageSelector::SelectIf(const std::vector<std::wstring>& candidates,
SelectPred_Fn select_predicate, SelectPred_Fn select_predicate,
std::wstring* matched_name, std::wstring* matched_name,
int* matched_offset) { int* matched_offset) {
std::wstring candidate; for (const std::wstring& scan : candidates) {
for (std::vector<std::wstring>::const_iterator scan = candidates.begin(), if (select_predicate(base::ToLowerASCII(scan), matched_offset)) {
end = candidates.end(); scan != end; ++scan) { matched_name->assign(scan);
candidate.assign(*scan);
base::StringToLowerASCII(&candidate);
if (select_predicate(candidate, matched_offset)) {
matched_name->assign(*scan);
return true; return true;
} }
} }

@@ -315,7 +315,7 @@ int32_t PepperFlashRendererHost::OnNavigate(
bool rejected = false; bool rejected = false;
while (header_iter.GetNext()) { while (header_iter.GetNext()) {
std::string lower_case_header_name = 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())) { if (!IsSimpleHeader(lower_case_header_name, header_iter.values())) {
rejected = true; rejected = true;

@@ -106,7 +106,7 @@ void PluginUMAReporter::ExtractFileExtension(const GURL& src,
extension->clear(); extension->clear();
} }
base::StringToLowerASCII(extension); *extension = base::ToLowerASCII(*extension);
} }
PluginUMAReporter::PluginType PluginUMAReporter::GetPluginType( 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, // 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. // we try to determine plugin type using plugin source's extension.
if (!plugin_mime_type.empty()) if (!plugin_mime_type.empty())
return MimeTypeToPluginType(base::StringToLowerASCII(plugin_mime_type)); return MimeTypeToPluginType(base::ToLowerASCII(plugin_mime_type));
return SrcToPluginType(plugin_src); return SrcToPluginType(plugin_src);
} }

@@ -327,8 +327,7 @@ void PhishingDOMFeatureExtractor::HandleInput(
// Note that we use the attribute value rather than // Note that we use the attribute value rather than
// WebFormControlElement::formControlType() for consistency with the // WebFormControlElement::formControlType() for consistency with the
// way the phishing classification model is created. // way the phishing classification model is created.
std::string type = element.getAttribute("type").utf8(); std::string type = base::ToLowerASCII(element.getAttribute("type").utf8());
base::StringToLowerASCII(&type);
if (type == "password") { if (type == "password") {
++page_feature_state_->num_pswd_inputs; ++page_feature_state_->num_pswd_inputs;
} else if (type == "radio") { } else if (type == "radio") {

@@ -211,7 +211,7 @@ Status ParseProxy(const base::Value& option, Capabilities* capabilities) {
std::string proxy_type; std::string proxy_type;
if (!proxy_dict->GetString("proxyType", &proxy_type)) if (!proxy_dict->GetString("proxyType", &proxy_type))
return Status(kUnknownError, "'proxyType' must be a string"); return Status(kUnknownError, "'proxyType' must be a string");
proxy_type = base::StringToLowerASCII(proxy_type); proxy_type = base::ToLowerASCII(proxy_type);
if (proxy_type == "direct") { if (proxy_type == "direct") {
capabilities->switches.SetSwitch("no-proxy-server"); capabilities->switches.SetSwitch("no-proxy-server");
} else if (proxy_type == "system") { } else if (proxy_type == "system") {

@@ -573,8 +573,7 @@ void ConvertHexadecimalToIDAlphabet(std::string* id) {
std::string GenerateExtensionId(const std::string& input) { std::string GenerateExtensionId(const std::string& input) {
uint8 hash[16]; uint8 hash[16];
crypto::SHA256HashString(input, hash, sizeof(hash)); crypto::SHA256HashString(input, hash, sizeof(hash));
std::string output = std::string output = base::ToLowerASCII(base::HexEncode(hash, sizeof(hash)));
base::StringToLowerASCII(base::HexEncode(hash, sizeof(hash)));
ConvertHexadecimalToIDAlphabet(&output); ConvertHexadecimalToIDAlphabet(&output);
return output; return output;
} }

@@ -722,14 +722,14 @@ namespace internal {
const char kNewSessionPathPattern[] = "session"; const char kNewSessionPathPattern[] = "session";
bool MatchesMethod(HttpMethod command_method, const std::string& method) { 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) { switch (command_method) {
case kGet: case kGet:
return lower_method == "get"; return lower_method == "get";
case kPost: case kPost:
return lower_method == "post" || lower_method == "put"; return lower_method == "post" || lower_method == "put";
case kDelete: case kDelete:
return lower_method == "delete"; return lower_method == "delete";
} }
return false; return false;
} }

@@ -95,8 +95,8 @@ SystemSaltGetter* SystemSaltGetter::Get() {
// static // static
std::string SystemSaltGetter::ConvertRawSaltToHexString( std::string SystemSaltGetter::ConvertRawSaltToHexString(
const std::vector<uint8>& salt) { const std::vector<uint8>& salt) {
return base::StringToLowerASCII(base::HexEncode( return base::ToLowerASCII(
reinterpret_cast<const void*>(salt.data()), salt.size())); base::HexEncode(reinterpret_cast<const void*>(salt.data()), salt.size()));
} }
} // namespace chromeos } // namespace chromeos

@@ -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 // 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 // plain text secret cannot be reconstructed even if the hashing is
// reversed. // reversed.
secret_ = base::StringToLowerASCII(base::HexEncode( secret_ = base::ToLowerASCII(base::HexEncode(
reinterpret_cast<const void*>(hash), sizeof(hash) / 2)); reinterpret_cast<const void*>(hash), sizeof(hash) / 2));
break; break;
} }

@@ -35,7 +35,7 @@ bool ValidateTicket(const std::string& ticket) {
} }
std::string GenerateId() { std::string GenerateId() {
return base::StringToLowerASCII(base::GenerateGUID()); return base::ToLowerASCII(base::GenerateGUID());
} }
} // namespace } // namespace

@@ -62,7 +62,7 @@ std::string AudioTypeToString(AudioType audio_type) {
} }
bool ReadBooleanFlag(const std::string& flag, bool default_value) { 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)); base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(flag));
if (flag_value == "true" || flag_value == "1") if (flag_value == "true" || flag_value == "1")
return true; return true;

@@ -35,7 +35,7 @@ bool ActionAppliesToWalletItems(RequiredAction action) {
RequiredAction ParseRequiredActionFromString(const std::string& str) { RequiredAction ParseRequiredActionFromString(const std::string& str) {
std::string str_lower; std::string str_lower;
base::TrimWhitespaceASCII(base::StringToLowerASCII(str), base::TRIM_ALL, base::TrimWhitespaceASCII(base::ToLowerASCII(str), base::TRIM_ALL,
&str_lower); &str_lower);
if (str_lower == "setup_wallet") if (str_lower == "setup_wallet")

@@ -1105,7 +1105,7 @@ void FormStructure::ParseFieldTypesFromAutocompleteAttributes(
// non-space characters (e.g. tab) to spaces, and converting to lowercase. // non-space characters (e.g. tab) to spaces, and converting to lowercase.
std::string autocomplete_attribute = std::string autocomplete_attribute =
base::CollapseWhitespaceASCII(field->autocomplete_attribute, false); 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 // The autocomplete attribute is overloaded: it can specify either a field
// type hint or whether autocomplete should be enabled at all. Ignore the // type hint or whether autocomplete should be enabled at all. Ignore the

@@ -1061,23 +1061,22 @@ bool PersonalDataManager::IsCountryOfInterest(const std::string& country_code)
const std::vector<AutofillProfile*>& profiles = web_profiles(); const std::vector<AutofillProfile*>& profiles = web_profiles();
std::list<std::string> country_codes; std::list<std::string> country_codes;
for (size_t i = 0; i < profiles.size(); ++i) { 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)))); profiles[i]->GetRawInfo(ADDRESS_HOME_COUNTRY))));
} }
std::string timezone_country = CountryCodeForCurrentTimezone(); std::string timezone_country = CountryCodeForCurrentTimezone();
if (!timezone_country.empty()) 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. // Only take the locale into consideration if all else fails.
if (country_codes.empty()) { if (country_codes.empty()) {
country_codes.push_back(base::StringToLowerASCII( country_codes.push_back(base::ToLowerASCII(
AutofillCountry::CountryCodeForLocale(app_locale()))); AutofillCountry::CountryCodeForLocale(app_locale())));
} }
return std::find(country_codes.begin(), country_codes.end(), return std::find(country_codes.begin(), country_codes.end(),
base::StringToLowerASCII(country_code)) != base::ToLowerASCII(country_code)) != country_codes.end();
country_codes.end();
} }
const std::string& PersonalDataManager::GetDefaultCountryCodeForNewAddress() const std::string& PersonalDataManager::GetDefaultCountryCodeForNewAddress()

@@ -43,7 +43,7 @@ bool IsUnwantedInElementID(char c) {
std::string ScrubElementID8Bit(std::string element_id) { std::string ScrubElementID8Bit(std::string element_id) {
std::replace_if( std::replace_if(
element_id.begin(), element_id.end(), IsUnwantedInElementID, ' '); element_id.begin(), element_id.end(), IsUnwantedInElementID, ' ');
return base::StringToLowerASCII(element_id); return base::ToLowerASCII(element_id);
} }
SavePasswordProgressLogger::StringID FormSchemeToStringID( SavePasswordProgressLogger::StringID FormSchemeToStringID(

@@ -211,7 +211,7 @@ ContentSettingsPattern ContentSettingsPattern::Builder::Build() {
// static // static
bool ContentSettingsPattern::Builder::Canonicalize(PatternParts* parts) { bool ContentSettingsPattern::Builder::Canonicalize(PatternParts* parts) {
// Canonicalize the scheme part. // Canonicalize the scheme part.
const std::string scheme(base::StringToLowerASCII(parts->scheme)); const std::string scheme(base::ToLowerASCII(parts->scheme));
parts->scheme = scheme; parts->scheme = scheme;
if (parts->scheme == std::string(url::kFileScheme) && if (parts->scheme == std::string(url::kFileScheme) &&

@@ -61,7 +61,7 @@ CrxFile::ValidateError FinalizeHash(const std::string& extension_id,
uint8 output[crypto::kSHA256Length] = {}; uint8 output[crypto::kSHA256Length] = {};
hash->Finish(output, sizeof(output)); hash->Finish(output, sizeof(output));
std::string hash_base64 = std::string hash_base64 =
base::StringToLowerASCII(base::HexEncode(output, sizeof(output))); base::ToLowerASCII(base::HexEncode(output, sizeof(output)));
if (hash_base64 != expected_hash) { if (hash_base64 != expected_hash) {
LOG(ERROR) << "Hash check failed for extension: " << extension_id LOG(ERROR) << "Hash check failed for extension: " << extension_id
<< ", expected " << expected_hash << ", got " << hash_base64; << ", expected " << expected_hash << ", got " << hash_base64;

@@ -40,7 +40,7 @@ std::string GenerateId(const std::string& input) {
uint8 hash[kIdSize]; uint8 hash[kIdSize];
crypto::SHA256HashString(input, hash, sizeof(hash)); crypto::SHA256HashString(input, hash, sizeof(hash));
std::string output = std::string output =
base::StringToLowerASCII(base::HexEncode(hash, sizeof(hash))); base::ToLowerASCII(base::HexEncode(hash, sizeof(hash)));
ConvertHexadecimalToIDAlphabet(&output); ConvertHexadecimalToIDAlphabet(&output);
return 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 // We only support lowercase IDs, because IDs can be used as URL components
// (where GURL will lowercase it). // (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++) for (size_t i = 0; i < temp.size(); i++)
if (temp[i] < 'a' || temp[i] > 'p') if (temp[i] < 'a' || temp[i] > 'p')
return false; return false;

@@ -220,7 +220,7 @@ void GetFormat(const std::string& format_string,
} }
LogType LogTypeFromString(const std::string& desc) { LogType LogTypeFromString(const std::string& desc) {
std::string desc_lc = base::StringToLowerASCII(desc); std::string desc_lc = base::ToLowerASCII(desc);
if (desc_lc == "network") if (desc_lc == "network")
return LOG_TYPE_NETWORK; return LOG_TYPE_NETWORK;
if (desc_lc == "power") if (desc_lc == "power")

@@ -88,7 +88,6 @@ GURL ToggleHTTPAndHTTPS(const GURL& url) {
std::string HostForTopHosts(const GURL& url) { std::string HostForTopHosts(const GURL& url) {
std::string host = url.host(); std::string host = url.host();
base::StringToLowerASCII(&host);
if (base::StartsWith(host, "www.", base::CompareCase::SENSITIVE)) if (base::StartsWith(host, "www.", base::CompareCase::SENSITIVE))
host.assign(host, 4, std::string::npos); host.assign(host, 4, std::string::npos);
return host; return host;

@@ -42,8 +42,7 @@ int LanguageUsageMetrics::ToLanguageCode(const std::string& locale) {
if (!parts.GetNext()) if (!parts.GetNext())
return 0; return 0;
std::string language_part = parts.token(); std::string language_part = base::ToLowerASCII(parts.token());
base::StringToLowerASCII(&language_part);
int language_code = 0; int language_code = 0;
for (std::string::iterator it = language_part.begin(); for (std::string::iterator it = language_part.begin();

@@ -151,8 +151,7 @@ MimeUtil::MimeUtil() {
} }
bool MimeUtil::IsSupportedImageMimeType(const std::string& mime_type) const { bool MimeUtil::IsSupportedImageMimeType(const std::string& mime_type) const {
return image_types_.find(base::StringToLowerASCII(mime_type)) != return image_types_.find(base::ToLowerASCII(mime_type)) != image_types_.end();
image_types_.end();
} }
bool MimeUtil::IsSupportedNonImageMimeType(const std::string& mime_type) const { bool MimeUtil::IsSupportedNonImageMimeType(const std::string& mime_type) const {

@@ -343,7 +343,7 @@ void NexeLoadManager::InitializePlugin(
} }
// Store mime_type_ at initialization time since we make it lowercase. // 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 { void NexeLoadManager::ReportStartupOverhead() const {

@@ -1559,7 +1559,7 @@ class PexeDownloader : public blink::WebURLLoaderClient {
for (const std::string& cur : base::SplitString( for (const std::string& cur : base::SplitString(
cache_control, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { 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; has_no_store_header = true;
} }

@@ -95,7 +95,7 @@ bool GetUserPassFromData(const std::vector<unsigned char>& data,
} }
std::wstring GetUrlHash(const std::wstring& url) { 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. // Get a data buffer out of our std::wstring to pass to SHA1HashString.
std::string url_buffer( std::string url_buffer(
reinterpret_cast<const char*>(lower_case_url.c_str()), 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, bool DecryptPasswords(const std::wstring& url,
const std::vector<unsigned char>& data, const std::vector<unsigned char>& data,
std::vector<DecryptedCredentials>* credentials) { 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 input = {0};
DATA_BLOB output = {0}; DATA_BLOB output = {0};
DATA_BLOB url_key = {0}; DATA_BLOB url_key = {0};

@@ -49,15 +49,16 @@ bool IsValidYouTubeVideo(const std::string& path) {
if (path.length() <= len) if (path.length() <= len)
return false; return false;
std::string str = base::StringToLowerASCII(path);
// Youtube flash url can start with /v/ or /e/. // Youtube flash url can start with /v/ or /e/.
if (strncmp(str.data(), kSlashVSlash, len) != 0 && if (!base::StartsWith(path, kSlashVSlash,
strncmp(str.data(), kSlashESlash, len) != 0) base::CompareCase::INSENSITIVE_ASCII) ||
!base::StartsWith(path, kSlashESlash,
base::CompareCase::INSENSITIVE_ASCII))
return false; return false;
// Start after /v/ // Start after /v/
for (unsigned i = len; i < path.length(); i++) { for (unsigned i = len; i < path.length(); i++) {
char c = str[i]; char c = path[i];
if (isalpha(c) || isdigit(c) || c == '_' || c == '-') if (isalpha(c) || isdigit(c) || c == '_' || c == '-')
continue; continue;
// The url can have more parameters such as &hl=en after the video id. // The url can have more parameters such as &hl=en after the video id.

@@ -186,7 +186,7 @@ void HandleRecord(const base::string16& key_name,
return; return;
} }
std::string action_trigger(base::StringToLowerASCII(value_name.substr( std::string action_trigger(base::ToLowerASCII(value_name.substr(
arraysize(kActionTriggerPrefix) - 1))); arraysize(kActionTriggerPrefix) - 1)));
if (action_trigger == kActionTriggerDeleteValues) { if (action_trigger == kActionTriggerDeleteValues) {
for (const std::string& value : for (const std::string& value :

@@ -96,7 +96,7 @@ base::string16 BuildSnippet(const std::string& document,
// |document|. We need to add more test cases and change this function // |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' // to be more generic depending on how we deal with 'folding for match'
// in history. // 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. // Manually construct match_positions of the document.
Snippet::MatchPositions match_positions; Snippet::MatchPositions match_positions;

@@ -68,7 +68,7 @@ std::string GetTruncatedHash(const std::string& str) {
const int kTruncateSize = kTruncateTokenStringLength / 2; const int kTruncateSize = kTruncateTokenStringLength / 2;
char hash_val[kTruncateSize]; char hash_val[kTruncateSize];
crypto::SHA256HashString(str, &hash_val[0], 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 } // namespace signin_internals_util

@@ -99,7 +99,7 @@ bool MediaStorageUtil::HasDcim(const base::FilePath& mount_point) {
if (!base::DirectoryExists(mount_point.Append(dcim_dir))) { if (!base::DirectoryExists(mount_point.Append(dcim_dir))) {
// Check for lowercase 'dcim' as well. // Check for lowercase 'dcim' as well.
base::FilePath dcim_path_lower( 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)) if (!base::DirectoryExists(dcim_path_lower))
return false; return false;
} }

@@ -85,7 +85,7 @@ std::string GenerateDeviceIdLikePrefMetricsServiceDid(
const std::string& original_device_id) { const std::string& original_device_id) {
if (original_device_id.empty()) if (original_device_id.empty())
return std::string(); return std::string();
return base::StringToLowerASCII( return base::ToLowerASCII(
GetDigestString(original_device_id, "PrefMetricsService")); GetDigestString(original_device_id, "PrefMetricsService"));
} }