diff options
92 files changed, 203 insertions, 190 deletions
diff --git a/base/strings/string_util.cc b/base/strings/string_util.cc index 42b9765..738d32e 100644 --- a/base/strings/string_util.cc +++ b/base/strings/string_util.cc @@ -528,8 +528,6 @@ bool StartsWith(const string16& str, CaseInsensitiveCompare<char16>()); } -} // namespace base - template <typename STR> bool EndsWithT(const STR& str, const STR& search, bool case_sensitive) { size_t str_length = str.length(); @@ -553,6 +551,8 @@ bool EndsWith(const string16& str, const string16& search, return EndsWithT(str, search, case_sensitive); } +} // namespace base + static const char* const kByteStringsUnlocalized[] = { " B", " kB", diff --git a/base/strings/string_util.h b/base/strings/string_util.h index bd86e91d..9628c67 100644 --- a/base/strings/string_util.h +++ b/base/strings/string_util.h @@ -330,6 +330,9 @@ BASE_EXPORT bool LowerCaseEqualsASCII(const char16* a_begin, BASE_EXPORT bool EqualsASCII(const string16& a, const StringPiece& b); // Returns true if str starts with search, or false otherwise. +// TODO(brettw) the case sensitive flag makes callsites difficult to read. +// Consider splitting this out in two variants (few callers want +// case-insensitive compares) or use an enum that makes this more explicit. BASE_EXPORT bool StartsWithASCII(const std::string& str, const std::string& search, bool case_sensitive); @@ -337,6 +340,15 @@ BASE_EXPORT bool StartsWith(const base::string16& str, const base::string16& search, bool case_sensitive); +// Returns true if str ends with search, or false otherwise. +// TODO(brettw) case sensitive flag confusion, see StartsWith above. +BASE_EXPORT bool EndsWith(const std::string& str, + const std::string& search, + bool case_sensitive); +BASE_EXPORT bool EndsWith(const base::string16& str, + const base::string16& search, + bool case_sensitive); + } // namespace base #if defined(OS_WIN) @@ -347,15 +359,6 @@ BASE_EXPORT bool StartsWith(const base::string16& str, #error Define string operations appropriately for your platform #endif -// Returns true if str ends with search, or false otherwise. -BASE_EXPORT bool EndsWith(const std::string& str, - const std::string& search, - bool case_sensitive); -BASE_EXPORT bool EndsWith(const base::string16& str, - const base::string16& search, - bool case_sensitive); - - // Determines the type of ASCII character, independent of locale (the C // library versions will change based on locale). template <typename Char> diff --git a/chrome/app/delay_load_hook_win.cc b/chrome/app/delay_load_hook_win.cc index e81407c..6afac88 100644 --- a/chrome/app/delay_load_hook_win.cc +++ b/chrome/app/delay_load_hook_win.cc @@ -28,7 +28,7 @@ FARPROC OnPreLoadLibrary(DelayLoadInfo* info) { // and bind to the real DLL. std::string dll_name(info->szDll); const char kDelaySuffix[] = "-delay.dll"; - if (EndsWith(dll_name, kDelaySuffix, false)) { + if (base::EndsWith(dll_name, kDelaySuffix, false)) { // Trim the "-delay.dll" suffix from the string. dll_name.resize(dll_name.length() - (sizeof(kDelaySuffix) - 1)); dll_name.append(".dll"); diff --git a/chrome/browser/android/preferences/website_preference_bridge.cc b/chrome/browser/android/preferences/website_preference_bridge.cc index 9d575d7..e262e84 100644 --- a/chrome/browser/android/preferences/website_preference_bridge.cc +++ b/chrome/browser/android/preferences/website_preference_bridge.cc @@ -75,11 +75,11 @@ static void GetOrigins(JNIEnv* env, const char* kHttpsPortSuffix = ":443"; ScopedJavaLocalRef<jstring> jorigin; if (base::StartsWithASCII(origin, url::kHttpsScheme, false) && - EndsWith(origin, kHttpsPortSuffix, false)) { + base::EndsWith(origin, kHttpsPortSuffix, false)) { jorigin = ConvertUTF8ToJavaString( env, origin.substr(0, origin.size() - strlen(kHttpsPortSuffix))); } else if (base::StartsWithASCII(origin, url::kHttpScheme, false) && - EndsWith(origin, kHttpPortSuffix, false)) { + base::EndsWith(origin, kHttpPortSuffix, false)) { jorigin = ConvertUTF8ToJavaString( env, origin.substr(0, origin.size() - strlen(kHttpPortSuffix))); } else { diff --git a/chrome/browser/autocomplete/builtin_provider.cc b/chrome/browser/autocomplete/builtin_provider.cc index 431ab46..6710e159 100644 --- a/chrome/browser/autocomplete/builtin_provider.cc +++ b/chrome/browser/autocomplete/builtin_provider.cc @@ -115,7 +115,7 @@ void BuiltinProvider::Start(const AutocompleteInput& input, false) && base::StartsWith(blank_host, host, false) && (url.path().length() <= 1) && - !EndsWith(text, base::ASCIIToUTF16("/"), false)) { + !base::EndsWith(text, base::ASCIIToUTF16("/"), false)) { ACMatchClassifications styles; styles.push_back(ACMatchClassification(0, kMatch)); base::string16 match = base::ASCIIToUTF16(url::kAboutBlankURL); diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc index cce297f..d8dec49 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc +++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc @@ -919,7 +919,7 @@ void WallpaperPrivateGetOfflineWallpaperListFunction::GetList() { current = files.Next()) { std::string file_name = current.BaseName().RemoveExtension().value(); // Do not add file name of small resolution wallpaper to the list. - if (!EndsWith(file_name, wallpaper::kSmallWallpaperSuffix, true)) + if (!base::EndsWith(file_name, wallpaper::kSmallWallpaperSuffix, true)) file_list.push_back(current.BaseName().value()); } } diff --git a/chrome/browser/chromeos/policy/device_local_account.cc b/chrome/browser/chromeos/policy/device_local_account.cc index 63c7a14..3e85b3c 100644 --- a/chrome/browser/chromeos/policy/device_local_account.cc +++ b/chrome/browser/chromeos/policy/device_local_account.cc @@ -68,7 +68,7 @@ bool IsDeviceLocalAccountUser(const std::string& user_id, if (user_id == chromeos::login::kGuestUserName) return false; const std::string domain = gaia::ExtractDomainName(user_id); - if (!EndsWith(domain, kDeviceLocalAccountDomainSuffix, true)) + if (!base::EndsWith(domain, kDeviceLocalAccountDomainSuffix, true)) return false; const std::string domain_prefix = domain.substr( diff --git a/chrome/browser/chromeos/power/peripheral_battery_observer.cc b/chrome/browser/chromeos/power/peripheral_battery_observer.cc index fc17ebf..8549cc0 100644 --- a/chrome/browser/chromeos/power/peripheral_battery_observer.cc +++ b/chrome/browser/chromeos/power/peripheral_battery_observer.cc @@ -50,7 +50,7 @@ const char kHIDBatteryPathSuffix[] = "-battery"; bool IsBluetoothHIDBattery(const std::string& path) { return base::StartsWithASCII(path, kHIDBatteryPathPrefix, false) && - EndsWith(path, kHIDBatteryPathSuffix, false); + base::EndsWith(path, kHIDBatteryPathSuffix, false); } std::string ExtractBluetoothAddress(const std::string& path) { diff --git a/chrome/browser/component_updater/cld_component_installer_unittest.cc b/chrome/browser/component_updater/cld_component_installer_unittest.cc index e3833f1..ab40b35 100644 --- a/chrome/browser/component_updater/cld_component_installer_unittest.cc +++ b/chrome/browser/component_updater/cld_component_installer_unittest.cc @@ -102,7 +102,7 @@ TEST_F(CldComponentInstallerTest, GetInstalledPath) { const base::FilePath base_dir; const base::FilePath result = CldComponentInstallerTraits::GetInstalledPath(base_dir); - ASSERT_TRUE(EndsWith(result.value(), kTestCldDataFileName, true)); + ASSERT_TRUE(base::EndsWith(result.value(), kTestCldDataFileName, true)); } TEST_F(CldComponentInstallerTest, GetBaseDirectory) { @@ -128,7 +128,7 @@ TEST_F(CldComponentInstallerTest, ComponentReady) { base::FilePath result = CldComponentInstallerTraits::GetLatestCldDataFile(); ASSERT_TRUE(base::StartsWith(result.AsUTF16Unsafe(), install_dir.AsUTF16Unsafe(), true)); - ASSERT_TRUE(EndsWith(result.value(), kTestCldDataFileName, true)); + ASSERT_TRUE(base::EndsWith(result.value(), kTestCldDataFileName, true)); } } // namespace component_updater diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc index ef231be..007f2b0 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc @@ -222,7 +222,8 @@ class DelayLoadStartAndExecuteJavascript content::RenderFrameHost* render_frame_host, const GURL& url, ui::PageTransition transition_type) override { - if (script_was_executed_ && EndsWith(url.spec(), until_url_suffix_, true)) { + if (script_was_executed_ && + base::EndsWith(url.spec(), until_url_suffix_, true)) { content::WebContentsObserver::Observe(NULL); test_navigation_listener_->ResumeAll(); } diff --git a/chrome/browser/extensions/default_apps.cc b/chrome/browser/extensions/default_apps.cc index 3b42e97..c8078e4 100644 --- a/chrome/browser/extensions/default_apps.cc +++ b/chrome/browser/extensions/default_apps.cc @@ -37,7 +37,7 @@ bool IsLocaleSupported() { const std::string& locale = g_browser_process->GetApplicationLocale(); static const char* const unsupported_locales[] = {"CN", "TR", "IR"}; for (size_t i = 0; i < arraysize(unsupported_locales); ++i) { - if (EndsWith(locale, unsupported_locales[i], false)) { + if (base::EndsWith(locale, unsupported_locales[i], false)) { return false; } } diff --git a/chrome/browser/extensions/extension_protocols_unittest.cc b/chrome/browser/extensions/extension_protocols_unittest.cc index 1924109..ab30636 100644 --- a/chrome/browser/extensions/extension_protocols_unittest.cc +++ b/chrome/browser/extensions/extension_protocols_unittest.cc @@ -299,7 +299,7 @@ TEST_F(ExtensionProtocolTest, ResourceRequestResponseHeaders) { std::string etag; request->GetResponseHeaderByName("ETag", &etag); EXPECT_TRUE(base::StartsWithASCII(etag, "\"", false)); - EXPECT_TRUE(EndsWith(etag, "\"", false)); + EXPECT_TRUE(base::EndsWith(etag, "\"", false)); std::string revalidation_header; request->GetResponseHeaderByName("cache-control", &revalidation_header); diff --git a/chrome/browser/extensions/updater/local_extension_cache.cc b/chrome/browser/extensions/updater/local_extension_cache.cc index 74dec39..677b3e8 100644 --- a/chrome/browser/extensions/updater/local_extension_cache.cc +++ b/chrome/browser/extensions/updater/local_extension_cache.cc @@ -420,7 +420,8 @@ void LocalExtensionCache::BackendCheckCacheContentsInternal( std::string id; std::string version; std::string expected_hash; - if (EndsWith(basename, kCRXFileExtension, false /* case-sensitive */)) { + if (base::EndsWith(basename, kCRXFileExtension, + false /* case-sensitive */)) { size_t n = basename.find('-'); if (n != std::string::npos && n + 1 < basename.size() - 4) { id = basename.substr(0, n); diff --git a/chrome/browser/metrics/chromeos_metrics_provider.cc b/chrome/browser/metrics/chromeos_metrics_provider.cc index 211eec3..8360369 100644 --- a/chrome/browser/metrics/chromeos_metrics_provider.cc +++ b/chrome/browser/metrics/chromeos_metrics_provider.cc @@ -115,7 +115,7 @@ EnrollmentStatus GetEnrollmentStatus() { return NON_MANAGED; std::string domain = connector->GetEnterpriseDomain(); - if (EndsWith(domain, kEduDomain, false /* case insensitive */)) + if (base::EndsWith(domain, kEduDomain, false /* case insensitive */)) return MANAGED_EDU; return MANAGED_NON_EDU; diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc index 50f83bb..737317e 100644 --- a/chrome/browser/net/chrome_network_delegate.cc +++ b/chrome/browser/net/chrome_network_delegate.cc @@ -189,7 +189,7 @@ bool CanRequestBeDeltaEncoded(const net::URLRequest* request) { const char *suffix = kEligibleMasks[i].suffix; if (prefix && !base::StartsWithASCII(mime_type, prefix, kCaseSensitive)) continue; - if (suffix && !EndsWith(mime_type, suffix, kCaseSensitive)) + if (suffix && !base::EndsWith(mime_type, suffix, kCaseSensitive)) continue; return true; } diff --git a/chrome/browser/net/pref_proxy_config_tracker_impl.cc b/chrome/browser/net/pref_proxy_config_tracker_impl.cc index f839949..a4ec56c 100644 --- a/chrome/browser/net/pref_proxy_config_tracker_impl.cc +++ b/chrome/browser/net/pref_proxy_config_tracker_impl.cc @@ -27,7 +27,7 @@ namespace { // Determine if |proxy| is of the form "*.googlezip.net". bool IsGooglezipDataReductionProxy(const net::ProxyServer& proxy) { return proxy.is_valid() && !proxy.is_direct() && - EndsWith(proxy.host_port_pair().host(), ".googlezip.net", true); + base::EndsWith(proxy.host_port_pair().host(), ".googlezip.net", true); } // Removes any Data Reduction Proxies like *.googlezip.net from |proxy_list|. diff --git a/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc b/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc index 7a639fa..aaebedf 100644 --- a/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc +++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc @@ -42,8 +42,8 @@ bool ContainsDataReductionProxyDefaultHostSuffix( const net::ProxyList& proxy_list) { for (const net::ProxyServer& proxy : proxy_list.GetAll()) { if (proxy.is_valid() && !proxy.is_direct() && - EndsWith(proxy.host_port_pair().host(), - kDataReductionProxyDefaultHostSuffix, true)) { + base::EndsWith(proxy.host_port_pair().host(), + kDataReductionProxyDefaultHostSuffix, true)) { return true; } } diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc index 7b7e811..09e4643 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database.cc @@ -1792,7 +1792,7 @@ void SafeBrowsingDatabaseNew::RecordFileSizeHistogram( // Default to logging DB sizes unless |file_path| points at PrefixSet storage. std::string histogram_name("SB2.DatabaseSizeKilobytes"); - if (EndsWith(filename, kPrefixSetFileSuffix, true)) { + if (base::EndsWith(filename, kPrefixSetFileSuffix, true)) { histogram_name = "SB2.PrefixSetSizeKilobytes"; // Clear the PrefixSet suffix to have the histogram suffix selector below // work the same for PrefixSet-based storage as it does for simple safe @@ -1805,21 +1805,21 @@ void SafeBrowsingDatabaseNew::RecordFileSizeHistogram( // Changes to histogram suffixes below need to be mirrored in the // SafeBrowsingLists suffix enum in histograms.xml. - if (EndsWith(filename, kBrowseDBFile, true)) + if (base::EndsWith(filename, kBrowseDBFile, true)) histogram_name.append(".Browse"); - else if (EndsWith(filename, kDownloadDBFile, true)) + else if (base::EndsWith(filename, kDownloadDBFile, true)) histogram_name.append(".Download"); - else if (EndsWith(filename, kCsdWhitelistDBFile, true)) + else if (base::EndsWith(filename, kCsdWhitelistDBFile, true)) histogram_name.append(".CsdWhitelist"); - else if (EndsWith(filename, kDownloadWhitelistDBFile, true)) + else if (base::EndsWith(filename, kDownloadWhitelistDBFile, true)) histogram_name.append(".DownloadWhitelist"); - else if (EndsWith(filename, kInclusionWhitelistDBFile, true)) + else if (base::EndsWith(filename, kInclusionWhitelistDBFile, true)) histogram_name.append(".InclusionWhitelist"); - else if (EndsWith(filename, kExtensionBlacklistDBFile, true)) + else if (base::EndsWith(filename, kExtensionBlacklistDBFile, true)) histogram_name.append(".ExtensionBlacklist"); - else if (EndsWith(filename, kIPBlacklistDBFile, true)) + else if (base::EndsWith(filename, kIPBlacklistDBFile, true)) histogram_name.append(".IPBlacklist"); - else if (EndsWith(filename, kUnwantedSoftwareDBFile, true)) + else if (base::EndsWith(filename, kUnwantedSoftwareDBFile, true)) histogram_name.append(".UnwantedSoftware"); else NOTREACHED(); // Add support for new lists above. diff --git a/chrome/browser/search/contextual_search_promo_source_android.cc b/chrome/browser/search/contextual_search_promo_source_android.cc index ea6f8c7..ec36bbd 100644 --- a/chrome/browser/search/contextual_search_promo_source_android.cc +++ b/chrome/browser/search/contextual_search_promo_source_android.cc @@ -90,13 +90,13 @@ std::string ContextualSearchPromoSourceAndroid::GetSource() const { std::string ContextualSearchPromoSourceAndroid::GetMimeType( const std::string& path_and_query) const { std::string path(GURL("chrome://host/" + path_and_query).path()); - if (EndsWith(path, ".js", false)) return "application/javascript"; - if (EndsWith(path, ".png", false)) return "image/png"; - if (EndsWith(path, ".css", false)) return "text/css"; - if (EndsWith(path, ".html", false)) return "text/html"; - if (EndsWith(path, ".woff", false)) return "font/woff"; - if (EndsWith(path, ".woff2", false)) return "font/woff2"; - return ""; + if (base::EndsWith(path, ".js", false)) return "application/javascript"; + if (base::EndsWith(path, ".png", false)) return "image/png"; + if (base::EndsWith(path, ".css", false)) return "text/css"; + if (base::EndsWith(path, ".html", false)) return "text/html"; + if (base::EndsWith(path, ".woff", false)) return "font/woff"; + if (base::EndsWith(path, ".woff2", false)) return "font/woff2"; + return std::string(); } bool ContextualSearchPromoSourceAndroid::ShouldDenyXFrameOptions() const { diff --git a/chrome/browser/search/iframe_source.cc b/chrome/browser/search/iframe_source.cc index e3f0b4e..2a86a45 100644 --- a/chrome/browser/search/iframe_source.cc +++ b/chrome/browser/search/iframe_source.cc @@ -25,15 +25,15 @@ IframeSource::~IframeSource() { std::string IframeSource::GetMimeType( const std::string& path_and_query) const { std::string path(GURL("chrome-search://host/" + path_and_query).path()); - if (EndsWith(path, ".js", false)) + if (base::EndsWith(path, ".js", false)) return "application/javascript"; - if (EndsWith(path, ".png", false)) + if (base::EndsWith(path, ".png", false)) return "image/png"; - if (EndsWith(path, ".css", false)) + if (base::EndsWith(path, ".css", false)) return "text/css"; - if (EndsWith(path, ".html", false)) + if (base::EndsWith(path, ".html", false)) return "text/html"; - return ""; + return std::string(); } bool IframeSource::ShouldServiceRequest( diff --git a/chrome/browser/supervised_user/experimental/supervised_user_async_url_checker.cc b/chrome/browser/supervised_user/experimental/supervised_user_async_url_checker.cc index f7eb8ae..13f0967 100644 --- a/chrome/browser/supervised_user/experimental/supervised_user_async_url_checker.cc +++ b/chrome/browser/supervised_user/experimental/supervised_user_async_url_checker.cc @@ -54,7 +54,7 @@ GURL GetNormalizedURL(const GURL& url) { replacements.SetHostStr(base::StringPiece(host).substr(www.size())); // Strip trailing slash (if any). const std::string path(url.path()); - if (EndsWith(path, "/", true)) + if (base::EndsWith(path, "/", true)) replacements.SetPathStr(base::StringPiece(path).substr(0, path.size() - 1)); return url.ReplaceComponents(replacements); } diff --git a/chrome/browser/supervised_user/supervised_user_url_filter.cc b/chrome/browser/supervised_user/supervised_user_url_filter.cc index acfda8b..ba513d9 100644 --- a/chrome/browser/supervised_user/supervised_user_url_filter.cc +++ b/chrome/browser/supervised_user/supervised_user_url_filter.cc @@ -239,7 +239,7 @@ bool SupervisedUserURLFilter::HostMatchesPattern(const std::string& host, const std::string& pattern) { std::string trimmed_pattern = pattern; std::string trimmed_host = host; - if (EndsWith(pattern, ".*", true)) { + if (base::EndsWith(pattern, ".*", true)) { size_t registry_length = GetRegistryLength( trimmed_host, EXCLUDE_UNKNOWN_REGISTRIES, EXCLUDE_PRIVATE_REGISTRIES); // A host without a known registry part does not match. @@ -258,7 +258,7 @@ bool SupervisedUserURLFilter::HostMatchesPattern(const std::string& host, // pattern. if (trimmed_pattern.empty() || trimmed_pattern.find('*') != std::string::npos || - !EndsWith(trimmed_host, trimmed_pattern, true)) { + !base::EndsWith(trimmed_host, trimmed_pattern, true)) { return false; } diff --git a/chrome/browser/sync/test/integration/bookmarks_helper.cc b/chrome/browser/sync/test/integration/bookmarks_helper.cc index c61bffb..6384073 100644 --- a/chrome/browser/sync/test/integration/bookmarks_helper.cc +++ b/chrome/browser/sync/test/integration/bookmarks_helper.cc @@ -929,7 +929,7 @@ gfx::Image CreateFavicon(SkColor color) { gfx::Image Create1xFaviconFromPNGFile(const std::string& path) { const char* kPNGExtension = ".png"; - if (!EndsWith(path, kPNGExtension, false)) + if (!base::EndsWith(path, kPNGExtension, false)) return gfx::Image(); base::FilePath full_path; diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc index 6ac5712..b964308 100644 --- a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc +++ b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc @@ -1401,15 +1401,15 @@ TEST_F(AutofillDialogControllerTest, BillingVsShippingStreetAddress) { EXPECT_TRUE(base::StartsWith(form_structure()->field(0)->value, shipping_profile.GetRawInfo(ADDRESS_HOME_LINE1), true)); - EXPECT_TRUE(EndsWith(form_structure()->field(0)->value, - shipping_profile.GetRawInfo(ADDRESS_HOME_LINE2), - true)); + EXPECT_TRUE(base::EndsWith(form_structure()->field(0)->value, + shipping_profile.GetRawInfo(ADDRESS_HOME_LINE2), + true)); EXPECT_TRUE(base::StartsWith(form_structure()->field(1)->value, billing_profile.GetRawInfo(ADDRESS_HOME_LINE1), true)); - EXPECT_TRUE(EndsWith(form_structure()->field(1)->value, - billing_profile.GetRawInfo(ADDRESS_HOME_LINE2), - true)); + EXPECT_TRUE(base::EndsWith(form_structure()->field(1)->value, + billing_profile.GetRawInfo(ADDRESS_HOME_LINE2), + true)); // The textareas should be an exact match. EXPECT_EQ(shipping_profile.GetRawInfo(ADDRESS_HOME_STREET_ADDRESS), form_structure()->field(2)->value); diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm index 9cef5fa..053002f 100644 --- a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm @@ -527,7 +527,7 @@ NSAttributedString* CreateClassifiedAttributedString( &contentsStartIndex); // Ignore invalid state. if (!base::StartsWith(match.fill_into_edit, inputText, true) || - !EndsWith(match.fill_into_edit, match.contents, true) || + !base::EndsWith(match.fill_into_edit, match.contents, true) || ((size_t)contentsStartIndex >= inputText.length())) { return 0; } diff --git a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc index 7a9d112..f9c8b53 100644 --- a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc +++ b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc @@ -32,7 +32,7 @@ namespace { // Makes sure that .jpg also shows .JPG. gboolean FileFilterCaseInsensitive(const GtkFileFilterInfo* file_info, std::string* file_extension) { - return EndsWith(file_info->filename, *file_extension, false); + return base::EndsWith(file_info->filename, *file_extension, false); } // Deletes |data| when gtk_file_filter_add_custom() is done with it. diff --git a/chrome/browser/ui/webui/devtools_ui.cc b/chrome/browser/ui/webui/devtools_ui.cc index e80b772..7a87620 100644 --- a/chrome/browser/ui/webui/devtools_ui.cc +++ b/chrome/browser/ui/webui/devtools_ui.cc @@ -49,19 +49,19 @@ const char kFallbackFrontendURL[] = std::string GetMimeTypeForPath(const std::string& path) { std::string filename = PathWithoutParams(path); - if (EndsWith(filename, ".html", false)) { + if (base::EndsWith(filename, ".html", false)) { return "text/html"; - } else if (EndsWith(filename, ".css", false)) { + } else if (base::EndsWith(filename, ".css", false)) { return "text/css"; - } else if (EndsWith(filename, ".js", false)) { + } else if (base::EndsWith(filename, ".js", false)) { return "application/javascript"; - } else if (EndsWith(filename, ".png", false)) { + } else if (base::EndsWith(filename, ".png", false)) { return "image/png"; - } else if (EndsWith(filename, ".gif", false)) { + } else if (base::EndsWith(filename, ".gif", false)) { return "image/gif"; - } else if (EndsWith(filename, ".svg", false)) { + } else if (base::EndsWith(filename, ".svg", false)) { return "image/svg+xml"; - } else if (EndsWith(filename, ".manifest", false)) { + } else if (base::EndsWith(filename, ".manifest", false)) { return "text/cache-manifest"; } return "text/html"; diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc index 43df837..352eba5 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc @@ -124,7 +124,7 @@ bool HandleRequestCallback( const content::WebUIDataSource::GotDataCallback& callback) { // ChromeWebUIDataSource handles most requests except for the print preview // data. - if (!EndsWith(path, "/print.pdf", true)) + if (!base::EndsWith(path, "/print.pdf", true)) return false; // Print Preview data. diff --git a/chrome/browser/ui/webui/profiler_ui.cc b/chrome/browser/ui/webui/profiler_ui.cc index ae30b22..fda2c09 100644 --- a/chrome/browser/ui/webui/profiler_ui.cc +++ b/chrome/browser/ui/webui/profiler_ui.cc @@ -58,7 +58,7 @@ class ProfilerWebUIDataSource : public content::URLDataSource { } std::string GetMimeType(const std::string& path) const override { - if (EndsWith(path, ".js", false)) + if (base::EndsWith(path, ".js", false)) return "application/javascript"; return "text/html"; } diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm index f5c8e8d..d6f47a6 100644 --- a/chrome/browser/web_applications/web_app_mac.mm +++ b/chrome/browser/web_applications/web_app_mac.mm @@ -183,7 +183,7 @@ bool HasExistingExtensionShim(const base::FilePath& destination_directory, for (base::FilePath shim_path = enumerator.Next(); !shim_path.empty(); shim_path = enumerator.Next()) { if (shim_path.BaseName() != own_basename && - EndsWith(shim_path.RemoveExtension().value(), + base::EndsWith(shim_path.RemoveExtension().value(), extension_id, true /* case_sensitive */)) { return true; diff --git a/chrome/common/extensions/api/networking_private/networking_private_crypto.cc b/chrome/common/extensions/api/networking_private/networking_private_crypto.cc index 66af2f9..7a3c5f3 100644 --- a/chrome/common/extensions/api/networking_private/networking_private_crypto.cc +++ b/chrome/common/extensions/api/networking_private/networking_private_crypto.cc @@ -65,7 +65,7 @@ bool VerifyCredentials( std::string common_name = verification_context->GetCommonName(); std::string translated_mac; base::RemoveChars(connected_mac, ":", &translated_mac); - if (!EndsWith(common_name, translated_mac, false)) { + if (!base::EndsWith(common_name, translated_mac, false)) { LOG(ERROR) << kErrorPrefix << "MAC addresses don't match."; return false; } diff --git a/chrome/common/extensions/chrome_extensions_client.cc b/chrome/common/extensions/chrome_extensions_client.cc index 1b07deb..73f89c5 100644 --- a/chrome/common/extensions/chrome_extensions_client.cc +++ b/chrome/common/extensions/chrome_extensions_client.cc @@ -347,7 +347,7 @@ std::string ChromeExtensionsClient::GetWebstoreBaseURL() const { gallery_prefix = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( switches::kAppsGalleryURL); - if (EndsWith(gallery_prefix, "/", true)) + if (base::EndsWith(gallery_prefix, "/", true)) gallery_prefix = gallery_prefix.substr(0, gallery_prefix.length() - 1); return gallery_prefix; } diff --git a/chrome/common/importer/firefox_importer_utils.cc b/chrome/common/importer/firefox_importer_utils.cc index 4e9a855..f824614 100644 --- a/chrome/common/importer/firefox_importer_utils.cc +++ b/chrome/common/importer/firefox_importer_utils.cc @@ -116,7 +116,7 @@ bool ComposeMacAppPath(const std::string& path_from_file, // append Contents/MacOS. for (size_t i = 1; i < path_components.size(); ++i) { *output = output->Append(path_components[i]); - if (EndsWith(path_components[i], ".app", true)) { + if (base::EndsWith(path_components[i], ".app", true)) { *output = output->Append("Contents"); *output = output->Append("MacOS"); return true; diff --git a/chrome/common/service_process_util_unittest.cc b/chrome/common/service_process_util_unittest.cc index 1881924..3f75249 100644 --- a/chrome/common/service_process_util_unittest.cc +++ b/chrome/common/service_process_util_unittest.cc @@ -63,7 +63,7 @@ TEST(ServiceProcessUtilTest, ScopedVersionedName) { std::string test_str = "test"; std::string scoped_name = GetServiceProcessScopedVersionedName(test_str); chrome::VersionInfo version_info; - EXPECT_TRUE(EndsWith(scoped_name, test_str, true)); + EXPECT_TRUE(base::EndsWith(scoped_name, test_str, true)); EXPECT_NE(std::string::npos, scoped_name.find(version_info.Version())); } diff --git a/chrome/common/variations/experiment_labels.cc b/chrome/common/variations/experiment_labels.cc index 6c95244..ad230f5 100644 --- a/chrome/common/variations/experiment_labels.cc +++ b/chrome/common/variations/experiment_labels.cc @@ -96,9 +96,9 @@ base::string16 CombineExperimentLabels(const base::string16& variation_labels, const base::string16& other_labels) { const base::string16 separator(1, google_update::kExperimentLabelSeparator); DCHECK(!base::StartsWith(variation_labels, separator, false)); - DCHECK(!EndsWith(variation_labels, separator, false)); + DCHECK(!base::EndsWith(variation_labels, separator, false)); DCHECK(!base::StartsWith(other_labels, separator, false)); - DCHECK(!EndsWith(other_labels, separator, false)); + DCHECK(!base::EndsWith(other_labels, separator, false)); // Note that if either label is empty, a separator is not necessary. base::string16 combined_labels = other_labels; if (!other_labels.empty() && !variation_labels.empty()) diff --git a/chrome/installer/setup/setup_util_unittest.cc b/chrome/installer/setup/setup_util_unittest.cc index dd92f56..5174d1c 100644 --- a/chrome/installer/setup/setup_util_unittest.cc +++ b/chrome/installer/setup/setup_util_unittest.cc @@ -503,5 +503,5 @@ TEST(SetupUtilTest, GetRegistrationDataCommandKey) { UpdatingAppRegistrationData reg_data(app_guid); base::string16 key = installer::GetRegistrationDataCommandKey(reg_data, L"test_name"); - EXPECT_TRUE(EndsWith(key, app_guid + L"\\Commands\\test_name", true)); + EXPECT_TRUE(base::EndsWith(key, app_guid + L"\\Commands\\test_name", true)); } diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 0f25166..f96036f 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -1101,7 +1101,7 @@ base::string16 ExtractShortcutNameFromProperties( dist->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME); } - if (!EndsWith(shortcut_name, installer::kLnkExt, false)) + if (!base::EndsWith(shortcut_name, installer::kLnkExt, false)) shortcut_name.append(installer::kLnkExt); return shortcut_name; diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index f34a5c7..c8b70f6 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -1019,8 +1019,8 @@ bool ChromeContentRendererClient::IsNaClAllowed( bool is_photo_app = // Whitelisted apps must be served over https. app_url.SchemeIsCryptographic() && manifest_url.SchemeIsCryptographic() && - (EndsWith(app_url_host, "plus.google.com", false) || - EndsWith(app_url_host, "plus.sandbox.google.com", false)) && + (base::EndsWith(app_url_host, "plus.google.com", false) || + base::EndsWith(app_url_host, "plus.sandbox.google.com", false)) && manifest_url.DomainIs("ssl.gstatic.com") && (manifest_url_path.find("s2/oz/nacl/") == 1 || manifest_url_path.find("photos/nacl/") == 1); @@ -1033,9 +1033,9 @@ bool ChromeContentRendererClient::IsNaClAllowed( // Whitelisted apps must be served over secure scheme. app_url.SchemeIsCryptographic() && manifest_url.SchemeIsFileSystem() && manifest_url.inner_url()->SchemeIsCryptographic() && - (EndsWith(app_url_host, "talkgadget.google.com", false) || - EndsWith(app_url_host, "plus.google.com", false) || - EndsWith(app_url_host, "plus.sandbox.google.com", false)) && + (base::EndsWith(app_url_host, "talkgadget.google.com", false) || + base::EndsWith(app_url_host, "plus.google.com", false) || + base::EndsWith(app_url_host, "plus.sandbox.google.com", false)) && // The manifest must be loaded from the host's FileSystem. (manifest_fs_host == app_url_host); @@ -1509,9 +1509,9 @@ bool ChromeContentRendererClient::AllowPepperMediaStreamAPI( // these APIs are public and stable. std::string url_host = url.host(); if (url.SchemeIs("https") && - (EndsWith(url_host, "talkgadget.google.com", false) || - EndsWith(url_host, "plus.google.com", false) || - EndsWith(url_host, "plus.sandbox.google.com", false)) && + (base::EndsWith(url_host, "talkgadget.google.com", false) || + base::EndsWith(url_host, "plus.google.com", false) || + base::EndsWith(url_host, "plus.sandbox.google.com", false)) && base::StartsWithASCII(url.path(), "/hangouts/", false)) { return true; } diff --git a/chrome/renderer/content_settings_observer.cc b/chrome/renderer/content_settings_observer.cc index af4158b..94654b2 100644 --- a/chrome/renderer/content_settings_observer.cc +++ b/chrome/renderer/content_settings_observer.cc @@ -107,7 +107,7 @@ static const char kDotHTML[] = ".html"; static const char kGoogleDotCom[] = "google.com"; static bool IsHostInDomain(const std::string& host, const std::string& domain) { - return (EndsWith(host, domain, false) && + return (base::EndsWith(host, domain, false) && (host.length() == domain.length() || (host.length() > domain.length() && host[host.length() - domain.length() - 1] == '.'))); @@ -509,7 +509,7 @@ bool ContentSettingsObserver::allowDisplayingInsecureContent( } GURL resource_gurl(resource_url); - if (EndsWith(resource_gurl.path(), kDotHTML, false)) + if (base::EndsWith(resource_gurl.path(), kDotHTML, false)) SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HTML); if (allowed_per_settings || allow_displaying_insecure_content_) @@ -564,7 +564,7 @@ bool ContentSettingsObserver::allowRunningInsecureContent( SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_MAPS_GOOGLE); } else if (origin_host == kWWWDotYoutubeDotCom) { SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_YOUTUBE); - } else if (EndsWith(origin_host, kDotGoogleUserContentDotCom, false)) { + } else if (base::EndsWith(origin_host, kDotGoogleUserContentDotCom, false)) { SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_GOOGLEUSERCONTENT); } @@ -572,11 +572,11 @@ bool ContentSettingsObserver::allowRunningInsecureContent( if (resource_gurl.host() == kWWWDotYoutubeDotCom) SendInsecureContentSignal(INSECURE_CONTENT_RUN_TARGET_YOUTUBE); - if (EndsWith(resource_gurl.path(), kDotJS, false)) + if (base::EndsWith(resource_gurl.path(), kDotJS, false)) SendInsecureContentSignal(INSECURE_CONTENT_RUN_JS); - else if (EndsWith(resource_gurl.path(), kDotCSS, false)) + else if (base::EndsWith(resource_gurl.path(), kDotCSS, false)) SendInsecureContentSignal(INSECURE_CONTENT_RUN_CSS); - else if (EndsWith(resource_gurl.path(), kDotSWF, false)) + else if (base::EndsWith(resource_gurl.path(), kDotSWF, false)) SendInsecureContentSignal(INSECURE_CONTENT_RUN_SWF); if (!allow_running_insecure_content_ && !allowed_per_settings) { diff --git a/components/devtools_http_handler/devtools_http_handler.cc b/components/devtools_http_handler/devtools_http_handler.cc index 1255dbf..16e7d04 100644 --- a/components/devtools_http_handler/devtools_http_handler.cc +++ b/components/devtools_http_handler/devtools_http_handler.cc @@ -359,17 +359,17 @@ static std::string PathWithoutParams(const std::string& path) { } static std::string GetMimeType(const std::string& filename) { - if (EndsWith(filename, ".html", false)) { + if (base::EndsWith(filename, ".html", false)) { return "text/html"; - } else if (EndsWith(filename, ".css", false)) { + } else if (base::EndsWith(filename, ".css", false)) { return "text/css"; - } else if (EndsWith(filename, ".js", false)) { + } else if (base::EndsWith(filename, ".js", false)) { return "application/javascript"; - } else if (EndsWith(filename, ".png", false)) { + } else if (base::EndsWith(filename, ".png", false)) { return "image/png"; - } else if (EndsWith(filename, ".gif", false)) { + } else if (base::EndsWith(filename, ".gif", false)) { return "image/gif"; - } else if (EndsWith(filename, ".json", false)) { + } else if (base::EndsWith(filename, ".json", false)) { return "application/json"; } LOG(ERROR) << "GetMimeType doesn't know mime type for: " diff --git a/components/dom_distiller/core/page_features.cc b/components/dom_distiller/core/page_features.cc index 7d3115c..f931bbe 100644 --- a/components/dom_distiller/core/page_features.cc +++ b/components/dom_distiller/core/page_features.cc @@ -16,6 +16,7 @@ namespace dom_distiller { */ namespace { + std::string GetLastSegment(const std::string& path) { // return re.search('[^/]*\/?$', path).group(0) if (path.size() == 0) @@ -46,7 +47,8 @@ bool EndsWith(const std::string& t, const std::string& s) { return s.size() >= t.size() && s.compare(s.size() - t.size(), std::string::npos, t) == 0; } -} + +} // namespace int kDerivedFeaturesCount = 29; @@ -176,4 +178,5 @@ std::vector<double> CalculateDerivedFeaturesFromJSON( numAnchors, numForms, innerText, textContent, innerHTML); } -} + +} // namespace dom_distiller diff --git a/components/google/core/browser/google_util.cc b/components/google/core/browser/google_util.cc index 4d7d9d7..5326502 100644 --- a/components/google/core/browser/google_util.cc +++ b/components/google/core/browser/google_util.cc @@ -57,7 +57,7 @@ bool IsValidHostName(const std::string& host, if (base::LowerCaseEqualsASCII(host_minus_tld, domain_in_lower_case.c_str())) return true; if (subdomain_permission == google_util::ALLOW_SUBDOMAIN) - return EndsWith(host_minus_tld, "." + domain_in_lower_case, false); + return base::EndsWith(host_minus_tld, "." + domain_in_lower_case, false); return base::LowerCaseEqualsASCII(host_minus_tld, ("www." + domain_in_lower_case).c_str()); } diff --git a/components/omnibox/keyword_provider.cc b/components/omnibox/keyword_provider.cc index 13b2710..d805b09 100644 --- a/components/omnibox/keyword_provider.cc +++ b/components/omnibox/keyword_provider.cc @@ -138,7 +138,7 @@ const TemplateURL* KeywordProvider::GetSubstitutingTemplateURLForInput( // of the original input. if (input->cursor_position() != base::string16::npos && !remaining_input.empty() && - EndsWith(input->text(), remaining_input, true)) { + base::EndsWith(input->text(), remaining_input, true)) { int offset = input->text().length() - input->cursor_position(); // The cursor should never be past the last character or before the // first character. diff --git a/components/omnibox/search_suggestion_parser.cc b/components/omnibox/search_suggestion_parser.cc index ecf580d..5ef4201 100644 --- a/components/omnibox/search_suggestion_parser.cc +++ b/components/omnibox/search_suggestion_parser.cc @@ -149,7 +149,7 @@ void SearchSuggestionParser::SuggestResult::ClassifyMatchContents( // Ensure the query starts with the input text, and ends with the match // contents, and the input text has an overlap with contents. if (base::StartsWith(suggestion_, input_text, true) && - EndsWith(suggestion_, match_contents_, true) && + base::EndsWith(suggestion_, match_contents_, true) && (input_text.length() > contents_index)) { lookup_text = input_text.substr(contents_index); } diff --git a/components/password_manager/core/browser/password_manager.cc b/components/password_manager/core/browser/password_manager.cc index 8f9c6fa..4ff4f02 100644 --- a/components/password_manager/core/browser/password_manager.cc +++ b/components/password_manager/core/browser/password_manager.cc @@ -424,7 +424,7 @@ void PasswordManager::CreatePendingLoginManagers( iter != forms.end(); ++iter) { // Don't involve the password manager if this form corresponds to // SpdyProxy authentication, as indicated by the realm. - if (EndsWith(iter->signon_realm, kSpdyProxyRealm, true)) + if (base::EndsWith(iter->signon_realm, kSpdyProxyRealm, true)) continue; bool old_manager_found = false; for (const auto& old_manager : old_login_managers) { diff --git a/components/plugins/renderer/mobile_youtube_plugin.cc b/components/plugins/renderer/mobile_youtube_plugin.cc index 9745a0a..af24a2b 100644 --- a/components/plugins/renderer/mobile_youtube_plugin.cc +++ b/components/plugins/renderer/mobile_youtube_plugin.cc @@ -89,8 +89,8 @@ MobileYouTubePlugin::~MobileYouTubePlugin() {} bool MobileYouTubePlugin::IsYouTubeURL(const GURL& url, const std::string& mime_type) { std::string host = url.host(); - bool is_youtube = EndsWith(host, "youtube.com", true) || - EndsWith(host, "youtube-nocookie.com", true); + bool is_youtube = base::EndsWith(host, "youtube.com", true) || + base::EndsWith(host, "youtube-nocookie.com", true); return is_youtube && IsValidYouTubeVideo(url.path()) && base::LowerCaseEqualsASCII(mime_type, diff --git a/components/plugins/renderer/plugin_placeholder.cc b/components/plugins/renderer/plugin_placeholder.cc index 7ef233d..b44cbe9 100644 --- a/components/plugins/renderer/plugin_placeholder.cc +++ b/components/plugins/renderer/plugin_placeholder.cc @@ -78,14 +78,14 @@ void PluginPlaceholderBase::HidePlugin() { if (element.hasAttribute("width") && element.hasAttribute("height")) { std::string width_str("width:[\\s]*"); width_str += element.getAttribute("width").utf8().data(); - if (EndsWith(width_str, "px", false)) { + if (base::EndsWith(width_str, "px", false)) { width_str = width_str.substr(0, width_str.length() - 2); } base::TrimWhitespace(width_str, base::TRIM_TRAILING, &width_str); width_str += "[\\s]*px"; std::string height_str("height:[\\s]*"); height_str += element.getAttribute("height").utf8().data(); - if (EndsWith(height_str, "px", false)) { + if (base::EndsWith(height_str, "px", false)) { height_str = height_str.substr(0, height_str.length() - 2); } base::TrimWhitespace(height_str, base::TRIM_TRAILING, &height_str); diff --git a/components/search/search.cc b/components/search/search.cc index 9afd666..8c50d16 100644 --- a/components/search/search.cc +++ b/components/search/search.cc @@ -90,7 +90,7 @@ bool GetFieldTrialInfo(FieldTrialFlags* flags) { kInstantExtendedFieldTrialName); } - if (EndsWith(group_name, kDisablingSuffix, true)) + if (base::EndsWith(group_name, kDisablingSuffix, true)) return false; // We have a valid trial that isn't disabled. Extract the flags. diff --git a/components/storage_monitor/volume_mount_watcher_win.cc b/components/storage_monitor/volume_mount_watcher_win.cc index bdc7634..0828db5 100644 --- a/components/storage_monitor/volume_mount_watcher_win.cc +++ b/components/storage_monitor/volume_mount_watcher_win.cc @@ -70,7 +70,7 @@ DeviceType GetDeviceType(const base::string16& mount_point) { // Check device strings of the form "X:" and "\\.\X:" // For floppy drives, these will return strings like "/Device/Floppy0" base::string16 device = mount_point; - if (EndsWith(mount_point, L"\\", false)) + if (base::EndsWith(mount_point, L"\\", false)) device = mount_point.substr(0, mount_point.length() - 1); base::string16 device_path; base::string16 device_path_slash; diff --git a/components/test_runner/web_test_proxy.cc b/components/test_runner/web_test_proxy.cc index 2f0c0c7..b363120 100644 --- a/components/test_runner/web_test_proxy.cc +++ b/components/test_runner/web_test_proxy.cc @@ -199,7 +199,7 @@ bool IsLocalHost(const std::string& host) { } bool IsTestHost(const std::string& host) { - return EndsWith(host, ".test", false); + return base::EndsWith(host, ".test", false); } bool HostIsUsedBySomeTestsToGenerateError(const std::string& host) { diff --git a/components/translate/core/browser/translate_language_list.cc b/components/translate/core/browser/translate_language_list.cc index 1b1bfed..c3a16f1 100644 --- a/components/translate/core/browser/translate_language_list.cc +++ b/components/translate/core/browser/translate_language_list.cc @@ -267,7 +267,7 @@ void TranslateLanguageList::SetSupportedLanguages( if (!base::StartsWithASCII(language_list, TranslateLanguageList::kLanguageListCallbackName, false) || - !EndsWith(language_list, ")", false)) { + !base::EndsWith(language_list, ")", false)) { // We don't have a NOTREACHED here since this can happen in ui_tests, even // though the the BrowserMain function won't call us with parameters.ui_task // is NULL some tests don't set it, so we must bail here. diff --git a/components/variations/net/variations_http_header_provider.cc b/components/variations/net/variations_http_header_provider.cc index fae7c95..00aa5d6 100644 --- a/components/variations/net/variations_http_header_provider.cc +++ b/components/variations/net/variations_http_header_provider.cc @@ -280,7 +280,7 @@ bool VariationsHttpHeaderProvider::ShouldAppendHeaders(const GURL& url) { // is very straight forward. const std::string host = url.host(); for (size_t i = 0; i < arraysize(kSuffixesToSetHeadersFor); ++i) { - if (EndsWith(host, kSuffixesToSetHeadersFor[i], false)) + if (base::EndsWith(host, kSuffixesToSetHeadersFor[i], false)) return true; } diff --git a/components/wifi/wifi_service_win.cc b/components/wifi/wifi_service_win.cc index f232000..5145fba 100644 --- a/components/wifi/wifi_service_win.cc +++ b/components/wifi/wifi_service_win.cc @@ -1152,7 +1152,7 @@ DWORD WiFiServiceImpl::FindAdapterIndexMapByGUID( error = GetInterfaceInfo(interface_info, &buffer_length); if (error == ERROR_SUCCESS) { for (int adapter = 0; adapter < interface_info->NumAdapters; ++adapter) { - if (EndsWith( + if (base::EndsWith( interface_info->Adapter[adapter].Name, guid_string, false)) { *adapter_index_map = interface_info->Adapter[adapter]; break; diff --git a/content/browser/accessibility/android_granularity_movement_browsertest.cc b/content/browser/accessibility/android_granularity_movement_browsertest.cc index b24fa75..392c262 100644 --- a/content/browser/accessibility/android_granularity_movement_browsertest.cc +++ b/content/browser/accessibility/android_granularity_movement_browsertest.cc @@ -91,7 +91,7 @@ class AndroidGranularityMovementBrowserTest : public ContentBrowserTest { int len = (granularity == GRANULARITY_CHARACTER) ? 1 : end_index - start_index; base::string16 selection = text.substr(start_index, len); - if (EndsWith(selection, base::ASCIIToUTF16("\n"), false)) + if (base::EndsWith(selection, base::ASCIIToUTF16("\n"), false)) selection.erase(selection.size() - 1); if (!selection.empty()) { if (!concatenated.empty()) @@ -116,7 +116,7 @@ class AndroidGranularityMovementBrowserTest : public ContentBrowserTest { int len = (granularity == GRANULARITY_CHARACTER) ? 1 : end_index - start_index; base::string16 selection = text.substr(start_index, len); - if (EndsWith(selection, base::ASCIIToUTF16("\n"), false)) + if (base::EndsWith(selection, base::ASCIIToUTF16("\n"), false)) selection = selection.substr(0, selection.size() - 1); if (!reverse.empty()) reverse = base::ASCIIToUTF16(", ") + reverse; diff --git a/content/browser/plugin_browsertest.cc b/content/browser/plugin_browsertest.cc index efc5c8c..12969f5 100644 --- a/content/browser/plugin_browsertest.cc +++ b/content/browser/plugin_browsertest.cc @@ -526,9 +526,9 @@ class TestResourceDispatcherHostDelegate ResourceResponse* response, IPC::Sender* sender) override { // The URL below comes from plugin_geturl_test.cc. - if (!EndsWith(request->url().spec(), - "npapi/plugin_ref_target_page.html", - true)) { + if (!base::EndsWith(request->url().spec(), + "npapi/plugin_ref_target_page.html", + true)) { return; } net::HttpRequestHeaders headers; diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc index 678171c..93140c2 100644 --- a/content/browser/plugin_service_impl.cc +++ b/content/browser/plugin_service_impl.cc @@ -581,7 +581,7 @@ base::string16 PluginServiceImpl::GetPluginDisplayNameByPath( // Many plugins on the Mac have .plugin in the actual name, which looks // terrible, so look for that and strip it off if present. const std::string kPluginExtension = ".plugin"; - if (EndsWith(plugin_name, base::ASCIIToUTF16(kPluginExtension), true)) + if (base::EndsWith(plugin_name, base::ASCIIToUTF16(kPluginExtension), true)) plugin_name.erase(plugin_name.length() - kPluginExtension.length()); #endif // OS_MACOSX } diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 9647bc7..4b50c00 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -2870,7 +2870,7 @@ void WebContentsImpl::OnDidRunInsecureContent( LOG(WARNING) << security_origin << " ran insecure content from " << target_url.possibly_invalid_spec(); RecordAction(base::UserMetricsAction("SSL.RanInsecureContent")); - if (EndsWith(security_origin, kDotGoogleDotCom, false)) + if (base::EndsWith(security_origin, kDotGoogleDotCom, false)) RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle")); controller_.ssl_manager()->DidRunInsecureContent(security_origin); displayed_insecure_content_ = true; diff --git a/content/browser/webui/web_ui_data_source_impl.cc b/content/browser/webui/web_ui_data_source_impl.cc index f3a5777..08ab2ad 100644 --- a/content/browser/webui/web_ui_data_source_impl.cc +++ b/content/browser/webui/web_ui_data_source_impl.cc @@ -190,16 +190,16 @@ std::string WebUIDataSourceImpl::GetSource() const { } std::string WebUIDataSourceImpl::GetMimeType(const std::string& path) const { - if (EndsWith(path, ".js", false)) + if (base::EndsWith(path, ".js", false)) return "application/javascript"; - if (EndsWith(path, ".json", false)) + if (base::EndsWith(path, ".json", false)) return "application/json"; - if (EndsWith(path, ".pdf", false)) + if (base::EndsWith(path, ".pdf", false)) return "application/pdf"; - if (EndsWith(path, ".svg", false)) + if (base::EndsWith(path, ".svg", false)) return "image/svg+xml"; return "text/html"; diff --git a/content/common/set_process_title.cc b/content/common/set_process_title.cc index 74651ca6..229524e 100644 --- a/content/common/set_process_title.cc +++ b/content/common/set_process_title.cc @@ -59,7 +59,7 @@ void SetProcessTitleFromCommandLine(const char** main_argv) { // If the binary has since been deleted, Linux appends " (deleted)" to the // symlink target. Remove it, since this is not really part of our name. const std::string kDeletedSuffix = " (deleted)"; - if (EndsWith(title, kDeletedSuffix, true)) + if (base::EndsWith(title, kDeletedSuffix, true)) title.resize(title.size() - kDeletedSuffix.size()); // PR_SET_NAME is available in Linux 2.6.9 and newer. diff --git a/dbus/string_util.cc b/dbus/string_util.cc index 0323e4a..0b07786 100644 --- a/dbus/string_util.cc +++ b/dbus/string_util.cc @@ -39,7 +39,7 @@ bool IsValidObjectPath(const std::string& value) { } // A trailing '/' character is not allowed unless the path is the root path. - if (value.size() > 1 && EndsWith(value, "/", kCaseSensitive)) + if (value.size() > 1 && base::EndsWith(value, "/", kCaseSensitive)) return false; return true; diff --git a/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc b/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc index c428af9..615090a 100644 --- a/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc +++ b/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc @@ -424,7 +424,7 @@ bool HeaderMatcher::StringMatchTest::Matches( case kPrefix: return base::StartsWithASCII(str, data_, case_sensitive_); case kSuffix: - return EndsWith(str, data_, case_sensitive_); + return base::EndsWith(str, data_, case_sensitive_); case kEquals: return str.size() == data_.size() && base::StartsWithASCII(str, data_, case_sensitive_); diff --git a/extensions/browser/api/web_request/web_request_permissions.cc b/extensions/browser/api/web_request/web_request_permissions.cc index 19d85b8..2f57d63 100644 --- a/extensions/browser/api/web_request/web_request_permissions.cc +++ b/extensions/browser/api/web_request/web_request_permissions.cc @@ -30,7 +30,7 @@ bool IsSensitiveURL(const GURL& url) { const std::string host = url.host(); const char kGoogleCom[] = ".google.com"; const char kClient[] = "clients"; - if (EndsWith(host, kGoogleCom, true)) { + if (base::EndsWith(host, kGoogleCom, true)) { // Check for "clients[0-9]*.google.com" hosts. // This protects requests to several internal services such as sync, // extension update pings, captive portal detection, fraudulent certificate @@ -50,7 +50,7 @@ bool IsSensitiveURL(const GURL& url) { // others. sensitive_chrome_url = sensitive_chrome_url || - EndsWith(url.host(), ".clients.google.com", true) || + base::EndsWith(url.host(), ".clients.google.com", true) || url.host() == "sb-ssl.google.com" || (url.host() == "chrome.google.com" && base::StartsWithASCII(url.path(), "/webstore", true)); diff --git a/extensions/common/user_script.cc b/extensions/common/user_script.cc index ddcfd80..5be4880 100644 --- a/extensions/common/user_script.cc +++ b/extensions/common/user_script.cc @@ -51,8 +51,8 @@ int UserScript::GenerateUserScriptID() { bool UserScript::IsURLUserScript(const GURL& url, const std::string& mime_type) { - return EndsWith(url.ExtractFileName(), kFileExtension, false) && - mime_type != "text/html"; + return base::EndsWith(url.ExtractFileName(), kFileExtension, false) && + mime_type != "text/html"; } // static diff --git a/google_apis/drive/test_util.cc b/google_apis/drive/test_util.cc index c621809..6a22ca0 100644 --- a/google_apis/drive/test_util.cc +++ b/google_apis/drive/test_util.cc @@ -96,7 +96,8 @@ scoped_ptr<net::test_server::BasicHttpResponse> CreateHttpResponseFromFile( return scoped_ptr<net::test_server::BasicHttpResponse>(); std::string content_type = "text/plain"; - if (EndsWith(file_path.AsUTF8Unsafe(), ".json", true /* case sensitive */)) + if (base::EndsWith(file_path.AsUTF8Unsafe(), ".json", + true /* case sensitive */)) content_type = "application/json"; scoped_ptr<net::test_server::BasicHttpResponse> http_response( diff --git a/google_apis/gaia/gaia_auth_fetcher_unittest.cc b/google_apis/gaia/gaia_auth_fetcher_unittest.cc index 6a8028d..15372cc 100644 --- a/google_apis/gaia/gaia_auth_fetcher_unittest.cc +++ b/google_apis/gaia/gaia_auth_fetcher_unittest.cc @@ -594,7 +594,8 @@ TEST_F(GaiaAuthFetcherTest, OAuthLoginTokenWithCookies) { net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); EXPECT_TRUE(NULL != fetcher); EXPECT_EQ(net::LOAD_NORMAL, fetcher->GetLoadFlags()); - EXPECT_FALSE(EndsWith(fetcher->upload_data(), "device_type=chrome", true)); + EXPECT_FALSE(base::EndsWith(fetcher->upload_data(), "device_type=chrome", + true)); } TEST_F(GaiaAuthFetcherTest, OAuthLoginTokenWithCookies_DeviceId) { @@ -607,7 +608,8 @@ TEST_F(GaiaAuthFetcherTest, OAuthLoginTokenWithCookies_DeviceId) { net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); EXPECT_TRUE(NULL != fetcher); EXPECT_EQ(net::LOAD_NORMAL, fetcher->GetLoadFlags()); - EXPECT_TRUE(EndsWith(fetcher->upload_data(), "device_type=chrome", true)); + EXPECT_TRUE(base::EndsWith(fetcher->upload_data(), "device_type=chrome", + true)); net::HttpRequestHeaders extra_request_headers; fetcher->GetExtraRequestHeaders(&extra_request_headers); std::string device_id; diff --git a/gpu/command_buffer/service/program_manager.cc b/gpu/command_buffer/service/program_manager.cc index 896669f..b1167b6 100644 --- a/gpu/command_buffer/service/program_manager.cc +++ b/gpu/command_buffer/service/program_manager.cc @@ -841,7 +841,7 @@ void Program::GetCorrectedUniformData( found = uniform->findInfoByMappedName(name, &info, original_name); if (found) { const std::string kArraySpec("[0]"); - if (info->arraySize > 0 && !EndsWith(name, kArraySpec, true)) { + if (info->arraySize > 0 && !base::EndsWith(name, kArraySpec, true)) { *corrected_name = name + kArraySpec; *original_name += kArraySpec; } else { diff --git a/ios/web/webui/web_ui_ios_data_source_impl.cc b/ios/web/webui/web_ui_ios_data_source_impl.cc index 6180836..ee0ed42 100644 --- a/ios/web/webui/web_ui_ios_data_source_impl.cc +++ b/ios/web/webui/web_ui_ios_data_source_impl.cc @@ -109,19 +109,19 @@ std::string WebUIIOSDataSourceImpl::GetSource() const { } std::string WebUIIOSDataSourceImpl::GetMimeType(const std::string& path) const { - if (EndsWith(path, ".js", false)) + if (base::EndsWith(path, ".js", false)) return "application/javascript"; - if (EndsWith(path, ".json", false)) + if (base::EndsWith(path, ".json", false)) return "application/json"; - if (EndsWith(path, ".pdf", false)) + if (base::EndsWith(path, ".pdf", false)) return "application/pdf"; - if (EndsWith(path, ".css", false)) + if (base::EndsWith(path, ".css", false)) return "text/css"; - if (EndsWith(path, ".svg", false)) + if (base::EndsWith(path, ".svg", false)) return "image/svg+xml"; return "text/html"; diff --git a/media/filters/chunk_demuxer_unittest.cc b/media/filters/chunk_demuxer_unittest.cc index 16ddff5..c995685 100644 --- a/media/filters/chunk_demuxer_unittest.cc +++ b/media/filters/chunk_demuxer_unittest.cc @@ -449,7 +449,7 @@ class ChunkDemuxerTest : public ::testing::Test { block_info.flags = 0; block_info.duration = 0; - if (EndsWith(timestamp_str, "K", true)) { + if (base::EndsWith(timestamp_str, "K", true)) { block_info.flags = kWebMFlagKeyframe; // Remove the "K" off of the token. timestamp_str = timestamp_str.substr(0, timestamps[i].length() - 1); @@ -1082,7 +1082,7 @@ class ChunkDemuxerTest : public ::testing::Test { ss << "K"; // Handle preroll buffers. - if (EndsWith(timestamps[i], "P", true)) { + if (base::EndsWith(timestamps[i], "P", true)) { ASSERT_EQ(kInfiniteDuration(), buffer->discard_padding().first); ASSERT_EQ(base::TimeDelta(), buffer->discard_padding().second); ss << "P"; diff --git a/media/filters/frame_processor_unittest.cc b/media/filters/frame_processor_unittest.cc index 7ee996c..21672f1 100644 --- a/media/filters/frame_processor_unittest.cc +++ b/media/filters/frame_processor_unittest.cc @@ -104,7 +104,7 @@ class FrameProcessorTest : public testing::TestWithParam<bool> { BufferQueue buffers; for (size_t i = 0; i < timestamps.size(); i++) { bool is_keyframe = false; - if (EndsWith(timestamps[i], "K", true)) { + if (base::EndsWith(timestamps[i], "K", true)) { is_keyframe = true; // Remove the "K" off of the token. timestamps[i] = timestamps[i].substr(0, timestamps[i].length() - 1); diff --git a/media/filters/source_buffer_stream_unittest.cc b/media/filters/source_buffer_stream_unittest.cc index d08b6c17..659f3d0 100644 --- a/media/filters/source_buffer_stream_unittest.cc +++ b/media/filters/source_buffer_stream_unittest.cc @@ -305,7 +305,7 @@ class SourceBufferStreamTest : public testing::Test { } // Handle preroll buffers. - if (EndsWith(timestamps[i], "P", true)) { + if (base::EndsWith(timestamps[i], "P", true)) { ASSERT_TRUE(buffer->is_key_frame()); scoped_refptr<StreamParserBuffer> preroll_buffer; preroll_buffer.swap(buffer); @@ -507,34 +507,34 @@ class SourceBufferStreamTest : public testing::Test { // Remove the "S(" off of the token. timestamps[i] = timestamps[i].substr(2, timestamps[i].length()); } - if (splice_frame && EndsWith(timestamps[i], ")", true)) { + if (splice_frame && base::EndsWith(timestamps[i], ")", true)) { splice_frame = false; last_splice_frame = true; // Remove the ")" off of the token. timestamps[i] = timestamps[i].substr(0, timestamps[i].length() - 1); } // Handle config changes within the splice frame. - if (splice_frame && EndsWith(timestamps[i], "C", true)) { + if (splice_frame && base::EndsWith(timestamps[i], "C", true)) { splice_config_id++; CHECK(splice_config_id < stream_->audio_configs_.size() || splice_config_id < stream_->video_configs_.size()); // Remove the "C" off of the token. timestamps[i] = timestamps[i].substr(0, timestamps[i].length() - 1); } - if (EndsWith(timestamps[i], "K", true)) { + if (base::EndsWith(timestamps[i], "K", true)) { is_keyframe = true; // Remove the "K" off of the token. timestamps[i] = timestamps[i].substr(0, timestamps[i].length() - 1); } // Handle preroll buffers. - if (EndsWith(timestamps[i], "P", true)) { + if (base::EndsWith(timestamps[i], "P", true)) { is_keyframe = true; has_preroll = true; // Remove the "P" off of the token. timestamps[i] = timestamps[i].substr(0, timestamps[i].length() - 1); } - if (EndsWith(timestamps[i], "E", true)) { + if (base::EndsWith(timestamps[i], "E", true)) { is_duration_estimated = true; // Remove the "E" off of the token. timestamps[i] = timestamps[i].substr(0, timestamps[i].length() - 1); diff --git a/media/video/capture/mac/video_capture_device_factory_mac.mm b/media/video/capture/mac/video_capture_device_factory_mac.mm index f7428eb..76e14c6 100644 --- a/media/video/capture/mac/video_capture_device_factory_mac.mm +++ b/media/video/capture/mac/video_capture_device_factory_mac.mm @@ -35,7 +35,7 @@ static bool IsDeviceBlacklisted(const VideoCaptureDevice::Name& name) { bool is_device_blacklisted = false; for(size_t i = 0; !is_device_blacklisted && i < arraysize(kBlacklistedCameras); ++i) { - is_device_blacklisted = EndsWith(name.id(), + is_device_blacklisted = base::EndsWith(name.id(), kBlacklistedCameras[i].unique_id_signature, false); } DVLOG_IF(2, is_device_blacklisted) << "Blacklisted camera: " << @@ -182,7 +182,8 @@ void VideoCaptureDeviceFactoryMac::GetDeviceSupportedFormats( // such information is provided for QTKit devices. if (device.is_blacklisted()) { for (size_t i = 0; i < arraysize(kBlacklistedCameras); ++i) { - if (EndsWith(device.id(), kBlacklistedCameras[i].unique_id_signature, + if (base::EndsWith(device.id(), + kBlacklistedCameras[i].unique_id_signature, false)) { supported_formats->push_back(media::VideoCaptureFormat( gfx::Size(kBlacklistedCameras[i].capture_width, diff --git a/media/video/capture/video_capture_device.cc b/media/video/capture/video_capture_device.cc index 44442c4..e474489 100644 --- a/media/video/capture/video_capture_device.cc +++ b/media/video/capture/video_capture_device.cc @@ -14,7 +14,7 @@ const std::string VideoCaptureDevice::Name::GetNameAndModel() const { if (model_id.empty()) return device_name_; const std::string suffix = " (" + model_id + ")"; - if (EndsWith(device_name_, suffix, true)) // |true| means case-sensitive. + if (base::EndsWith(device_name_, suffix, true /* case sensitive */)) return device_name_; return device_name_ + suffix; } diff --git a/mojo/runner/shell_apptest.cc b/mojo/runner/shell_apptest.cc index a675805..70f7864 100644 --- a/mojo/runner/shell_apptest.cc +++ b/mojo/runner/shell_apptest.cc @@ -184,7 +184,7 @@ TEST_F(ShellAppTest, MojoURLQueryHandling) { application_impl()->ConnectToService("mojo:pingable_app?foo", &pingable); auto callback = [this](const String& app_url, const String& connection_url, const String& message) { - EXPECT_TRUE(EndsWith(app_url, "/pingable_app.mojo", true)); + EXPECT_TRUE(base::EndsWith(app_url, "/pingable_app.mojo", true)); EXPECT_EQ(app_url.To<std::string>() + "?foo", connection_url); EXPECT_EQ("hello", message); base::MessageLoop::current()->Quit(); diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc index 4468fc4..dee8892 100644 --- a/net/base/mime_util.cc +++ b/net/base/mime_util.cc @@ -286,7 +286,7 @@ bool MimeUtil::MatchesMimeType(const std::string& mime_type_pattern, if (!base::StartsWithASCII(base_type, left, false)) return false; - if (!right.empty() && !EndsWith(base_type, right, false)) + if (!right.empty() && !base::EndsWith(base_type, right, false)) return false; return MatchesMimeTypeParameters(mime_type_pattern, mime_type); @@ -521,7 +521,7 @@ void GetExtensionsForMimeType( const std::string mime_type = base::StringToLowerASCII(unsafe_mime_type); base::hash_set<base::FilePath::StringType> unique_extensions; - if (EndsWith(mime_type, "/*", false)) { + if (base::EndsWith(mime_type, "/*", false)) { std::string leading_mime_type = mime_type.substr(0, mime_type.length() - 1); // Find the matching StandardType from within kStandardTypes, or fall diff --git a/net/base/net_util.cc b/net/base/net_util.cc index 04733a8..2239cc4 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -794,7 +794,7 @@ bool HasGoogleHost(const GURL& url) { }; const std::string& host = url.host(); for (const char* suffix : kGoogleHostSuffixes) { - if (EndsWith(host, suffix, false)) + if (base::EndsWith(host, suffix, false)) return true; } return false; diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index c8b8226..f60bb57 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -1444,7 +1444,7 @@ void HttpNetworkTransaction::RecordSSLFallbackMetrics(int result) { return; const std::string& host = request_->url.host(); - bool is_google = EndsWith(host, "google.com", true) && + bool is_google = base::EndsWith(host, "google.com", true) && (host.size() == 10 || host[host.size() - 11] == '.'); if (is_google) { // Some fraction of successful connections use the fallback, but only due to diff --git a/net/http/http_server_properties_impl.cc b/net/http/http_server_properties_impl.cc index d5c6559..1f667a1 100644 --- a/net/http/http_server_properties_impl.cc +++ b/net/http/http_server_properties_impl.cc @@ -89,7 +89,7 @@ void HttpServerPropertiesImpl::InitializeAlternativeServiceServers( for (AlternativeServiceMap::const_iterator it = alternative_service_map_.begin(); it != alternative_service_map_.end(); ++it) { - if (EndsWith(it->first.host(), canonical_suffixes_[i], false)) { + if (base::EndsWith(it->first.host(), canonical_suffixes_[i], false)) { canonical_host_to_origin_map_[canonical_host] = it->first; break; } @@ -226,7 +226,7 @@ std::string HttpServerPropertiesImpl::GetCanonicalSuffix( // suffix. for (size_t i = 0; i < canonical_suffixes_.size(); ++i) { std::string canonical_suffix = canonical_suffixes_[i]; - if (EndsWith(host, canonical_suffixes_[i], false)) { + if (base::EndsWith(host, canonical_suffixes_[i], false)) { return canonical_suffix; } } @@ -315,7 +315,7 @@ void HttpServerPropertiesImpl::SetAlternativeService( // canonical host. for (size_t i = 0; i < canonical_suffixes_.size(); ++i) { std::string canonical_suffix = canonical_suffixes_[i]; - if (EndsWith(origin.host(), canonical_suffixes_[i], false)) { + if (base::EndsWith(origin.host(), canonical_suffixes_[i], false)) { HostPortPair canonical_host(canonical_suffix, origin.port()); canonical_host_to_origin_map_[canonical_host] = origin; break; @@ -557,7 +557,7 @@ HttpServerPropertiesImpl::CanonicalHostMap::const_iterator HttpServerPropertiesImpl::GetCanonicalHost(HostPortPair server) const { for (size_t i = 0; i < canonical_suffixes_.size(); ++i) { std::string canonical_suffix = canonical_suffixes_[i]; - if (EndsWith(server.host(), canonical_suffixes_[i], false)) { + if (base::EndsWith(server.host(), canonical_suffixes_[i], false)) { HostPortPair canonical_host(canonical_suffix, server.port()); return canonical_host_to_origin_map_.find(canonical_host); } diff --git a/net/quic/crypto/quic_crypto_client_config.cc b/net/quic/crypto/quic_crypto_client_config.cc index 3ad3876..cd4887f 100644 --- a/net/quic/crypto/quic_crypto_client_config.cc +++ b/net/quic/crypto/quic_crypto_client_config.cc @@ -904,7 +904,7 @@ bool QuicCryptoClientConfig::PopulateFromCanonicalConfig( DCHECK(server_state->IsEmpty()); size_t i = 0; for (; i < canonical_suffixes_.size(); ++i) { - if (EndsWith(server_id.host(), canonical_suffixes_[i], false)) { + if (base::EndsWith(server_id.host(), canonical_suffixes_[i], false)) { break; } } diff --git a/net/server/http_server_unittest.cc b/net/server/http_server_unittest.cc index 09b6bf4..c76ae63 100644 --- a/net/server/http_server_unittest.cc +++ b/net/server/http_server_unittest.cc @@ -443,7 +443,7 @@ TEST_F(HttpServerTest, Send200) { std::string response; ASSERT_TRUE(client.ReadResponse(&response)); ASSERT_TRUE(base::StartsWithASCII(response, "HTTP/1.1 200 OK", true)); - ASSERT_TRUE(EndsWith(response, "Response!", true)); + ASSERT_TRUE(base::EndsWith(response, "Response!", true)); } TEST_F(HttpServerTest, SendRaw) { @@ -592,7 +592,7 @@ TEST_F(HttpServerTest, MultipleRequestsOnSameConnection) { std::string response1; ASSERT_TRUE(client.ReadResponse(&response1)); ASSERT_TRUE(base::StartsWithASCII(response1, "HTTP/1.1 200 OK", true)); - ASSERT_TRUE(EndsWith(response1, "Content for /test", true)); + ASSERT_TRUE(base::EndsWith(response1, "Content for /test", true)); client.Send("GET /test2 HTTP/1.1\r\n\r\n"); ASSERT_TRUE(RunUntilRequestsReceived(2)); @@ -613,7 +613,7 @@ TEST_F(HttpServerTest, MultipleRequestsOnSameConnection) { std::string response3; ASSERT_TRUE(client.ReadResponse(&response3)); ASSERT_TRUE(base::StartsWithASCII(response3, "HTTP/1.1 200 OK", true)); - ASSERT_TRUE(EndsWith(response3, "Content for /test3", true)); + ASSERT_TRUE(base::EndsWith(response3, "Content for /test3", true)); } class CloseOnConnectHttpServerTest : public HttpServerTest { diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index dab2aec..9ed7e65 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -2975,7 +2975,7 @@ void SpdySession::RecordProtocolErrorHistogram( SpdyProtocolErrorDetails details) { UMA_HISTOGRAM_ENUMERATION("Net.SpdySessionErrorDetails2", details, NUM_SPDY_PROTOCOL_ERROR_DETAILS); - if (EndsWith(host_port_pair().host(), "google.com", false)) { + if (base::EndsWith(host_port_pair().host(), "google.com", false)) { UMA_HISTOGRAM_ENUMERATION("Net.SpdySessionErrorDetails_Google2", details, NUM_SPDY_PROTOCOL_ERROR_DETAILS); } diff --git a/net/spdy/spdy_session_test_util.cc b/net/spdy/spdy_session_test_util.cc index d901cf6..e817ce1 100644 --- a/net/spdy/spdy_session_test_util.cc +++ b/net/spdy/spdy_session_test_util.cc @@ -28,9 +28,9 @@ void SpdySessionTestTaskObserver::WillProcessTask( void SpdySessionTestTaskObserver::DidProcessTask( const base::PendingTask& pending_task) { - if (EndsWith(pending_task.posted_from.file_name(), file_name_, true) && - EndsWith(pending_task.posted_from.function_name(), function_name_, - true)) { + if (base::EndsWith(pending_task.posted_from.file_name(), file_name_, true) && + base::EndsWith(pending_task.posted_from.function_name(), function_name_, + true)) { ++executed_count_; } } diff --git a/net/tools/flip_server/mem_cache.cc b/net/tools/flip_server/mem_cache.cc index 521f56c..b280b98 100644 --- a/net/tools/flip_server/mem_cache.cc +++ b/net/tools/flip_server/mem_cache.cc @@ -204,7 +204,7 @@ void MemoryCache::ReadAndStoreFileContents(const char* filename) { FileData* MemoryCache::GetFileData(const std::string& filename) { Files::iterator fi = files_.end(); - if (EndsWith(filename, ".html", true)) { + if (base::EndsWith(filename, ".html", true)) { fi = files_.find(filename.substr(0, filename.size() - 5) + ".http"); } if (fi == files_.end()) diff --git a/net/websockets/websocket_stream_cookie_test.cc b/net/websockets/websocket_stream_cookie_test.cc index 9b819b5..8e4d9c4 100644 --- a/net/websockets/websocket_stream_cookie_test.cc +++ b/net/websockets/websocket_stream_cookie_test.cc @@ -35,7 +35,7 @@ class TestBase : public WebSocketStreamCreateTestBase { // We assume cookie_header ends with CRLF if not empty, as // WebSocketStandardRequestWithCookies requires. Use AddCRLFIfNotEmpty // in a call site. - CHECK(cookie_header.empty() || EndsWith(cookie_header, "\r\n", true)); + CHECK(cookie_header.empty() || base::EndsWith(cookie_header, "\r\n", true)); url_request_context_host_.SetExpectations( WebSocketStandardRequestWithCookies(url.path(), url.host(), origin, diff --git a/pdf/document_loader.cc b/pdf/document_loader.cc index 48d8352..f696656 100644 --- a/pdf/document_loader.cc +++ b/pdf/document_loader.cc @@ -68,12 +68,12 @@ std::string GetMultiPartBoundary(const std::string& headers) { } bool IsValidContentType(const std::string& type) { - return (EndsWith(type, "/pdf", false) || - EndsWith(type, ".pdf", false) || - EndsWith(type, "/x-pdf", false) || - EndsWith(type, "/*", false) || - EndsWith(type, "/acrobat", false) || - EndsWith(type, "/unknown", false)); + return (base::EndsWith(type, "/pdf", false) || + base::EndsWith(type, ".pdf", false) || + base::EndsWith(type, "/x-pdf", false) || + base::EndsWith(type, "/*", false) || + base::EndsWith(type, "/acrobat", false) || + base::EndsWith(type, "/unknown", false)); } } // namespace diff --git a/remoting/host/it2me/it2me_host.cc b/remoting/host/it2me/it2me_host.cc index a67511cb..79d5f45 100644 --- a/remoting/host/it2me/it2me_host.cc +++ b/remoting/host/it2me/it2me_host.cc @@ -196,8 +196,8 @@ void It2MeHost::FinishConnect() { // Check the host domain policy. if (!required_host_domain_.empty() && - !EndsWith(xmpp_server_config_.username, - std::string("@") + required_host_domain_, false)) { + !base::EndsWith(xmpp_server_config_.username, + std::string("@") + required_host_domain_, false)) { SetState(kInvalidDomainError); return; } diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc index 8124cc5..993c0ab 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc @@ -1084,7 +1084,7 @@ void HostProcess::ApplyHostDomainPolicy() { ShutdownHost(kInvalidHostDomainExitCode); } - if (!EndsWith(host_owner_, std::string("@") + host_domain_, false)) { + if (!base::EndsWith(host_owner_, std::string("@") + host_domain_, false)) { LOG(ERROR) << "The host domain does not match the policy."; ShutdownHost(kInvalidHostDomainExitCode); } diff --git a/third_party/zlib/google/zip_reader.cc b/third_party/zlib/google/zip_reader.cc index 3acbb418..d3c2775 100644 --- a/third_party/zlib/google/zip_reader.cc +++ b/third_party/zlib/google/zip_reader.cc @@ -131,7 +131,7 @@ ZipReader::EntryInfo::EntryInfo(const std::string& file_name_in_zip, original_size_ = raw_file_info.uncompressed_size; // Directory entries in zip files end with "/". - is_directory_ = EndsWith(file_name_in_zip, "/", false); + is_directory_ = base::EndsWith(file_name_in_zip, "/", false); // Check the file name here for directory traversal issues. is_unsafe_ = file_path_.ReferencesParent(); diff --git a/tools/gn/ninja_binary_target_writer.cc b/tools/gn/ninja_binary_target_writer.cc index 7a611db..680c0d9 100644 --- a/tools/gn/ninja_binary_target_writer.cc +++ b/tools/gn/ninja_binary_target_writer.cc @@ -336,7 +336,8 @@ void NinjaBinaryTargetWriter::WriteLibs() { const OrderedSet<std::string> all_libs = target_->all_libs(); const std::string framework_ending(".framework"); for (size_t i = 0; i < all_libs.size(); i++) { - if (settings_->IsMac() && EndsWith(all_libs[i], framework_ending, false)) { + if (settings_->IsMac() && + base::EndsWith(all_libs[i], framework_ending, false)) { // Special-case libraries ending in ".framework" on Mac. Add the // -framework switch and don't add the extension to the output. out_ << " -framework "; diff --git a/tools/gn/ninja_target_writer.cc b/tools/gn/ninja_target_writer.cc index 78a2c8f..e03b2d2 100644 --- a/tools/gn/ninja_target_writer.cc +++ b/tools/gn/ninja_target_writer.cc @@ -242,7 +242,7 @@ void NinjaTargetWriter::WriteStampForTarget( // First validate that the target's dependency is a stamp file. Otherwise, // we shouldn't have gotten here! - CHECK(EndsWith(stamp_file.value(), ".stamp", false)) + CHECK(base::EndsWith(stamp_file.value(), ".stamp", false)) << "Output should end in \".stamp\" for stamp file output. Instead got: " << "\"" << stamp_file.value() << "\""; diff --git a/ui/base/l10n/l10n_util.cc b/ui/base/l10n/l10n_util.cc index 426c8b5..3191a51 100644 --- a/ui/base/l10n/l10n_util.cc +++ b/ui/base/l10n/l10n_util.cc @@ -202,7 +202,7 @@ bool IsDuplicateName(const std::string& locale_name) { // Skip all the es_Foo other than es_419 for now. if (base::StartsWithASCII(locale_name, "es_", false)) - return !EndsWith(locale_name, "419", true); + return !base::EndsWith(locale_name, "419", true); for (size_t i = 0; i < arraysize(kDuplicateNames); ++i) { if (base::strcasecmp(kDuplicateNames[i], locale_name.c_str()) == 0) diff --git a/ui/gfx/font_list.cc b/ui/gfx/font_list.cc index aea7396..d0df023 100644 --- a/ui/gfx/font_list.cc +++ b/ui/gfx/font_list.cc @@ -50,7 +50,7 @@ bool FontList::ParseDescription(const std::string& description, // The size takes the form "<INT>px". std::string size_string = styles.back(); styles.pop_back(); - if (!EndsWith(size_string, "px", true /* case_sensitive */)) + if (!base::EndsWith(size_string, "px", true /* case_sensitive */)) return false; size_string.resize(size_string.size() - 2); if (!base::StringToInt(size_string, size_pixels_out) || @@ -100,7 +100,7 @@ void FontList::SetDefaultFontDescription(const std::string& font_description) { // The description string must end with "px" for size in pixel, or must be // the empty string, which specifies to use a single default font. DCHECK(font_description.empty() || - EndsWith(font_description, "px", true)); + base::EndsWith(font_description, "px", true)); g_default_font_description.Get() = font_description; g_default_impl_initialized = false; diff --git a/ui/gfx/font_list_impl.cc b/ui/gfx/font_list_impl.cc index babadb1..4037032 100644 --- a/ui/gfx/font_list_impl.cc +++ b/ui/gfx/font_list_impl.cc @@ -44,7 +44,7 @@ FontListImpl::FontListImpl(const std::string& font_description_string) font_size_(-1) { DCHECK(!font_description_string.empty()); // DCHECK description string ends with "px" for size in pixel. - DCHECK(EndsWith(font_description_string, "px", true)); + DCHECK(base::EndsWith(font_description_string, "px", true)); } FontListImpl::FontListImpl(const std::vector<std::string>& font_names, |