diff options
author | brettw <brettw@chromium.org> | 2015-06-09 15:39:08 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-09 22:39:37 +0000 |
commit | bc17d2c8d864a118f48a84de0709f5a6c463cffd (patch) | |
tree | 1b22817d8ab1d8797b14d734f0f2924c4db1736b | |
parent | 952985e3821fea40f284004cae13795f8a3db489 (diff) | |
download | chromium_src-bc17d2c8d864a118f48a84de0709f5a6c463cffd.zip chromium_src-bc17d2c8d864a118f48a84de0709f5a6c463cffd.tar.gz chromium_src-bc17d2c8d864a118f48a84de0709f5a6c463cffd.tar.bz2 |
Move LowerCaseEqualsASCII to base namespace
Remove url:: variants. Add the 4-element version from url:: to base::
Review URL: https://codereview.chromium.org/1172753003
Cr-Commit-Position: refs/heads/master@{#333597}
117 files changed, 436 insertions, 450 deletions
diff --git a/base/files/file_util_unittest.cc b/base/files/file_util_unittest.cc index 1d8eeef..52581f8 100644 --- a/base/files/file_util_unittest.cc +++ b/base/files/file_util_unittest.cc @@ -2498,7 +2498,9 @@ TEST(ScopedFD, ScopedFDDoesClose) { ASSERT_EQ(0, pipe(fds)); const int write_end = fds[1]; ScopedFD read_end_closer(fds[0]); - { ScopedFD write_end_closer(fds[1]); } + { + ScopedFD write_end_closer(fds[1]); + } // This is the only thread. This file descriptor should no longer be valid. int ret = close(write_end); EXPECT_EQ(-1, ret); diff --git a/base/strings/string_util.cc b/base/strings/string_util.cc index 6f6d6e2..9fd823a 100644 --- a/base/strings/string_util.cc +++ b/base/strings/string_util.cc @@ -420,14 +420,12 @@ bool IsStringUTF8(const StringPiece& str) { return true; } -} // namespace base - template<typename Iter> static inline bool DoLowerCaseEqualsASCII(Iter a_begin, Iter a_end, const char* b) { for (Iter it = a_begin; it != a_end; ++it, ++b) { - if (!*b || base::ToLowerASCII(*it) != *b) + if (!*b || ToLowerASCII(*it) != *b) return false; } return *b == 0; @@ -460,12 +458,26 @@ bool LowerCaseEqualsASCII(const char* a_begin, return DoLowerCaseEqualsASCII(a_begin, a_end, b); } +bool LowerCaseEqualsASCII(const char* a_begin, + const char* a_end, + const char* b_begin, + const char* b_end) { + while (a_begin != a_end && b_begin != b_end && + ToLowerASCII(*a_begin) == *b_begin) { + a_begin++; + b_begin++; + } + return a_begin == a_end && b_begin == b_end; +} + bool LowerCaseEqualsASCII(const char16* a_begin, const char16* a_end, const char* b) { return DoLowerCaseEqualsASCII(a_begin, a_end, b); } +} // namespace base + bool EqualsASCII(const string16& a, const base::StringPiece& b) { if (a.length() != b.length()) return false; diff --git a/base/strings/string_util.h b/base/strings/string_util.h index 0bdf2ef..c17429e 100644 --- a/base/strings/string_util.h +++ b/base/strings/string_util.h @@ -285,38 +285,42 @@ template <class str> inline str StringToUpperASCII(const str& s) { StringToUpperASCII(&output); return output; } - -} // namespace base - -#if defined(OS_WIN) -#include "base/strings/string_util_win.h" -#elif defined(OS_POSIX) -#include "base/strings/string_util_posix.h" -#else -#error Define string operations appropriately for your platform -#endif - +// // Compare the lower-case form of the given string against the given ASCII // string. This is useful for doing checking if an input string matches some // token, and it is optimized to avoid intermediate string copies. This API is // borrowed from the equivalent APIs in Mozilla. BASE_EXPORT bool LowerCaseEqualsASCII(const std::string& a, const char* b); -BASE_EXPORT bool LowerCaseEqualsASCII(const base::string16& a, const char* b); +BASE_EXPORT bool LowerCaseEqualsASCII(const string16& a, const char* b); // Same thing, but with string iterators instead. BASE_EXPORT bool LowerCaseEqualsASCII(std::string::const_iterator a_begin, std::string::const_iterator a_end, const char* b); -BASE_EXPORT bool LowerCaseEqualsASCII(base::string16::const_iterator a_begin, - base::string16::const_iterator a_end, +BASE_EXPORT bool LowerCaseEqualsASCII(string16::const_iterator a_begin, + string16::const_iterator a_end, const char* b); BASE_EXPORT bool LowerCaseEqualsASCII(const char* a_begin, const char* a_end, const char* b); -BASE_EXPORT bool LowerCaseEqualsASCII(const base::char16* a_begin, - const base::char16* a_end, +BASE_EXPORT bool LowerCaseEqualsASCII(const char* a_begin, + const char* a_end, + const char* b_begin, + const char* b_end); +BASE_EXPORT bool LowerCaseEqualsASCII(const char16* a_begin, + const char16* a_end, const char* b); +} // namespace base + +#if defined(OS_WIN) +#include "base/strings/string_util_win.h" +#elif defined(OS_POSIX) +#include "base/strings/string_util_posix.h" +#else +#error Define string operations appropriately for your platform +#endif + // Performs a case-sensitive string compare. The behavior is undefined if both // strings are not ASCII. BASE_EXPORT bool EqualsASCII(const base::string16& a, const base::StringPiece& b); diff --git a/chrome/browser/auto_launch_trial.cc b/chrome/browser/auto_launch_trial.cc index ae53d7b..a235de7 100644 --- a/chrome/browser/auto_launch_trial.cc +++ b/chrome/browser/auto_launch_trial.cc @@ -24,11 +24,11 @@ bool IsInAutoLaunchGroup() { } bool IsInExperimentGroup(const std::string& brand_code) { - return LowerCaseEqualsASCII(brand_code, "rngp"); + return base::LowerCaseEqualsASCII(brand_code, "rngp"); } bool IsInControlGroup(const std::string& brand_code) { - return LowerCaseEqualsASCII(brand_code, "rngq"); + return base::LowerCaseEqualsASCII(brand_code, "rngq"); } } // namespace auto_launch_trial diff --git a/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc b/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc index c64520f..61e5f32 100644 --- a/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc +++ b/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc @@ -25,9 +25,9 @@ ChromeAutocompleteSchemeClassifier::GetInputTypeForScheme( const std::string& scheme) const { if (base::IsStringASCII(scheme) && (ProfileIOData::IsHandledProtocol(scheme) || - LowerCaseEqualsASCII(scheme, content::kViewSourceScheme) || - LowerCaseEqualsASCII(scheme, url::kJavaScriptScheme) || - LowerCaseEqualsASCII(scheme, url::kDataScheme))) { + base::LowerCaseEqualsASCII(scheme, content::kViewSourceScheme) || + base::LowerCaseEqualsASCII(scheme, url::kJavaScriptScheme) || + base::LowerCaseEqualsASCII(scheme, url::kDataScheme))) { return metrics::OmniboxInputType::URL; } diff --git a/chrome/browser/autocomplete/history_url_provider.cc b/chrome/browser/autocomplete/history_url_provider.cc index 93581bf..7f59e68 100644 --- a/chrome/browser/autocomplete/history_url_provider.cc +++ b/chrome/browser/autocomplete/history_url_provider.cc @@ -968,7 +968,7 @@ bool HistoryURLProvider::CanFindIntranetURL( // input's text and parts between Parse() and here, it seems better to be // paranoid and check. if ((input.type() != metrics::OmniboxInputType::UNKNOWN) || - !LowerCaseEqualsASCII(input.scheme(), url::kHttpScheme) || + !base::LowerCaseEqualsASCII(input.scheme(), url::kHttpScheme) || !input.parts().host.is_nonempty()) return false; const std::string host(base::UTF16ToUTF8( diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 42a453a..81b19ca 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -103,13 +103,13 @@ bool WillHandleBrowserAboutURL(GURL* url, bool HandleNonNavigationAboutURL(const GURL& url) { const std::string spec(url.spec()); - if (LowerCaseEqualsASCII(spec, chrome::kChromeUIRestartURL)) { + if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIRestartURL)) { // Call AttemptRestart after chrome::Navigate() completes to avoid access of // gtk objects after they are destroyed by BrowserWindowGtk::Close(). base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(&chrome::AttemptRestart)); return true; - } else if (LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { + } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(&chrome::AttemptExit)); return true; diff --git a/chrome/browser/chromeos/events/event_rewriter.cc b/chrome/browser/chromeos/events/event_rewriter.cc index 4d75023..2d0ce2d 100644 --- a/chrome/browser/chromeos/events/event_rewriter.cc +++ b/chrome/browser/chromeos/events/event_rewriter.cc @@ -145,7 +145,7 @@ EventRewriter::DeviceType GetDeviceType(const std::string& device_name, return EventRewriter::kDeviceHotrodRemote; } - if (LowerCaseEqualsASCII(device_name, "virtual core keyboard")) + if (base::LowerCaseEqualsASCII(device_name, "virtual core keyboard")) return EventRewriter::kDeviceVirtualCoreKeyboard; std::vector<std::string> tokens; @@ -157,9 +157,9 @@ EventRewriter::DeviceType GetDeviceType(const std::string& device_name, bool found_apple = false; bool found_keyboard = false; for (size_t i = 0; i < tokens.size(); ++i) { - if (!found_apple && LowerCaseEqualsASCII(tokens[i], "apple")) + if (!found_apple && base::LowerCaseEqualsASCII(tokens[i], "apple")) found_apple = true; - if (!found_keyboard && LowerCaseEqualsASCII(tokens[i], "keyboard")) + if (!found_keyboard && base::LowerCaseEqualsASCII(tokens[i], "keyboard")) found_keyboard = true; if (found_apple && found_keyboard) return EventRewriter::kDeviceAppleKeyboard; diff --git a/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc b/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc index e20daf5..d423c32 100644 --- a/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc +++ b/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc @@ -166,7 +166,7 @@ scoped_ptr<base::DictionaryValue> ComponentExtensionIMEManagerImpl::GetManifest( // static bool ComponentExtensionIMEManagerImpl::IsIMEExtensionID(const std::string& id) { for (size_t i = 0; i < arraysize(whitelisted_component_extension); ++i) { - if (LowerCaseEqualsASCII(id, whitelisted_component_extension[i].id)) + if (base::LowerCaseEqualsASCII(id, whitelisted_component_extension[i].id)) return true; } return false; diff --git a/chrome/browser/download/download_extensions.cc b/chrome/browser/download/download_extensions.cc index 623bdf4..df961a5 100644 --- a/chrome/browser/download/download_extensions.cc +++ b/chrome/browser/download/download_extensions.cc @@ -221,7 +221,7 @@ DownloadDangerLevel GetFileDangerLevel(const base::FilePath& path) { ascii_extension.erase(0, 1); for (size_t i = 0; i < arraysize(g_executables); ++i) { - if (LowerCaseEqualsASCII(ascii_extension, g_executables[i].extension)) + if (base::LowerCaseEqualsASCII(ascii_extension, g_executables[i].extension)) return g_executables[i].level; } return NOT_DANGEROUS; diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index cb9f69e..42bbf7c 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc @@ -1036,17 +1036,17 @@ void IOThread::ConfigureSpdyGlobals( } if (spdy_trial_group.starts_with(kSpdyFieldTrialParametrizedPrefix)) { bool spdy_enabled = false; - if (LowerCaseEqualsASCII( + if (base::LowerCaseEqualsASCII( GetVariationParam(spdy_trial_params, "enable_spdy31"), "true")) { globals->next_protos.push_back(net::kProtoSPDY31); spdy_enabled = true; } - if (LowerCaseEqualsASCII( + if (base::LowerCaseEqualsASCII( GetVariationParam(spdy_trial_params, "enable_http2_14"), "true")) { globals->next_protos.push_back(net::kProtoSPDY4_14); spdy_enabled = true; } - if (LowerCaseEqualsASCII( + if (base::LowerCaseEqualsASCII( GetVariationParam(spdy_trial_params, "enable_http2"), "true")) { globals->next_protos.push_back(net::kProtoSPDY4); spdy_enabled = true; @@ -1412,7 +1412,7 @@ bool IOThread::ShouldEnableQuicForDataReductionProxy() { // static bool IOThread::ShouldDisableInsecureQuic( const VariationParameters& quic_trial_params) { - return LowerCaseEqualsASCII( + return base::LowerCaseEqualsASCII( GetVariationParam(quic_trial_params, "disable_insecure_quic"), "true"); } @@ -1482,7 +1482,7 @@ double IOThread::GetAlternativeProtocolProbabilityThreshold( // static bool IOThread::ShouldQuicAlwaysRequireHandshakeConfirmation( const VariationParameters& quic_trial_params) { - return LowerCaseEqualsASCII( + return base::LowerCaseEqualsASCII( GetVariationParam(quic_trial_params, "always_require_handshake_confirmation"), "true"); @@ -1491,7 +1491,7 @@ bool IOThread::ShouldQuicAlwaysRequireHandshakeConfirmation( // static bool IOThread::ShouldQuicDisableConnectionPooling( const VariationParameters& quic_trial_params) { - return LowerCaseEqualsASCII( + return base::LowerCaseEqualsASCII( GetVariationParam(quic_trial_params, "disable_connection_pooling"), "true"); } @@ -1511,7 +1511,7 @@ float IOThread::GetQuicLoadServerInfoTimeoutSrttMultiplier( // static bool IOThread::ShouldQuicEnableConnectionRacing( const VariationParameters& quic_trial_params) { - return LowerCaseEqualsASCII( + return base::LowerCaseEqualsASCII( GetVariationParam(quic_trial_params, "enable_connection_racing"), "true"); } @@ -1519,7 +1519,7 @@ bool IOThread::ShouldQuicEnableConnectionRacing( // static bool IOThread::ShouldQuicEnableNonBlockingIO( const VariationParameters& quic_trial_params) { - return LowerCaseEqualsASCII( + return base::LowerCaseEqualsASCII( GetVariationParam(quic_trial_params, "enable_non_blocking_io"), "true"); } @@ -1527,7 +1527,7 @@ bool IOThread::ShouldQuicEnableNonBlockingIO( // static bool IOThread::ShouldQuicDisableDiskCache( const VariationParameters& quic_trial_params) { - return LowerCaseEqualsASCII( + return base::LowerCaseEqualsASCII( GetVariationParam(quic_trial_params, "disable_disk_cache"), "true"); } diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc index 784cd21..c6a7e7c 100644 --- a/chrome/browser/memory_details.cc +++ b/chrome/browser/memory_details.cc @@ -343,11 +343,13 @@ void MemoryDetails::CollectChildInfoOnUIThread() { const NavigationEntry* last_committed_entry = contents->GetController().GetLastCommittedEntry(); if ((last_committed_entry && - LowerCaseEqualsASCII(last_committed_entry->GetVirtualURL().spec(), - chrome::kChromeUIMemoryURL)) || + base::LowerCaseEqualsASCII( + last_committed_entry->GetVirtualURL().spec(), + chrome::kChromeUIMemoryURL)) || (pending_entry && - LowerCaseEqualsASCII(pending_entry->GetVirtualURL().spec(), - chrome::kChromeUIMemoryURL))) { + base::LowerCaseEqualsASCII( + pending_entry->GetVirtualURL().spec(), + chrome::kChromeUIMemoryURL))) { process.is_diagnostics = true; } } diff --git a/chrome/browser/net/firefox_proxy_settings.cc b/chrome/browser/net/firefox_proxy_settings.cc index 7b135b9..39dd5f1 100644 --- a/chrome/browser/net/firefox_proxy_settings.cc +++ b/chrome/browser/net/firefox_proxy_settings.cc @@ -106,8 +106,8 @@ bool ParsePrefFile(const base::FilePath& pref_file, stop_value - start_value - 1); base::TrimWhitespace(value, base::TRIM_ALL, &value); // Value could be a boolean. - bool is_value_true = LowerCaseEqualsASCII(value, "true"); - if (is_value_true || LowerCaseEqualsASCII(value, "false")) { + bool is_value_true = base::LowerCaseEqualsASCII(value, "true"); + if (is_value_true || base::LowerCaseEqualsASCII(value, "false")) { prefs->SetBoolean(key, is_value_true); continue; } diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc index 8bf401e..c7bdfdcc 100644 --- a/chrome/browser/profiles/profile_impl_io_data.cc +++ b/chrome/browser/profiles/profile_impl_io_data.cc @@ -74,9 +74,9 @@ net::BackendType ChooseCacheBackendType() { if (command_line.HasSwitch(switches::kUseSimpleCacheBackend)) { const std::string opt_value = command_line.GetSwitchValueASCII(switches::kUseSimpleCacheBackend); - if (LowerCaseEqualsASCII(opt_value, "off")) + if (base::LowerCaseEqualsASCII(opt_value, "off")) return net::CACHE_BACKEND_BLOCKFILE; - if (opt_value.empty() || LowerCaseEqualsASCII(opt_value, "on")) + if (opt_value.empty() || base::LowerCaseEqualsASCII(opt_value, "on")) return net::CACHE_BACKEND_SIMPLE; } const std::string experiment_name = diff --git a/chrome/browser/safe_browsing/malware_details_cache.cc b/chrome/browser/safe_browsing/malware_details_cache.cc index 4e8ae12..d70fb11 100644 --- a/chrome/browser/safe_browsing/malware_details_cache.cc +++ b/chrome/browser/safe_browsing/malware_details_cache.cc @@ -156,7 +156,7 @@ void MalwareDetailsCacheCollector::ReadResponse( pb_response->add_headers(); pb_header->set_name(name); // Strip any Set-Cookie headers. - if (LowerCaseEqualsASCII(name, "set-cookie")) { + if (base::LowerCaseEqualsASCII(name, "set-cookie")) { pb_header->set_value(""); } else { pb_header->set_value(value); diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc index 223655a..9ca088e 100644 --- a/chrome/browser/ssl/ssl_browser_tests.cc +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -808,7 +808,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestWSSInvalidCertAndClose) { // The title will be changed to 'PASS'. ui_test_utils::NavigateToURL(browser(), master_url); const base::string16 result = watcher.WaitAndGetTitle(); - EXPECT_TRUE(LowerCaseEqualsASCII(result, "pass")); + EXPECT_TRUE(base::LowerCaseEqualsASCII(result, "pass")); // Close tabs which contains the test page. for (int i = 0; i < 16; ++i) @@ -844,7 +844,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestWSSInvalidCertAndGoForward) { // Test page run a WebSocket wss connection test. The result will be shown // as page title. const base::string16 result = watcher.WaitAndGetTitle(); - EXPECT_TRUE(LowerCaseEqualsASCII(result, "pass")); + EXPECT_TRUE(base::LowerCaseEqualsASCII(result, "pass")); } #if defined(USE_NSS_CERTS) @@ -931,7 +931,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITestWithClientCert, TestWSSClientCert) { // Test page runs a WebSocket wss connection test. The result will be shown // as page title. const base::string16 result = watcher.WaitAndGetTitle(); - EXPECT_TRUE(LowerCaseEqualsASCII(result, "pass")); + EXPECT_TRUE(base::LowerCaseEqualsASCII(result, "pass")); } #endif // defined(USE_NSS_CERTS) @@ -2083,7 +2083,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITestIgnoreCertErrors, TestWSS) { // Test page run a WebSocket wss connection test. The result will be shown // as page title. const base::string16 result = watcher.WaitAndGetTitle(); - EXPECT_TRUE(LowerCaseEqualsASCII(result, "pass")); + EXPECT_TRUE(base::LowerCaseEqualsASCII(result, "pass")); } // Verifies that the interstitial can proceed, even if JavaScript is disabled. diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc index 6d833eb..51512e6 100644 --- a/chrome/browser/themes/browser_theme_pack.cc +++ b/chrome/browser/themes/browser_theme_pack.cc @@ -209,7 +209,8 @@ int GetPersistentIDByNameHelper(const std::string& key, const PersistingImagesTable* image_table, size_t image_table_size) { for (size_t i = 0; i < image_table_size; ++i) { - if (image_table[i].key && LowerCaseEqualsASCII(key, image_table[i].key)) { + if (image_table[i].key && + base::LowerCaseEqualsASCII(key, image_table[i].key)) { return image_table[i].persistent_id; } } @@ -344,7 +345,7 @@ int GetIntForString(const std::string& key, StringToIntTable* table, size_t table_length) { for (size_t i = 0; i < table_length; ++i) { - if (LowerCaseEqualsASCII(key, table[i].key)) { + if (base::LowerCaseEqualsASCII(key, table[i].key)) { return table[i].id; } } diff --git a/chrome/browser/themes/theme_properties.cc b/chrome/browser/themes/theme_properties.cc index 8e184c0..f32530f 100644 --- a/chrome/browser/themes/theme_properties.cc +++ b/chrome/browser/themes/theme_properties.cc @@ -145,13 +145,13 @@ int ThemeProperties::StringToAlignment(const std::string& alignment) { int alignment_mask = 0; for (std::vector<std::string>::iterator component(split.begin()); component != split.end(); ++component) { - if (LowerCaseEqualsASCII(*component, kAlignmentTop)) + if (base::LowerCaseEqualsASCII(*component, kAlignmentTop)) alignment_mask |= ALIGN_TOP; - else if (LowerCaseEqualsASCII(*component, kAlignmentBottom)) + else if (base::LowerCaseEqualsASCII(*component, kAlignmentBottom)) alignment_mask |= ALIGN_BOTTOM; - else if (LowerCaseEqualsASCII(*component, kAlignmentLeft)) + else if (base::LowerCaseEqualsASCII(*component, kAlignmentLeft)) alignment_mask |= ALIGN_LEFT; - else if (LowerCaseEqualsASCII(*component, kAlignmentRight)) + else if (base::LowerCaseEqualsASCII(*component, kAlignmentRight)) alignment_mask |= ALIGN_RIGHT; } return alignment_mask; @@ -159,11 +159,11 @@ int ThemeProperties::StringToAlignment(const std::string& alignment) { // static int ThemeProperties::StringToTiling(const std::string& tiling) { - if (LowerCaseEqualsASCII(tiling, kTilingRepeatX)) + if (base::LowerCaseEqualsASCII(tiling, kTilingRepeatX)) return REPEAT_X; - if (LowerCaseEqualsASCII(tiling, kTilingRepeatY)) + if (base::LowerCaseEqualsASCII(tiling, kTilingRepeatY)) return REPEAT_Y; - if (LowerCaseEqualsASCII(tiling, kTilingRepeat)) + if (base::LowerCaseEqualsASCII(tiling, kTilingRepeat)) return REPEAT; // NO_REPEAT is the default choice. return NO_REPEAT; diff --git a/chrome/browser/ui/app_list/search/common/webservice_search_provider.cc b/chrome/browser/ui/app_list/search/common/webservice_search_provider.cc index a7bcf57..32e64c1 100644 --- a/chrome/browser/ui/app_list/search/common/webservice_search_provider.cc +++ b/chrome/browser/ui/app_list/search/common/webservice_search_provider.cc @@ -71,7 +71,7 @@ bool WebserviceSearchProvider::IsSensitiveInput(const base::string16& query) { // file, we shouldn't send it. Sending such things is a waste of time and a // disclosure of potentially private, local data. If the scheme is OK, we // still need to check other cases below. - if (LowerCaseEqualsASCII(query_as_url.scheme(), url::kFileScheme)) + if (base::LowerCaseEqualsASCII(query_as_url.scheme(), url::kFileScheme)) return true; // Don't send URLs with usernames, queries or refs. Some of these are @@ -90,7 +90,7 @@ bool WebserviceSearchProvider::IsSensitiveInput(const base::string16& query) { // Don't send anything for https except the hostname. Hostnames are OK // because they are visible when the TCP connection is established, but the // specific path may reveal private information. - if (LowerCaseEqualsASCII(query_as_url.scheme(), url::kHttpsScheme) && + if (base::LowerCaseEqualsASCII(query_as_url.scheme(), url::kHttpsScheme) && !query_as_url.path().empty() && query_as_url.path() != "/") { return true; } diff --git a/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc b/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc index 2c43cb3..72f9f06 100644 --- a/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc +++ b/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc @@ -40,13 +40,13 @@ const char kLegacyPackagedAppType[] = "legacy_packaged_app"; // Converts the item type string from the web store to an // extensions::Manifest::Type. extensions::Manifest::Type ParseItemType(const std::string& item_type_str) { - if (LowerCaseEqualsASCII(item_type_str, kPlatformAppType)) + if (base::LowerCaseEqualsASCII(item_type_str, kPlatformAppType)) return extensions::Manifest::TYPE_PLATFORM_APP; - if (LowerCaseEqualsASCII(item_type_str, kLegacyPackagedAppType)) + if (base::LowerCaseEqualsASCII(item_type_str, kLegacyPackagedAppType)) return extensions::Manifest::TYPE_LEGACY_PACKAGED_APP; - if (LowerCaseEqualsASCII(item_type_str, kHostedAppType)) + if (base::LowerCaseEqualsASCII(item_type_str, kHostedAppType)) return extensions::Manifest::TYPE_HOSTED_APP; return extensions::Manifest::TYPE_UNKNOWN; diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc index ff627e8..a4111ec 100644 --- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc +++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc @@ -3282,7 +3282,7 @@ bool AutofillDialogControllerImpl::CanAcceptCountry( DCHECK_EQ(2U, country_code.size()); if (section == SECTION_CC_BILLING) - return LowerCaseEqualsASCII(country_code, "us"); + return base::LowerCaseEqualsASCII(country_code, "us"); CountryComboboxModel* model = CountryComboboxModelForSection(section); const std::vector<AutofillCountry*>& countries = model->countries(); diff --git a/chrome/browser/ui/login/login_prompt.cc b/chrome/browser/ui/login/login_prompt.cc index 95717d5..1c955a1 100644 --- a/chrome/browser/ui/login/login_prompt.cc +++ b/chrome/browser/ui/login/login_prompt.cc @@ -432,9 +432,9 @@ void MakeInputForPasswordManager( LoginHandler* handler, std::vector<PasswordForm>* password_manager_input) { PasswordForm dialog_form; - if (LowerCaseEqualsASCII(auth_info->scheme, "basic")) { + if (base::LowerCaseEqualsASCII(auth_info->scheme, "basic")) { dialog_form.scheme = PasswordForm::SCHEME_BASIC; - } else if (LowerCaseEqualsASCII(auth_info->scheme, "digest")) { + } else if (base::LowerCaseEqualsASCII(auth_info->scheme, "digest")) { dialog_form.scheme = PasswordForm::SCHEME_DIGEST; } else { dialog_form.scheme = PasswordForm::SCHEME_OTHER; diff --git a/chrome/browser/ui/views/keyboard_access_browsertest.cc b/chrome/browser/ui/views/keyboard_access_browsertest.cc index 76636d5..5bf8784 100644 --- a/chrome/browser/ui/views/keyboard_access_browsertest.cc +++ b/chrome/browser/ui/views/keyboard_access_browsertest.cc @@ -256,7 +256,7 @@ LRESULT CALLBACK SystemMenuTestCBTHook(int n_code, GetClassName(reinterpret_cast<HWND>(w_param), class_name, arraysize(class_name)); - if (LowerCaseEqualsASCII(class_name, "#32768")) { + if (base::LowerCaseEqualsASCII(class_name, "#32768")) { // Select the New Tab option and then send the enter key to execute it. ::PostMessage(reinterpret_cast<HWND>(w_param), WM_CHAR, 'T', 0); ::PostMessage(reinterpret_cast<HWND>(w_param), WM_KEYDOWN, VK_RETURN, 0); diff --git a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc index cf35c04..abaf4c8 100644 --- a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc +++ b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc @@ -108,7 +108,7 @@ void GetDeviceInfo(const base::DictionaryValue& properties, value->SetString("activation_type", activation_type); value->SetString("carrier", name); value->SetString("payment_url", payment_url); - if (LowerCaseEqualsASCII(post_method, "post") && !post_data.empty()) + if (base::LowerCaseEqualsASCII(post_method, "post") && !post_data.empty()) value->SetString("post_data", post_data); // Use the cached DeviceState properties. @@ -464,7 +464,7 @@ void MobileSetupHandler::HandleSetTransactionStatus( return; MobileActivator::GetInstance()->OnSetTransactionStatus( - LowerCaseEqualsASCII(status, kJsApiResultOK)); + base::LowerCaseEqualsASCII(status, kJsApiResultOK)); } void MobileSetupHandler::HandlePaymentPortalLoad(const base::ListValue* args) { @@ -481,7 +481,7 @@ void MobileSetupHandler::HandlePaymentPortalLoad(const base::ListValue* args) { return; MobileActivator::GetInstance()->OnPortalLoaded( - LowerCaseEqualsASCII(result, kJsApiResultOK)); + base::LowerCaseEqualsASCII(result, kJsApiResultOK)); } void MobileSetupHandler::HandleGetDeviceInfo(const base::ListValue* args) { diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc index 7b40d98..4824016 100644 --- a/chrome/installer/setup/install_worker.cc +++ b/chrome/installer/setup/install_worker.cc @@ -717,7 +717,7 @@ void AddVersionKeyWorkItems(HKEY root, // languages is a superset of Chrome's set of translations with this one // exception: what Chrome calls "en-us", Omaha calls "en". sigh. base::string16 language(GetCurrentTranslation()); - if (LowerCaseEqualsASCII(language, "en-us")) + if (base::LowerCaseEqualsASCII(language, "en-us")) language.resize(2); list->AddSetRegValueWorkItem(root, version_key, diff --git a/chrome/renderer/chrome_render_view_observer.cc b/chrome/renderer/chrome_render_view_observer.cc index 6f77594..20ba1d5 100644 --- a/chrome/renderer/chrome_render_view_observer.cc +++ b/chrome/renderer/chrome_render_view_observer.cc @@ -485,7 +485,7 @@ bool ChromeRenderViewObserver::HasRefreshMetaTag(WebFrame* frame) { if (!element.hasHTMLTagName(tag_name)) continue; WebString value = element.getAttribute(attribute_name); - if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) + if (value.isNull() || !base::LowerCaseEqualsASCII(value, "refresh")) continue; return true; } diff --git a/chrome/renderer/extensions/webstore_bindings.cc b/chrome/renderer/extensions/webstore_bindings.cc index 239ebb0..1ab5810 100644 --- a/chrome/renderer/extensions/webstore_bindings.cc +++ b/chrome/renderer/extensions/webstore_bindings.cc @@ -142,7 +142,7 @@ bool WebstoreBindings::GetWebstoreItemIdFromFrame( continue; std::string rel = elem.getAttribute("rel").utf8(); - if (!LowerCaseEqualsASCII(rel, kWebstoreLinkRelation)) + if (!base::LowerCaseEqualsASCII(rel, kWebstoreLinkRelation)) continue; std::string webstore_url_string(elem.getAttribute("href").utf8()); diff --git a/chrome/renderer/web_apps.cc b/chrome/renderer/web_apps.cc index 6032524..5b3e2eb 100644 --- a/chrome/renderer/web_apps.cc +++ b/chrome/renderer/web_apps.cc @@ -152,11 +152,11 @@ void ParseWebAppFromWebDocument(WebFrame* frame, bool bookmark_apps_enabled = !base::CommandLine::ForCurrentProcess()-> HasSwitch(switches::kDisableNewBookmarkApps); #endif - if (LowerCaseEqualsASCII(rel, "icon") || - LowerCaseEqualsASCII(rel, "shortcut icon") || + if (base::LowerCaseEqualsASCII(rel, "icon") || + base::LowerCaseEqualsASCII(rel, "shortcut icon") || (bookmark_apps_enabled && - (LowerCaseEqualsASCII(rel, "apple-touch-icon") || - LowerCaseEqualsASCII(rel, "apple-touch-icon-precomposed")))) { + (base::LowerCaseEqualsASCII(rel, "apple-touch-icon") || + base::LowerCaseEqualsASCII(rel, "apple-touch-icon-precomposed")))) { AddInstallIcon(elem, &app_info->icons); } } else if (elem.hasHTMLTagName("meta") && elem.hasAttribute("name")) { @@ -173,10 +173,10 @@ void ParseWebAppFromWebDocument(WebFrame* frame, if (!app_info->app_url.is_valid()) app_info->app_url = GURL(); } else if (name == "mobile-web-app-capable" && - LowerCaseEqualsASCII(content, "yes")) { + base::LowerCaseEqualsASCII(content, "yes")) { app_info->mobile_capable = WebApplicationInfo::MOBILE_CAPABLE; } else if (name == "apple-mobile-web-app-capable" && - LowerCaseEqualsASCII(content, "yes") && + base::LowerCaseEqualsASCII(content, "yes") && app_info->mobile_capable == WebApplicationInfo::MOBILE_CAPABLE_UNSPECIFIED) { app_info->mobile_capable = WebApplicationInfo::MOBILE_CAPABLE_APPLE; diff --git a/chrome/test/chromedriver/element_util.cc b/chrome/test/chromedriver/element_util.cc index e8714d3..6a3ee19 100644 --- a/chrome/test/chromedriver/element_util.cc +++ b/chrome/test/chromedriver/element_util.cc @@ -337,10 +337,12 @@ Status IsElementAttributeEqualToIgnoreCase( if (status.IsError()) return status; std::string actual_value; - if (result->GetAsString(&actual_value)) - *is_equal = LowerCaseEqualsASCII(actual_value, attribute_value.c_str()); - else + if (result->GetAsString(&actual_value)) { + *is_equal = + base::LowerCaseEqualsASCII(actual_value, attribute_value.c_str()); + } else { *is_equal = false; + } return status; } diff --git a/chrome/utility/importer/bookmark_html_reader.cc b/chrome/utility/importer/bookmark_html_reader.cc index eed15fa..ec192d3 100644 --- a/chrome/utility/importer/bookmark_html_reader.cc +++ b/chrome/utility/importer/bookmark_html_reader.cc @@ -329,7 +329,7 @@ bool ParseFolderNameFromLine(const std::string& line, } if (GetAttribute(attribute_list, kToolbarFolderAttribute, &value) && - LowerCaseEqualsASCII(value, "true")) + base::LowerCaseEqualsASCII(value, "true")) *is_toolbar_folder = true; else *is_toolbar_folder = false; diff --git a/chrome/utility/importer/ie_importer_win.cc b/chrome/utility/importer/ie_importer_win.cc index e1f5e4f..8933592 100644 --- a/chrome/utility/importer/ie_importer_win.cc +++ b/chrome/utility/importer/ie_importer_win.cc @@ -613,8 +613,8 @@ void IEImporter::ImportPasswordsIE6() { continue; GURL url(ac_list[i].key.c_str()); - if (!(LowerCaseEqualsASCII(url.scheme(), url::kHttpScheme) || - LowerCaseEqualsASCII(url.scheme(), url::kHttpsScheme))) { + if (!(base::LowerCaseEqualsASCII(url.scheme(), url::kHttpScheme) || + base::LowerCaseEqualsASCII(url.scheme(), url::kHttpsScheme))) { continue; } @@ -823,7 +823,7 @@ void IEImporter::ParseFavoritesFolder( for (std::vector<base::FilePath::StringType>::iterator it = file_list.begin(); it != file_list.end(); ++it) { base::FilePath shortcut(*it); - if (!LowerCaseEqualsASCII(shortcut.Extension(), ".url")) + if (!base::LowerCaseEqualsASCII(shortcut.Extension(), ".url")) continue; // Skip the bookmark with invalid URL. diff --git a/chromeos/dbus/dbus_client_bundle.cc b/chromeos/dbus/dbus_client_bundle.cc index 3296736..a18a611 100644 --- a/chromeos/dbus/dbus_client_bundle.cc +++ b/chromeos/dbus/dbus_client_bundle.cc @@ -141,7 +141,8 @@ const struct { DBusClientBundle::DBusClientType GetDBusClientType( const std::string& client_type_name) { for (size_t i = 0; i < arraysize(client_type_map); i++) { - if (LowerCaseEqualsASCII(client_type_name, client_type_map[i].param_name)) + if (base::LowerCaseEqualsASCII(client_type_name, + client_type_map[i].param_name)) return client_type_map[i].client_type; } return DBusClientBundle::NO_CLIENT; diff --git a/components/autofill/content/browser/wallet/form_field_error.cc b/components/autofill/content/browser/wallet/form_field_error.cc index 826ea37..5d254a0 100644 --- a/components/autofill/content/browser/wallet/form_field_error.cc +++ b/components/autofill/content/browser/wallet/form_field_error.cc @@ -15,35 +15,35 @@ namespace wallet { namespace { FormFieldError::ErrorType ErrorTypeFromString(const std::string& error_type) { - if (LowerCaseEqualsASCII(error_type, "unknown_error")) + if (base::LowerCaseEqualsASCII(error_type, "unknown_error")) return FormFieldError::UNKNOWN_ERROR; - if (LowerCaseEqualsASCII(error_type, "invalid_phone_number")) + if (base::LowerCaseEqualsASCII(error_type, "invalid_phone_number")) return FormFieldError::INVALID_PHONE_NUMBER; - if (LowerCaseEqualsASCII(error_type, "invalid_postal_code")) + if (base::LowerCaseEqualsASCII(error_type, "invalid_postal_code")) return FormFieldError::INVALID_POSTAL_CODE; - if (LowerCaseEqualsASCII(error_type, "invalid_address")) + if (base::LowerCaseEqualsASCII(error_type, "invalid_address")) return FormFieldError::INVALID_ADDRESS; - if (LowerCaseEqualsASCII(error_type, "invalid_card_details")) + if (base::LowerCaseEqualsASCII(error_type, "invalid_card_details")) return FormFieldError::INVALID_CARD_DETAILS; - if (LowerCaseEqualsASCII(error_type, "invalid_city")) + if (base::LowerCaseEqualsASCII(error_type, "invalid_city")) return FormFieldError::INVALID_CITY; - if (LowerCaseEqualsASCII(error_type, "invalid_instrument")) + if (base::LowerCaseEqualsASCII(error_type, "invalid_instrument")) return FormFieldError::INVALID_INSTRUMENT; - if (LowerCaseEqualsASCII(error_type, "invalid_state")) + if (base::LowerCaseEqualsASCII(error_type, "invalid_state")) return FormFieldError::INVALID_STATE; - if (LowerCaseEqualsASCII(error_type, "required_field_not_set")) + if (base::LowerCaseEqualsASCII(error_type, "required_field_not_set")) return FormFieldError::REQUIRED_FIELD_NOT_SET; return FormFieldError::UNKNOWN_ERROR; } FormFieldError::Location LocationFromString(const std::string& location) { - if (LowerCaseEqualsASCII(location, "unknown_location")) + if (base::LowerCaseEqualsASCII(location, "unknown_location")) return FormFieldError::UNKNOWN_LOCATION; - if (LowerCaseEqualsASCII(location, "payment_instrument")) + if (base::LowerCaseEqualsASCII(location, "payment_instrument")) return FormFieldError::PAYMENT_INSTRUMENT; - if (LowerCaseEqualsASCII(location, "shipping_address")) + if (base::LowerCaseEqualsASCII(location, "shipping_address")) return FormFieldError::SHIPPING_ADDRESS; - if (LowerCaseEqualsASCII(location, "legal_address")) + if (base::LowerCaseEqualsASCII(location, "legal_address")) return FormFieldError::LEGAL_ADDRESS; return FormFieldError::UNKNOWN_LOCATION; } diff --git a/components/autofill/content/browser/wallet/wallet_client.cc b/components/autofill/content/browser/wallet/wallet_client.cc index 1a23ea0..7719a1a 100644 --- a/components/autofill/content/browser/wallet/wallet_client.cc +++ b/components/autofill/content/browser/wallet/wallet_client.cc @@ -66,21 +66,21 @@ std::string RiskCapabilityToString( WalletClient::ErrorType StringToErrorType(const std::string& error_type) { std::string trimmed; base::TrimWhitespaceASCII(error_type, base::TRIM_ALL, &trimmed); - if (LowerCaseEqualsASCII(trimmed, "buyer_account_error")) + if (base::LowerCaseEqualsASCII(trimmed, "buyer_account_error")) return WalletClient::BUYER_ACCOUNT_ERROR; - if (LowerCaseEqualsASCII(trimmed, "unsupported_merchant")) + if (base::LowerCaseEqualsASCII(trimmed, "unsupported_merchant")) return WalletClient::UNSUPPORTED_MERCHANT; - if (LowerCaseEqualsASCII(trimmed, "internal_error")) + if (base::LowerCaseEqualsASCII(trimmed, "internal_error")) return WalletClient::INTERNAL_ERROR; - if (LowerCaseEqualsASCII(trimmed, "invalid_params")) + if (base::LowerCaseEqualsASCII(trimmed, "invalid_params")) return WalletClient::INVALID_PARAMS; - if (LowerCaseEqualsASCII(trimmed, "service_unavailable")) + if (base::LowerCaseEqualsASCII(trimmed, "service_unavailable")) return WalletClient::SERVICE_UNAVAILABLE; - if (LowerCaseEqualsASCII(trimmed, "unsupported_api_version")) + if (base::LowerCaseEqualsASCII(trimmed, "unsupported_api_version")) return WalletClient::UNSUPPORTED_API_VERSION; - if (LowerCaseEqualsASCII(trimmed, "unsupported_user_agent")) + if (base::LowerCaseEqualsASCII(trimmed, "unsupported_user_agent")) return WalletClient::UNSUPPORTED_USER_AGENT_OR_API_KEY; - if (LowerCaseEqualsASCII(trimmed, "spending_limit_exceeded")) + if (base::LowerCaseEqualsASCII(trimmed, "spending_limit_exceeded")) return WalletClient::SPENDING_LIMIT_EXCEEDED; DVLOG(1) << "Unknown wallet error string: \"" << error_type << '"'; @@ -93,9 +93,9 @@ WalletClient::ErrorType BuyerErrorStringToErrorType( const std::string& message_type_for_buyer) { std::string trimmed; base::TrimWhitespaceASCII(message_type_for_buyer, base::TRIM_ALL, &trimmed); - if (LowerCaseEqualsASCII(trimmed, "bla_country_not_supported")) + if (base::LowerCaseEqualsASCII(trimmed, "bla_country_not_supported")) return WalletClient::BUYER_LEGAL_ADDRESS_NOT_SUPPORTED; - if (LowerCaseEqualsASCII(trimmed, "buyer_kyc_error")) + if (base::LowerCaseEqualsASCII(trimmed, "buyer_kyc_error")) return WalletClient::UNVERIFIED_KNOW_YOUR_CUSTOMER_STATUS; return WalletClient::BUYER_ACCOUNT_ERROR; @@ -649,7 +649,7 @@ void WalletClient::OnURLFetchComplete( std::string trimmed; base::TrimWhitespaceASCII(auth_result, base::TRIM_ALL, &trimmed); delegate_->OnDidAuthenticateInstrument( - LowerCaseEqualsASCII(trimmed, "success")); + base::LowerCaseEqualsASCII(trimmed, "success")); } else { HandleMalformedResponse(type, scoped_request.get()); } diff --git a/components/autofill/content/browser/wallet/wallet_signin_helper.cc b/components/autofill/content/browser/wallet/wallet_signin_helper.cc index f7b0fbc..fb84fba 100644 --- a/components/autofill/content/browser/wallet/wallet_signin_helper.cc +++ b/components/autofill/content/browser/wallet/wallet_signin_helper.cc @@ -45,8 +45,8 @@ void GetGoogleCookiesCallback( std::string host = wallet::GetPassiveAuthUrl(0).host(); std::string wallet_cookie; for (size_t i = 0; i < cookies.size(); ++i) { - if (LowerCaseEqualsASCII(cookies[i].Name(), kWalletCookieName) && - LowerCaseEqualsASCII(cookies[i].Domain(), host.c_str())) { + if (base::LowerCaseEqualsASCII(cookies[i].Name(), kWalletCookieName) && + base::LowerCaseEqualsASCII(cookies[i].Domain(), host.c_str())) { wallet_cookie = cookies[i].Value(); break; } @@ -154,7 +154,7 @@ void WalletSigninHelper::OnURLFetchComplete( return; } - if (!LowerCaseEqualsASCII(data, "yes")) { + if (!base::LowerCaseEqualsASCII(data, "yes")) { OnServiceError( GoogleServiceAuthError(GoogleServiceAuthError::USER_NOT_SIGNED_UP)); return; diff --git a/components/autofill/content/renderer/form_autofill_util.cc b/components/autofill/content/renderer/form_autofill_util.cc index c9ebc62..3a00eb2 100644 --- a/components/autofill/content/renderer/form_autofill_util.cc +++ b/components/autofill/content/renderer/form_autofill_util.cc @@ -1183,7 +1183,7 @@ void WebFormControlElementToFormField(const WebFormControlElement& element, // attribute was present. field->autocomplete_attribute = "x-max-data-length-exceeded"; } - if (LowerCaseEqualsASCII(element.getAttribute(kRole), "presentation")) + if (base::LowerCaseEqualsASCII(element.getAttribute(kRole), "presentation")) field->role = FormFieldData::ROLE_ATTRIBUTE_PRESENTATION; if (!IsAutofillableElement(element)) diff --git a/components/autofill/content/renderer/password_form_conversion_utils.cc b/components/autofill/content/renderer/password_form_conversion_utils.cc index f4dfcdf..24deefb 100644 --- a/components/autofill/content/renderer/password_form_conversion_utils.cc +++ b/components/autofill/content/renderer/password_form_conversion_utils.cc @@ -100,8 +100,8 @@ PasswordForm::Layout SequenceToLayout(base::StringPiece layout_sequence) { // |element| is present and has the specified |value_in_lowercase|. bool HasAutocompleteAttributeValue(const WebInputElement& element, const char* value_in_lowercase) { - return LowerCaseEqualsASCII(element.getAttribute("autocomplete"), - value_in_lowercase); + return base::LowerCaseEqualsASCII(element.getAttribute("autocomplete"), + value_in_lowercase); } // Helper to determine which password is the main (current) one, and which is diff --git a/components/autofill/core/browser/contact_info.cc b/components/autofill/core/browser/contact_info.cc index 10520f0..707e323 100644 --- a/components/autofill/core/browser/contact_info.cc +++ b/components/autofill/core/browser/contact_info.cc @@ -45,7 +45,7 @@ bool ContainsString(const char* const set[], base::TrimString(element, base::ASCIIToUTF16("."), &trimmed_element); for (size_t i = 0; i < set_size; ++i) { - if (LowerCaseEqualsASCII(trimmed_element, set[i])) + if (base::LowerCaseEqualsASCII(trimmed_element, set[i])) return true; } diff --git a/components/autofill/core/browser/credit_card_field.cc b/components/autofill/core/browser/credit_card_field.cc index d6b67dc..3b24ec3 100644 --- a/components/autofill/core/browser/credit_card_field.cc +++ b/components/autofill/core/browser/credit_card_field.cc @@ -344,7 +344,8 @@ bool CreditCardField::ClassifyField(ServerFieldTypeMap* map) const { bool CreditCardField::ParseExpirationDate(AutofillScanner* scanner) { if (!expiration_date_ && - LowerCaseEqualsASCII(scanner->Cursor()->form_control_type, "month")) { + base::LowerCaseEqualsASCII(scanner->Cursor()->form_control_type, + "month")) { expiration_date_ = scanner->Cursor(); expiration_month_ = nullptr; expiration_year_ = nullptr; diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc index b451b68..dae8736 100644 --- a/components/autofill/core/browser/personal_data_manager.cc +++ b/components/autofill/core/browser/personal_data_manager.cc @@ -391,7 +391,7 @@ bool PersonalDataManager::ImportFormData( types_seen.insert(server_field_type); if (group == CREDIT_CARD) { - if (LowerCaseEqualsASCII(field->form_control_type, "month")) { + if (base::LowerCaseEqualsASCII(field->form_control_type, "month")) { DCHECK_EQ(CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, server_field_type); local_imported_credit_card->SetInfoForMonthInputType(value); } else { diff --git a/components/autofill/core/browser/state_names.cc b/components/autofill/core/browser/state_names.cc index d4975b4..de65924 100644 --- a/components/autofill/core/browser/state_names.cc +++ b/components/autofill/core/browser/state_names.cc @@ -80,7 +80,7 @@ StateData kStateData[] = { base::string16 GetAbbreviationForName(const base::string16& name) { for (size_t i = 0; i < arraysize(kStateData); ++i) { const StateData& state = kStateData[i]; - if (LowerCaseEqualsASCII(name, state.name)) + if (base::LowerCaseEqualsASCII(name, state.name)) return base::ASCIIToUTF16(state.abbreviation); } return base::string16(); @@ -89,7 +89,7 @@ base::string16 GetAbbreviationForName(const base::string16& name) { base::string16 GetNameForAbbreviation(const base::string16& abbreviation) { for (size_t i = 0; i < arraysize(kStateData); ++i) { const StateData& state = kStateData[i]; - if (LowerCaseEqualsASCII(abbreviation, state.abbreviation)) + if (base::LowerCaseEqualsASCII(abbreviation, state.abbreviation)) return base::ASCIIToUTF16(state.name); } return base::string16(); diff --git a/components/autofill/core/browser/wallet/real_pan_wallet_client.cc b/components/autofill/core/browser/wallet/real_pan_wallet_client.cc index 578d765..dbec883 100644 --- a/components/autofill/core/browser/wallet/real_pan_wallet_client.cc +++ b/components/autofill/core/browser/wallet/real_pan_wallet_client.cc @@ -147,7 +147,7 @@ void RealPanWalletClient::OnURLFetchComplete(const net::URLFetcher* source) { response_dict->GetString("error.code", &error_code); } - if (LowerCaseEqualsASCII(error_code, "internal")) + if (base::LowerCaseEqualsASCII(error_code, "internal")) result = AutofillClient::TRY_AGAIN_FAILURE; else if (real_pan.empty() || !error_code.empty()) result = AutofillClient::PERMANENT_FAILURE; diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc index 6beee3c..08cf86f 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc @@ -806,7 +806,7 @@ bool DataReductionProxyConfig::MaybeDisableIfVPN() { const std::string vpn_interface_name_prefix = "tun"; for (size_t i = 0; i < network_interfaces.size(); ++i) { std::string interface_name = network_interfaces[i].name; - if (LowerCaseEqualsASCII( + if (base::LowerCaseEqualsASCII( interface_name.begin(), interface_name.begin() + vpn_interface_name_prefix.size(), vpn_interface_name_prefix.c_str())) { diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_headers.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_headers.cc index 35c93f5..b423275 100644 --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_headers.cc +++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_headers.cc @@ -74,9 +74,8 @@ bool GetDataReductionProxyActionValue( while (headers->EnumerateHeader(&iter, kChromeProxyHeader, &value)) { if (value.size() > prefix.size()) { - if (LowerCaseEqualsASCII(value.begin(), - value.begin() + prefix.size(), - prefix.c_str())) { + if (base::LowerCaseEqualsASCII( + value.begin(), value.begin() + prefix.size(), prefix.c_str())) { if (action_value) *action_value = value.substr(prefix.size()); return true; @@ -99,9 +98,8 @@ bool ParseHeadersAndSetBypassDuration(const net::HttpResponseHeaders* headers, while (headers->EnumerateHeader(&iter, kChromeProxyHeader, &value)) { if (value.size() > prefix.size()) { - if (LowerCaseEqualsASCII(value.begin(), - value.begin() + prefix.size(), - prefix.c_str())) { + if (base::LowerCaseEqualsASCII( + value.begin(), value.begin() + prefix.size(), prefix.c_str())) { int64 seconds; if (!base::StringToInt64( StringPiece(value.begin() + prefix.size(), value.end()), @@ -305,10 +303,10 @@ void GetDataReductionProxyHeaderWithFingerprintRemoved( void* iter = NULL; while (headers->EnumerateHeader(&iter, kChromeProxyHeader, &value)) { if (value.size() > chrome_proxy_fingerprint_prefix.size()) { - if (LowerCaseEqualsASCII( - value.begin(), - value.begin() + chrome_proxy_fingerprint_prefix.size(), - chrome_proxy_fingerprint_prefix.c_str())) { + if (base::LowerCaseEqualsASCII( + value.begin(), + value.begin() + chrome_proxy_fingerprint_prefix.size(), + chrome_proxy_fingerprint_prefix.c_str())) { continue; } } diff --git a/components/google/core/browser/google_util.cc b/components/google/core/browser/google_util.cc index dfe5d04..9b16899 100644 --- a/components/google/core/browser/google_util.cc +++ b/components/google/core/browser/google_util.cc @@ -54,12 +54,12 @@ bool IsValidHostName(const std::string& host, return false; // Removes the tld and the preceding dot. std::string host_minus_tld(host, 0, host.length() - tld_length - 1); - if (LowerCaseEqualsASCII(host_minus_tld, domain_in_lower_case.c_str())) + if (base::LowerCaseEqualsASCII(host_minus_tld, domain_in_lower_case.c_str())) return true; if (subdomain_permission == google_util::ALLOW_SUBDOMAIN) return EndsWith(host_minus_tld, "." + domain_in_lower_case, false); - return LowerCaseEqualsASCII(host_minus_tld, - ("www." + domain_in_lower_case).c_str()); + return base::LowerCaseEqualsASCII(host_minus_tld, + ("www." + domain_in_lower_case).c_str()); } // True if |url| is a valid URL with HTTP or HTTPS scheme. If |port_permission| diff --git a/components/history/core/browser/visitsegment_database.cc b/components/history/core/browser/visitsegment_database.cc index 7beabd0..891c1b5 100644 --- a/components/history/core/browser/visitsegment_database.cc +++ b/components/history/core/browser/visitsegment_database.cc @@ -108,7 +108,7 @@ std::string VisitSegmentDatabase::ComputeSegmentName(const GURL& url) { const char* host_c = host.c_str(); // Remove www. to avoid some dups. if (static_cast<int>(host.size()) > kWWWDotLen && - LowerCaseEqualsASCII(host_c, host_c + kWWWDotLen, kWWWDot)) { + base::LowerCaseEqualsASCII(host_c, host_c + kWWWDotLen, kWWWDot)) { r.SetHost(host.c_str(), url::Component(kWWWDotLen, static_cast<int>(host.size()) - kWWWDotLen)); diff --git a/components/html_viewer/blink_url_request_type_converters.cc b/components/html_viewer/blink_url_request_type_converters.cc index 9e6a40d..339db95 100644 --- a/components/html_viewer/blink_url_request_type_converters.cc +++ b/components/html_viewer/blink_url_request_type_converters.cc @@ -23,7 +23,7 @@ class HeaderFlattener : public blink::WebHTTPHeaderVisitor { const std::string& name_latin1 = name.latin1(); const std::string& value_latin1 = value.latin1(); - if (LowerCaseEqualsASCII(name_latin1, "accept")) + if (base::LowerCaseEqualsASCII(name_latin1, "accept")) has_accept_header_ = true; HttpHeaderPtr header = HttpHeader::New(); diff --git a/components/metrics/serialization/serialization_utils.cc b/components/metrics/serialization/serialization_utils.cc index 11f45a6..940729d 100644 --- a/components/metrics/serialization/serialization_utils.cc +++ b/components/metrics/serialization/serialization_utils.cc @@ -97,15 +97,15 @@ scoped_ptr<MetricSample> SerializationUtils::ParseSample( const std::string& name = parts[0]; const std::string& value = parts[1]; - if (LowerCaseEqualsASCII(name, "crash")) { + if (base::LowerCaseEqualsASCII(name, "crash")) { return MetricSample::CrashSample(value); - } else if (LowerCaseEqualsASCII(name, "histogram")) { + } else if (base::LowerCaseEqualsASCII(name, "histogram")) { return MetricSample::ParseHistogram(value); - } else if (LowerCaseEqualsASCII(name, "linearhistogram")) { + } else if (base::LowerCaseEqualsASCII(name, "linearhistogram")) { return MetricSample::ParseLinearHistogram(value); - } else if (LowerCaseEqualsASCII(name, "sparsehistogram")) { + } else if (base::LowerCaseEqualsASCII(name, "sparsehistogram")) { return MetricSample::ParseSparseHistogram(value); - } else if (LowerCaseEqualsASCII(name, "useraction")) { + } else if (base::LowerCaseEqualsASCII(name, "useraction")) { return MetricSample::UserActionSample(value); } else { DLOG(ERROR) << "invalid event type: " << name << ", value: " << value; diff --git a/components/omnibox/autocomplete_input.cc b/components/omnibox/autocomplete_input.cc index 30af0d2..a078f8c 100644 --- a/components/omnibox/autocomplete_input.cc +++ b/components/omnibox/autocomplete_input.cc @@ -169,7 +169,7 @@ metrics::OmniboxInputType::Type AutocompleteInput::Parse( if (!canonicalized_url->is_valid()) return metrics::OmniboxInputType::QUERY; - if (LowerCaseEqualsASCII(parsed_scheme_utf8, url::kFileScheme)) { + if (base::LowerCaseEqualsASCII(parsed_scheme_utf8, url::kFileScheme)) { // A user might or might not type a scheme when entering a file URL. In // either case, |parsed_scheme_utf8| will tell us that this is a file URL, // but |parts->scheme| might be empty, e.g. if the user typed "C:\foo". @@ -183,8 +183,8 @@ metrics::OmniboxInputType::Type AutocompleteInput::Parse( // (e.g. "ftp" or "view-source") but I'll wait to spend the effort on that // until I run into some cases that really need it. if (parts->scheme.is_nonempty() && - !LowerCaseEqualsASCII(parsed_scheme_utf8, url::kHttpScheme) && - !LowerCaseEqualsASCII(parsed_scheme_utf8, url::kHttpsScheme)) { + !base::LowerCaseEqualsASCII(parsed_scheme_utf8, url::kHttpScheme) && + !base::LowerCaseEqualsASCII(parsed_scheme_utf8, url::kHttpsScheme)) { metrics::OmniboxInputType::Type type = scheme_classifier.GetInputTypeForScheme(parsed_scheme_utf8); if (type != metrics::OmniboxInputType::INVALID) @@ -435,7 +435,7 @@ void AutocompleteInput::ParseForEmphasizeComponents( int after_scheme_and_colon = parts.scheme.end() + 1; // For the view-source scheme, we should emphasize the scheme and host of the // URL qualified by the view-source prefix. - if (LowerCaseEqualsASCII(scheme_str, kViewSourceScheme) && + if (base::LowerCaseEqualsASCII(scheme_str, kViewSourceScheme) && (static_cast<int>(text.length()) > after_scheme_and_colon)) { // Obtain the URL prefixed by view-source and parse it. base::string16 real_url(text.substr(after_scheme_and_colon)); @@ -457,7 +457,7 @@ void AutocompleteInput::ParseForEmphasizeComponents( host->reset(); } } - } else if (LowerCaseEqualsASCII(scheme_str, url::kFileSystemScheme) && + } else if (base::LowerCaseEqualsASCII(scheme_str, url::kFileSystemScheme) && parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid()) { *host = parts.inner_parsed()->host; } diff --git a/components/omnibox/search_provider.cc b/components/omnibox/search_provider.cc index 670debf..e97e7f0 100644 --- a/components/omnibox/search_provider.cc +++ b/components/omnibox/search_provider.cc @@ -732,9 +732,9 @@ bool SearchProvider::IsQueryPotentionallyPrivate() const { // and happens to currently be invalid -- in which case we again want to run // our checks below. Other QUERY cases are less likely to be URLs and thus we // assume we're OK. - if (!LowerCaseEqualsASCII(input_.scheme(), url::kHttpScheme) && - !LowerCaseEqualsASCII(input_.scheme(), url::kHttpsScheme) && - !LowerCaseEqualsASCII(input_.scheme(), url::kFtpScheme)) + if (!base::LowerCaseEqualsASCII(input_.scheme(), url::kHttpScheme) && + !base::LowerCaseEqualsASCII(input_.scheme(), url::kHttpsScheme) && + !base::LowerCaseEqualsASCII(input_.scheme(), url::kFtpScheme)) return (input_.type() != metrics::OmniboxInputType::QUERY); // Don't send URLs with usernames, queries or refs. Some of these are @@ -756,7 +756,7 @@ bool SearchProvider::IsQueryPotentionallyPrivate() const { // Don't send anything for https except the hostname. Hostnames are OK // because they are visible when the TCP connection is established, but the // specific path may reveal private information. - if (LowerCaseEqualsASCII(input_.scheme(), url::kHttpsScheme) && + if (base::LowerCaseEqualsASCII(input_.scheme(), url::kHttpsScheme) && parts.path.is_nonempty()) return true; diff --git a/components/password_manager/core/browser/affiliation_utils.cc b/components/password_manager/core/browser/affiliation_utils.cc index 6fbf02c..3cdc9ea 100644 --- a/components/password_manager/core/browser/affiliation_utils.cc +++ b/components/password_manager/core/browser/affiliation_utils.cc @@ -18,7 +18,6 @@ #include "net/base/escape.h" #include "url/third_party/mozilla/url_parse.h" #include "url/url_canon_stdstring.h" -#include "url/url_util.h" namespace password_manager { @@ -183,11 +182,11 @@ bool ParseAndCanonicalizeFacetURI(const std::string& input_uri, url::ParseStandardURL(input_uri.c_str(), input_uri.size(), &input_parsed); base::StringPiece scheme = ComponentString(input_uri, input_parsed.scheme); - if (url::LowerCaseEqualsASCII(scheme.begin(), scheme.end(), - url::kHttpsScheme)) { + if (base::LowerCaseEqualsASCII(scheme.begin(), scheme.end(), + url::kHttpsScheme)) { return CanonicalizeWebFacetURI(input_uri, input_parsed, canonical_uri); - } else if (url::LowerCaseEqualsASCII(scheme.begin(), scheme.end(), - kAndroidAppScheme)) { + } else if (base::LowerCaseEqualsASCII(scheme.begin(), scheme.end(), + kAndroidAppScheme)) { return CanonicalizeAndroidFacetURI(input_uri, input_parsed, canonical_uri); } return false; @@ -318,7 +317,7 @@ bool IsPropagatingPasswordChangesToWebCredentialsEnabled( return false; if (command_line.HasSwitch(switches::kEnableAffiliationBasedMatching)) return true; - return LowerCaseEqualsASCII(update_enabled, "enabled"); + return base::LowerCaseEqualsASCII(update_enabled, "enabled"); } bool IsAffiliationRequestsForDummyFacetsEnabled( @@ -329,7 +328,7 @@ bool IsAffiliationRequestsForDummyFacetsEnabled( return false; if (command_line.HasSwitch(switches::kEnableAffiliationBasedMatching)) return true; - return LowerCaseEqualsASCII(synthesizing_enabled, "enabled"); + return base::LowerCaseEqualsASCII(synthesizing_enabled, "enabled"); } bool IsValidAndroidFacetURI(const std::string& url) { diff --git a/components/plugins/renderer/mobile_youtube_plugin.cc b/components/plugins/renderer/mobile_youtube_plugin.cc index 4664db7..6db102a 100644 --- a/components/plugins/renderer/mobile_youtube_plugin.cc +++ b/components/plugins/renderer/mobile_youtube_plugin.cc @@ -94,7 +94,8 @@ bool MobileYouTubePlugin::IsYouTubeURL(const GURL& url, EndsWith(host, "youtube-nocookie.com", true); return is_youtube && IsValidYouTubeVideo(url.path()) && - LowerCaseEqualsASCII(mime_type, content::kFlashPluginSwfMimeType); + base::LowerCaseEqualsASCII(mime_type, + content::kFlashPluginSwfMimeType); } void MobileYouTubePlugin::OpenYoutubeUrlCallback() { diff --git a/components/policy/core/common/policy_loader_win.cc b/components/policy/core/common/policy_loader_win.cc index 449b99f..f199a20d 100644 --- a/components/policy/core/common/policy_loader_win.cc +++ b/components/policy/core/common/policy_loader_win.cc @@ -156,7 +156,8 @@ void FilterUntrustedPolicy(PolicyMap* policy) { if (pos == std::string::npos) continue; // Only allow custom update urls in enterprise environments. - if (!LowerCaseEqualsASCII(entry.substr(pos), kExpectedWebStoreUrl)) { + if (!base::LowerCaseEqualsASCII(entry.substr(pos), + kExpectedWebStoreUrl)) { entry = kBlockedExtensionPrefix + entry; invalid_policies++; } diff --git a/components/search_engines/template_url_parser.cc b/components/search_engines/template_url_parser.cc index edcc1dc..394512c 100644 --- a/components/search_engines/template_url_parser.cc +++ b/components/search_engines/template_url_parser.cc @@ -364,7 +364,7 @@ void TemplateURLParsingContext::ParseURL(const xmlChar** atts) { } else if (name == kURLTemplateAttribute) { template_url = XMLCharToString(value); } else if (name == kParamMethodAttribute) { - is_post = LowerCaseEqualsASCII(XMLCharToString(value), "post"); + is_post = base::LowerCaseEqualsASCII(XMLCharToString(value), "post"); } } diff --git a/components/translate/content/renderer/translate_helper.cc b/components/translate/content/renderer/translate_helper.cc index a17f351..a020f0a 100644 --- a/components/translate/content/renderer/translate_helper.cc +++ b/components/translate/content/renderer/translate_helper.cc @@ -116,7 +116,7 @@ bool HasNoTranslateMeta(WebDocument* document) { attribute = element.getAttribute(content); if (attribute.isNull()) continue; - if (LowerCaseEqualsASCII(attribute, "notranslate")) + if (base::LowerCaseEqualsASCII(attribute, "notranslate")) return true; } return false; diff --git a/components/url_fixer/url_fixer.cc b/components/url_fixer/url_fixer.cc index 811f1fb..eaf85b0 100644 --- a/components/url_fixer/url_fixer.cc +++ b/components/url_fixer/url_fixer.cc @@ -547,7 +547,7 @@ GURL url_fixer::FixupURL(const std::string& text, // Parse and rebuild about: and chrome: URLs, except about:blank. bool chrome_url = - !LowerCaseEqualsASCII(trimmed, url::kAboutBlankURL) && + !base::LowerCaseEqualsASCII(trimmed, url::kAboutBlankURL) && ((scheme == url::kAboutScheme) || (scheme == kChromeUIScheme)); // For some schemes whose layouts we understand, we rebuild it. diff --git a/components/webcrypto/test/test_helpers.cc b/components/webcrypto/test/test_helpers.cc index 4684c40..5e3dc5a 100644 --- a/components/webcrypto/test/test_helpers.cc +++ b/components/webcrypto/test/test_helpers.cc @@ -495,8 +495,9 @@ scoped_ptr<base::DictionaryValue> GetJwkDictionary( std::string k_value; if (!Base64DecodeUrlSafe(value_string, &k_value)) return ::testing::AssertionFailure() << "Base64DecodeUrlSafe(k) failed"; - if (!LowerCaseEqualsASCII(base::HexEncode(k_value.data(), k_value.size()), - k_expected_hex.c_str())) { + if (!base::LowerCaseEqualsASCII( + base::HexEncode(k_value.data(), k_value.size()), + k_expected_hex.c_str())) { return ::testing::AssertionFailure() << "Expected 'k' to be " << k_expected_hex << " but found something different"; @@ -534,8 +535,9 @@ scoped_ptr<base::DictionaryValue> GetJwkDictionary( std::string e_value; if (!Base64DecodeUrlSafe(value_string, &e_value)) return ::testing::AssertionFailure() << "Base64DecodeUrlSafe(e) failed"; - if (!LowerCaseEqualsASCII(base::HexEncode(e_value.data(), e_value.size()), - e_expected_hex.c_str())) { + if (!base::LowerCaseEqualsASCII( + base::HexEncode(e_value.data(), e_value.size()), + e_expected_hex.c_str())) { return ::testing::AssertionFailure() << "Expected 'e' to be " << e_expected_hex << " but found something different"; diff --git a/content/browser/accessibility/browser_accessibility_state_impl_win.cc b/content/browser/accessibility/browser_accessibility_state_impl_win.cc index ddce50e..058e3a7 100644 --- a/content/browser/accessibility/browser_accessibility_state_impl_win.cc +++ b/content/browser/accessibility/browser_accessibility_state_impl_win.cc @@ -59,13 +59,13 @@ void BrowserAccessibilityStateImpl::UpdatePlatformSpecificHistograms() { TCHAR filename[MAX_PATH]; GetModuleFileName(modules[i], filename, arraysize(filename)); base::string16 module_name(base::FilePath(filename).BaseName().value()); - if (LowerCaseEqualsASCII(module_name, "fsdomsrv.dll")) + if (base::LowerCaseEqualsASCII(module_name, "fsdomsrv.dll")) jaws = true; - if (LowerCaseEqualsASCII(module_name, "vbufbackend_gecko_ia2.dll")) + if (base::LowerCaseEqualsASCII(module_name, "vbufbackend_gecko_ia2.dll")) nvda = true; - if (LowerCaseEqualsASCII(module_name, "stsaw32.dll")) + if (base::LowerCaseEqualsASCII(module_name, "stsaw32.dll")) satogo = true; - if (LowerCaseEqualsASCII(module_name, "zslhook.dll")) + if (base::LowerCaseEqualsASCII(module_name, "zslhook.dll")) zoomtext = true; } diff --git a/content/browser/child_process_security_policy_impl.cc b/content/browser/child_process_security_policy_impl.cc index 5b03dfc..bb4a3e2 100644 --- a/content/browser/child_process_security_policy_impl.cc +++ b/content/browser/child_process_security_policy_impl.cc @@ -598,7 +598,7 @@ bool ChildProcessSecurityPolicyImpl::CanRequestURL( return CanRequestURL(child_id, child_url); } - if (LowerCaseEqualsASCII(url.spec(), url::kAboutBlankURL)) + if (base::LowerCaseEqualsASCII(url.spec(), url::kAboutBlankURL)) return true; // Every child process can request <about:blank>. // URLs like <about:memory> and <about:crash> shouldn't be requestable by diff --git a/content/browser/download/download_stats.cc b/content/browser/download/download_stats.cc index f8b92be..d673f86 100644 --- a/content/browser/download/download_stats.cc +++ b/content/browser/download/download_stats.cc @@ -344,13 +344,13 @@ void RecordAcceptsRanges(const std::string& accepts_ranges, download_len /= 1024; // In Kilobytes static const int kBuckets = 50; - if (LowerCaseEqualsASCII(accepts_ranges, "none")) { + if (base::LowerCaseEqualsASCII(accepts_ranges, "none")) { UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesNone.KBytes", download_len, 1, max, kBuckets); - } else if (LowerCaseEqualsASCII(accepts_ranges, "bytes")) { + } else if (base::LowerCaseEqualsASCII(accepts_ranges, "bytes")) { UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesBytes.KBytes", download_len, 1, diff --git a/content/browser/loader/buffered_resource_handler.cc b/content/browser/loader/buffered_resource_handler.cc index a160eed..5a18072 100644 --- a/content/browser/loader/buffered_resource_handler.cc +++ b/content/browser/loader/buffered_resource_handler.cc @@ -259,7 +259,7 @@ bool BufferedResourceHandler::ShouldSniffContent() { &content_type_options); bool sniffing_blocked = - LowerCaseEqualsASCII(content_type_options, "nosniff"); + base::LowerCaseEqualsASCII(content_type_options, "nosniff"); bool we_would_like_to_sniff = net::ShouldSniffMimeType(request()->url(), mime_type); diff --git a/content/child/multipart_response_delegate.cc b/content/child/multipart_response_delegate.cc index 21d2d51..c29fe55 100644 --- a/content/child/multipart_response_delegate.cc +++ b/content/child/multipart_response_delegate.cc @@ -43,7 +43,7 @@ class HeaderCopier : public WebHTTPHeaderVisitor { virtual void visitHeader(const WebString& name, const WebString& value) { const std::string& name_utf8 = name.utf8(); for (size_t i = 0; i < arraysize(kReplaceHeaders); ++i) { - if (LowerCaseEqualsASCII(name_utf8, kReplaceHeaders[i])) + if (base::LowerCaseEqualsASCII(name_utf8, kReplaceHeaders[i])) return; } response_->setHTTPHeaderField(name, value); diff --git a/content/child/npapi/plugin_url_fetcher.cc b/content/child/npapi/plugin_url_fetcher.cc index c8a93ca..e56c63a 100644 --- a/content/child/npapi/plugin_url_fetcher.cc +++ b/content/child/npapi/plugin_url_fetcher.cc @@ -131,7 +131,7 @@ PluginURLFetcher::PluginURLFetcher(PluginStreamUrl* plugin_stream, if (!request_info.headers.empty()) request_info.headers += "\r\n"; request_info.headers += names[i] + ": " + values[i]; - if (LowerCaseEqualsASCII(names[i], "content-type")) + if (base::LowerCaseEqualsASCII(names[i], "content-type")) content_type_found = true; } diff --git a/content/child/npapi/webplugin_delegate_impl.cc b/content/child/npapi/webplugin_delegate_impl.cc index 9d76054..18149c3 100644 --- a/content/child/npapi/webplugin_delegate_impl.cc +++ b/content/child/npapi/webplugin_delegate_impl.cc @@ -70,7 +70,7 @@ bool WebPluginDelegateImpl::Initialize( scoped_ptr<char*[]> argv(new char*[arg_names.size()]); for (size_t i = 0; i < arg_names.size(); ++i) { if (quirks_ & PLUGIN_QUIRK_NO_WINDOWLESS && - LowerCaseEqualsASCII(arg_names[i], "windowlessvideo")) { + base::LowerCaseEqualsASCII(arg_names[i], "windowlessvideo")) { continue; } argn[argc] = const_cast<char*>(arg_names[i].c_str()); diff --git a/content/child/site_isolation_policy.cc b/content/child/site_isolation_policy.cc index 6d42423..5210423 100644 --- a/content/child/site_isolation_policy.cc +++ b/content/child/site_isolation_policy.cc @@ -66,8 +66,9 @@ bool MatchesSignature(StringPiece data, if (length < signature_length) continue; - if (LowerCaseEqualsASCII(data.begin(), data.begin() + signature_length, - signature.data())) + if (base::LowerCaseEqualsASCII(data.begin(), + data.begin() + signature_length, + signature.data())) return true; } return false; @@ -194,7 +195,7 @@ SiteIsolationPolicy::OnReceivedResponse(const GURL& frame_origin, resp_data->resource_type = resource_type; resp_data->canonical_mime_type = canonical_mime_type; resp_data->http_status_code = info.headers->response_code(); - resp_data->no_sniff = LowerCaseEqualsASCII(no_sniff, "nosniff"); + resp_data->no_sniff = base::LowerCaseEqualsASCII(no_sniff, "nosniff"); return resp_data; } @@ -299,23 +300,23 @@ bool SiteIsolationPolicy::ShouldBlockResponse( SiteIsolationResponseMetaData::CanonicalMimeType SiteIsolationPolicy::GetCanonicalMimeType(const std::string& mime_type) { - if (LowerCaseEqualsASCII(mime_type, kTextHtml)) { + if (base::LowerCaseEqualsASCII(mime_type, kTextHtml)) { return SiteIsolationResponseMetaData::HTML; } - if (LowerCaseEqualsASCII(mime_type, kTextPlain)) { + if (base::LowerCaseEqualsASCII(mime_type, kTextPlain)) { return SiteIsolationResponseMetaData::Plain; } - if (LowerCaseEqualsASCII(mime_type, kAppJson) || - LowerCaseEqualsASCII(mime_type, kTextJson) || - LowerCaseEqualsASCII(mime_type, kTextXjson)) { + if (base::LowerCaseEqualsASCII(mime_type, kAppJson) || + base::LowerCaseEqualsASCII(mime_type, kTextJson) || + base::LowerCaseEqualsASCII(mime_type, kTextXjson)) { return SiteIsolationResponseMetaData::JSON; } - if (LowerCaseEqualsASCII(mime_type, kTextXml) || - LowerCaseEqualsASCII(mime_type, xAppRssXml) || - LowerCaseEqualsASCII(mime_type, kAppXml)) { + if (base::LowerCaseEqualsASCII(mime_type, kTextXml) || + base::LowerCaseEqualsASCII(mime_type, xAppRssXml) || + base::LowerCaseEqualsASCII(mime_type, kAppXml)) { return SiteIsolationResponseMetaData::XML; } diff --git a/content/child/web_url_request_util.cc b/content/child/web_url_request_util.cc index 6737307..438ccf7 100644 --- a/content/child/web_url_request_util.cc +++ b/content/child/web_url_request_util.cc @@ -37,10 +37,10 @@ class HeaderFlattener : public blink::WebHTTPHeaderVisitor { // Skip over referrer headers found in the header map because we already // pulled it out as a separate parameter. - if (LowerCaseEqualsASCII(name_latin1, "referer")) + if (base::LowerCaseEqualsASCII(name_latin1, "referer")) return; - if (LowerCaseEqualsASCII(name_latin1, "accept")) + if (base::LowerCaseEqualsASCII(name_latin1, "accept")) has_accept_header_ = true; if (!buffer_.empty()) diff --git a/content/common/android/address_parser.cc b/content/common/android/address_parser.cc index 41bdeb7..2b0478a 100644 --- a/content/common/android/address_parser.cc +++ b/content/common/android/address_parser.cc @@ -171,10 +171,12 @@ bool FindAddress(const base::string16::const_iterator& begin, if (current_word_length == 2 && words.size() > 2) { const Word& previous_word = words[state_first_word - 1]; if (previous_word.end - previous_word.begin == 2 && - LowerCaseEqualsASCII(previous_word.begin, previous_word.end, - "et") && - LowerCaseEqualsASCII(current_word.begin, current_word.end, - "al")) + base::LowerCaseEqualsASCII(previous_word.begin, + previous_word.end, + "et") && + base::LowerCaseEqualsASCII(current_word.begin, + current_word.end, + "al")) break; } diff --git a/content/common/android/address_parser_internal.cc b/content/common/android/address_parser_internal.cc index 127fb3c..12ac3cc 100644 --- a/content/common/android/address_parser_internal.cc +++ b/content/common/android/address_parser_internal.cc @@ -157,7 +157,7 @@ bool HouseNumberParser::Parse( if (IsAsciiAlpha(*it_)) { // Handle special case 'one'. if (result_chars_ == 0) { - if (it_ + 3 <= end_ && LowerCaseEqualsASCII(it_, it_ + 3, "one")) + if (it_ + 3 <= end_ && base::LowerCaseEqualsASCII(it_, it_ + 3, "one")) AcceptChars(3); else RestartOnNextDelimiter(); diff --git a/content/public/common/window_container_type.cc b/content/public/common/window_container_type.cc index ec3b12c..57c91d0 100644 --- a/content/public/common/window_container_type.cc +++ b/content/public/common/window_container_type.cc @@ -22,11 +22,11 @@ WindowContainerType WindowFeaturesToContainerType( bool persistent = false; for (size_t i = 0; i < window_features.additionalFeatures.size(); ++i) { - if (LowerCaseEqualsASCII(window_features.additionalFeatures[i], - kBackground)) + if (base::LowerCaseEqualsASCII(window_features.additionalFeatures[i], + kBackground)) background = true; - else if (LowerCaseEqualsASCII(window_features.additionalFeatures[i], - kPersistent)) + else if (base::LowerCaseEqualsASCII(window_features.additionalFeatures[i], + kPersistent)) persistent = true; } diff --git a/content/renderer/dom_serializer_browsertest.cc b/content/renderer/dom_serializer_browsertest.cc index cd99e27..c72df6f 100644 --- a/content/renderer/dom_serializer_browsertest.cc +++ b/content/renderer/dom_serializer_browsertest.cc @@ -108,7 +108,7 @@ bool IsMetaElement(const WebNode& node, std::string& charset_info) { charset_info.erase(0, charset_info.length()); // Check the META charset declaration. WebString httpEquiv = meta.getAttribute("http-equiv"); - if (LowerCaseEqualsASCII(httpEquiv, "content-type")) { + if (base::LowerCaseEqualsASCII(httpEquiv, "content-type")) { std::string content = meta.getAttribute("content").utf8(); int pos = content.find("charset", 0); if (pos > -1) { diff --git a/content/renderer/fetchers/resource_fetcher_impl.cc b/content/renderer/fetchers/resource_fetcher_impl.cc index e296937..b48ad21 100644 --- a/content/renderer/fetchers/resource_fetcher_impl.cc +++ b/content/renderer/fetchers/resource_fetcher_impl.cc @@ -56,7 +56,7 @@ void ResourceFetcherImpl::SetHeader(const std::string& header, DCHECK(!request_.isNull()); DCHECK(!loader_); - if (LowerCaseEqualsASCII(header, "referer")) { + if (base::LowerCaseEqualsASCII(header, "referer")) { blink::WebString referrer = blink::WebSecurityPolicy::generateReferrerHeader( blink::WebReferrerPolicyDefault, diff --git a/content/renderer/manifest/manifest_parser.cc b/content/renderer/manifest/manifest_parser.cc index 02a5c9c..7e2fc77 100644 --- a/content/renderer/manifest/manifest_parser.cc +++ b/content/renderer/manifest/manifest_parser.cc @@ -221,13 +221,13 @@ Manifest::DisplayMode ManifestParser::ParseDisplay( if (display.is_null()) return Manifest::DISPLAY_MODE_UNSPECIFIED; - if (LowerCaseEqualsASCII(display.string(), "fullscreen")) + if (base::LowerCaseEqualsASCII(display.string(), "fullscreen")) return Manifest::DISPLAY_MODE_FULLSCREEN; - else if (LowerCaseEqualsASCII(display.string(), "standalone")) + else if (base::LowerCaseEqualsASCII(display.string(), "standalone")) return Manifest::DISPLAY_MODE_STANDALONE; - else if (LowerCaseEqualsASCII(display.string(), "minimal-ui")) + else if (base::LowerCaseEqualsASCII(display.string(), "minimal-ui")) return Manifest::DISPLAY_MODE_MINIMAL_UI; - else if (LowerCaseEqualsASCII(display.string(), "browser")) + else if (base::LowerCaseEqualsASCII(display.string(), "browser")) return Manifest::DISPLAY_MODE_BROWSER; else { errors_.push_back(GetErrorPrefix() + "unknown 'display' value ignored."); @@ -243,21 +243,25 @@ blink::WebScreenOrientationLockType ManifestParser::ParseOrientation( if (orientation.is_null()) return blink::WebScreenOrientationLockDefault; - if (LowerCaseEqualsASCII(orientation.string(), "any")) + if (base::LowerCaseEqualsASCII(orientation.string(), "any")) return blink::WebScreenOrientationLockAny; - else if (LowerCaseEqualsASCII(orientation.string(), "natural")) + else if (base::LowerCaseEqualsASCII(orientation.string(), "natural")) return blink::WebScreenOrientationLockNatural; - else if (LowerCaseEqualsASCII(orientation.string(), "landscape")) + else if (base::LowerCaseEqualsASCII(orientation.string(), "landscape")) return blink::WebScreenOrientationLockLandscape; - else if (LowerCaseEqualsASCII(orientation.string(), "landscape-primary")) + else if (base::LowerCaseEqualsASCII(orientation.string(), + "landscape-primary")) return blink::WebScreenOrientationLockLandscapePrimary; - else if (LowerCaseEqualsASCII(orientation.string(), "landscape-secondary")) + else if (base::LowerCaseEqualsASCII(orientation.string(), + "landscape-secondary")) return blink::WebScreenOrientationLockLandscapeSecondary; - else if (LowerCaseEqualsASCII(orientation.string(), "portrait")) + else if (base::LowerCaseEqualsASCII(orientation.string(), "portrait")) return blink::WebScreenOrientationLockPortrait; - else if (LowerCaseEqualsASCII(orientation.string(), "portrait-primary")) + else if (base::LowerCaseEqualsASCII(orientation.string(), + "portrait-primary")) return blink::WebScreenOrientationLockPortraitPrimary; - else if (LowerCaseEqualsASCII(orientation.string(), "portrait-secondary")) + else if (base::LowerCaseEqualsASCII(orientation.string(), + "portrait-secondary")) return blink::WebScreenOrientationLockPortraitSecondary; else { errors_.push_back(GetErrorPrefix() + diff --git a/content/renderer/media/user_media_client_impl.cc b/content/renderer/media/user_media_client_impl.cc index e09ccb6..22ec3d1 100644 --- a/content/renderer/media/user_media_client_impl.cc +++ b/content/renderer/media/user_media_client_impl.cc @@ -160,7 +160,7 @@ void UserMediaClientImpl::requestUserMedia( std::string enable; if (options.GetFirstAudioConstraintByName( kMediaStreamRenderToAssociatedSink, &enable, NULL) && - LowerCaseEqualsASCII(enable, "true")) { + base::LowerCaseEqualsASCII(enable, "true")) { enable_automatic_output_device_selection = true; } } diff --git a/content/renderer/npapi/webplugin_impl.cc b/content/renderer/npapi/webplugin_impl.cc index 127c574..046d33c 100644 --- a/content/renderer/npapi/webplugin_impl.cc +++ b/content/renderer/npapi/webplugin_impl.cc @@ -942,7 +942,7 @@ void WebPluginImpl::willSendRequest(WebURLLoader* loader, // just block cross origin 307 POST redirects. if (!client_info->notify_redirects) { if (response.httpStatusCode() == 307 && - LowerCaseEqualsASCII(request.httpMethod().utf8(), "post")) { + base::LowerCaseEqualsASCII(request.httpMethod().utf8(), "post")) { GURL original_request_url(response.url()); GURL response_url(request.url()); if (original_request_url.GetOrigin() != response_url.GetOrigin()) { diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index e37dcde..5197c66 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -3247,7 +3247,7 @@ void RenderFrameImpl::willSendRequest( navigation_state->start_params().extra_headers.begin(), navigation_state->start_params().extra_headers.end(), "\n"); i.GetNext();) { - if (LowerCaseEqualsASCII(i.name(), "referer")) { + if (base::LowerCaseEqualsASCII(i.name(), "referer")) { WebString referrer = WebSecurityPolicy::generateReferrerHeader( blink::WebReferrerPolicyDefault, request.url(), diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 1c4f809..9ab74b3 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -2219,8 +2219,8 @@ bool RenderViewImpl::IsEditableNode(const WebNode& node) const { // Also return true if it has an ARIA role of 'textbox'. for (unsigned i = 0; i < element.attributeCount(); ++i) { - if (LowerCaseEqualsASCII(element.attributeLocalName(i), "role")) { - if (LowerCaseEqualsASCII(element.attributeValue(i), "textbox")) + if (base::LowerCaseEqualsASCII(element.attributeLocalName(i), "role")) { + if (base::LowerCaseEqualsASCII(element.attributeValue(i), "textbox")) return true; break; } diff --git a/content/renderer/savable_resources.cc b/content/renderer/savable_resources.cc index 958003f..363cb59 100644 --- a/content/renderer/savable_resources.cc +++ b/content/renderer/savable_resources.cc @@ -166,7 +166,7 @@ WebString GetSubResourceLinkFromElement(const WebElement& element) { attribute_name = "cite"; } else if (element.hasHTMLTagName("link")) { // If the link element is not linked to css, ignore it. - if (LowerCaseEqualsASCII(element.getAttribute("type"), "text/css")) { + if (base::LowerCaseEqualsASCII(element.getAttribute("type"), "text/css")) { // TODO(jnd): Add support for extracting links of sub-resources which // are inside style-sheet such as @import, url(), etc. // See bug: http://b/issue?id=1111667. diff --git a/content/test/net/url_request_abort_on_end_job.cc b/content/test/net/url_request_abort_on_end_job.cc index 8bfd7f9..3fd494f 100644 --- a/content/test/net/url_request_abort_on_end_job.cc +++ b/content/test/net/url_request_abort_on_end_job.cc @@ -67,8 +67,8 @@ void URLRequestAbortOnEndJob::GetResponseInfoConst( net::HttpResponseInfo* info) const { // Send back mock headers. std::string raw_headers; - if (LowerCaseEqualsASCII(k400AbortOnEndUrl, - request_->url().spec().c_str())) { + if (base::LowerCaseEqualsASCII(k400AbortOnEndUrl, + request_->url().spec().c_str())) { raw_headers.append( "HTTP/1.1 400 This is not OK\n" "Content-type: text/plain\n"); diff --git a/content/test/plugin/plugin_test.cc b/content/test/plugin/plugin_test.cc index eb2d8640..84ad5ab 100644 --- a/content/test/plugin/plugin_test.cc +++ b/content/test/plugin/plugin_test.cc @@ -121,7 +121,7 @@ void PluginTest::SetError(const std::string &msg) { void PluginTest::ExpectStringLowerCaseEqual(const std::string &val1, const std::string &val2) { - if (!LowerCaseEqualsASCII(val1, val2.c_str())) { + if (!base::LowerCaseEqualsASCII(val1, val2.c_str())) { std::string err; err = "Expected Equal for '"; err.append(val1); diff --git a/extensions/browser/api/web_request/web_request_api_helpers.cc b/extensions/browser/api/web_request/web_request_api_helpers.cc index 020aa4f..fb6908f 100644 --- a/extensions/browser/api/web_request/web_request_api_helpers.cc +++ b/extensions/browser/api/web_request/web_request_api_helpers.cc @@ -350,7 +350,7 @@ EventResponseDelta* CalculateOnHeadersReceivedDelta( bool header_found = false; for (ResponseHeaders::const_iterator i = new_response_headers->begin(); i != new_response_headers->end(); ++i) { - if (LowerCaseEqualsASCII(i->first, name_lowercase.c_str()) && + if (base::LowerCaseEqualsASCII(i->first, name_lowercase.c_str()) && value == i->second) { header_found = true; break; diff --git a/extensions/common/csp_validator.cc b/extensions/common/csp_validator.cc index 371d7f8..2a28ebb 100644 --- a/extensions/common/csp_validator.cc +++ b/extensions/common/csp_validator.cc @@ -128,19 +128,17 @@ void GetSecureDirectiveValues(const std::string& directive_name, bool is_secure_csp_token = false; // We might need to relax this whitelist over time. - if (source == "'self'" || - source == "'none'" || + if (source == "'self'" || source == "'none'" || source == "http://127.0.0.1" || - LowerCaseEqualsASCII(source, "blob:") || - LowerCaseEqualsASCII(source, "filesystem:") || - LowerCaseEqualsASCII(source, "http://localhost") || + base::LowerCaseEqualsASCII(source, "blob:") || + base::LowerCaseEqualsASCII(source, "filesystem:") || + base::LowerCaseEqualsASCII(source, "http://localhost") || StartsWithASCII(source, "http://127.0.0.1:", true) || StartsWithASCII(source, "http://localhost:", true) || isNonWildcardTLD(source, "https://", true) || isNonWildcardTLD(source, "chrome://", false) || - isNonWildcardTLD(source, - std::string(extensions::kExtensionScheme) + - url::kStandardSchemeSeparator, + isNonWildcardTLD(source, std::string(extensions::kExtensionScheme) + + url::kStandardSchemeSeparator, false) || StartsWithASCII(source, "chrome-extension-resource:", true)) { is_secure_csp_token = true; @@ -209,7 +207,7 @@ bool AllowedToHaveInsecureObjectSrc( base::StringTokenizer tokenizer(input, " \t\r\n"); if (!tokenizer.GetNext()) continue; - if (!LowerCaseEqualsASCII(tokenizer.token(), kPluginTypes)) + if (!base::LowerCaseEqualsASCII(tokenizer.token(), kPluginTypes)) continue; while (tokenizer.GetNext()) { if (!PluginTypeAllowed(tokenizer.token())) diff --git a/google_apis/gaia/gaia_auth_fetcher.cc b/google_apis/gaia/gaia_auth_fetcher.cc index eaae715..e1ef712 100644 --- a/google_apis/gaia/gaia_auth_fetcher.cc +++ b/google_apis/gaia/gaia_auth_fetcher.cc @@ -35,7 +35,7 @@ static bool CookiePartsContains(const std::vector<std::string>& parts, const char* part) { for (std::vector<std::string>::const_iterator it = parts.begin(); it != parts.end(); ++it) { - if (LowerCaseEqualsASCII(*it, part)) + if (base::LowerCaseEqualsASCII(*it, part)) return true; } return false; diff --git a/gpu/config/gpu_test_expectations_parser.cc b/gpu/config/gpu_test_expectations_parser.cc index 8b3584a..d210cbd 100644 --- a/gpu/config/gpu_test_expectations_parser.cc +++ b/gpu/config/gpu_test_expectations_parser.cc @@ -137,7 +137,7 @@ Token ParseToken(const std::string& word) { return kConfigGPUDeviceID; for (int32 i = 0; i < kNumberOfExactMatchTokens; ++i) { - if (LowerCaseEqualsASCII(word, kTokenData[i].name)) + if (base::LowerCaseEqualsASCII(word, kTokenData[i].name)) return static_cast<Token>(i); } return kTokenWord; diff --git a/ios/chrome/browser/chrome_url_util.mm b/ios/chrome/browser/chrome_url_util.mm index db685d7..13477a6 100644 --- a/ios/chrome/browser/chrome_url_util.mm +++ b/ios/chrome/browser/chrome_url_util.mm @@ -18,7 +18,7 @@ bool UrlIsExternalFileReference(const GURL& url) { return url.SchemeIs(ios::GetChromeBrowserProvider()->GetChromeUIScheme()) && - LowerCaseEqualsASCII(url.host(), kChromeUIExternalFileHost); + base::LowerCaseEqualsASCII(url.host(), kChromeUIExternalFileHost); } NSURL* UrlToLaunchChrome() { diff --git a/media/base/audio_video_metadata_extractor.cc b/media/base/audio_video_metadata_extractor.cc index fd666f6..0ba36e1 100644 --- a/media/base/audio_video_metadata_extractor.cc +++ b/media/base/audio_video_metadata_extractor.cc @@ -23,7 +23,7 @@ void OnError(bool* succeeded) { // Returns true if the |tag| matches |expected_key|. bool ExtractString(AVDictionaryEntry* tag, const char* expected_key, std::string* destination) { - if (!LowerCaseEqualsASCII(std::string(tag->key), expected_key)) + if (!base::LowerCaseEqualsASCII(std::string(tag->key), expected_key)) return false; if (destination->empty()) @@ -35,7 +35,7 @@ bool ExtractString(AVDictionaryEntry* tag, const char* expected_key, // Returns true if the |tag| matches |expected_key|. bool ExtractInt(AVDictionaryEntry* tag, const char* expected_key, int* destination) { - if (!LowerCaseEqualsASCII(std::string(tag->key), expected_key)) + if (!base::LowerCaseEqualsASCII(std::string(tag->key), expected_key)) return false; int temporary = -1; diff --git a/net/base/host_mapping_rules.cc b/net/base/host_mapping_rules.cc index a2789c0..179a0dc8 100644 --- a/net/base/host_mapping_rules.cc +++ b/net/base/host_mapping_rules.cc @@ -72,7 +72,7 @@ bool HostMappingRules::AddRuleFromString(const std::string& rule_string) { base::SplitString(trimmed, ' ', &parts); // Test for EXCLUSION rule. - if (parts.size() == 2 && LowerCaseEqualsASCII(parts[0], "exclude")) { + if (parts.size() == 2 && base::LowerCaseEqualsASCII(parts[0], "exclude")) { ExclusionRule rule; rule.hostname_pattern = base::StringToLowerASCII(parts[1]); exclusion_rules_.push_back(rule); @@ -80,7 +80,7 @@ bool HostMappingRules::AddRuleFromString(const std::string& rule_string) { } // Test for MAP rule. - if (parts.size() == 3 && LowerCaseEqualsASCII(parts[0], "map")) { + if (parts.size() == 3 && base::LowerCaseEqualsASCII(parts[0], "map")) { MapRule rule; rule.hostname_pattern = base::StringToLowerASCII(parts[1]); diff --git a/net/base/net_util.cc b/net/base/net_util.cc index 028b56b..f8615cc 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -290,7 +290,7 @@ NET_EXPORT bool IsPortAllowedForScheme(int port, } // FTP requests have an extra set of whitelisted schemes. - if (LowerCaseEqualsASCII(url_scheme, url::kFtpScheme)) { + if (base::LowerCaseEqualsASCII(url_scheme, url::kFtpScheme)) { for (int allowed_ftp_port : kAllowedFtpPorts) { if (allowed_ftp_port == port) return true; diff --git a/net/filter/filter.cc b/net/filter/filter.cc index b49aa34..4df0191 100644 --- a/net/filter/filter.cc +++ b/net/filter/filter.cc @@ -184,12 +184,12 @@ bool Filter::FlushStreamBuffer(int stream_data_len) { Filter::FilterType Filter::ConvertEncodingToType( const std::string& filter_type) { FilterType type_id; - if (LowerCaseEqualsASCII(filter_type, kDeflate)) { + if (base::LowerCaseEqualsASCII(filter_type, kDeflate)) { type_id = FILTER_TYPE_DEFLATE; - } else if (LowerCaseEqualsASCII(filter_type, kGZip) || - LowerCaseEqualsASCII(filter_type, kXGZip)) { + } else if (base::LowerCaseEqualsASCII(filter_type, kGZip) || + base::LowerCaseEqualsASCII(filter_type, kXGZip)) { type_id = FILTER_TYPE_GZIP; - } else if (LowerCaseEqualsASCII(filter_type, kSdch)) { + } else if (base::LowerCaseEqualsASCII(filter_type, kSdch)) { type_id = FILTER_TYPE_SDCH; } else { // Note we also consider "identity" and "uncompressed" UNSUPPORTED as diff --git a/net/http/http_auth.cc b/net/http/http_auth.cc index 3525114..7752d74 100644 --- a/net/http/http_auth.cc +++ b/net/http/http_auth.cc @@ -76,7 +76,8 @@ HttpAuth::AuthorizationResult HttpAuth::HandleChallengeResponse( HttpAuth::AUTHORIZATION_RESULT_INVALID; while (headers->EnumerateHeader(&iter, header_name, &challenge)) { HttpAuthChallengeTokenizer props(challenge.begin(), challenge.end()); - if (!LowerCaseEqualsASCII(props.scheme(), current_scheme_name.c_str())) + if (!base::LowerCaseEqualsASCII(props.scheme(), + current_scheme_name.c_str())) continue; authorization_result = handler->HandleAnotherChallenge(&props); if (authorization_result != HttpAuth::AUTHORIZATION_RESULT_INVALID) { diff --git a/net/http/http_auth_gssapi_posix.cc b/net/http/http_auth_gssapi_posix.cc index 9b902af..388cc64 100644 --- a/net/http/http_auth_gssapi_posix.cc +++ b/net/http/http_auth_gssapi_posix.cc @@ -688,8 +688,8 @@ void HttpAuthGSSAPI::Delegate() { HttpAuth::AuthorizationResult HttpAuthGSSAPI::ParseChallenge( HttpAuthChallengeTokenizer* tok) { // Verify the challenge's auth-scheme. - if (!LowerCaseEqualsASCII(tok->scheme(), - base::StringToLowerASCII(scheme_).c_str())) + if (!base::LowerCaseEqualsASCII(tok->scheme(), + base::StringToLowerASCII(scheme_).c_str())) return HttpAuth::AUTHORIZATION_RESULT_INVALID; std::string encoded_auth_token = tok->base64_param(); diff --git a/net/http/http_auth_handler_basic.cc b/net/http/http_auth_handler_basic.cc index b1624b8..27b892b 100644 --- a/net/http/http_auth_handler_basic.cc +++ b/net/http/http_auth_handler_basic.cc @@ -40,7 +40,7 @@ bool ParseRealm(const HttpAuthChallengeTokenizer& tokenizer, realm->clear(); HttpUtil::NameValuePairsIterator parameters = tokenizer.param_pairs(); while (parameters.GetNext()) { - if (!LowerCaseEqualsASCII(parameters.name(), "realm")) + if (!base::LowerCaseEqualsASCII(parameters.name(), "realm")) continue; if (!ConvertToUtf8AndNormalize(parameters.value(), kCharsetLatin1, realm)) { @@ -62,7 +62,7 @@ bool HttpAuthHandlerBasic::Init(HttpAuthChallengeTokenizer* challenge) { bool HttpAuthHandlerBasic::ParseChallenge( HttpAuthChallengeTokenizer* challenge) { // Verify the challenge's auth-scheme. - if (!LowerCaseEqualsASCII(challenge->scheme(), "basic")) + if (!base::LowerCaseEqualsASCII(challenge->scheme(), "basic")) return false; std::string realm; diff --git a/net/http/http_auth_handler_digest.cc b/net/http/http_auth_handler_digest.cc index 0fbd0d3..a5f96b1 100644 --- a/net/http/http_auth_handler_digest.cc +++ b/net/http/http_auth_handler_digest.cc @@ -113,7 +113,7 @@ HttpAuth::AuthorizationResult HttpAuthHandlerDigest::HandleAnotherChallenge( // to differentiate between stale and rejected responses. // Note that the state of the current handler is not mutated - this way if // there is a rejection the realm hasn't changed. - if (!LowerCaseEqualsASCII(challenge->scheme(), "digest")) + if (!base::LowerCaseEqualsASCII(challenge->scheme(), "digest")) return HttpAuth::AUTHORIZATION_RESULT_INVALID; HttpUtil::NameValuePairsIterator parameters = challenge->param_pairs(); @@ -122,10 +122,10 @@ HttpAuth::AuthorizationResult HttpAuthHandlerDigest::HandleAnotherChallenge( // for the new challenge. std::string original_realm; while (parameters.GetNext()) { - if (LowerCaseEqualsASCII(parameters.name(), "stale")) { - if (LowerCaseEqualsASCII(parameters.value(), "true")) + if (base::LowerCaseEqualsASCII(parameters.name(), "stale")) { + if (base::LowerCaseEqualsASCII(parameters.value(), "true")) return HttpAuth::AUTHORIZATION_RESULT_STALE; - } else if (LowerCaseEqualsASCII(parameters.name(), "realm")) { + } else if (base::LowerCaseEqualsASCII(parameters.name(), "realm")) { original_realm = parameters.value(); } } @@ -199,7 +199,7 @@ bool HttpAuthHandlerDigest::ParseChallenge( realm_ = original_realm_ = nonce_ = domain_ = opaque_ = std::string(); // FAIL -- Couldn't match auth-scheme. - if (!LowerCaseEqualsASCII(challenge->scheme(), "digest")) + if (!base::LowerCaseEqualsASCII(challenge->scheme(), "digest")) return false; HttpUtil::NameValuePairsIterator parameters = challenge->param_pairs(); @@ -225,38 +225,38 @@ bool HttpAuthHandlerDigest::ParseChallenge( bool HttpAuthHandlerDigest::ParseChallengeProperty(const std::string& name, const std::string& value) { - if (LowerCaseEqualsASCII(name, "realm")) { + if (base::LowerCaseEqualsASCII(name, "realm")) { std::string realm; if (!ConvertToUtf8AndNormalize(value, kCharsetLatin1, &realm)) return false; realm_ = realm; original_realm_ = value; - } else if (LowerCaseEqualsASCII(name, "nonce")) { + } else if (base::LowerCaseEqualsASCII(name, "nonce")) { nonce_ = value; - } else if (LowerCaseEqualsASCII(name, "domain")) { + } else if (base::LowerCaseEqualsASCII(name, "domain")) { domain_ = value; - } else if (LowerCaseEqualsASCII(name, "opaque")) { + } else if (base::LowerCaseEqualsASCII(name, "opaque")) { opaque_ = value; - } else if (LowerCaseEqualsASCII(name, "stale")) { + } else if (base::LowerCaseEqualsASCII(name, "stale")) { // Parse the stale boolean. - stale_ = LowerCaseEqualsASCII(value, "true"); - } else if (LowerCaseEqualsASCII(name, "algorithm")) { + stale_ = base::LowerCaseEqualsASCII(value, "true"); + } else if (base::LowerCaseEqualsASCII(name, "algorithm")) { // Parse the algorithm. - if (LowerCaseEqualsASCII(value, "md5")) { + if (base::LowerCaseEqualsASCII(value, "md5")) { algorithm_ = ALGORITHM_MD5; - } else if (LowerCaseEqualsASCII(value, "md5-sess")) { + } else if (base::LowerCaseEqualsASCII(value, "md5-sess")) { algorithm_ = ALGORITHM_MD5_SESS; } else { DVLOG(1) << "Unknown value of algorithm"; return false; // FAIL -- unsupported value of algorithm. } - } else if (LowerCaseEqualsASCII(name, "qop")) { + } else if (base::LowerCaseEqualsASCII(name, "qop")) { // Parse the comma separated list of qops. // auth is the only supported qop, and all other values are ignored. HttpUtil::ValuesIterator qop_values(value.begin(), value.end(), ','); qop_ = QOP_UNSPECIFIED; while (qop_values.GetNext()) { - if (LowerCaseEqualsASCII(qop_values.value(), "auth")) { + if (base::LowerCaseEqualsASCII(qop_values.value(), "auth")) { qop_ = QOP_AUTH; break; } diff --git a/net/http/http_auth_handler_mock.cc b/net/http/http_auth_handler_mock.cc index 35ed3ab..0c0444e 100644 --- a/net/http/http_auth_handler_mock.cc +++ b/net/http/http_auth_handler_mock.cc @@ -83,7 +83,7 @@ HttpAuth::AuthorizationResult HttpAuthHandlerMock::HandleAnotherChallenge( // challenge for a non connection based scheme, assume it's a rejection. if (!is_connection_based() || challenge->base64_param().empty()) return HttpAuth::AUTHORIZATION_RESULT_REJECT; - if (!LowerCaseEqualsASCII(challenge->scheme(), "mock")) + if (!base::LowerCaseEqualsASCII(challenge->scheme(), "mock")) return HttpAuth::AUTHORIZATION_RESULT_INVALID; return HttpAuth::AUTHORIZATION_RESULT_ACCEPT; } diff --git a/net/http/http_auth_handler_ntlm.cc b/net/http/http_auth_handler_ntlm.cc index de0fe29..51a3232 100644 --- a/net/http/http_auth_handler_ntlm.cc +++ b/net/http/http_auth_handler_ntlm.cc @@ -114,7 +114,7 @@ HttpAuth::AuthorizationResult HttpAuthHandlerNTLM::ParseChallenge( auth_data_.clear(); // Verify the challenge's auth-scheme. - if (!LowerCaseEqualsASCII(tok->scheme(), "ntlm")) + if (!base::LowerCaseEqualsASCII(tok->scheme(), "ntlm")) return HttpAuth::AUTHORIZATION_RESULT_INVALID; std::string base64_param = tok->base64_param(); diff --git a/net/http/http_auth_sspi_win.cc b/net/http/http_auth_sspi_win.cc index 56b1c8c..c935d33 100644 --- a/net/http/http_auth_sspi_win.cc +++ b/net/http/http_auth_sspi_win.cc @@ -283,8 +283,8 @@ void HttpAuthSSPI::ResetSecurityContext() { HttpAuth::AuthorizationResult HttpAuthSSPI::ParseChallenge( HttpAuthChallengeTokenizer* tok) { // Verify the challenge's auth-scheme. - if (!LowerCaseEqualsASCII(tok->scheme(), - base::StringToLowerASCII(scheme_).c_str())) + if (!base::LowerCaseEqualsASCII(tok->scheme(), + base::StringToLowerASCII(scheme_).c_str())) return HttpAuth::AUTHORIZATION_RESULT_INVALID; std::string encoded_auth_token = tok->base64_param(); diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc index e3af3f7..dd4b357 100644 --- a/net/http/http_cache_transaction.cc +++ b/net/http/http_cache_transaction.cc @@ -254,7 +254,8 @@ static bool HeaderMatches(const HttpRequestHeaders& headers, HttpUtil::ValuesIterator v(header_value.begin(), header_value.end(), ','); while (v.GetNext()) { - if (LowerCaseEqualsASCII(v.value_begin(), v.value_end(), search->value)) + if (base::LowerCaseEqualsASCII(v.value_begin(), v.value_end(), + search->value)) return true; } } diff --git a/net/http/http_content_disposition.cc b/net/http/http_content_disposition.cc index 1563bec..06f815b 100644 --- a/net/http/http_content_disposition.cc +++ b/net/http/http_content_disposition.cc @@ -359,9 +359,9 @@ std::string::const_iterator HttpContentDisposition::ConsumeDispositionType( DCHECK(std::find(type_begin, type_end, '=') == type_end); - if (LowerCaseEqualsASCII(type_begin, type_end, "inline")) { + if (base::LowerCaseEqualsASCII(type_begin, type_end, "inline")) { type_ = INLINE; - } else if (LowerCaseEqualsASCII(type_begin, type_end, "attachment")) { + } else if (base::LowerCaseEqualsASCII(type_begin, type_end, "attachment")) { type_ = ATTACHMENT; } else { parse_result_flags_ |= HAS_UNKNOWN_DISPOSITION_TYPE; @@ -402,16 +402,16 @@ void HttpContentDisposition::Parse(const std::string& header, HttpUtil::NameValuePairsIterator iter(pos, end, ';'); while (iter.GetNext()) { - if (filename.empty() && LowerCaseEqualsASCII(iter.name_begin(), - iter.name_end(), - "filename")) { + if (filename.empty() && + base::LowerCaseEqualsASCII(iter.name_begin(), iter.name_end(), + "filename")) { DecodeFilenameValue(iter.value(), referrer_charset, &filename, &parse_result_flags_); if (!filename.empty()) parse_result_flags_ |= HAS_FILENAME; - } else if (ext_filename.empty() && LowerCaseEqualsASCII(iter.name_begin(), - iter.name_end(), - "filename*")) { + } else if (ext_filename.empty() && + base::LowerCaseEqualsASCII(iter.name_begin(), iter.name_end(), + "filename*")) { DecodeExtValue(iter.raw_value(), &ext_filename); if (!ext_filename.empty()) parse_result_flags_ |= HAS_EXT_FILENAME; diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc index d56f8f0..257a88c 100644 --- a/net/http/http_response_headers.cc +++ b/net/http/http_response_headers.cc @@ -98,7 +98,7 @@ const char* const kNonUpdatedHeaderPrefixes[] = { bool ShouldUpdateHeader(const std::string::const_iterator& name_begin, const std::string::const_iterator& name_end) { for (size_t i = 0; i < arraysize(kNonUpdatedHeaders); ++i) { - if (LowerCaseEqualsASCII(name_begin, name_end, kNonUpdatedHeaders[i])) + if (base::LowerCaseEqualsASCII(name_begin, name_end, kNonUpdatedHeaders[i])) return false; } for (size_t i = 0; i < arraysize(kNonUpdatedHeaderPrefixes); ++i) { @@ -632,7 +632,7 @@ HttpVersion HttpResponseHeaders::ParseVersion( // TODO: (1*DIGIT apparently means one or more digits, but we only handle 1). // TODO: handle leading zeros, which is allowed by the rfc1616 sec 3.1. - if ((line_end - p < 4) || !LowerCaseEqualsASCII(p, p + 4, "http")) { + if ((line_end - p < 4) || !base::LowerCaseEqualsASCII(p, p + 4, "http")) { DVLOG(1) << "missing status line"; return HttpVersion(); } @@ -763,9 +763,8 @@ bool HttpResponseHeaders::GetCacheControlDirective(const StringPiece& directive, void* iter = NULL; while (EnumerateHeader(&iter, name, &value)) { if (value.size() > directive_size + 1 && - LowerCaseEqualsASCII(value.begin(), - value.begin() + directive_size, - directive.begin()) && + base::LowerCaseEqualsASCII( + value.begin(), value.begin() + directive_size, directive.begin()) && value[directive_size] == '=') { int64 seconds; base::StringToInt64( @@ -1232,7 +1231,7 @@ bool HttpResponseHeaders::IsKeepAlive() const { std::string token; while (EnumerateHeader(&iterator, header, &token)) { for (const KeepAliveToken& keep_alive_token : kKeepAliveTokens) { - if (LowerCaseEqualsASCII(token, keep_alive_token.token)) + if (base::LowerCaseEqualsASCII(token, keep_alive_token.token)) return keep_alive_token.keep_alive; } } @@ -1309,9 +1308,8 @@ bool HttpResponseHeaders::GetContentRange(int64* first_byte_position, std::string::const_iterator content_range_spec_end = content_range_spec.begin() + space_position; HttpUtil::TrimLWS(&content_range_spec_begin, &content_range_spec_end); - if (!LowerCaseEqualsASCII(content_range_spec_begin, - content_range_spec_end, - "bytes")) { + if (!base::LowerCaseEqualsASCII(content_range_spec_begin, + content_range_spec_end, "bytes")) { return false; } @@ -1330,7 +1328,7 @@ bool HttpResponseHeaders::GetContentRange(int64* first_byte_position, std::string byte_range_resp_spec(byte_range_resp_spec_begin, byte_range_resp_spec_end); // If byte-range-resp-spec != "*". - if (!LowerCaseEqualsASCII(byte_range_resp_spec, "*")) { + if (!base::LowerCaseEqualsASCII(byte_range_resp_spec, "*")) { size_t minus_position = byte_range_resp_spec.find('-'); if (minus_position != std::string::npos) { // Obtain first-byte-pos. @@ -1374,7 +1372,8 @@ bool HttpResponseHeaders::GetContentRange(int64* first_byte_position, content_range_spec.end(); HttpUtil::TrimLWS(&instance_length_begin, &instance_length_end); - if (LowerCaseEqualsASCII(instance_length_begin, instance_length_end, "*")) { + if (base::LowerCaseEqualsASCII(instance_length_begin, instance_length_end, + "*")) { return false; } else if (!base::StringToInt64(StringPiece(instance_length_begin, instance_length_end), diff --git a/net/http/http_security_headers.cc b/net/http/http_security_headers.cc index aff4a30..e8e3a47 100644 --- a/net/http/http_security_headers.cc +++ b/net/http/http_security_headers.cc @@ -199,11 +199,11 @@ bool ParseHSTSHeader(const std::string& value, case DIRECTIVE_END: if (IsAsciiWhitespace(*tokenizer.token_begin())) continue; - if (LowerCaseEqualsASCII(tokenizer.token(), "max-age")) { + if (base::LowerCaseEqualsASCII(tokenizer.token(), "max-age")) { state = AFTER_MAX_AGE_LABEL; max_age_observed++; - } else if (LowerCaseEqualsASCII(tokenizer.token(), - "includesubdomains")) { + } else if (base::LowerCaseEqualsASCII(tokenizer.token(), + "includesubdomains")) { state = AFTER_INCLUDE_SUBDOMAINS; include_subdomains_observed++; include_subdomains_candidate = true; @@ -296,20 +296,20 @@ bool ParseHPKPHeader(const std::string& value, equals.first = Strip(equals.first); equals.second = Strip(equals.second); - if (LowerCaseEqualsASCII(equals.first, "max-age")) { + if (base::LowerCaseEqualsASCII(equals.first, "max-age")) { if (equals.second.empty() || !MaxAgeToInt(equals.second.begin(), equals.second.end(), &max_age_candidate)) { return false; } parsed_max_age = true; - } else if (LowerCaseEqualsASCII(equals.first, "pin-sha1")) { + } else if (base::LowerCaseEqualsASCII(equals.first, "pin-sha1")) { if (!ParseAndAppendPin(equals.second, HASH_VALUE_SHA1, &pins)) return false; - } else if (LowerCaseEqualsASCII(equals.first, "pin-sha256")) { + } else if (base::LowerCaseEqualsASCII(equals.first, "pin-sha256")) { if (!ParseAndAppendPin(equals.second, HASH_VALUE_SHA256, &pins)) return false; - } else if (LowerCaseEqualsASCII(equals.first, "includesubdomains")) { + } else if (base::LowerCaseEqualsASCII(equals.first, "includesubdomains")) { include_subdomains_candidate = true; } else { // Silently ignore unknown directives for forward compatibility. diff --git a/net/http/http_util.cc b/net/http/http_util.cc index baa2eff1..a22ee60 100644 --- a/net/http/http_util.cc +++ b/net/http/http_util.cc @@ -118,13 +118,14 @@ void HttpUtil::ParseContentType(const std::string& content_type_str, DCHECK(param_value_begin <= tokenizer.token_end()); TrimLWS(¶m_value_begin, ¶m_value_end); - if (LowerCaseEqualsASCII(param_name_begin, param_name_end, "charset")) { + if (base::LowerCaseEqualsASCII(param_name_begin, param_name_end, + "charset")) { // TODO(abarth): Refactor this function to consistently use iterators. charset_val = param_value_begin - begin; charset_end = param_value_end - begin; type_has_charset = true; - } else if (LowerCaseEqualsASCII(param_name_begin, param_name_end, - "boundary")) { + } else if (base::LowerCaseEqualsASCII(param_name_begin, param_name_end, + "boundary")) { if (boundary) boundary->assign(param_value_begin, param_value_end); } @@ -160,9 +161,9 @@ void HttpUtil::ParseContentType(const std::string& content_type_str, content_type_str != "*/*" && content_type_str.find_first_of('/') != std::string::npos) { // Common case here is that mime_type is empty - bool eq = !mime_type->empty() && LowerCaseEqualsASCII(begin + type_val, - begin + type_end, - mime_type->data()); + bool eq = !mime_type->empty() && + base::LowerCaseEqualsASCII(begin + type_val, begin + type_end, + mime_type->data()); if (!eq) { mime_type->assign(begin + type_val, begin + type_end); base::StringToLowerASCII(mime_type); @@ -190,7 +191,7 @@ bool HttpUtil::ParseRanges(const std::string& headers, while (it.GetNext()) { // Look for "Range" header. - if (!LowerCaseEqualsASCII(it.name(), "range")) + if (!base::LowerCaseEqualsASCII(it.name(), "range")) continue; ranges_specifier = it.values(); // We just care about the first "Range" header, so break here. @@ -219,7 +220,7 @@ bool HttpUtil::ParseRangeHeader(const std::string& ranges_specifier, TrimLWS(&bytes_unit_begin, &bytes_unit_end); // "bytes" unit identifier is not found. - if (!LowerCaseEqualsASCII(bytes_unit_begin, bytes_unit_end, "bytes")) + if (!base::LowerCaseEqualsASCII(bytes_unit_begin, bytes_unit_end, "bytes")) return false; ValuesIterator byte_range_set_iterator(byte_range_set_begin, @@ -385,8 +386,8 @@ std::string HttpUtil::StripHeaders(const std::string& headers, while (it.GetNext()) { bool should_remove = false; for (size_t i = 0; i < headers_to_remove_len; ++i) { - if (LowerCaseEqualsASCII(it.name_begin(), it.name_end(), - headers_to_remove[i])) { + if (base::LowerCaseEqualsASCII(it.name_begin(), it.name_end(), + headers_to_remove[i])) { should_remove = true; break; } @@ -421,7 +422,8 @@ bool HttpUtil::IsNonCoalescingHeader(std::string::const_iterator name_begin, "strict-transport-security" }; for (size_t i = 0; i < arraysize(kNonCoalescingHeaders); ++i) { - if (LowerCaseEqualsASCII(name_begin, name_end, kNonCoalescingHeaders[i])) + if (base::LowerCaseEqualsASCII(name_begin, name_end, + kNonCoalescingHeaders[i])) return true; } return false; @@ -535,7 +537,7 @@ int HttpUtil::LocateStartOfStatusLine(const char* buf, int buf_len) { if (buf_len >= http_len) { int i_max = std::min(buf_len - http_len, slop); for (int i = 0; i <= i_max; ++i) { - if (LowerCaseEqualsASCII(buf + i, buf + i + http_len, "http")) + if (base::LowerCaseEqualsASCII(buf + i, buf + i + http_len, "http")) return i; } } @@ -731,7 +733,7 @@ bool HttpUtil::HasStrongValidators(HttpVersion version, std::string::const_iterator i = etag_header.begin(); std::string::const_iterator j = etag_header.begin() + slash; TrimLWS(&i, &j); - if (!LowerCaseEqualsASCII(i, j, "w")) + if (!base::LowerCaseEqualsASCII(i, j, "w")) return true; } @@ -832,7 +834,7 @@ bool HttpUtil::HeadersIterator::AdvanceTo(const char* name) { << "the header name must be in all lower case"; while (GetNext()) { - if (LowerCaseEqualsASCII(name_begin_, name_end_, name)) { + if (base::LowerCaseEqualsASCII(name_begin_, name_end_, name)) { return true; } } diff --git a/net/proxy/proxy_bypass_rules.cc b/net/proxy/proxy_bypass_rules.cc index 5344b82..bb163ad 100644 --- a/net/proxy/proxy_bypass_rules.cc +++ b/net/proxy/proxy_bypass_rules.cc @@ -264,7 +264,7 @@ bool ProxyBypassRules::AddRuleFromStringInternal( // This is the special syntax used by WinInet's bypass list -- we allow it // on all platforms and interpret it the same way. - if (LowerCaseEqualsASCII(raw, "<local>")) { + if (base::LowerCaseEqualsASCII(raw, "<local>")) { AddRuleToBypassLocal(); return true; } diff --git a/net/proxy/proxy_script_fetcher_impl.cc b/net/proxy/proxy_script_fetcher_impl.cc index 1b9ed9f..81961f8 100644 --- a/net/proxy/proxy_script_fetcher_impl.cc +++ b/net/proxy/proxy_script_fetcher_impl.cc @@ -40,7 +40,7 @@ bool IsPacMimeType(const std::string& mime_type) { "application/x-javascript-config", }; for (size_t i = 0; i < arraysize(kSupportedPacMimeTypes); ++i) { - if (LowerCaseEqualsASCII(mime_type, kSupportedPacMimeTypes[i])) + if (base::LowerCaseEqualsASCII(mime_type, kSupportedPacMimeTypes[i])) return true; } return false; diff --git a/net/proxy/proxy_server.cc b/net/proxy/proxy_server.cc index 1e8bba9..c65df31 100644 --- a/net/proxy/proxy_server.cc +++ b/net/proxy/proxy_server.cc @@ -21,23 +21,23 @@ namespace { ProxyServer::Scheme GetSchemeFromPacTypeInternal( std::string::const_iterator begin, std::string::const_iterator end) { - if (LowerCaseEqualsASCII(begin, end, "proxy")) + if (base::LowerCaseEqualsASCII(begin, end, "proxy")) return ProxyServer::SCHEME_HTTP; - if (LowerCaseEqualsASCII(begin, end, "socks")) { + if (base::LowerCaseEqualsASCII(begin, end, "socks")) { // Default to v4 for compatibility. This is because the SOCKS4 vs SOCKS5 // notation didn't originally exist, so if a client returns SOCKS they // really meant SOCKS4. return ProxyServer::SCHEME_SOCKS4; } - if (LowerCaseEqualsASCII(begin, end, "socks4")) + if (base::LowerCaseEqualsASCII(begin, end, "socks4")) return ProxyServer::SCHEME_SOCKS4; - if (LowerCaseEqualsASCII(begin, end, "socks5")) + if (base::LowerCaseEqualsASCII(begin, end, "socks5")) return ProxyServer::SCHEME_SOCKS5; - if (LowerCaseEqualsASCII(begin, end, "direct")) + if (base::LowerCaseEqualsASCII(begin, end, "direct")) return ProxyServer::SCHEME_DIRECT; - if (LowerCaseEqualsASCII(begin, end, "https")) + if (base::LowerCaseEqualsASCII(begin, end, "https")) return ProxyServer::SCHEME_HTTPS; - if (LowerCaseEqualsASCII(begin, end, "quic")) + if (base::LowerCaseEqualsASCII(begin, end, "quic")) return ProxyServer::SCHEME_QUIC; return ProxyServer::SCHEME_INVALID; @@ -48,19 +48,19 @@ ProxyServer::Scheme GetSchemeFromPacTypeInternal( // ProxyServer::ToURI(). If no type could be matched, returns SCHEME_INVALID. ProxyServer::Scheme GetSchemeFromURIInternal(std::string::const_iterator begin, std::string::const_iterator end) { - if (LowerCaseEqualsASCII(begin, end, "http")) + if (base::LowerCaseEqualsASCII(begin, end, "http")) return ProxyServer::SCHEME_HTTP; - if (LowerCaseEqualsASCII(begin, end, "socks4")) + if (base::LowerCaseEqualsASCII(begin, end, "socks4")) return ProxyServer::SCHEME_SOCKS4; - if (LowerCaseEqualsASCII(begin, end, "socks")) + if (base::LowerCaseEqualsASCII(begin, end, "socks")) return ProxyServer::SCHEME_SOCKS5; - if (LowerCaseEqualsASCII(begin, end, "socks5")) + if (base::LowerCaseEqualsASCII(begin, end, "socks5")) return ProxyServer::SCHEME_SOCKS5; - if (LowerCaseEqualsASCII(begin, end, "direct")) + if (base::LowerCaseEqualsASCII(begin, end, "direct")) return ProxyServer::SCHEME_DIRECT; - if (LowerCaseEqualsASCII(begin, end, "https")) + if (base::LowerCaseEqualsASCII(begin, end, "https")) return ProxyServer::SCHEME_HTTPS; - if (LowerCaseEqualsASCII(begin, end, "quic")) + if (base::LowerCaseEqualsASCII(begin, end, "quic")) return ProxyServer::SCHEME_QUIC; return ProxyServer::SCHEME_INVALID; } diff --git a/net/test/url_request/url_request_slow_download_job.cc b/net/test/url_request/url_request_slow_download_job.cc index d736097..74d1934 100644 --- a/net/test/url_request/url_request_slow_download_job.cc +++ b/net/test/url_request/url_request_slow_download_job.cc @@ -115,9 +115,11 @@ URLRequestSlowDownloadJob::URLRequestSlowDownloadJob( } void URLRequestSlowDownloadJob::StartAsync() { - if (LowerCaseEqualsASCII(kFinishDownloadUrl, request_->url().spec().c_str())) + if (base::LowerCaseEqualsASCII(kFinishDownloadUrl, + request_->url().spec().c_str())) URLRequestSlowDownloadJob::FinishPendingRequests(); - if (LowerCaseEqualsASCII(kErrorDownloadUrl, request_->url().spec().c_str())) + if (base::LowerCaseEqualsASCII(kErrorDownloadUrl, + request_->url().spec().c_str())) URLRequestSlowDownloadJob::ErrorPendingRequests(); NotifyHeadersComplete(); @@ -178,9 +180,10 @@ URLRequestSlowDownloadJob::FillBufferHelper(IOBuffer* buf, bool URLRequestSlowDownloadJob::ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read) { - if (LowerCaseEqualsASCII(kFinishDownloadUrl, - request_->url().spec().c_str()) || - LowerCaseEqualsASCII(kErrorDownloadUrl, request_->url().spec().c_str())) { + if (base::LowerCaseEqualsASCII(kFinishDownloadUrl, + request_->url().spec().c_str()) || + base::LowerCaseEqualsASCII(kErrorDownloadUrl, + request_->url().spec().c_str())) { VLOG(10) << __FUNCTION__ << " called w/ kFinish/ErrorDownloadUrl."; *bytes_read = 0; return true; @@ -247,9 +250,10 @@ void URLRequestSlowDownloadJob::GetResponseInfoConst( HttpResponseInfo* info) const { // Send back mock headers. std::string raw_headers; - if (LowerCaseEqualsASCII(kFinishDownloadUrl, - request_->url().spec().c_str()) || - LowerCaseEqualsASCII(kErrorDownloadUrl, request_->url().spec().c_str())) { + if (base::LowerCaseEqualsASCII(kFinishDownloadUrl, + request_->url().spec().c_str()) || + base::LowerCaseEqualsASCII(kErrorDownloadUrl, + request_->url().spec().c_str())) { raw_headers.append( "HTTP/1.1 200 OK\n" "Content-type: text/plain\n"); @@ -259,7 +263,8 @@ void URLRequestSlowDownloadJob::GetResponseInfoConst( "Content-type: application/octet-stream\n" "Cache-Control: max-age=0\n"); - if (LowerCaseEqualsASCII(kKnownSizeUrl, request_->url().spec().c_str())) { + if (base::LowerCaseEqualsASCII(kKnownSizeUrl, + request_->url().spec().c_str())) { raw_headers.append(base::StringPrintf( "Content-Length: %d\n", kFirstDownloadSize + kSecondDownloadSize)); } diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc index 864001e..17bc642 100644 --- a/net/url_request/url_request_file_job.cc +++ b/net/url_request/url_request_file_job.cc @@ -140,7 +140,7 @@ bool URLRequestFileJob::IsRedirectResponse(GURL* location, #if defined(OS_WIN) // Follow a Windows shortcut. // We just resolve .lnk file, ignore others. - if (!LowerCaseEqualsASCII(file_path_.Extension(), ".lnk")) + if (!base::LowerCaseEqualsASCII(file_path_.Extension(), ".lnk")) return false; base::FilePath new_path = file_path_; @@ -161,8 +161,9 @@ bool URLRequestFileJob::IsRedirectResponse(GURL* location, Filter* URLRequestFileJob::SetupFilter() const { // Bug 9936 - .svgz files needs to be decompressed. - return LowerCaseEqualsASCII(file_path_.Extension(), ".svgz") - ? Filter::GZipFactory() : NULL; + return base::LowerCaseEqualsASCII(file_path_.Extension(), ".svgz") + ? Filter::GZipFactory() + : NULL; } bool URLRequestFileJob::GetMimeType(std::string* mime_type) const { diff --git a/net/url_request/url_request_job_manager.cc b/net/url_request/url_request_job_manager.cc index b2392e8..39c21b7 100644 --- a/net/url_request/url_request_job_manager.cc +++ b/net/url_request/url_request_job_manager.cc @@ -143,7 +143,7 @@ URLRequestJob* URLRequestJobManager::MaybeInterceptResponse( // static bool URLRequestJobManager::SupportsScheme(const std::string& scheme) { for (size_t i = 0; i < arraysize(kBuiltinFactories); ++i) { - if (LowerCaseEqualsASCII(scheme, kBuiltinFactories[i].scheme)) + if (base::LowerCaseEqualsASCII(scheme, kBuiltinFactories[i].scheme)) return true; } diff --git a/net/websockets/websocket_basic_handshake_stream.cc b/net/websockets/websocket_basic_handshake_stream.cc index 7bb34a3..1261e1c 100644 --- a/net/websockets/websocket_basic_handshake_stream.cc +++ b/net/websockets/websocket_basic_handshake_stream.cc @@ -142,7 +142,7 @@ bool ValidateUpgrade(const HttpResponseHeaders* headers, return false; } - if (!LowerCaseEqualsASCII(value, websockets::kWebSocketLowercase)) { + if (!base::LowerCaseEqualsASCII(value, websockets::kWebSocketLowercase)) { *failure_message = "'Upgrade' header value is not 'WebSocket': " + value; return false; diff --git a/pdf/document_loader.cc b/pdf/document_loader.cc index 165fffe..8801a5a 100644 --- a/pdf/document_loader.cc +++ b/pdf/document_loader.cc @@ -27,7 +27,7 @@ const uint32_t kMinFileSize = 64 * 1024; bool GetByteRange(const std::string& headers, uint32_t* start, uint32_t* end) { net::HttpUtil::HeadersIterator it(headers.begin(), headers.end(), "\n"); while (it.GetNext()) { - if (LowerCaseEqualsASCII(it.name(), "content-range")) { + if (base::LowerCaseEqualsASCII(it.name(), "content-range")) { std::string range = it.values().c_str(); if (StartsWithASCII(range, "bytes", false)) { range = range.substr(strlen("bytes")); @@ -51,7 +51,7 @@ bool GetByteRange(const std::string& headers, uint32_t* start, uint32_t* end) { std::string GetMultiPartBoundary(const std::string& headers) { net::HttpUtil::HeadersIterator it(headers.begin(), headers.end(), "\n"); while (it.GetNext()) { - if (LowerCaseEqualsASCII(it.name(), "content-type")) { + if (base::LowerCaseEqualsASCII(it.name(), "content-type")) { std::string type = base::StringToLowerASCII(it.values()); if (StartsWithASCII(type, "multipart/", true)) { const char* boundary = strstr(type.c_str(), "boundary="); @@ -127,20 +127,20 @@ bool DocumentLoader::Init(const pp::URLLoader& loader, net::HttpUtil::HeadersIterator it(response_headers.begin(), response_headers.end(), "\n"); while (it.GetNext()) { - if (LowerCaseEqualsASCII(it.name(), "content-length")) { + if (base::LowerCaseEqualsASCII(it.name(), "content-length")) { content_length = atoi(it.values().c_str()); - } else if (LowerCaseEqualsASCII(it.name(), "accept-ranges")) { - accept_ranges_bytes = LowerCaseEqualsASCII(it.values(), "bytes"); - } else if (LowerCaseEqualsASCII(it.name(), "content-encoding")) { + } else if (base::LowerCaseEqualsASCII(it.name(), "accept-ranges")) { + accept_ranges_bytes = base::LowerCaseEqualsASCII(it.values(), "bytes"); + } else if (base::LowerCaseEqualsASCII(it.name(), "content-encoding")) { content_encoded = true; - } else if (LowerCaseEqualsASCII(it.name(), "content-type")) { + } else if (base::LowerCaseEqualsASCII(it.name(), "content-type")) { type = it.values(); size_t semi_colon_pos = type.find(';'); if (semi_colon_pos != std::string::npos) { type = type.substr(0, semi_colon_pos); } TrimWhitespace(type, base::TRIM_ALL, &type); - } else if (LowerCaseEqualsASCII(it.name(), "content-disposition")) { + } else if (base::LowerCaseEqualsASCII(it.name(), "content-disposition")) { disposition = it.values(); } } diff --git a/ui/accessibility/ax_node_data.cc b/ui/accessibility/ax_node_data.cc index 8cdc67b..d31aa6c 100644 --- a/ui/accessibility/ax_node_data.cc +++ b/ui/accessibility/ax_node_data.cc @@ -201,7 +201,7 @@ bool AXNodeData::GetHtmlAttribute( const char* html_attr, std::string* value) const { for (size_t i = 0; i < html_attributes.size(); ++i) { const std::string& attr = html_attributes[i].first; - if (LowerCaseEqualsASCII(attr, html_attr)) { + if (base::LowerCaseEqualsASCII(attr, html_attr)) { *value = html_attributes[i].second; return true; } diff --git a/ui/base/l10n/l10n_util.cc b/ui/base/l10n/l10n_util.cc index 23ca7ce..6ed1d42 100644 --- a/ui/base/l10n/l10n_util.cc +++ b/ui/base/l10n/l10n_util.cc @@ -288,9 +288,9 @@ struct AvailableLocalesTraits std::replace(locale_name.begin(), locale_name.end(), '_', '-'); // Map the Chinese locale names over to zh-CN and zh-TW. - if (LowerCaseEqualsASCII(locale_name, "zh-hans")) { + if (base::LowerCaseEqualsASCII(locale_name, "zh-hans")) { locale_name = "zh-CN"; - } else if (LowerCaseEqualsASCII(locale_name, "zh-hant")) { + } else if (base::LowerCaseEqualsASCII(locale_name, "zh-hant")) { locale_name = "zh-TW"; } locales->push_back(locale_name); @@ -341,26 +341,26 @@ bool CheckAndResolveLocale(const std::string& locale, std::string tmp_locale(lang); // Map es-RR other than es-ES to es-419 (Chrome's Latin American // Spanish locale). - if (LowerCaseEqualsASCII(lang, "es") && - !LowerCaseEqualsASCII(region, "es")) { + if (base::LowerCaseEqualsASCII(lang, "es") && + !base::LowerCaseEqualsASCII(region, "es")) { tmp_locale.append("-419"); - } else if (LowerCaseEqualsASCII(lang, "zh")) { + } else if (base::LowerCaseEqualsASCII(lang, "zh")) { // Map zh-HK and zh-MO to zh-TW. Otherwise, zh-FOO is mapped to zh-CN. - if (LowerCaseEqualsASCII(region, "hk") || - LowerCaseEqualsASCII(region, "mo")) { // Macao + if (base::LowerCaseEqualsASCII(region, "hk") || + base::LowerCaseEqualsASCII(region, "mo")) { // Macao tmp_locale.append("-TW"); } else { tmp_locale.append("-CN"); } - } else if (LowerCaseEqualsASCII(lang, "en")) { + } else if (base::LowerCaseEqualsASCII(lang, "en")) { // Map Australian, Canadian, New Zealand and South African English // to British English for now. // TODO(jungshik): en-CA may have to change sides once // we have OS locale separate from app locale (Chrome's UI language). - if (LowerCaseEqualsASCII(region, "au") || - LowerCaseEqualsASCII(region, "ca") || - LowerCaseEqualsASCII(region, "nz") || - LowerCaseEqualsASCII(region, "za")) { + if (base::LowerCaseEqualsASCII(region, "au") || + base::LowerCaseEqualsASCII(region, "ca") || + base::LowerCaseEqualsASCII(region, "nz") || + base::LowerCaseEqualsASCII(region, "za")) { tmp_locale.append("-GB"); } else { tmp_locale.append("-US"); @@ -384,7 +384,7 @@ bool CheckAndResolveLocale(const std::string& locale, }; for (size_t i = 0; i < arraysize(alias_map); ++i) { - if (LowerCaseEqualsASCII(lang, alias_map[i].source)) { + if (base::LowerCaseEqualsASCII(lang, alias_map[i].source)) { std::string tmp_locale(alias_map[i].dest); if (IsLocaleAvailable(tmp_locale)) { resolved_locale->swap(tmp_locale); diff --git a/ui/base/l10n/l10n_util_posix.cc b/ui/base/l10n/l10n_util_posix.cc index 590cfb7..6415ff8 100644 --- a/ui/base/l10n/l10n_util_posix.cc +++ b/ui/base/l10n/l10n_util_posix.cc @@ -18,7 +18,7 @@ bool IsLocaleSupportedByOS(const std::string& locale) { // to return true. static const char kUnsupportedLocales[][3] = {"am", "sw"}; for (size_t i = 0; i < arraysize(kUnsupportedLocales); ++i) { - if (LowerCaseEqualsASCII(locale, kUnsupportedLocales[i])) + if (base::LowerCaseEqualsASCII(locale, kUnsupportedLocales[i])) return false; } return true; diff --git a/ui/base/l10n/l10n_util_win.cc b/ui/base/l10n/l10n_util_win.cc index 4e2f7f4..bfe12a7 100644 --- a/ui/base/l10n/l10n_util_win.cc +++ b/ui/base/l10n/l10n_util_win.cc @@ -111,7 +111,8 @@ bool IsLocaleSupportedByOS(const std::string& locale) { // 'Abyssinica SIL' in the resource bundle to use in the UI. Check // for its presence to determine whether or not to support Amharic UI on XP. return (base::win::GetVersion() >= base::win::VERSION_VISTA || - !LowerCaseEqualsASCII(locale, "am") || IsFontPresent(L"Abyssinica SIL")); + !base::LowerCaseEqualsASCII(locale, "am") || + IsFontPresent(L"Abyssinica SIL")); } bool NeedOverrideDefaultUIFont(base::string16* override_font_family, diff --git a/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc b/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc index b3289ff..9c3a00e 100644 --- a/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc +++ b/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc @@ -510,12 +510,14 @@ bool IsMatchDeviceType(const std::string& match_type) { // Parse a boolean value keyword (e.g., on/off, true/false). int ParseBooleanKeyword(const std::string& value) { - for (size_t i = 0; i < arraysize(kTrue); ++i) - if (LowerCaseEqualsASCII(value, kTrue[i])) + for (size_t i = 0; i < arraysize(kTrue); ++i) { + if (base::LowerCaseEqualsASCII(value, kTrue[i])) return 1; - for (size_t i = 0; i < arraysize(kFalse); ++i) - if (LowerCaseEqualsASCII(value, kFalse[i])) + } + for (size_t i = 0; i < arraysize(kFalse); ++i) { + if (base::LowerCaseEqualsASCII(value, kFalse[i])) return -1; + } return 0; } diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc index 32a9e55..1c19afe 100644 --- a/ui/gfx/render_text_harfbuzz.cc +++ b/ui/gfx/render_text_harfbuzz.cc @@ -1321,8 +1321,8 @@ void RenderTextHarfBuzz::ShapeRun(const base::string16& text, // http://crbug.com/467459. On some Windows configurations the default font // could be a raster font like System, which would not give us a reasonable // fallback font list. - if (!LowerCaseEqualsASCII(primary_family, "segoe ui") && - !LowerCaseEqualsASCII(uniscribe_family, "segoe ui")) { + if (!base::LowerCaseEqualsASCII(primary_family, "segoe ui") && + !base::LowerCaseEqualsASCII(uniscribe_family, "segoe ui")) { std::vector<std::string> default_fallback_families = GetFallbackFontFamilies("Segoe UI"); fallback_families.insert(fallback_families.end(), diff --git a/url/gurl.cc b/url/gurl.cc index 46ca408..52aad73 100644 --- a/url/gurl.cc +++ b/url/gurl.cc @@ -14,6 +14,7 @@ #include "url/gurl.h" #include "base/logging.h" +#include "base/strings/string_util.h" #include "url/url_canon_stdstring.h" #include "url/url_util.h" @@ -382,9 +383,9 @@ bool GURL::IsStandard() const { bool GURL::SchemeIs(const char* lower_ascii_scheme) const { if (parsed_.scheme.len <= 0) return lower_ascii_scheme == NULL; - return url::LowerCaseEqualsASCII(spec_.data() + parsed_.scheme.begin, - spec_.data() + parsed_.scheme.end(), - lower_ascii_scheme); + return base::LowerCaseEqualsASCII(spec_.data() + parsed_.scheme.begin, + spec_.data() + parsed_.scheme.end(), + lower_ascii_scheme); } bool GURL::SchemeIsHTTPOrHTTPS() const { @@ -521,10 +522,10 @@ bool GURL::DomainIs(const char* lower_ascii_domain, const char* start_pos = spec_.data() + parsed_.host.begin + host_len - domain_len; - if (!url::LowerCaseEqualsASCII(start_pos, - last_pos + 1, - lower_ascii_domain, - lower_ascii_domain + domain_len)) + if (!base::LowerCaseEqualsASCII(start_pos, + last_pos + 1, + lower_ascii_domain, + lower_ascii_domain + domain_len)) return false; // Check whether host has right domain start with dot, make sure we got diff --git a/url/url_util.cc b/url/url_util.cc index 008a5e4..28a8931 100644 --- a/url/url_util.cc +++ b/url/url_util.cc @@ -9,6 +9,7 @@ #include "base/debug/leak_annotations.h" #include "base/logging.h" +#include "base/strings/string_util.h" #include "url/url_canon_internal.h" #include "url/url_file.h" #include "url/url_util_internal.h" @@ -17,23 +18,6 @@ namespace url { namespace { -// ASCII-specific tolower. The standard library's tolower is locale sensitive, -// so we don't want to use it here. -template<class Char> -inline Char ToLowerASCII(Char c) { - return (c >= 'A' && c <= 'Z') ? (c + ('a' - 'A')) : c; -} - -// Backend for LowerCaseEqualsASCII. -template<typename Iter> -inline bool DoLowerCaseEqualsASCII(Iter a_begin, Iter a_end, const char* b) { - for (Iter it = a_begin; it != a_end; ++it, ++b) { - if (!*b || ToLowerASCII(*it) != *b) - return false; - } - return *b == 0; -} - const int kNumStandardURLSchemes = 8; const char* kStandardURLSchemes[kNumStandardURLSchemes] = { kHttpScheme, @@ -72,9 +56,9 @@ inline bool DoCompareSchemeComponent(const CHAR* spec, const char* compare_to) { if (!component.is_nonempty()) return compare_to[0] == 0; // When component is empty, match empty scheme. - return LowerCaseEqualsASCII(&spec[component.begin], - &spec[component.end()], - compare_to); + return base::LowerCaseEqualsASCII(&spec[component.begin], + &spec[component.end()], + compare_to); } // Returns true if the given scheme identified by |scheme| within |spec| is one @@ -86,8 +70,8 @@ bool DoIsStandard(const CHAR* spec, const Component& scheme) { InitStandardSchemes(); for (size_t i = 0; i < standard_schemes->size(); i++) { - if (LowerCaseEqualsASCII(&spec[scheme.begin], &spec[scheme.end()], - standard_schemes->at(i))) + if (base::LowerCaseEqualsASCII(&spec[scheme.begin], &spec[scheme.end()], + standard_schemes->at(i))) return true; } return false; @@ -486,31 +470,6 @@ bool ReplaceComponents(const char* spec, charset_converter, output, out_parsed); } -// Front-ends for LowerCaseEqualsASCII. -bool LowerCaseEqualsASCII(const char* a_begin, - const char* a_end, - const char* b) { - return DoLowerCaseEqualsASCII(a_begin, a_end, b); -} - -bool LowerCaseEqualsASCII(const char* a_begin, - const char* a_end, - const char* b_begin, - const char* b_end) { - while (a_begin != a_end && b_begin != b_end && - ToLowerASCII(*a_begin) == *b_begin) { - a_begin++; - b_begin++; - } - return a_begin == a_end && b_begin == b_end; -} - -bool LowerCaseEqualsASCII(const base::char16* a_begin, - const base::char16* a_end, - const char* b) { - return DoLowerCaseEqualsASCII(a_begin, a_end, b); -} - void DecodeURLEscapeSequences(const char* input, int length, CanonOutputW* output) { diff --git a/url/url_util.h b/url/url_util.h index bf05e87..55a83eb 100644 --- a/url/url_util.h +++ b/url/url_util.h @@ -166,23 +166,6 @@ URL_EXPORT bool ReplaceComponents( // String helper functions ---------------------------------------------------- -// Compare the lower-case form of the given string against the given ASCII -// string. This is useful for doing checking if an input string matches some -// token, and it is optimized to avoid intermediate string copies. -// -// The versions of this function that don't take a b_end assume that the b -// string is NULL terminated. -URL_EXPORT bool LowerCaseEqualsASCII(const char* a_begin, - const char* a_end, - const char* b); -URL_EXPORT bool LowerCaseEqualsASCII(const char* a_begin, - const char* a_end, - const char* b_begin, - const char* b_end); -URL_EXPORT bool LowerCaseEqualsASCII(const base::char16* a_begin, - const base::char16* a_end, - const char* b); - // Unescapes the given string using URL escaping rules. URL_EXPORT void DecodeURLEscapeSequences(const char* input, int length, |