diff options
283 files changed, 691 insertions, 670 deletions
diff --git a/android_webview/native/android_protocol_handler.cc b/android_webview/native/android_protocol_handler.cc index c80d9bd..aaadb14 100644 --- a/android_webview/native/android_protocol_handler.cc +++ b/android_webview/native/android_protocol_handler.cc @@ -252,8 +252,8 @@ bool AssetFileRequestInterceptor::ShouldHandleRequest( return false; const std::string& url = request->url().spec(); - if (!StartsWithASCII(url, asset_prefix_, /*case_sensitive=*/ true) && - !StartsWithASCII(url, resource_prefix_, /*case_sensitive=*/ true)) { + if (!base::StartsWithASCII(url, asset_prefix_, /*case_sensitive=*/ true) && + !base::StartsWithASCII(url, resource_prefix_, /*case_sensitive=*/ true)) { return false; } diff --git a/android_webview/native/aw_media_url_interceptor.cc b/android_webview/native/aw_media_url_interceptor.cc index a2c1cdd..96d3298 100644 --- a/android_webview/native/aw_media_url_interceptor.cc +++ b/android_webview/native/aw_media_url_interceptor.cc @@ -19,7 +19,7 @@ bool AwMediaUrlInterceptor::Intercept(const std::string& url, std::string(url::kStandardSchemeSeparator) + android_webview::kAndroidAssetPath); - if (StartsWithASCII(url, asset_file_prefix, true)) { + if (base::StartsWithASCII(url, asset_file_prefix, true)) { std::string filename(url); ReplaceFirstSubstringAfterOffset( &filename, 0, asset_file_prefix, "assets/"); diff --git a/ash/wm/lock_state_controller.cc b/ash/wm/lock_state_controller.cc index 4448812..9a9d520 100644 --- a/ash/wm/lock_state_controller.cc +++ b/ash/wm/lock_state_controller.cc @@ -493,9 +493,9 @@ void LockStateController::PreLockAnimationFinished(bool request_lock) { // Increase lock timeout for slower hardware, see http://crbug.com/350628 const std::string board = base::SysInfo::GetLsbReleaseBoard(); if (board == "x86-mario" || - StartsWithASCII(board, "x86-alex", true /* case_sensitive */) || - StartsWithASCII(board, "x86-zgb", true /* case_sensitive */) || - StartsWithASCII(board, "daisy", true /* case_sensitive */)) { + base::StartsWithASCII(board, "x86-alex", true /* case_sensitive */) || + base::StartsWithASCII(board, "x86-zgb", true /* case_sensitive */) || + base::StartsWithASCII(board, "daisy", true /* case_sensitive */)) { timeout *= 2; } // Times out on ASAN bots. diff --git a/base/strings/string_util.cc b/base/strings/string_util.cc index cc77693..c1fc056 100644 --- a/base/strings/string_util.cc +++ b/base/strings/string_util.cc @@ -482,8 +482,6 @@ bool EqualsASCII(const string16& a, const StringPiece& b) { return std::equal(b.begin(), b.end(), a.begin()); } -} // namespace base - bool StartsWithASCII(const std::string& str, const std::string& search, bool case_sensitive) { @@ -493,22 +491,19 @@ bool StartsWithASCII(const std::string& str, return base::strncasecmp(str.c_str(), search.c_str(), search.length()) == 0; } -template <typename STR> -bool StartsWithT(const STR& str, const STR& search, bool case_sensitive) { +bool StartsWith(const string16& str, + const string16& search, + bool case_sensitive) { if (case_sensitive) { return str.compare(0, search.length(), search) == 0; - } else { - if (search.size() > str.size()) - return false; - return std::equal(search.begin(), search.end(), str.begin(), - base::CaseInsensitiveCompare<typename STR::value_type>()); } + if (search.size() > str.size()) + return false; + return std::equal(search.begin(), search.end(), str.begin(), + CaseInsensitiveCompare<char16>()); } -bool StartsWith(const string16& str, const string16& search, - bool case_sensitive) { - return StartsWithT(str, search, case_sensitive); -} +} // namespace base template <typename STR> bool EndsWithT(const STR& str, const STR& search, bool case_sensitive) { diff --git a/base/strings/string_util.h b/base/strings/string_util.h index bea44ae..12915f7 100644 --- a/base/strings/string_util.h +++ b/base/strings/string_util.h @@ -315,6 +315,14 @@ BASE_EXPORT bool LowerCaseEqualsASCII(const char16* a_begin, // strings are not ASCII. BASE_EXPORT bool EqualsASCII(const string16& a, const StringPiece& b); +// Returns true if str starts with search, or false otherwise. +BASE_EXPORT bool StartsWithASCII(const std::string& str, + const std::string& search, + bool case_sensitive); +BASE_EXPORT bool StartsWith(const base::string16& str, + const base::string16& search, + bool case_sensitive); + } // namespace base #if defined(OS_WIN) @@ -325,14 +333,6 @@ BASE_EXPORT bool EqualsASCII(const string16& a, const StringPiece& b); #error Define string operations appropriately for your platform #endif -// Returns true if str starts with search, or false otherwise. -BASE_EXPORT bool StartsWithASCII(const std::string& str, - const std::string& search, - bool case_sensitive); -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. BASE_EXPORT bool EndsWith(const std::string& str, const std::string& search, diff --git a/base/test/test_pending_task_unittest.cc b/base/test/test_pending_task_unittest.cc index 32502f2..7623ce4 100644 --- a/base/test/test_pending_task_unittest.cc +++ b/base/test/test_pending_task_unittest.cc @@ -10,7 +10,7 @@ #include "testing/gtest/include/gtest/gtest-spi.h" #include "testing/gtest/include/gtest/gtest.h" -namespace { +namespace base { TEST(TestPendingTaskTest, TraceSupport) { base::TestPendingTask task; @@ -52,4 +52,4 @@ TEST(TestPendingTaskTest, ShouldRunBefore) { << task_first << ".ShouldRunBefore(" << task_after << ")\n"; } -} // namespace +} // namespace base diff --git a/base/win/win_util.cc b/base/win/win_util.cc index c5b06c4..cf93444 100644 --- a/base/win/win_util.cc +++ b/base/win/win_util.cc @@ -32,13 +32,16 @@ #include "base/win/scoped_propvariant.h" #include "base/win/windows_version.h" +namespace base { +namespace win { + namespace { // Sets the value of |property_key| to |property_value| in |property_store|. bool SetPropVariantValueForPropertyStore( IPropertyStore* property_store, const PROPERTYKEY& property_key, - const base::win::ScopedPropVariant& property_value) { + const ScopedPropVariant& property_value) { DCHECK(property_store); HRESULT result = property_store->SetValue(property_key, property_value.get()); @@ -62,7 +65,7 @@ const wchar_t kWindows8OSKRegPath[] = // are attached to the machine. bool IsKeyboardPresentOnSlate() { // This function is only supported for Windows 8 and up. - DCHECK(base::win::GetVersion() >= base::win::VERSION_WIN8); + DCHECK(GetVersion() >= VERSION_WIN8); // This function should be only invoked for machines with touch screens. if ((GetSystemMetrics(SM_DIGITIZER) & NID_INTEGRATED_TOUCH) @@ -160,9 +163,6 @@ bool IsKeyboardPresentOnSlate() { } // namespace -namespace base { -namespace win { - static bool g_crash_on_process_detach = false; void GetNonClientMetrics(NONCLIENTMETRICS_XP* metrics) { @@ -181,7 +181,7 @@ bool GetUserSidString(std::wstring* user_sid) { HANDLE token = NULL; if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token)) return false; - base::win::ScopedHandle token_scoped(token); + ScopedHandle token_scoped(token); DWORD size = sizeof(TOKEN_USER) + SECURITY_MAX_SID_SIZE; scoped_ptr<BYTE[]> user_bytes(new BYTE[size]); @@ -226,11 +226,11 @@ bool UserAccountControlIsEnabled() { // This can be slow if Windows ends up going to disk. Should watch this key // for changes and only read it once, preferably on the file thread. // http://code.google.com/p/chromium/issues/detail?id=61644 - base::ThreadRestrictions::ScopedAllowIO allow_io; + ThreadRestrictions::ScopedAllowIO allow_io; - base::win::RegKey key(HKEY_LOCAL_MACHINE, - L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", - KEY_READ); + RegKey key(HKEY_LOCAL_MACHINE, + L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", + KEY_READ); DWORD uac_enabled; if (key.ReadValueDW(L"EnableLUA", &uac_enabled) != ERROR_SUCCESS) return true; @@ -284,20 +284,20 @@ static const char16 kAutoRunKeyPath[] = bool AddCommandToAutoRun(HKEY root_key, const string16& name, const string16& command) { - base::win::RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_SET_VALUE); + RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_SET_VALUE); return (autorun_key.WriteValue(name.c_str(), command.c_str()) == ERROR_SUCCESS); } bool RemoveCommandFromAutoRun(HKEY root_key, const string16& name) { - base::win::RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_SET_VALUE); + RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_SET_VALUE); return (autorun_key.DeleteValue(name.c_str()) == ERROR_SUCCESS); } bool ReadCommandFromAutoRun(HKEY root_key, const string16& name, string16* command) { - base::win::RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_QUERY_VALUE); + RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_QUERY_VALUE); return (autorun_key.ReadValue(name.c_str(), command) == ERROR_SUCCESS); } @@ -326,8 +326,8 @@ bool IsTabletDevice() { if (GetSystemMetrics(SM_MAXIMUMTOUCHES) == 0) return false; - base::win::Version version = base::win::GetVersion(); - if (version == base::win::VERSION_XP) + Version version = GetVersion(); + if (version == VERSION_XP) return (GetSystemMetrics(SM_TABLETPC) != 0); // If the device is docked, the user is treating the device as a PC. @@ -339,7 +339,7 @@ bool IsTabletDevice() { POWER_PLATFORM_ROLE role = PowerDeterminePlatformRole(); bool mobile_power_profile = (role == PlatformRoleMobile); bool slate_power_profile = false; - if (version >= base::win::VERSION_WIN8) + if (version >= VERSION_WIN8) slate_power_profile = (role == PlatformRoleSlate); if (mobile_power_profile || slate_power_profile) @@ -349,14 +349,13 @@ bool IsTabletDevice() { } bool DisplayVirtualKeyboard() { - if (base::win::GetVersion() < base::win::VERSION_WIN8) + if (GetVersion() < VERSION_WIN8) return false; if (IsKeyboardPresentOnSlate()) return false; - static base::LazyInstance<string16>::Leaky osk_path = - LAZY_INSTANCE_INITIALIZER; + static LazyInstance<string16>::Leaky osk_path = LAZY_INSTANCE_INITIALIZER; if (osk_path.Get().empty()) { // We need to launch TabTip.exe from the location specified under the @@ -367,9 +366,8 @@ bool DisplayVirtualKeyboard() { // We don't want to launch TabTip.exe from // c:\program files (x86)\common files\microsoft shared\ink. This path is // normally found on 64 bit Windows. - base::win::RegKey key(HKEY_LOCAL_MACHINE, - kWindows8OSKRegPath, - KEY_READ | KEY_WOW64_64KEY); + RegKey key(HKEY_LOCAL_MACHINE, kWindows8OSKRegPath, + KEY_READ | KEY_WOW64_64KEY); DWORD osk_path_length = 1024; if (key.ReadValue(NULL, WriteInto(&osk_path.Get(), osk_path_length), @@ -410,7 +408,7 @@ bool DisplayVirtualKeyboard() { common_program_files_path = common_program_files_wow6432.get(); DCHECK(!common_program_files_path.empty()); } else { - base::win::ScopedCoMem<wchar_t> common_program_files; + ScopedCoMem<wchar_t> common_program_files; if (FAILED(SHGetKnownFolderPath(FOLDERID_ProgramFilesCommon, 0, NULL, &common_program_files))) { return false; @@ -432,7 +430,7 @@ bool DisplayVirtualKeyboard() { } bool DismissVirtualKeyboard() { - if (base::win::GetVersion() < base::win::VERSION_WIN8) + if (GetVersion() < VERSION_WIN8) return false; // We dismiss the virtual keyboard by generating the ESC keystroke @@ -474,21 +472,21 @@ void SetDomainStateForTesting(bool state) { } bool MaybeHasSHA256Support() { - const base::win::OSInfo* os_info = base::win::OSInfo::GetInstance(); + const OSInfo* os_info = OSInfo::GetInstance(); - if (os_info->version() == base::win::VERSION_PRE_XP) + if (os_info->version() == VERSION_PRE_XP) return false; // Too old to have it and this OS is not supported anyway. - if (os_info->version() == base::win::VERSION_XP) + if (os_info->version() == VERSION_XP) return os_info->service_pack().major >= 3; // Windows XP SP3 has it. // Assume it is missing in this case, although it may not be. This category // includes Windows XP x64, and Windows Server, where a hotfix could be // deployed. - if (os_info->version() == base::win::VERSION_SERVER_2003) + if (os_info->version() == VERSION_SERVER_2003) return false; - DCHECK(os_info->version() >= base::win::VERSION_VISTA); + DCHECK(os_info->version() >= VERSION_VISTA); return true; // New enough to have SHA-256 support. } diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index af1c4b8..2e85e865 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -2822,7 +2822,7 @@ void ReportCustomFlags(const std::string& uma_histogram_hame, const std::set<std::string>& command_line_difference) { for (const std::string& flag : command_line_difference) { int uma_id = about_flags::testing::kBadSwitchFormatHistogramId; - if (StartsWithASCII(flag, "--", true /* case_sensitive */)) { + if (base::StartsWithASCII(flag, "--", true /* case_sensitive */)) { // Skip '--' before switch name. std::string switch_name(flag.substr(2)); diff --git a/chrome/browser/android/preferences/website_preference_bridge.cc b/chrome/browser/android/preferences/website_preference_bridge.cc index eded547..9d575d7 100644 --- a/chrome/browser/android/preferences/website_preference_bridge.cc +++ b/chrome/browser/android/preferences/website_preference_bridge.cc @@ -74,11 +74,11 @@ static void GetOrigins(JNIEnv* env, const char* kHttpPortSuffix = ":80"; const char* kHttpsPortSuffix = ":443"; ScopedJavaLocalRef<jstring> jorigin; - if (StartsWithASCII(origin, url::kHttpsScheme, false) && + if (base::StartsWithASCII(origin, url::kHttpsScheme, false) && EndsWith(origin, kHttpsPortSuffix, false)) { jorigin = ConvertUTF8ToJavaString( env, origin.substr(0, origin.size() - strlen(kHttpsPortSuffix))); - } else if (StartsWithASCII(origin, url::kHttpScheme, false) && + } else if (base::StartsWithASCII(origin, url::kHttpScheme, false) && EndsWith(origin, kHttpPortSuffix, false)) { jorigin = ConvertUTF8ToJavaString( env, origin.substr(0, origin.size() - strlen(kHttpPortSuffix))); diff --git a/chrome/browser/apps/guest_view/web_view_browsertest.cc b/chrome/browser/apps/guest_view/web_view_browsertest.cc index 7e023e5..bbe1cd8 100644 --- a/chrome/browser/apps/guest_view/web_view_browsertest.cc +++ b/chrome/browser/apps/guest_view/web_view_browsertest.cc @@ -540,13 +540,13 @@ class WebViewTest : public extensions::PlatformAppBrowserTest { const std::string& path, const GURL& redirect_target, const net::test_server::HttpRequest& request) { - if (!StartsWithASCII(path, request.relative_url, true)) + if (!base::StartsWithASCII(path, request.relative_url, true)) return scoped_ptr<net::test_server::HttpResponse>(); std::map<std::string, std::string>::const_iterator it = request.headers.find("User-Agent"); EXPECT_TRUE(it != request.headers.end()); - if (!StartsWithASCII("foobar", it->second, true)) + if (!base::StartsWithASCII("foobar", it->second, true)) return scoped_ptr<net::test_server::HttpResponse>(); scoped_ptr<net::test_server::BasicHttpResponse> http_response( @@ -561,7 +561,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest { const std::string& path, const GURL& redirect_target, const net::test_server::HttpRequest& request) { - if (!StartsWithASCII(path, request.relative_url, true)) + if (!base::StartsWithASCII(path, request.relative_url, true)) return scoped_ptr<net::test_server::HttpResponse>(); scoped_ptr<net::test_server::BasicHttpResponse> http_response( @@ -575,7 +575,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest { static scoped_ptr<net::test_server::HttpResponse> EmptyResponseHandler( const std::string& path, const net::test_server::HttpRequest& request) { - if (StartsWithASCII(path, request.relative_url, true)) + if (base::StartsWithASCII(path, request.relative_url, true)) return scoped_ptr<net::test_server::HttpResponse>(new EmptyHttpResponse); return scoped_ptr<net::test_server::HttpResponse>(); @@ -585,7 +585,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest { static scoped_ptr<net::test_server::HttpResponse> CacheControlResponseHandler( const std::string& path, const net::test_server::HttpRequest& request) { - if (!StartsWithASCII(path, request.relative_url, true)) + if (!base::StartsWithASCII(path, request.relative_url, true)) return scoped_ptr<net::test_server::HttpResponse>(); scoped_ptr<net::test_server::BasicHttpResponse> http_response( diff --git a/chrome/browser/autocomplete/builtin_provider.cc b/chrome/browser/autocomplete/builtin_provider.cc index d3bd7a7..431ab46 100644 --- a/chrome/browser/autocomplete/builtin_provider.cc +++ b/chrome/browser/autocomplete/builtin_provider.cc @@ -81,8 +81,8 @@ void BuiltinProvider::Start(const AutocompleteInput& input, const int kMatch = kUrl | ACMatchClassification::MATCH; base::string16 text = input.text(); - bool starting_chrome = StartsWith(kChrome, text, false); - if (starting_chrome || StartsWith(kAbout, text, false)) { + bool starting_chrome = base::StartsWith(kChrome, text, false); + if (starting_chrome || base::StartsWith(kAbout, text, false)) { ACMatchClassifications styles; // Highlight the input portion matching "chrome://"; or if the user has // input "about:" (with optional slashes), highlight the whole "chrome://". @@ -111,8 +111,10 @@ void BuiltinProvider::Start(const AutocompleteInput& input, // Chrome does not support trailing slashes or paths for about:blank. const base::string16 blank_host = base::ASCIIToUTF16("blank"); const base::string16 host = base::UTF8ToUTF16(url.host()); - if (StartsWith(text, base::ASCIIToUTF16(url::kAboutScheme), false) && - StartsWith(blank_host, host, false) && (url.path().length() <= 1) && + if (base::StartsWith(text, base::ASCIIToUTF16(url::kAboutScheme), + false) && + base::StartsWith(blank_host, host, false) && + (url.path().length() <= 1) && !EndsWith(text, base::ASCIIToUTF16("/"), false)) { ACMatchClassifications styles; styles.push_back(ACMatchClassification(0, kMatch)); @@ -130,7 +132,7 @@ void BuiltinProvider::Start(const AutocompleteInput& input, size_t match_length = kChrome.length() + host_and_path.length(); for (Builtins::const_iterator i(builtins_.begin()); (i != builtins_.end()) && (matches_.size() < kMaxMatches); ++i) { - if (StartsWith(*i, host_and_path, false)) { + if (base::StartsWith(*i, host_and_path, false)) { ACMatchClassifications styles; // Highlight the "chrome://" scheme, even for input "about:foo". styles.push_back(ACMatchClassification(0, kMatch)); diff --git a/chrome/browser/autocomplete/shortcuts_backend.cc b/chrome/browser/autocomplete/shortcuts_backend.cc index 003be70..4768209 100644 --- a/chrome/browser/autocomplete/shortcuts_backend.cc +++ b/chrome/browser/autocomplete/shortcuts_backend.cc @@ -131,9 +131,10 @@ void ShortcutsBackend::AddOrUpdateShortcut(const base::string16& text, const base::string16 text_lowercase(base::i18n::ToLower(text)); const base::Time now(base::Time::Now()); for (ShortcutMap::const_iterator it( - shortcuts_map_.lower_bound(text_lowercase)); + shortcuts_map_.lower_bound(text_lowercase)); it != shortcuts_map_.end() && - StartsWith(it->first, text_lowercase, true); ++it) { + base::StartsWith(it->first, text_lowercase, true); + ++it) { if (match.destination_url == it->second.match_core.destination_url) { UpdateShortcut(ShortcutsDatabase::Shortcut( it->second.id, text, MatchToMatchCore(match, profile_), now, @@ -315,10 +316,10 @@ bool ShortcutsBackend::DeleteShortcutsWithURL(const GURL& url, const std::string& url_spec = url.spec(); ShortcutsDatabase::ShortcutIDs shortcut_ids; for (GuidMap::iterator it(guid_map_.begin()); it != guid_map_.end(); ) { - if (exact_match ? - (it->second->second.match_core.destination_url == url) : - StartsWithASCII(it->second->second.match_core.destination_url.spec(), - url_spec, true)) { + if (exact_match ? (it->second->second.match_core.destination_url == url) + : base::StartsWithASCII( + it->second->second.match_core.destination_url.spec(), + url_spec, true)) { shortcut_ids.push_back(it->first); shortcuts_map_.erase(it->second); guid_map_.erase(it++); diff --git a/chrome/browser/autocomplete/shortcuts_provider.cc b/chrome/browser/autocomplete/shortcuts_provider.cc index 443eb72..dc46d0c 100644 --- a/chrome/browser/autocomplete/shortcuts_provider.cc +++ b/chrome/browser/autocomplete/shortcuts_provider.cc @@ -146,7 +146,8 @@ void ShortcutsProvider::GetMatches(const AutocompleteInput& input) { for (ShortcutsBackend::ShortcutMap::const_iterator it = FindFirstMatch(term_string, backend.get()); it != backend->shortcuts_map().end() && - StartsWith(it->first, term_string, true); ++it) { + base::StartsWith(it->first, term_string, true); + ++it) { // Don't return shortcuts with zero relevance. int relevance = CalculateScore(term_string, it->second, max_relevance); if (relevance) { @@ -216,7 +217,7 @@ AutocompleteMatch ShortcutsProvider::ShortcutToACMatch( // input of "foo.c" to autocomplete to "foo.com" for a fill_into_edit of // "http://foo.com". if (AutocompleteMatch::IsSearchType(match.type)) { - if (StartsWith(match.fill_into_edit, input.text(), false)) { + if (base::StartsWith(match.fill_into_edit, input.text(), false)) { match.inline_autocompletion = match.fill_into_edit.substr(input.text().length()); match.allowed_to_be_default_match = @@ -304,7 +305,7 @@ ACMatchClassifications ShortcutsProvider::ClassifyAllMatchesInString( base::string16 text_lowercase(base::i18n::ToLower(text)); ACMatchClassifications match_class; size_t last_position = 0; - if (StartsWith(text_lowercase, find_text, true)) { + if (base::StartsWith(text_lowercase, find_text, true)) { match_class.push_back( ACMatchClassification(0, ACMatchClassification::MATCH)); last_position = find_text.length(); @@ -368,8 +369,9 @@ ShortcutsBackend::ShortcutMap::const_iterator // Lower bound not necessarily matches the keyword, check for item pointed by // the lower bound iterator to at least start with keyword. return ((it == backend->shortcuts_map().end()) || - StartsWith(it->first, keyword, true)) ? it : - backend->shortcuts_map().end(); + base::StartsWith(it->first, keyword, true)) + ? it + : backend->shortcuts_map().end(); } int ShortcutsProvider::CalculateScore( diff --git a/chrome/browser/autocomplete/url_index_private_data.cc b/chrome/browser/autocomplete/url_index_private_data.cc index 2b11380..68943f4 100644 --- a/chrome/browser/autocomplete/url_index_private_data.cc +++ b/chrome/browser/autocomplete/url_index_private_data.cc @@ -564,7 +564,7 @@ HistoryIDSet URLIndexPrivateData::HistoryIDsForTerm( SearchTermCacheMap::iterator best_prefix(search_term_cache_.end()); for (SearchTermCacheMap::iterator cache_iter = search_term_cache_.begin(); cache_iter != search_term_cache_.end(); ++cache_iter) { - if (StartsWith(term, cache_iter->first, false) && + if (base::StartsWith(term, cache_iter->first, false) && (best_prefix == search_term_cache_.end() || cache_iter->first.length() > best_prefix->first.length())) best_prefix = cache_iter; diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc index c280cb8..2da8bad 100644 --- a/chrome/browser/autofill/autofill_browsertest.cc +++ b/chrome/browser/autofill/autofill_browsertest.cc @@ -246,7 +246,7 @@ class AutofillTest : public InProcessBrowserTest { base::SplitString(data, '\n', &lines); int parsed_profiles = 0; for (size_t i = 0; i < lines.size(); ++i) { - if (StartsWithASCII(lines[i], "#", false)) + if (base::StartsWithASCII(lines[i], "#", false)) continue; std::vector<std::string> fields; diff --git a/chrome/browser/chromeos/chromeos_utils.cc b/chrome/browser/chromeos/chromeos_utils.cc index c6777e5..e93a5ec9 100644 --- a/chrome/browser/chromeos/chromeos_utils.cc +++ b/chrome/browser/chromeos/chromeos_utils.cc @@ -53,15 +53,15 @@ base::string16 GetChromeDeviceType() { int GetChromeDeviceTypeResourceId() { const std::string board = base::SysInfo::GetLsbReleaseBoard(); for (size_t i = 0; i < arraysize(kChromeboxBoards); ++i) { - if (StartsWithASCII(board, kChromeboxBoards[i], true)) + if (base::StartsWithASCII(board, kChromeboxBoards[i], true)) return IDS_CHROMEBOX; } for (size_t i = 0; i < arraysize(kChromebaseBoards); ++i) { - if (StartsWithASCII(board, kChromebaseBoards[i], true)) + if (base::StartsWithASCII(board, kChromebaseBoards[i], true)) return IDS_CHROMEBASE; } for (size_t i = 0; i < arraysize(kChromebitBoards); ++i) { - if (StartsWithASCII(board, kChromebitBoards[i], true)) + if (base::StartsWithASCII(board, kChromebitBoards[i], true)) return IDS_CHROMEBIT; } return IDS_CHROMEBOOK; diff --git a/chrome/browser/chromeos/drive/file_system_util.cc b/chrome/browser/chromeos/drive/file_system_util.cc index 3781eef..1c70e99 100644 --- a/chrome/browser/chromeos/drive/file_system_util.cc +++ b/chrome/browser/chromeos/drive/file_system_util.cc @@ -184,7 +184,7 @@ base::FilePath ExtractDrivePath(const base::FilePath& path) { return base::FilePath(); if (components[1] != FILE_PATH_LITERAL("special")) return base::FilePath(); - if (!StartsWithASCII(components[2], "drive", true)) + if (!base::StartsWithASCII(components[2], "drive", true)) return base::FilePath(); base::FilePath drive_path = GetDriveGrandRootPath(); diff --git a/chrome/browser/chromeos/file_manager/file_tasks.cc b/chrome/browser/chromeos/file_manager/file_tasks.cc index d4cb77e..b70c7b7 100644 --- a/chrome/browser/chromeos/file_manager/file_tasks.cc +++ b/chrome/browser/chromeos/file_manager/file_tasks.cc @@ -228,7 +228,7 @@ bool ParseTaskID(const std::string& task_id, TaskDescriptor* task) { // identified by a prefix "drive-app:" on the extension ID. The legacy task // IDs can be stored in preferences. if (count == 2) { - if (StartsWithASCII(result[0], kDriveTaskExtensionPrefix, true)) { + if (base::StartsWithASCII(result[0], kDriveTaskExtensionPrefix, true)) { task->task_type = TASK_TYPE_DRIVE_APP; task->app_id = result[0].substr(kDriveTaskExtensionPrefixLength); } else { diff --git a/chrome/browser/chromeos/input_method/input_method_engine.cc b/chrome/browser/chromeos/input_method/input_method_engine.cc index 32c125d..c25ff77 100644 --- a/chrome/browser/chromeos/input_method/input_method_engine.cc +++ b/chrome/browser/chromeos/input_method/input_method_engine.cc @@ -72,13 +72,13 @@ size_t GetUtf8StringLength(const char* s) { std::string GetKeyFromEvent(const ui::KeyEvent& event) { const std::string code = event.GetCodeString(); - if (StartsWithASCII(code, "Control", true)) + if (base::StartsWithASCII(code, "Control", true)) return "Ctrl"; - if (StartsWithASCII(code, "Shift", true)) + if (base::StartsWithASCII(code, "Shift", true)) return "Shift"; - if (StartsWithASCII(code, "Alt", true)) + if (base::StartsWithASCII(code, "Alt", true)) return "Alt"; - if (StartsWithASCII(code, "Arrow", true)) + if (base::StartsWithASCII(code, "Arrow", true)) return code.substr(5); if (code == "Escape") return "Esc"; diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc index 7baeec4..d658efc 100644 --- a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc +++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc @@ -70,22 +70,22 @@ InputMethodCategory GetInputMethodCategory(const std::string& input_method_id, extension_ime_util::GetComponentIDByInputMethodID(input_method_id); InputMethodCategory category = INPUT_METHOD_CATEGORY_UNKNOWN; char ch = 0; - if (StartsWithASCII(component_id, "xkb:", true)) { + if (base::StartsWithASCII(component_id, "xkb:", true)) { ch = component_id[4]; category = INPUT_METHOD_CATEGORY_XKB; - } else if (StartsWithASCII(component_id, "zh-", true)) { + } else if (base::StartsWithASCII(component_id, "zh-", true)) { size_t pos = component_id.find("-t-i0-"); if (pos > 0) pos += 6; ch = component_id[pos]; category = INPUT_METHOD_CATEGORY_ZH; - } else if (StartsWithASCII(component_id, "nacl_mozc_", true)) { + } else if (base::StartsWithASCII(component_id, "nacl_mozc_", true)) { ch = component_id[10]; category = INPUT_METHOD_CATEGORY_JA; - } else if (StartsWithASCII(component_id, "hangul_", true)) { + } else if (base::StartsWithASCII(component_id, "hangul_", true)) { ch = component_id[7]; category = INPUT_METHOD_CATEGORY_KO; - } else if (StartsWithASCII(component_id, "vkd_", true)) { + } else if (base::StartsWithASCII(component_id, "vkd_", true)) { ch = component_id[4]; category = INPUT_METHOD_CATEGORY_M17N; } else if (component_id.find("-t-i0-") > 0) { diff --git a/chrome/browser/chromeos/input_method/input_method_util.cc b/chrome/browser/chromeos/input_method/input_method_util.cc index f565d13..ca66fa5 100644 --- a/chrome/browser/chromeos/input_method/input_method_util.cc +++ b/chrome/browser/chromeos/input_method/input_method_util.cc @@ -429,8 +429,8 @@ bool InputMethodUtil::IsValidInputMethodId( // static bool InputMethodUtil::IsKeyboardLayout(const std::string& input_method_id) { - return StartsWithASCII(input_method_id, "xkb:", false) || - extension_ime_util::IsKeyboardLayoutExtension(input_method_id); + return base::StartsWithASCII(input_method_id, "xkb:", false) || + extension_ime_util::IsKeyboardLayoutExtension(input_method_id); } std::string InputMethodUtil::GetKeyboardLayoutName( diff --git a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc index 136ce50..470c1db 100644 --- a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc +++ b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc @@ -383,7 +383,7 @@ class WizardControllerTestURLFetcherFactory const GURL& url, net::URLFetcher::RequestType request_type, net::URLFetcherDelegate* d) override { - if (StartsWithASCII( + if (base::StartsWithASCII( url.spec(), SimpleGeolocationProvider::DefaultGeolocationProviderURL().spec(), true)) { @@ -391,9 +391,8 @@ class WizardControllerTestURLFetcherFactory url, d, std::string(kGeolocationResponseBody), net::HTTP_OK, net::URLRequestStatus::SUCCESS)); } - if (StartsWithASCII(url.spec(), - chromeos::DefaultTimezoneProviderURL().spec(), - true)) { + if (base::StartsWithASCII( + url.spec(), chromeos::DefaultTimezoneProviderURL().spec(), true)) { return scoped_ptr<net::URLFetcher>(new net::FakeURLFetcher( url, d, std::string(kTimezoneResponseBody), net::HTTP_OK, net::URLRequestStatus::SUCCESS)); diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc index 6a0b46e..af19f7d 100644 --- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc +++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc @@ -212,9 +212,8 @@ class UserCloudPolicyManagerChromeOSTest : public testing::Test { if (!fetcher) return NULL; EXPECT_TRUE(fetcher->delegate()); - EXPECT_TRUE(StartsWithASCII(fetcher->GetOriginalURL().spec(), - expected_url.spec(), - true)); + EXPECT_TRUE(base::StartsWithASCII(fetcher->GetOriginalURL().spec(), + expected_url.spec(), true)); fetcher->set_url(fetcher->GetOriginalURL()); fetcher->set_response_code(200); fetcher->set_status(net::URLRequestStatus()); diff --git a/chrome/browser/chromeos/policy/variations_service_policy_browsertest.cc b/chrome/browser/chromeos/policy/variations_service_policy_browsertest.cc index 8050393..7cb63ab 100644 --- a/chrome/browser/chromeos/policy/variations_service_policy_browsertest.cc +++ b/chrome/browser/chromeos/policy/variations_service_policy_browsertest.cc @@ -44,7 +44,7 @@ IN_PROC_BROWSER_TEST_F(VariationsServiceDevicePolicyTest, VariationsURLValid) { // Device policy has updated the cros settings. const GURL url = chrome_variations::VariationsService::GetVariationsServerURL( g_browser_process->local_state(), std::string()); - EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); + EXPECT_TRUE(base::StartsWithASCII(url.spec(), default_variations_url, true)); std::string value; EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); EXPECT_EQ("restricted", value); diff --git a/chrome/browser/chromeos/power/peripheral_battery_observer.cc b/chrome/browser/chromeos/power/peripheral_battery_observer.cc index a36a5edc73..fc17ebf 100644 --- a/chrome/browser/chromeos/power/peripheral_battery_observer.cc +++ b/chrome/browser/chromeos/power/peripheral_battery_observer.cc @@ -49,8 +49,8 @@ const char kHIDBatteryPathPrefix[] = "/sys/class/power_supply/hid-"; const char kHIDBatteryPathSuffix[] = "-battery"; bool IsBluetoothHIDBattery(const std::string& path) { - return StartsWithASCII(path, kHIDBatteryPathPrefix, false) && - EndsWith(path, kHIDBatteryPathSuffix, false); + return base::StartsWithASCII(path, kHIDBatteryPathPrefix, false) && + EndsWith(path, kHIDBatteryPathSuffix, false); } std::string ExtractBluetoothAddress(const std::string& path) { diff --git a/chrome/browser/chromeos/proxy_cros_settings_parser.cc b/chrome/browser/chromeos/proxy_cros_settings_parser.cc index 0f9be54..500e7c6 100644 --- a/chrome/browser/chromeos/proxy_cros_settings_parser.cc +++ b/chrome/browser/chromeos/proxy_cros_settings_parser.cc @@ -112,7 +112,7 @@ net::ProxyServer CreateProxyServerFromPort( namespace proxy_cros_settings_parser { bool IsProxyPref(const std::string& path) { - return StartsWithASCII(path, kProxyPrefsPrefix, true); + return base::StartsWithASCII(path, kProxyPrefsPrefix, true); } void SetProxyPrefValue(const std::string& path, @@ -247,11 +247,10 @@ void SetProxyPrefValue(const std::string& path, if (in_value->GetAsString(&val)) { config.SetProxyForScheme( "socks", CreateProxyServerFromHost( - val, - config.socks_proxy, - StartsWithASCII(val, "socks5://", false) ? - net::ProxyServer::SCHEME_SOCKS5 : - net::ProxyServer::SCHEME_SOCKS4)); + val, config.socks_proxy, + base::StartsWithASCII(val, "socks5://", false) + ? net::ProxyServer::SCHEME_SOCKS5 + : net::ProxyServer::SCHEME_SOCKS4)); } } else if (path == kProxySocksPort) { int val; @@ -259,11 +258,10 @@ void SetProxyPrefValue(const std::string& path, std::string host = config.socks_proxy.server.host_port_pair().host(); config.SetProxyForScheme( "socks", CreateProxyServerFromPort( - val, - config.socks_proxy, - StartsWithASCII(host, "socks5://", false) ? - net::ProxyServer::SCHEME_SOCKS5 : - net::ProxyServer::SCHEME_SOCKS4)); + val, config.socks_proxy, + base::StartsWithASCII(host, "socks5://", false) + ? net::ProxyServer::SCHEME_SOCKS5 + : net::ProxyServer::SCHEME_SOCKS4)); } } else if (path == kProxyIgnoreList) { net::ProxyBypassRules bypass_rules; diff --git a/chrome/browser/chromeos/settings/cros_settings.cc b/chrome/browser/chromeos/settings/cros_settings.cc index 016b33a..b981b37 100644 --- a/chrome/browser/chromeos/settings/cros_settings.cc +++ b/chrome/browser/chromeos/settings/cros_settings.cc @@ -86,7 +86,7 @@ CrosSettings::~CrosSettings() { } bool CrosSettings::IsCrosSettings(const std::string& path) { - return StartsWithASCII(path, kCrosSettingsPrefix, true); + return base::StartsWithASCII(path, kCrosSettingsPrefix, true); } void CrosSettings::Set(const std::string& path, const base::Value& in_value) { diff --git a/chrome/browser/chromeos/system_logs/touch_log_source_ozone.cc b/chrome/browser/chromeos/system_logs/touch_log_source_ozone.cc index 030536d..29d8eb5 100644 --- a/chrome/browser/chromeos/system_logs/touch_log_source_ozone.cc +++ b/chrome/browser/chromeos/system_logs/touch_log_source_ozone.cc @@ -65,7 +65,7 @@ std::string GetEventLogListOfOnePrefix( std::string log_list; for (size_t i = 0; i < log_paths.size(); ++i) { const std::string basename = log_paths[i].BaseName().value(); - if (StartsWithASCII(basename, prefix, true)) { + if (base::StartsWithASCII(basename, prefix, true)) { log_list.append(" " + log_paths[i].value()); // Limit the max number of collected logs to shorten the log collection diff --git a/chrome/browser/component_updater/cld_component_installer_unittest.cc b/chrome/browser/component_updater/cld_component_installer_unittest.cc index fe1efcd..e3833f1 100644 --- a/chrome/browser/component_updater/cld_component_installer_unittest.cc +++ b/chrome/browser/component_updater/cld_component_installer_unittest.cc @@ -126,8 +126,8 @@ TEST_F(CldComponentInstallerTest, ComponentReady) { const base::Version version("1.2.3.4"); traits_.ComponentReady(version, install_dir, manifest.Pass()); base::FilePath result = CldComponentInstallerTraits::GetLatestCldDataFile(); - ASSERT_TRUE( - StartsWith(result.AsUTF16Unsafe(), install_dir.AsUTF16Unsafe(), true)); + ASSERT_TRUE(base::StartsWith(result.AsUTF16Unsafe(), + install_dir.AsUTF16Unsafe(), true)); ASSERT_TRUE(EndsWith(result.value(), kTestCldDataFileName, true)); } diff --git a/chrome/browser/enumerate_modules_model_win.cc b/chrome/browser/enumerate_modules_model_win.cc index 15c53dc..4a23e1d 100644 --- a/chrome/browser/enumerate_modules_model_win.cc +++ b/chrome/browser/enumerate_modules_model_win.cc @@ -690,7 +690,7 @@ void ModuleEnumerator::CollapsePath(Module* entry) { for (PathMapping::const_iterator mapping = path_mapping_.begin(); mapping != path_mapping_.end(); ++mapping) { base::string16 prefix = mapping->first; - if (StartsWith(location, prefix, false)) { + if (base::StartsWith(location, prefix, false)) { base::string16 new_location = mapping->second + location.substr(prefix.length() - 1); size_t length = new_location.length() - mapping->second.length(); @@ -734,8 +734,8 @@ void ModuleEnumerator::MatchAgainstBlacklist() { // for blacklisting individually. Mark them as suspicious if we haven't // classified them as bad yet. if (module->status == NOT_MATCHED || module->status == GOOD) { - if (StartsWith(module->location, L"%temp%", false) || - StartsWith(module->location, L"%tmp%", false)) { + if (base::StartsWith(module->location, L"%temp%", false) || + base::StartsWith(module->location, L"%tmp%", false)) { module->status = SUSPECTED_BAD; } } diff --git a/chrome/browser/extensions/activity_log/activity_actions.cc b/chrome/browser/extensions/activity_log/activity_actions.cc index b22d434..6d6db0d 100644 --- a/chrome/browser/extensions/activity_log/activity_actions.cc +++ b/chrome/browser/extensions/activity_log/activity_actions.cc @@ -191,7 +191,8 @@ std::string Action::SerializePageUrl() const { } void Action::ParsePageUrl(const std::string& url) { - set_page_incognito(StartsWithASCII(url, constants::kIncognitoUrl, true)); + set_page_incognito( + base::StartsWithASCII(url, constants::kIncognitoUrl, true)); if (page_incognito()) set_page_url(GURL(url.substr(strlen(constants::kIncognitoUrl)))); else @@ -203,7 +204,7 @@ std::string Action::SerializeArgUrl() const { } void Action::ParseArgUrl(const std::string& url) { - set_arg_incognito(StartsWithASCII(url, constants::kIncognitoUrl, true)); + set_arg_incognito(base::StartsWithASCII(url, constants::kIncognitoUrl, true)); if (arg_incognito()) set_arg_url(GURL(url.substr(strlen(constants::kIncognitoUrl)))); else diff --git a/chrome/browser/extensions/activity_log/activity_log.cc b/chrome/browser/extensions/activity_log/activity_log.cc index 9963a25..6a8263c 100644 --- a/chrome/browser/extensions/activity_log/activity_log.cc +++ b/chrome/browser/extensions/activity_log/activity_log.cc @@ -521,7 +521,7 @@ void ActivityLog::LogAction(scoped_refptr<Action> action) { // Mark DOM XHR requests as such, for easier processing later. if (action->action_type() == Action::ACTION_DOM_ACCESS && - StartsWithASCII(action->api_name(), kDomXhrPrefix, true) && + base::StartsWithASCII(action->api_name(), kDomXhrPrefix, true) && action->other()) { base::DictionaryValue* other = action->mutable_other(); int dom_verb = -1; diff --git a/chrome/browser/extensions/api/commands/command_service.cc b/chrome/browser/extensions/api/commands/command_service.cc index 7503726..45be93b 100644 --- a/chrome/browser/extensions/api/commands/command_service.cc +++ b/chrome/browser/extensions/api/commands/command_service.cc @@ -69,7 +69,7 @@ std::string GetPlatformKeybindingKeyForAccelerator( } bool IsForCurrentPlatform(const std::string& key) { - return StartsWithASCII(key, Command::CommandPlatform() + ":", true); + return base::StartsWithASCII(key, Command::CommandPlatform() + ":", true); } std::string StripCurrentPlatform(const std::string& key) { diff --git a/chrome/browser/extensions/api/extension_action/extension_action_api.cc b/chrome/browser/extensions/api/extension_action/extension_action_api.cc index 0cc5bfa..c011538 100644 --- a/chrome/browser/extensions/api/extension_action/extension_action_api.cc +++ b/chrome/browser/extensions/api/extension_action/extension_action_api.cc @@ -376,7 +376,7 @@ ExtensionActionFunction::~ExtensionActionFunction() { bool ExtensionActionFunction::RunSync() { ExtensionActionManager* manager = ExtensionActionManager::Get(GetProfile()); - if (StartsWithASCII(name(), "systemIndicator.", false)) { + if (base::StartsWithASCII(name(), "systemIndicator.", false)) { extension_action_ = manager->GetSystemIndicator(*extension()); } else { extension_action_ = manager->GetBrowserAction(*extension()); diff --git a/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc b/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc index 821a886..414a05a 100644 --- a/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc +++ b/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc @@ -31,7 +31,7 @@ namespace { // This is undesirable, strip it if it exists. std::string StripFakepath(const std::string& path) { const char kFakePathStr[] = "C:\\fakepath\\"; - if (StartsWithASCII(path, kFakePathStr, false)) + if (base::StartsWithASCII(path, kFakePathStr, false)) return path.substr(arraysize(kFakePathStr) - 1); return path; } diff --git a/chrome/browser/extensions/api/identity/gaia_web_auth_flow.cc b/chrome/browser/extensions/api/identity/gaia_web_auth_flow.cc index 9e1d497..3301db8 100644 --- a/chrome/browser/extensions/api/identity/gaia_web_auth_flow.cc +++ b/chrome/browser/extensions/api/identity/gaia_web_auth_flow.cc @@ -179,7 +179,7 @@ void GaiaWebAuthFlow::OnAuthFlowURLChange(const GURL& url) { // interpreted as a path, including the fragment. if (url.scheme() == redirect_scheme_ && !url.has_host() && !url.has_port() && - StartsWithASCII(url.GetContent(), redirect_path_prefix_, true)) { + base::StartsWithASCII(url.GetContent(), redirect_path_prefix_, true)) { web_flow_.release()->DetachDelegateAndDelete(); std::string fragment = url.GetContent().substr( @@ -223,7 +223,7 @@ void GaiaWebAuthFlow::OnAuthFlowTitleChange(const std::string& title) { const char kRedirectPrefix[] = "Loading "; std::string prefix(kRedirectPrefix); - if (StartsWithASCII(title, prefix, true)) { + if (base::StartsWithASCII(title, prefix, true)) { GURL url(title.substr(prefix.length(), std::string::npos)); if (url.is_valid()) OnAuthFlowURLChange(url); diff --git a/chrome/browser/extensions/api/identity/identity_apitest.cc b/chrome/browser/extensions/api/identity/identity_apitest.cc index f406ec2..0850b45 100644 --- a/chrome/browser/extensions/api/identity/identity_apitest.cc +++ b/chrome/browser/extensions/api/identity/identity_apitest.cc @@ -801,7 +801,7 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, func->set_mint_token_result(TestOAuth2MintTokenFlow::MINT_TOKEN_FAILURE); std::string error = utils::RunFunctionAndReturnError(func.get(), "[{}]", browser()); - EXPECT_TRUE(StartsWithASCII(error, errors::kAuthFailure, false)); + EXPECT_TRUE(base::StartsWithASCII(error, errors::kAuthFailure, false)); EXPECT_FALSE(func->login_ui_shown()); EXPECT_FALSE(func->scope_ui_shown()); } @@ -814,7 +814,7 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, func->set_login_access_token_result(false); std::string error = utils::RunFunctionAndReturnError( func.get(), "[{}]", browser()); - EXPECT_TRUE(StartsWithASCII(error, errors::kAuthFailure, false)); + EXPECT_TRUE(base::StartsWithASCII(error, errors::kAuthFailure, false)); } IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, @@ -843,7 +843,7 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, TestOAuth2MintTokenFlow::MINT_TOKEN_BAD_CREDENTIALS); std::string error = utils::RunFunctionAndReturnError(func.get(), "[{}]", browser()); - EXPECT_TRUE(StartsWithASCII(error, errors::kAuthFailure, false)); + EXPECT_TRUE(base::StartsWithASCII(error, errors::kAuthFailure, false)); EXPECT_FALSE(func->login_ui_shown()); EXPECT_FALSE(func->scope_ui_shown()); } @@ -857,7 +857,7 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, TestOAuth2MintTokenFlow::MINT_TOKEN_SERVICE_ERROR); std::string error = utils::RunFunctionAndReturnError(func.get(), "[{}]", browser()); - EXPECT_TRUE(StartsWithASCII(error, errors::kAuthFailure, false)); + EXPECT_TRUE(base::StartsWithASCII(error, errors::kAuthFailure, false)); EXPECT_FALSE(func->login_ui_shown()); EXPECT_FALSE(func->scope_ui_shown()); } @@ -959,7 +959,7 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, func->set_mint_token_result(TestOAuth2MintTokenFlow::MINT_TOKEN_FAILURE); std::string error = utils::RunFunctionAndReturnError( func.get(), "[{\"interactive\": true}]", browser()); - EXPECT_TRUE(StartsWithASCII(error, errors::kAuthFailure, false)); + EXPECT_TRUE(base::StartsWithASCII(error, errors::kAuthFailure, false)); EXPECT_TRUE(func->login_ui_shown()); EXPECT_FALSE(func->scope_ui_shown()); } @@ -972,7 +972,7 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, func->set_login_access_token_result(false); std::string error = utils::RunFunctionAndReturnError( func.get(), "[{\"interactive\": true}]", browser()); - EXPECT_TRUE(StartsWithASCII(error, errors::kAuthFailure, false)); + EXPECT_TRUE(base::StartsWithASCII(error, errors::kAuthFailure, false)); EXPECT_TRUE(func->login_ui_shown()); EXPECT_FALSE(func->scope_ui_shown()); } @@ -1076,7 +1076,7 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, func->set_scope_ui_failure(GaiaWebAuthFlow::SERVICE_AUTH_ERROR); std::string error = utils::RunFunctionAndReturnError( func.get(), "[{\"interactive\": true}]", browser()); - EXPECT_TRUE(StartsWithASCII(error, errors::kAuthFailure, false)); + EXPECT_TRUE(base::StartsWithASCII(error, errors::kAuthFailure, false)); EXPECT_FALSE(func->login_ui_shown()); EXPECT_TRUE(func->scope_ui_shown()); } @@ -1498,7 +1498,7 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, func->set_mint_token_result(TestOAuth2MintTokenFlow::MINT_TOKEN_FAILURE); std::string error = utils::RunFunctionAndReturnError( func.get(), "[{\"account\": { \"id\": \"2\" } }]", browser()); - EXPECT_TRUE(StartsWithASCII(error, errors::kAuthFailure, false)); + EXPECT_TRUE(base::StartsWithASCII(error, errors::kAuthFailure, false)); EXPECT_FALSE(func->login_ui_shown()); EXPECT_FALSE(func->scope_ui_shown()); } @@ -1515,7 +1515,7 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, func->set_login_access_token_result(false); std::string error = utils::RunFunctionAndReturnError( func.get(), "[{\"account\": { \"id\": \"2\" } }]", browser()); - EXPECT_TRUE(StartsWithASCII(error, errors::kAuthFailure, false)); + EXPECT_TRUE(base::StartsWithASCII(error, errors::kAuthFailure, false)); } IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, diff --git a/chrome/browser/extensions/blob_reader.cc b/chrome/browser/extensions/blob_reader.cc index c8d4218..33ec632 100644 --- a/chrome/browser/extensions/blob_reader.cc +++ b/chrome/browser/extensions/blob_reader.cc @@ -21,7 +21,7 @@ BlobReader::BlobReader(Profile* profile, : callback_(callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); GURL blob_url; - if (StartsWithASCII(blob_uuid, "blob:blobinternal", true)) { + if (base::StartsWithASCII(blob_uuid, "blob:blobinternal", true)) { // TODO(michaeln): remove support for deprecated blob urls blob_url = GURL(blob_uuid); } else { diff --git a/chrome/browser/extensions/chrome_url_request_util.cc b/chrome/browser/extensions/chrome_url_request_util.cc index 4551151..fcfa3a5 100644 --- a/chrome/browser/extensions/chrome_url_request_util.cc +++ b/chrome/browser/extensions/chrome_url_request_util.cc @@ -98,7 +98,7 @@ class URLRequestResourceBundleJob : public net::URLRequestSimpleJob { const net::CompletionCallback& callback, bool read_result) { *out_mime_type = *read_mime_type; - if (StartsWithASCII(*read_mime_type, "text/", false)) { + if (base::StartsWithASCII(*read_mime_type, "text/", false)) { // All of our HTML files should be UTF-8 and for other resource types // (like images), charset doesn't matter. DCHECK(base::IsStringUTF8(base::StringPiece( diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc index c370197..febd096 100644 --- a/chrome/browser/extensions/extension_apitest.cc +++ b/chrome/browser/extensions/extension_apitest.cc @@ -41,7 +41,7 @@ const char kSpawnedTestServerPort[] = "spawnedTestServer.port"; scoped_ptr<net::test_server::HttpResponse> HandleServerRedirectRequest( const net::test_server::HttpRequest& request) { - if (!StartsWithASCII(request.relative_url, "/server-redirect?", true)) + if (!base::StartsWithASCII(request.relative_url, "/server-redirect?", true)) return nullptr; size_t query_string_pos = request.relative_url.find('?'); @@ -57,7 +57,7 @@ scoped_ptr<net::test_server::HttpResponse> HandleServerRedirectRequest( scoped_ptr<net::test_server::HttpResponse> HandleEchoHeaderRequest( const net::test_server::HttpRequest& request) { - if (!StartsWithASCII(request.relative_url, "/echoheader?", true)) + if (!base::StartsWithASCII(request.relative_url, "/echoheader?", true)) return nullptr; size_t query_string_pos = request.relative_url.find('?'); @@ -79,7 +79,7 @@ scoped_ptr<net::test_server::HttpResponse> HandleEchoHeaderRequest( scoped_ptr<net::test_server::HttpResponse> HandleSetCookieRequest( const net::test_server::HttpRequest& request) { - if (!StartsWithASCII(request.relative_url, "/set-cookie?", true)) + if (!base::StartsWithASCII(request.relative_url, "/set-cookie?", true)) return nullptr; scoped_ptr<net::test_server::BasicHttpResponse> http_response( @@ -101,7 +101,7 @@ scoped_ptr<net::test_server::HttpResponse> HandleSetCookieRequest( scoped_ptr<net::test_server::HttpResponse> HandleSetHeaderRequest( const net::test_server::HttpRequest& request) { - if (!StartsWithASCII(request.relative_url, "/set-header?", true)) + if (!base::StartsWithASCII(request.relative_url, "/set-header?", true)) return nullptr; size_t query_string_pos = request.relative_url.find('?'); diff --git a/chrome/browser/extensions/extension_install_ui_browsertest.cc b/chrome/browser/extensions/extension_install_ui_browsertest.cc index f99e521..dcebd09 100644 --- a/chrome/browser/extensions/extension_install_ui_browsertest.cc +++ b/chrome/browser/extensions/extension_install_ui_browsertest.cc @@ -161,8 +161,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(web_contents); - EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), - "chrome://newtab/", false)); + EXPECT_TRUE(base::StartsWithASCII(web_contents->GetURL().spec(), + "chrome://newtab/", false)); } else { // TODO(xiyuan): Figure out how to test extension installed bubble? } @@ -187,8 +187,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(web_contents); - EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), - "chrome://newtab/", false)); + EXPECT_TRUE(base::StartsWithASCII(web_contents->GetURL().spec(), + "chrome://newtab/", false)); } else { // TODO(xiyuan): Figure out how to test extension installed bubble? } diff --git a/chrome/browser/extensions/extension_management.cc b/chrome/browser/extensions/extension_management.cc index bd995e5..d46eacd 100644 --- a/chrome/browser/extensions/extension_management.cc +++ b/chrome/browser/extensions/extension_management.cc @@ -374,8 +374,8 @@ void ExtensionManagement::Refresh() { continue; if (!iter.value().GetAsDictionary(&subdict)) continue; - if (StartsWithASCII(iter.key(), schema_constants::kUpdateUrlPrefix, - true)) { + if (base::StartsWithASCII(iter.key(), schema_constants::kUpdateUrlPrefix, + true)) { const std::string& update_url = iter.key().substr(strlen(schema_constants::kUpdateUrlPrefix)); if (!GURL(update_url).is_valid()) { diff --git a/chrome/browser/extensions/extension_protocols_unittest.cc b/chrome/browser/extensions/extension_protocols_unittest.cc index e70cddc..1924109 100644 --- a/chrome/browser/extensions/extension_protocols_unittest.cc +++ b/chrome/browser/extensions/extension_protocols_unittest.cc @@ -298,7 +298,7 @@ TEST_F(ExtensionProtocolTest, ResourceRequestResponseHeaders) { // Check that cache-related headers are set. std::string etag; request->GetResponseHeaderByName("ETag", &etag); - EXPECT_TRUE(StartsWithASCII(etag, "\"", false)); + EXPECT_TRUE(base::StartsWithASCII(etag, "\"", false)); EXPECT_TRUE(EndsWith(etag, "\"", false)); std::string revalidation_header; diff --git a/chrome/browser/extensions/extension_web_ui.cc b/chrome/browser/extensions/extension_web_ui.cc index 9d6526d..2b30e03 100644 --- a/chrome/browser/extensions/extension_web_ui.cc +++ b/chrome/browser/extensions/extension_web_ui.cc @@ -285,7 +285,7 @@ bool ExtensionWebUI::HandleChromeURLOverrideReverse( std::string override; if (!(*it2)->GetAsString(&override)) continue; - if (StartsWithASCII(url->spec(), override, true)) { + if (base::StartsWithASCII(url->spec(), override, true)) { GURL original_url(content::kChromeUIScheme + std::string("://") + it.key() + url->spec().substr(override.length())); *url = original_url; diff --git a/chrome/browser/extensions/isolated_app_browsertest.cc b/chrome/browser/extensions/isolated_app_browsertest.cc index c55f602..f7b1b1e 100644 --- a/chrome/browser/extensions/isolated_app_browsertest.cc +++ b/chrome/browser/extensions/isolated_app_browsertest.cc @@ -42,7 +42,8 @@ std::string WrapForJavascriptAndExtract(const char* javascript_expression) { scoped_ptr<net::test_server::HttpResponse> HandleExpectAndSetCookieRequest( const net::test_server::EmbeddedTestServer* test_server, const net::test_server::HttpRequest& request) { - if (!StartsWithASCII(request.relative_url, "/expect-and-set-cookie?", true)) + if (!base::StartsWithASCII(request.relative_url, "/expect-and-set-cookie?", + true)) return scoped_ptr<net::test_server::HttpResponse>(); scoped_ptr<net::test_server::BasicHttpResponse> http_response( diff --git a/chrome/browser/google/google_brand.cc b/chrome/browser/google/google_brand.cc index a452844..894efb5 100644 --- a/chrome/browser/google/google_brand.cc +++ b/chrome/browser/google/google_brand.cc @@ -103,9 +103,9 @@ bool IsOrganic(const std::string& brand) { if (found != end) return true; - return StartsWithASCII(brand, "EUB", true) || - StartsWithASCII(brand, "EUC", true) || - StartsWithASCII(brand, "GGR", true); + return base::StartsWithASCII(brand, "EUB", true) || + base::StartsWithASCII(brand, "EUC", true) || + base::StartsWithASCII(brand, "GGR", true); } bool IsOrganicFirstRun(const std::string& brand) { @@ -117,8 +117,8 @@ bool IsOrganicFirstRun(const std::string& brand) { } #endif - return StartsWithASCII(brand, "GG", true) || - StartsWithASCII(brand, "EU", true); + return base::StartsWithASCII(brand, "GG", true) || + base::StartsWithASCII(brand, "EU", true); } bool IsInternetCafeBrandCode(const std::string& brand) { diff --git a/chrome/browser/local_discovery/device_description.cc b/chrome/browser/local_discovery/device_description.cc index 71e748d..b9a3dda 100644 --- a/chrome/browser/local_discovery/device_description.cc +++ b/chrome/browser/local_discovery/device_description.cc @@ -19,7 +19,7 @@ std::string GetValueByName(const std::vector<std::string>& metadata, const std::string& name) { std::string prefix(name + "="); for (const std::string& record : metadata) { - if (StartsWithASCII(record, prefix, false)) { + if (base::StartsWithASCII(record, prefix, false)) { return record.substr(prefix.size()); } } diff --git a/chrome/browser/media/router/media_source_helper.cc b/chrome/browser/media/router/media_source_helper.cc index 47c717a..a5d1288 100644 --- a/chrome/browser/media/router/media_source_helper.cc +++ b/chrome/browser/media/router/media_source_helper.cc @@ -34,13 +34,13 @@ MediaSource MediaSourceForPresentationUrl(const std::string& presentation_url) { } bool IsMirroringMediaSource(const MediaSource& source) { - return StartsWithASCII(source.id(), kDesktopMediaUrn, true) || - StartsWithASCII(source.id(), kTabMediaUrnPrefix, true); + return base::StartsWithASCII(source.id(), kDesktopMediaUrn, true) || + base::StartsWithASCII(source.id(), kTabMediaUrnPrefix, true); } bool IsValidMediaSource(const MediaSource& source) { if (IsMirroringMediaSource(source) || - StartsWithASCII(source.id(), kCastUrnPrefix, true)) { + base::StartsWithASCII(source.id(), kCastUrnPrefix, true)) { return true; } GURL url(source.id()); diff --git a/chrome/browser/media/webrtc_browsertest_base.cc b/chrome/browser/media/webrtc_browsertest_base.cc index 8b9134e..20241c2 100644 --- a/chrome/browser/media/webrtc_browsertest_base.cc +++ b/chrome/browser/media/webrtc_browsertest_base.cc @@ -322,7 +322,7 @@ std::string WebRtcTestBase::GetStreamSize( std::string javascript = base::StringPrintf("getStreamSize('%s')", video_element.c_str()); std::string result = ExecuteJavascript(javascript, tab_contents); - EXPECT_TRUE(StartsWithASCII(result, "ok-", true)); + EXPECT_TRUE(base::StartsWithASCII(result, "ok-", true)); return result.substr(3); } diff --git a/chrome/browser/media/webrtc_browsertest_common.cc b/chrome/browser/media/webrtc_browsertest_common.cc index 635b818..61f967e 100644 --- a/chrome/browser/media/webrtc_browsertest_common.cc +++ b/chrome/browser/media/webrtc_browsertest_common.cc @@ -40,7 +40,7 @@ static const char kAdviseOnGclientSolution[] = const int kDefaultPollIntervalMsec = 250; bool IsErrorResult(const std::string& result) { - return StartsWithASCII(result, "failed-", false); + return base::StartsWithASCII(result, "failed-", false); } base::FilePath GetReferenceFilesDir() { diff --git a/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc b/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc index b7f629c..5c65f96 100644 --- a/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc +++ b/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc @@ -91,9 +91,8 @@ void AttemptAutoMountOnUIThread( MediaFileSystemBackend::ConstructMountName( profile->GetPath(), storage_domain, kInvalidMediaGalleryPrefId); MediaGalleryPrefId pref_id = kInvalidMediaGalleryPrefId; - if (extension && - extension->id() == storage_domain && - StartsWithASCII(mount_point, expected_mount_prefix, true) && + if (extension && extension->id() == storage_domain && + base::StartsWithASCII(mount_point, expected_mount_prefix, true) && base::StringToUint64(mount_point.substr(expected_mount_prefix.size()), &pref_id) && pref_id != kInvalidMediaGalleryPrefId) { @@ -197,7 +196,7 @@ bool MediaFileSystemBackend::AttemptAutoMountForURLRequest( if (components.empty()) return false; std::string mount_point = base::FilePath(components[0]).AsUTF8Unsafe(); - if (!StartsWithASCII(mount_point, kMediaGalleryMountPrefix, true)) + if (!base::StartsWithASCII(mount_point, kMediaGalleryMountPrefix, true)) return false; const content::ResourceRequestInfo* request_info = diff --git a/chrome/browser/media_galleries/fileapi/native_media_file_util.cc b/chrome/browser/media_galleries/fileapi/native_media_file_util.cc index 79dc4f0..87acf8c 100644 --- a/chrome/browser/media_galleries/fileapi/native_media_file_util.cc +++ b/chrome/browser/media_galleries/fileapi/native_media_file_util.cc @@ -37,9 +37,9 @@ base::File::Error IsMediaHeader(const char* buf, size_t length) { if (!net::SniffMimeTypeFromLocalData(buf, length, &mime_type)) return base::File::FILE_ERROR_SECURITY; - if (StartsWithASCII(mime_type, "image/", true) || - StartsWithASCII(mime_type, "audio/", true) || - StartsWithASCII(mime_type, "video/", true) || + if (base::StartsWithASCII(mime_type, "image/", true) || + base::StartsWithASCII(mime_type, "audio/", true) || + base::StartsWithASCII(mime_type, "video/", true) || mime_type == "application/x-shockwave-flash") { return base::File::FILE_OK; } diff --git a/chrome/browser/media_galleries/media_folder_finder.cc b/chrome/browser/media_galleries/media_folder_finder.cc index 1d72012..b80b1bf 100644 --- a/chrome/browser/media_galleries/media_folder_finder.cc +++ b/chrome/browser/media_galleries/media_folder_finder.cc @@ -98,8 +98,8 @@ bool ShouldIgnoreScanRoot(const base::FilePath& path) { return mount_point.IsParent(path); #elif defined(OS_LINUX) // /media and /mnt are likely the only places with interesting mount points. - if (StartsWithASCII(path.value(), "/media", true) || - StartsWithASCII(path.value(), "/mnt", true)) { + if (base::StartsWithASCII(path.value(), "/media", true) || + base::StartsWithASCII(path.value(), "/mnt", true)) { return false; } return true; diff --git a/chrome/browser/metrics/variations/variations_service_unittest.cc b/chrome/browser/metrics/variations/variations_service_unittest.cc index 1b98cd1..1741572 100644 --- a/chrome/browser/metrics/variations/variations_service_unittest.cc +++ b/chrome/browser/metrics/variations/variations_service_unittest.cc @@ -243,18 +243,18 @@ TEST_F(VariationsServiceTest, GetVariationsServerURL) { std::string value; GURL url = VariationsService::GetVariationsServerURL(prefs, std::string()); - EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); + EXPECT_TRUE(base::StartsWithASCII(url.spec(), default_variations_url, true)); EXPECT_FALSE(net::GetValueForKeyInQuery(url, "restrict", &value)); prefs_store.SetVariationsRestrictParameterPolicyValue("restricted"); url = VariationsService::GetVariationsServerURL(prefs, std::string()); - EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); + EXPECT_TRUE(base::StartsWithASCII(url.spec(), default_variations_url, true)); EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); EXPECT_EQ("restricted", value); // The override value should take precedence over what's in prefs. url = VariationsService::GetVariationsServerURL(prefs, "override"); - EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); + EXPECT_TRUE(base::StartsWithASCII(url.spec(), default_variations_url, true)); EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); EXPECT_EQ("override", value); } diff --git a/chrome/browser/net/async_dns_field_trial.cc b/chrome/browser/net/async_dns_field_trial.cc index 7e98d13..ab4f704 100644 --- a/chrome/browser/net/async_dns_field_trial.cc +++ b/chrome/browser/net/async_dns_field_trial.cc @@ -79,8 +79,8 @@ bool ConfigureAsyncDnsFieldTrial() { // otherwise (trial absent): return default. std::string group_name = base::FieldTrialList::FindFullName("AsyncDns"); if (!group_name.empty()) { - const bool enabled = StartsWithASCII( - group_name, "AsyncDns", false /* case_sensitive */); + const bool enabled = base::StartsWithASCII(group_name, "AsyncDns", + false /* case_sensitive */); HistogramPrefDefaultSource(FIELD_TRIAL, enabled); return enabled; } diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc index 4953a72..50f83bb 100644 --- a/chrome/browser/net/chrome_network_delegate.cc +++ b/chrome/browser/net/chrome_network_delegate.cc @@ -187,7 +187,7 @@ bool CanRequestBeDeltaEncoded(const net::URLRequest* request) { for (size_t i = 0; i < arraysize(kEligibleMasks); i++) { const char *prefix = kEligibleMasks[i].prefix; const char *suffix = kEligibleMasks[i].suffix; - if (prefix && !StartsWithASCII(mime_type, prefix, kCaseSensitive)) + if (prefix && !base::StartsWithASCII(mime_type, prefix, kCaseSensitive)) continue; if (suffix && !EndsWith(mime_type, suffix, kCaseSensitive)) continue; diff --git a/chrome/browser/net/safe_search_util.cc b/chrome/browser/net/safe_search_util.cc index 29f095d..86862cd 100644 --- a/chrome/browser/net/safe_search_util.cc +++ b/chrome/browser/net/safe_search_util.cc @@ -38,7 +38,7 @@ bool HasSameParameterKey(const std::string& first_parameter, // Prefix for "foo=bar" is "foo=". std::string parameter_prefix = second_parameter.substr( 0, second_parameter.find("=") + 1); - return StartsWithASCII(first_parameter, parameter_prefix, false); + return base::StartsWithASCII(first_parameter, parameter_prefix, false); } // Examines the query string containing parameters and adds the necessary ones 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 80404d9..7a639fa 100644 --- a/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc +++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc @@ -67,7 +67,7 @@ bool GetEmbeddedPacScript(const std::string& pac_url, std::string* pac_script) { DCHECK(pac_script); const std::string kPacURLPrefix = "data:application/x-ns-proxy-autoconfig;base64,"; - return StartsWithASCII(pac_url, kPacURLPrefix, true) && + return base::StartsWithASCII(pac_url, kPacURLPrefix, true) && base::Base64Decode(pac_url.substr(kPacURLPrefix.size()), pac_script); } diff --git a/chrome/browser/password_manager/password_manager_browsertest.cc b/chrome/browser/password_manager/password_manager_browsertest.cc index 3a41c29..6a6416b 100644 --- a/chrome/browser/password_manager/password_manager_browsertest.cc +++ b/chrome/browser/password_manager/password_manager_browsertest.cc @@ -271,7 +271,7 @@ scoped_ptr<PromptObserver> PromptObserver::Create( // serves a Basic Auth challenge. scoped_ptr<net::test_server::HttpResponse> HandleTestAuthRequest( const net::test_server::HttpRequest& request) { - if (!StartsWithASCII(request.relative_url, "/basic_auth", true)) + if (!base::StartsWithASCII(request.relative_url, "/basic_auth", true)) return scoped_ptr<net::test_server::HttpResponse>(); if (ContainsKey(request.headers, "Authorization")) { diff --git a/chrome/browser/plugins/plugin_info_message_filter.cc b/chrome/browser/plugins/plugin_info_message_filter.cc index 72e09c4..b0337f2 100644 --- a/chrome/browser/plugins/plugin_info_message_filter.cc +++ b/chrome/browser/plugins/plugin_info_message_filter.cc @@ -129,8 +129,8 @@ void ReportMetrics(const std::string& mime_type, if (!rappor_service) return; - if (StartsWithASCII(mime_type, content::kSilverlightPluginMimeTypePrefix, - false)) { + if (base::StartsWithASCII(mime_type, + content::kSilverlightPluginMimeTypePrefix, false)) { rappor_service->RecordSample( "Plugins.SilverlightOriginUrl", rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, net::registry_controlled_domains::GetDomainAndRegistry( diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index 31e3c79..0b0aec1 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc @@ -3780,7 +3780,7 @@ IN_PROC_BROWSER_TEST_F(PolicyVariationsServiceTest, VariationsURLIsValid) { const GURL url = chrome_variations::VariationsService::GetVariationsServerURL( g_browser_process->local_state(), std::string()); - EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); + EXPECT_TRUE(base::StartsWithASCII(url.spec(), default_variations_url, true)); std::string value; EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); EXPECT_EQ("restricted", value); diff --git a/chrome/browser/policy/policy_prefs_browsertest.cc b/chrome/browser/policy/policy_prefs_browsertest.cc index e34a06f..bd53790 100644 --- a/chrome/browser/policy/policy_prefs_browsertest.cc +++ b/chrome/browser/policy/policy_prefs_browsertest.cc @@ -559,7 +559,8 @@ IN_PROC_BROWSER_TEST_F(PolicyPrefsTest, PolicyToPrefsMapping) { ++pref_mapping) { // Skip Chrome OS preferences that use a different backend and cannot be // retrieved through the prefs mechanism. - if (StartsWithASCII((*pref_mapping)->pref(), kCrosSettingsPrefix, true)) + if (base::StartsWithASCII((*pref_mapping)->pref(), kCrosSettingsPrefix, + true)) continue; // Skip preferences that should not be checked when the policy is set to diff --git a/chrome/browser/predictors/autocomplete_action_predictor.cc b/chrome/browser/predictors/autocomplete_action_predictor.cc index 0104895..51a22c1 100644 --- a/chrome/browser/predictors/autocomplete_action_predictor.cc +++ b/chrome/browser/predictors/autocomplete_action_predictor.cc @@ -344,7 +344,7 @@ void AutocompleteActionPredictor::OnOmniboxOpenedUrl(const OmniboxLog& log) { for (std::vector<TransitionalMatch>::const_iterator it = transitional_matches_.begin(); it != transitional_matches_.end(); ++it) { - if (!StartsWith(lower_user_text, it->user_text, true)) + if (!base::StartsWith(lower_user_text, it->user_text, true)) continue; // Add entries to the database for those matches. diff --git a/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc b/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc index 707a650..00562c6 100644 --- a/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc +++ b/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc @@ -321,7 +321,8 @@ TEST_F(AutocompleteActionPredictorTest, DeleteOldIdsFromCaches) { std::string row_id = AddRow(test_url_db[i]); all_ids.push_back(row_id); - bool exclude_url = StartsWithASCII(test_url_db[i].url.path(), "/d", true) || + bool exclude_url = + base::StartsWithASCII(test_url_db[i].url.path(), "/d", true) || (test_url_db[i].days_from_now > maximum_days_to_keep_entry()); if (exclude_url) diff --git a/chrome/browser/prefetch/prefetch_field_trial.cc b/chrome/browser/prefetch/prefetch_field_trial.cc index abdb112..e51dcb3 100644 --- a/chrome/browser/prefetch/prefetch_field_trial.cc +++ b/chrome/browser/prefetch/prefetch_field_trial.cc @@ -14,7 +14,7 @@ namespace prefetch { bool DisableForFieldTrial() { std::string experiment = base::FieldTrialList::FindFullName("Prefetch"); - return StartsWithASCII(experiment, "ExperimentDisable", false); + return base::StartsWithASCII(experiment, "ExperimentDisable", false); } } // namespace prefetch diff --git a/chrome/browser/prefs/tracked/pref_hash_browsertest.cc b/chrome/browser/prefs/tracked/pref_hash_browsertest.cc index 3608606..48d4bfe 100644 --- a/chrome/browser/prefs/tracked/pref_hash_browsertest.cc +++ b/chrome/browser/prefs/tracked/pref_hash_browsertest.cc @@ -309,9 +309,8 @@ class PrefHashBrowserTestBase private: // Returns true if this is the PRE_ phase of the test. bool IsPRETest() { - return StartsWithASCII( - testing::UnitTest::GetInstance()->current_test_info()->name(), - "PRE_", + return base::StartsWithASCII( + testing::UnitTest::GetInstance()->current_test_info()->name(), "PRE_", true /* case_sensitive */); } diff --git a/chrome/browser/prerender/prerender_util.cc b/chrome/browser/prerender/prerender_util.cc index 45266ee..1b60fcb 100644 --- a/chrome/browser/prerender/prerender_util.cc +++ b/chrome/browser/prerender/prerender_util.cc @@ -72,16 +72,16 @@ bool MaybeGetQueryStringBasedAliasURL( } bool IsGoogleDomain(const GURL& url) { - return StartsWithASCII(url.host(), std::string("www.google."), true); + return base::StartsWithASCII(url.host(), std::string("www.google."), true); } bool IsGoogleSearchResultURL(const GURL& url) { if (!IsGoogleDomain(url)) return false; return (url.path().empty() || - StartsWithASCII(url.path(), std::string("/search"), true) || + base::StartsWithASCII(url.path(), std::string("/search"), true) || (url.path() == "/") || - StartsWithASCII(url.path(), std::string("/webhp"), true)); + base::StartsWithASCII(url.path(), std::string("/webhp"), true)); } void ReportPrerenderExternalURL() { diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc index a708193..d2118fc 100644 --- a/chrome/browser/printing/print_dialog_cloud.cc +++ b/chrome/browser/printing/print_dialog_cloud.cc @@ -126,7 +126,7 @@ const int kDefaultHeight = 633; bool IsSimilarUrl(const GURL& url, const GURL& cloud_print_url) { return url.host() == cloud_print_url.host() && - StartsWithASCII(url.path(), cloud_print_url.path(), false) && + base::StartsWithASCII(url.path(), cloud_print_url.path(), false) && url.scheme() == cloud_print_url.scheme(); } diff --git a/chrome/browser/profile_resetter/automatic_profile_resetter.cc b/chrome/browser/profile_resetter/automatic_profile_resetter.cc index 9dead81..f932946 100644 --- a/chrome/browser/profile_resetter/automatic_profile_resetter.cc +++ b/chrome/browser/profile_resetter/automatic_profile_resetter.cc @@ -85,14 +85,14 @@ const uint32 kCombinedStatusMaskMaximumValue = // Returns whether or not a dry-run shall be performed. bool ShouldPerformDryRun() { - return StartsWithASCII( + return base::StartsWithASCII( base::FieldTrialList::FindFullName(kAutomaticProfileResetStudyName), kAutomaticProfileResetStudyDryRunGroupName, true); } // Returns whether or not a live-run shall be performed. bool ShouldPerformLiveRun() { - return StartsWithASCII( + return base::StartsWithASCII( base::FieldTrialList::FindFullName(kAutomaticProfileResetStudyName), kAutomaticProfileResetStudyEnabledGroupName, true); } diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index 4e1f3b7..5e3185e 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc @@ -159,7 +159,7 @@ bool IsSupportedDevToolsURL(const GURL& url, base::FilePath* path) { if (!url.SchemeIs(content::kChromeDevToolsScheme) || url.host() != chrome::kChromeUIDevToolsHost || - !StartsWithASCII(url.path(), bundled_path_prefix, false)) { + !base::StartsWithASCII(url.path(), bundled_path_prefix, false)) { return false; } diff --git a/chrome/browser/push_messaging/push_messaging_app_identifier.cc b/chrome/browser/push_messaging/push_messaging_app_identifier.cc index 46bd7ca..325081a 100644 --- a/chrome/browser/push_messaging/push_messaging_app_identifier.cc +++ b/chrome/browser/push_messaging/push_messaging_app_identifier.cc @@ -75,8 +75,8 @@ PushMessagingAppIdentifier PushMessagingAppIdentifier::Generate( // static PushMessagingAppIdentifier PushMessagingAppIdentifier::FindByAppId( Profile* profile, const std::string& app_id) { - if (!StartsWithASCII(app_id, kPushMessagingAppIdentifierPrefix, - false /* case_sensitive */)) { + if (!base::StartsWithASCII(app_id, kPushMessagingAppIdentifierPrefix, + false /* case_sensitive */)) { return PushMessagingAppIdentifier(); } diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate_browsertest.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate_browsertest.cc index 36159bc..98e86d3 100644 --- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate_browsertest.cc +++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate_browsertest.cc @@ -30,7 +30,7 @@ static const char kServerRedirectUrl[] = "/server-redirect"; scoped_ptr<net::test_server::HttpResponse> HandleTestRequest( const net::test_server::HttpRequest& request) { - if (StartsWithASCII(request.relative_url, kServerRedirectUrl, true)) { + if (base::StartsWithASCII(request.relative_url, kServerRedirectUrl, true)) { // Extract the target URL and redirect there. size_t query_string_pos = request.relative_url.find('?'); std::string redirect_target = diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc index b1910d1..01aece1 100644 --- a/chrome/browser/safe_browsing/protocol_manager.cc +++ b/chrome/browser/safe_browsing/protocol_manager.cc @@ -749,10 +749,10 @@ GURL SafeBrowsingProtocolManager::GetHashUrl() const { GURL SafeBrowsingProtocolManager::NextChunkUrl(const std::string& url) const { DCHECK(CalledOnValidThread()); std::string next_url; - if (!StartsWithASCII(url, "http://", false) && - !StartsWithASCII(url, "https://", false)) { + if (!base::StartsWithASCII(url, "http://", false) && + !base::StartsWithASCII(url, "https://", false)) { // Use https if we updated via https, otherwise http (useful for testing). - if (StartsWithASCII(url_prefix_, "https://", false)) + if (base::StartsWithASCII(url_prefix_, "https://", false)) next_url.append("https://"); else next_url.append("http://"); diff --git a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc index 9b18e37..7a69139 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc @@ -1303,7 +1303,7 @@ class SafeBrowsingDatabaseManagerCookieTest : public InProcessBrowserTest { private: static scoped_ptr<net::test_server::HttpResponse> HandleRequest( const net::test_server::HttpRequest& request) { - if (!StartsWithASCII(request.relative_url, "/testpath/", true)) { + if (!base::StartsWithASCII(request.relative_url, "/testpath/", true)) { ADD_FAILURE() << "bad path"; return nullptr; } diff --git a/chrome/browser/search/local_ntp_source.cc b/chrome/browser/search/local_ntp_source.cc index 3fb513f..5d10b6f 100644 --- a/chrome/browser/search/local_ntp_source.cc +++ b/chrome/browser/search/local_ntp_source.cc @@ -94,7 +94,7 @@ bool IsIconNTPEnabled() { if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableIconNtp)) return true; - return StartsWithASCII(group_name, "Enabled", true); + return base::StartsWithASCII(group_name, "Enabled", true); } // Adds a localized string keyed by resource id to the dictionary. 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 04b2a8e..f7eb8ae 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 @@ -50,7 +50,7 @@ GURL GetNormalizedURL(const GURL& url) { // Strip leading "www." (if any). const std::string www("www."); const std::string host(url.host()); - if (StartsWithASCII(host, www, true)) + if (base::StartsWithASCII(host, www, true)) replacements.SetHostStr(base::StringPiece(host).substr(www.size())); // Strip trailing slash (if any). const std::string path(url.path()); diff --git a/chrome/browser/supervised_user/supervised_user_settings_service.cc b/chrome/browser/supervised_user/supervised_user_settings_service.cc index dc47d60..f18bc1e 100644 --- a/chrome/browser/supervised_user/supervised_user_settings_service.cc +++ b/chrome/browser/supervised_user/supervised_user_settings_service.cc @@ -44,7 +44,7 @@ const char kSplitSettings[] = "split_settings"; namespace { bool SettingShouldApplyToPrefs(const std::string& name) { - return !StartsWithASCII(name, kSupervisedUserInternalItemPrefix, false); + return !base::StartsWithASCII(name, kSupervisedUserInternalItemPrefix, false); } } // namespace diff --git a/chrome/browser/supervised_user/supervised_user_settings_service_unittest.cc b/chrome/browser/supervised_user/supervised_user_settings_service_unittest.cc index b13fa00..c2a99dc 100644 --- a/chrome/browser/supervised_user/supervised_user_settings_service_unittest.cc +++ b/chrome/browser/supervised_user/supervised_user_settings_service_unittest.cc @@ -99,9 +99,9 @@ class SupervisedUserSettingsServiceTest : public ::testing::Test { if (supervised_user_setting.name() == kAtomicItemName) { expected_value = atomic_setting_value_.get(); } else { - EXPECT_TRUE(StartsWithASCII(supervised_user_setting.name(), - std::string(kSplitItemName) + ':', - true)); + EXPECT_TRUE(base::StartsWithASCII(supervised_user_setting.name(), + std::string(kSplitItemName) + ':', + true)); std::string key = supervised_user_setting.name().substr(strlen(kSplitItemName) + 1); EXPECT_TRUE(split_items_.GetWithoutPathExpansion(key, &expected_value)); diff --git a/chrome/browser/supervised_user/supervised_user_url_filter.cc b/chrome/browser/supervised_user/supervised_user_url_filter.cc index 1f406a3..acfda8b 100644 --- a/chrome/browser/supervised_user/supervised_user_url_filter.cc +++ b/chrome/browser/supervised_user/supervised_user_url_filter.cc @@ -250,7 +250,7 @@ bool SupervisedUserURLFilter::HostMatchesPattern(const std::string& host, trimmed_host.erase(trimmed_host.length() - (registry_length + 1)); } - if (StartsWithASCII(trimmed_pattern, "*.", true)) { + if (base::StartsWithASCII(trimmed_pattern, "*.", true)) { trimmed_pattern.erase(0, 2); // The remaining pattern should be non-empty, and it should not contain diff --git a/chrome/browser/sync/sessions/sessions_sync_manager_unittest.cc b/chrome/browser/sync/sessions/sessions_sync_manager_unittest.cc index bc0ba59..c11c8d9 100644 --- a/chrome/browser/sync/sessions/sessions_sync_manager_unittest.cc +++ b/chrome/browser/sync/sessions/sessions_sync_manager_unittest.cc @@ -1010,8 +1010,8 @@ TEST_F(SessionsSyncManagerTest, MergeWithLocalAndForeignTabs) { for (int i = 1; i < 3; i++) { EXPECT_TRUE(output[i].IsValid()); const SyncData data(output[i].sync_data()); - EXPECT_TRUE(StartsWithASCII(syncer::SyncDataLocal(data).GetTag(), - manager()->current_machine_tag(), true)); + EXPECT_TRUE(base::StartsWithASCII(syncer::SyncDataLocal(data).GetTag(), + manager()->current_machine_tag(), true)); const sync_pb::SessionSpecifics& specifics(data.GetSpecifics().session()); EXPECT_EQ(manager()->current_machine_tag(), specifics.session_tag()); } @@ -1444,17 +1444,15 @@ TEST_F(SessionsSyncManagerTest, AssociateWindowsDontReloadTabs) { EXPECT_EQ(3U, out.size()); // Tab add, update, and header update. EXPECT_TRUE( - StartsWithASCII(syncer::SyncDataLocal(out[0].sync_data()).GetTag(), - manager()->current_machine_tag(), - true)); + base::StartsWithASCII(syncer::SyncDataLocal(out[0].sync_data()).GetTag(), + manager()->current_machine_tag(), true)); EXPECT_EQ(manager()->current_machine_tag(), out[0].sync_data().GetSpecifics().session().session_tag()); EXPECT_EQ(SyncChange::ACTION_ADD, out[0].change_type()); EXPECT_TRUE( - StartsWithASCII(syncer::SyncDataLocal(out[1].sync_data()).GetTag(), - manager()->current_machine_tag(), - true)); + base::StartsWithASCII(syncer::SyncDataLocal(out[1].sync_data()).GetTag(), + manager()->current_machine_tag(), true)); EXPECT_EQ(manager()->current_machine_tag(), out[1].sync_data().GetSpecifics().session().session_tag()); EXPECT_TRUE(out[1].sync_data().GetSpecifics().session().has_tab()); @@ -1508,8 +1506,8 @@ TEST_F(SessionsSyncManagerTest, OnLocalTabModified) { SCOPED_TRACE(i); EXPECT_TRUE(out[i].IsValid()); const SyncData data(out[i].sync_data()); - EXPECT_TRUE(StartsWithASCII(syncer::SyncDataLocal(data).GetTag(), - manager()->current_machine_tag(), true)); + EXPECT_TRUE(base::StartsWithASCII(syncer::SyncDataLocal(data).GetTag(), + manager()->current_machine_tag(), true)); const sync_pb::SessionSpecifics& specifics(data.GetSpecifics().session()); EXPECT_EQ(manager()->current_machine_tag(), specifics.session_tag()); if (i % 6 == 0) { @@ -1616,8 +1614,8 @@ TEST_F(SessionsSyncManagerTest, MergeLocalSessionExistingTabs) { for (int i = 1; i < 5; i++) { EXPECT_TRUE(out[i].IsValid()); const SyncData data(out[i].sync_data()); - EXPECT_TRUE(StartsWithASCII(syncer::SyncDataLocal(data).GetTag(), - manager()->current_machine_tag(), true)); + EXPECT_TRUE(base::StartsWithASCII(syncer::SyncDataLocal(data).GetTag(), + manager()->current_machine_tag(), true)); const sync_pb::SessionSpecifics& specifics(data.GetSpecifics().session()); EXPECT_EQ(manager()->current_machine_tag(), specifics.session_tag()); if (i % 2 == 1) { diff --git a/chrome/browser/sync/test/integration/extensions_helper.cc b/chrome/browser/sync/test/integration/extensions_helper.cc index 9c23374..4448958 100644 --- a/chrome/browser/sync/test/integration/extensions_helper.cc +++ b/chrome/browser/sync/test/integration/extensions_helper.cc @@ -124,7 +124,7 @@ std::string CreateFakeExtensionName(int index) { } bool ExtensionNameToIndex(const std::string& name, int* index) { - if (!StartsWithASCII(name, extension_name_prefix, true) || + if (!base::StartsWithASCII(name, extension_name_prefix, true) || !base::StringToInt(name.substr(strlen(extension_name_prefix)), index)) { LOG(WARNING) << "Unable to convert extension name \"" << name << "\" to index"; diff --git a/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc b/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc index fe6b676..9984d8e 100644 --- a/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc +++ b/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc @@ -153,7 +153,7 @@ SyncStatusCode DriveApiErrorCodeToSyncStatusCode( bool RemovePrefix(const std::string& str, const std::string& prefix, std::string* out) { - if (!StartsWithASCII(str, prefix, true)) { + if (!base::StartsWithASCII(str, prefix, true)) { if (out) *out = str; return false; diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc b/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc index 8e44f75..b656450 100644 --- a/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc +++ b/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc @@ -522,7 +522,8 @@ bool MetadataDatabaseIndexOnDisk::HasDemotedDirtyTracker() const { itr->Seek(kDemotedDirtyIDKeyPrefix); if (!itr->Valid()) return false; - return StartsWithASCII(itr->key().ToString(), kDemotedDirtyIDKeyPrefix, true); + return base::StartsWithASCII(itr->key().ToString(), kDemotedDirtyIDKeyPrefix, + true); } bool MetadataDatabaseIndexOnDisk::IsDemotedDirtyTracker( @@ -570,7 +571,8 @@ size_t MetadataDatabaseIndexOnDisk::CountFileMetadata() const { size_t count = 0; scoped_ptr<LevelDBWrapper::Iterator> itr(db_->NewIterator()); for (itr->Seek(kFileMetadataKeyPrefix); itr->Valid(); itr->Next()) { - if (!StartsWithASCII(itr->key().ToString(), kFileMetadataKeyPrefix, true)) + if (!base::StartsWithASCII(itr->key().ToString(), kFileMetadataKeyPrefix, + true)) break; ++count; } @@ -582,7 +584,8 @@ size_t MetadataDatabaseIndexOnDisk::CountFileTracker() const { size_t count = 0; scoped_ptr<LevelDBWrapper::Iterator> itr(db_->NewIterator()); for (itr->Seek(kFileTrackerKeyPrefix); itr->Valid(); itr->Next()) { - if (!StartsWithASCII(itr->key().ToString(), kFileTrackerKeyPrefix, true)) + if (!base::StartsWithASCII(itr->key().ToString(), kFileTrackerKeyPrefix, + true)) break; ++count; } @@ -1143,7 +1146,7 @@ size_t MetadataDatabaseIndexOnDisk::CountDirtyTrackerInternal() const { scoped_ptr<LevelDBWrapper::Iterator> itr(db_->NewIterator()); for (itr->Seek(kDirtyIDKeyPrefix); itr->Valid(); itr->Next()) { - if (!StartsWithASCII(itr->key().ToString(), kDirtyIDKeyPrefix, true)) + if (!base::StartsWithASCII(itr->key().ToString(), kDirtyIDKeyPrefix, true)) break; ++num_dirty_trackers; } @@ -1178,7 +1181,7 @@ void MetadataDatabaseIndexOnDisk::DeleteKeyStartsWith( scoped_ptr<LevelDBWrapper::Iterator> itr(db_->NewIterator()); for (itr->Seek(prefix); itr->Valid();) { const std::string key = itr->key().ToString(); - if (!StartsWithASCII(key, prefix, true)) + if (!base::StartsWithASCII(key, prefix, true)) break; itr->Delete(); } diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_db_migration_util.cc b/chrome/browser/sync_file_system/drive_backend/metadata_db_migration_util.cc index 95c094b2..deafbea3 100644 --- a/chrome/browser/sync_file_system/drive_backend/metadata_db_migration_util.cc +++ b/chrome/browser/sync_file_system/drive_backend/metadata_db_migration_util.cc @@ -46,22 +46,24 @@ SyncStatusCode MigrateDatabaseFromV4ToV3(leveldb::DB* db) { std::string key = itr->key().ToString(); // Do nothing for valid entries in both versions. - if (StartsWithASCII(key, kServiceMetadataKey, true) || - StartsWithASCII(key, kFileMetadataKeyPrefix, true) || - StartsWithASCII(key, kFileTrackerKeyPrefix, true)) { + if (base::StartsWithASCII(key, kServiceMetadataKey, true) || + base::StartsWithASCII(key, kFileMetadataKeyPrefix, true) || + base::StartsWithASCII(key, kFileTrackerKeyPrefix, true)) { continue; } // Drop entries used in version 4 only. - if (StartsWithASCII(key, kAppRootIDByAppIDKeyPrefix, true) || - StartsWithASCII(key, kActiveTrackerIDByFileIDKeyPrefix, true) || - StartsWithASCII(key, kTrackerIDByFileIDKeyPrefix, true) || - StartsWithASCII(key, kMultiTrackerByFileIDKeyPrefix, true) || - StartsWithASCII(key, kActiveTrackerIDByParentAndTitleKeyPrefix, true) || - StartsWithASCII(key, kTrackerIDByParentAndTitleKeyPrefix, true) || - StartsWithASCII(key, kMultiBackingParentAndTitleKeyPrefix, true) || - StartsWithASCII(key, kDirtyIDKeyPrefix, true) || - StartsWithASCII(key, kDemotedDirtyIDKeyPrefix, true)) { + if (base::StartsWithASCII(key, kAppRootIDByAppIDKeyPrefix, true) || + base::StartsWithASCII(key, kActiveTrackerIDByFileIDKeyPrefix, true) || + base::StartsWithASCII(key, kTrackerIDByFileIDKeyPrefix, true) || + base::StartsWithASCII(key, kMultiTrackerByFileIDKeyPrefix, true) || + base::StartsWithASCII(key, kActiveTrackerIDByParentAndTitleKeyPrefix, + true) || + base::StartsWithASCII(key, kTrackerIDByParentAndTitleKeyPrefix, true) || + base::StartsWithASCII(key, kMultiBackingParentAndTitleKeyPrefix, + true) || + base::StartsWithASCII(key, kDirtyIDKeyPrefix, true) || + base::StartsWithASCII(key, kDemotedDirtyIDKeyPrefix, true)) { write_batch.Delete(key); continue; } diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_db_migration_util_unittest.cc b/chrome/browser/sync_file_system/drive_backend/metadata_db_migration_util_unittest.cc index 761a96f..2d9308c 100644 --- a/chrome/browser/sync_file_system/drive_backend/metadata_db_migration_util_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/metadata_db_migration_util_unittest.cc @@ -40,7 +40,7 @@ void VerifyNotExist(const std::string& key, leveldb::DB* db) { itr->Seek(key); EXPECT_TRUE(!itr->Valid() || - !StartsWithASCII(itr->key().ToString(), key, true)); + !base::StartsWithASCII(itr->key().ToString(), key, true)); } } // namespace diff --git a/chrome/browser/ui/app_list/app_list_syncable_service.cc b/chrome/browser/ui/app_list/app_list_syncable_service.cc index b3bc806..5a44a21 100644 --- a/chrome/browser/ui/app_list/app_list_syncable_service.cc +++ b/chrome/browser/ui/app_list/app_list_syncable_service.cc @@ -142,7 +142,7 @@ bool GetAppListItemType(AppListItem* item, } bool IsDriveAppSyncId(const std::string& sync_id) { - return StartsWithASCII(sync_id, kDriveAppSyncIdPrefix, true); + return base::StartsWithASCII(sync_id, kDriveAppSyncIdPrefix, true); } std::string GetDriveAppSyncId(const std::string& drive_app_id) { diff --git a/chrome/browser/ui/app_list/search/search_controller_factory.cc b/chrome/browser/ui/app_list/search/search_controller_factory.cc index 232855b..9f4b4c1 100644 --- a/chrome/browser/ui/app_list/search/search_controller_factory.cc +++ b/chrome/browser/ui/app_list/search/search_controller_factory.cc @@ -48,7 +48,7 @@ const char kSuggestionsProviderFieldTrialEnabledPrefix[] = "Enabled"; // Returns whether the user is part of a group where the Suggestions provider is // enabled. bool IsSuggestionsSearchProviderEnabled() { - return StartsWithASCII( + return base::StartsWithASCII( base::FieldTrialList::FindFullName(kSuggestionsProviderFieldTrialName), kSuggestionsProviderFieldTrialEnabledPrefix, true); } diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc index b19fdee..6ac5712 100644 --- a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc +++ b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc @@ -1398,15 +1398,15 @@ TEST_F(AutofillDialogControllerTest, BillingVsShippingStreetAddress) { EXPECT_EQ(ADDRESS_BILLING, form_structure()->field(1)->Type().group()); // Inexact matching; single-line inputs get the address data concatenated but // separated by commas. - EXPECT_TRUE(StartsWith(form_structure()->field(0)->value, - shipping_profile.GetRawInfo(ADDRESS_HOME_LINE1), - true)); + 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(StartsWith(form_structure()->field(1)->value, - billing_profile.GetRawInfo(ADDRESS_HOME_LINE1), - 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)); diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc index 7ab288b..196b0d9 100644 --- a/chrome/browser/ui/browser_navigator_browsertest.cc +++ b/chrome/browser/ui/browser_navigator_browsertest.cc @@ -1291,10 +1291,9 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, observer.Wait(); } EXPECT_EQ(1, browser()->tab_strip_model()->count()); - EXPECT_TRUE(StartsWithASCII( + EXPECT_TRUE(base::StartsWithASCII( browser()->tab_strip_model()->GetActiveWebContents()->GetURL().spec(), - chrome::kChromeUIBookmarksURL, - true)); + chrome::kChromeUIBookmarksURL, true)); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm index 936ce57..9cef5fa 100644 --- a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm @@ -526,9 +526,9 @@ NSAttributedString* CreateClassifiedAttributedString( match.GetAdditionalInfo(kACMatchPropertyContentsStartIndex), &contentsStartIndex); // Ignore invalid state. - if (!StartsWith(match.fill_into_edit, inputText, true) - || !EndsWith(match.fill_into_edit, match.contents, true) - || ((size_t)contentsStartIndex >= inputText.length())) { + if (!base::StartsWith(match.fill_into_edit, inputText, true) || + !EndsWith(match.fill_into_edit, match.contents, true) || + ((size_t)contentsStartIndex >= inputText.length())) { return 0; } bool isContentsRTL = (base::i18n::RIGHT_TO_LEFT == diff --git a/chrome/browser/ui/omnibox/omnibox_view.cc b/chrome/browser/ui/omnibox/omnibox_view.cc index 833cdfa..177bb7e 100644 --- a/chrome/browser/ui/omnibox/omnibox_view.cc +++ b/chrome/browser/ui/omnibox/omnibox_view.cc @@ -28,7 +28,7 @@ base::string16 OmniboxView::StripJavascriptSchemas(const base::string16& text) { const base::string16 kJsPrefix( base::ASCIIToUTF16(url::kJavaScriptScheme) + base::ASCIIToUTF16(":")); base::string16 out(text); - while (StartsWith(out, kJsPrefix, false)) { + while (base::StartsWith(out, kJsPrefix, false)) { base::TrimWhitespace(out.substr(kJsPrefix.length()), base::TRIM_LEADING, &out); } diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.cc b/chrome/browser/ui/prefs/prefs_tab_helper.cc index 670e36a..19c396d 100644 --- a/chrome/browser/ui/prefs/prefs_tab_helper.cc +++ b/chrome/browser/ui/prefs/prefs_tab_helper.cc @@ -137,7 +137,7 @@ void RegisterFontFamilyMapObserver( PrefChangeRegistrar* registrar, const char* map_name, const PrefChangeRegistrar::NamedChangeCallback& obs) { - DCHECK(StartsWithASCII(map_name, "webkit.webprefs.", true)); + DCHECK(base::StartsWithASCII(map_name, "webkit.webprefs.", true)); for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) { const char* script = prefs::kWebKitScriptsForFontFamilyMaps[i]; @@ -149,7 +149,7 @@ void RegisterFontFamilyMapObserver( // On Windows with antialising we want to use an alternate fixed font like // Consolas, which looks much better than Courier New. bool ShouldUseAlternateDefaultFixedFont(const std::string& script) { - if (!StartsWithASCII(script, "courier", false)) + if (!base::StartsWithASCII(script, "courier", false)) return false; UINT smooth_type = 0; SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &smooth_type, 0); diff --git a/chrome/browser/ui/search/instant_extended_manual_interactive_uitest.cc b/chrome/browser/ui/search/instant_extended_manual_interactive_uitest.cc index 7707c58..e25c471 100644 --- a/chrome/browser/ui/search/instant_extended_manual_interactive_uitest.cc +++ b/chrome/browser/ui/search/instant_extended_manual_interactive_uitest.cc @@ -58,8 +58,8 @@ class InstantExtendedManualTest : public InProcessBrowserTest, void SetUpOnMainThread() override { const testing::TestInfo* const test_info = testing::UnitTest::GetInstance()->current_test_info(); - ASSERT_TRUE(StartsWithASCII(test_info->name(), "MANUAL_", true) || - StartsWithASCII(test_info->name(), "DISABLED_", true)); + ASSERT_TRUE(base::StartsWithASCII(test_info->name(), "MANUAL_", true) || + base::StartsWithASCII(test_info->name(), "DISABLED_", true)); // Make IsOffline() return false so we don't try to use the local NTP. disable_network_change_notifier_.reset( new net::NetworkChangeNotifier::DisableForTest()); diff --git a/chrome/browser/ui/webui/devtools_ui.cc b/chrome/browser/ui/webui/devtools_ui.cc index 4360cf1..e80b772 100644 --- a/chrome/browser/ui/webui/devtools_ui.cc +++ b/chrome/browser/ui/webui/devtools_ui.cc @@ -143,7 +143,7 @@ void DevToolsDataSource::StartDataRequest( // Serve request from local bundle. std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath); bundled_path_prefix += "/"; - if (StartsWithASCII(path, bundled_path_prefix, false)) { + if (base::StartsWithASCII(path, bundled_path_prefix, false)) { StartBundledDataRequest(path.substr(bundled_path_prefix.length()), render_process_id, render_frame_id, callback); return; @@ -152,7 +152,7 @@ void DevToolsDataSource::StartDataRequest( // Serve request from remote location. std::string remote_path_prefix(chrome::kChromeUIDevToolsRemotePath); remote_path_prefix += "/"; - if (StartsWithASCII(path, remote_path_prefix, false)) { + if (base::StartsWithASCII(path, remote_path_prefix, false)) { StartRemoteDataRequest(path.substr(remote_path_prefix.length()), render_process_id, render_frame_id, callback); return; diff --git a/chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc b/chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc index b1d3d56..cd688e6 100644 --- a/chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc +++ b/chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc @@ -75,8 +75,8 @@ bool ExtractsAppIdFromInput(const std::string& input, if (webstore_url.scheme() != webstore_base_url.scheme() || webstore_url.host() != webstore_base_url.host() || - !StartsWithASCII( - webstore_url.path(), webstore_base_url.path(), true)) { + !base::StartsWithASCII(webstore_url.path(), webstore_base_url.path(), + true)) { return false; } diff --git a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc index f71f025..23833b1 100644 --- a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc +++ b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc @@ -182,9 +182,9 @@ void InterstitialHTMLSource::StartDataRequest( int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { scoped_ptr<content::InterstitialPageDelegate> interstitial_delegate; - if (StartsWithASCII(path, "ssl", true)) { + if (base::StartsWithASCII(path, "ssl", true)) { interstitial_delegate.reset(CreateSSLBlockingPage(web_contents_)); - } else if (StartsWithASCII(path, "safebrowsing", true)) { + } else if (base::StartsWithASCII(path, "safebrowsing", true)) { interstitial_delegate.reset(CreateSafeBrowsingBlockingPage(web_contents_)); } diff --git a/chrome/browser/ui/webui/media_router/media_router_ui.cc b/chrome/browser/ui/webui/media_router/media_router_ui.cc index d7b2b2a..9e6d529 100644 --- a/chrome/browser/ui/webui/media_router/media_router_ui.cc +++ b/chrome/browser/ui/webui/media_router/media_router_ui.cc @@ -37,7 +37,7 @@ namespace { std::string GetHostFromURL(const GURL& gurl) { std::string host = gurl.host(); - if (StartsWithASCII(host, "www.", false)) + if (base::StartsWithASCII(host, "www.", false)) host = host.substr(4); return host; } diff --git a/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc b/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc index 8f1c392..dcb600d 100644 --- a/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc +++ b/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc @@ -84,7 +84,7 @@ void FaviconWebUIHandler::HandleGetFaviconDominantColor( std::string path; CHECK(args->GetString(0, &path)); std::string prefix = "chrome://favicon/size/"; - DCHECK(StartsWithASCII(path, prefix, false)) << "path is " << path; + DCHECK(base::StartsWithASCII(path, prefix, false)) << "path is " << path; size_t slash = path.find("/", prefix.length()); path = path.substr(slash + 1); diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm index 12fd2df..f5c8e8d 100644 --- a/chrome/browser/web_applications/web_app_mac.mm +++ b/chrome/browser/web_applications/web_app_mac.mm @@ -212,11 +212,10 @@ bool HasSameUserDataDir(const base::FilePath& bundle_path) { base::FilePath user_data_dir; PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); DCHECK(!user_data_dir.empty()); - return StartsWithASCII( + return base::StartsWithASCII( base::SysNSStringToUTF8( [plist valueForKey:app_mode::kCrAppModeUserDataDirKey]), - user_data_dir.value(), - true /* case_sensitive */); + user_data_dir.value(), true /* case_sensitive */); } void LaunchShimOnFileThread(scoped_ptr<web_app::ShortcutInfo> shortcut_info, @@ -454,7 +453,7 @@ void DeletePathAndParentIfEmpty(const base::FilePath& app_path) { bool IsShimForProfile(const base::FilePath& base_name, const std::string& profile_base_name) { - if (!StartsWithASCII(base_name.value(), profile_base_name, true)) + if (!base::StartsWithASCII(base_name.value(), profile_base_name, true)) return false; if (base_name.Extension() != ".app") diff --git a/chrome/common/crash_keys.cc b/chrome/common/crash_keys.cc index d9be107..c44f1bf 100644 --- a/chrome/common/crash_keys.cc +++ b/chrome/common/crash_keys.cc @@ -339,11 +339,11 @@ static bool IsBoringSwitch(const std::string& flag) { #if defined(OS_WIN) // Just about everything has this, don't bother. - if (StartsWithASCII(flag, "/prefetch:", true)) + if (base::StartsWithASCII(flag, "/prefetch:", true)) return true; #endif - if (!StartsWithASCII(flag, "--", true)) + if (!base::StartsWithASCII(flag, "--", true)) return false; size_t end = flag.find("="); size_t len = (end == std::string::npos) ? flag.length() - 2 : end - 2; diff --git a/chrome/common/extensions/api/file_browser_handlers/file_browser_handler.cc b/chrome/common/extensions/api/file_browser_handlers/file_browser_handler.cc index ac957e4..c2a4e7b 100644 --- a/chrome/common/extensions/api/file_browser_handlers/file_browser_handler.cc +++ b/chrome/common/extensions/api/file_browser_handlers/file_browser_handler.cc @@ -200,9 +200,8 @@ FileBrowserHandler* LoadFileBrowserHandler( return NULL; } base::StringToLowerASCII(&filter); - if (!StartsWithASCII(filter, - std::string(url::kFileSystemScheme) + ':', - true)) { + if (!base::StartsWithASCII( + filter, std::string(url::kFileSystemScheme) + ':', true)) { *error = extensions::ErrorUtils::FormatErrorMessageUTF16( errors::kInvalidURLPatternError, filter); return NULL; diff --git a/chrome/common/extensions/chrome_extensions_client.cc b/chrome/common/extensions/chrome_extensions_client.cc index 7d88608..1b07deb 100644 --- a/chrome/common/extensions/chrome_extensions_client.cc +++ b/chrome/common/extensions/chrome_extensions_client.cc @@ -367,8 +367,10 @@ bool ChromeExtensionsClient::IsBlacklistUpdateURL(const GURL& url) const { // ExtensionUpdater ensures that we notice a change. This is the full URL // of a blacklist: // http://www.gstatic.com/chrome/extensions/blacklist/l_0_0_0_7.txt - return StartsWithASCII(url.spec(), kExtensionBlocklistUrlPrefix, true) || - StartsWithASCII(url.spec(), kExtensionBlocklistHttpsUrlPrefix, true); + return base::StartsWithASCII(url.spec(), kExtensionBlocklistUrlPrefix, + true) || + base::StartsWithASCII(url.spec(), kExtensionBlocklistHttpsUrlPrefix, + true); } std::set<base::FilePath> ChromeExtensionsClient::GetBrowserImagePaths( diff --git a/chrome/common/extensions/manifest_handlers/settings_overrides_handler.cc b/chrome/common/extensions/manifest_handlers/settings_overrides_handler.cc index 67683db..cb86156 100644 --- a/chrome/common/extensions/manifest_handlers/settings_overrides_handler.cc +++ b/chrome/common/extensions/manifest_handlers/settings_overrides_handler.cc @@ -103,7 +103,7 @@ scoped_ptr<ChromeSettingsOverrides::Search_provider> ParseSearchEngine( // A www. prefix is not informative and thus not worth the limited real estate // in the permissions UI. std::string RemoveWwwPrefix(const std::string& url) { - if (StartsWithASCII(url, kWwwPrefix, false)) + if (base::StartsWithASCII(url, kWwwPrefix, false)) return url.substr(strlen(kWwwPrefix)); return url; } diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc index 5a1afab..5ba9582 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc @@ -39,10 +39,9 @@ TEST_F(HomepageURLManifestTest, GetHomepageURL) { // The Google Gallery URL ends with the id, which depends on the path, which // can be different in testing, so we just check the part before id. extension = LoadAndExpectSuccess("homepage_google_hosted.json"); - EXPECT_TRUE(StartsWithASCII( + EXPECT_TRUE(base::StartsWithASCII( extensions::ManifestURL::GetHomepageURL(extension.get()).spec(), - "https://chrome.google.com/webstore/detail/", - false)); + "https://chrome.google.com/webstore/detail/", false)); extension = LoadAndExpectSuccess("homepage_externally_hosted.json"); EXPECT_EQ(GURL(), extensions::ManifestURL::GetHomepageURL(extension.get())); diff --git a/chrome/common/pref_names_util.cc b/chrome/common/pref_names_util.cc index 7ab3db3..0857265 100644 --- a/chrome/common/pref_names_util.cc +++ b/chrome/common/pref_names_util.cc @@ -13,7 +13,7 @@ const char kWebKitFontPrefPrefix[] = "webkit.webprefs.fonts."; bool ParseFontNamePrefPath(const std::string& pref_path, std::string* generic_family, std::string* script) { - if (!StartsWithASCII(pref_path, kWebKitFontPrefPrefix, true)) + if (!base::StartsWithASCII(pref_path, kWebKitFontPrefPrefix, true)) return false; size_t start = strlen(kWebKitFontPrefPrefix); diff --git a/chrome/common/variations/experiment_labels.cc b/chrome/common/variations/experiment_labels.cc index 7ec0ea2..6c95244 100644 --- a/chrome/common/variations/experiment_labels.cc +++ b/chrome/common/variations/experiment_labels.cc @@ -79,7 +79,7 @@ base::string16 ExtractNonVariationLabels(const base::string16& labels) { for (std::vector<base::string16>::const_iterator it = entries.begin(); it != entries.end(); ++it) { if (it->empty() || - StartsWith(*it, base::ASCIIToUTF16(kVariationPrefix), false)) { + base::StartsWith(*it, base::ASCIIToUTF16(kVariationPrefix), false)) { continue; } @@ -95,9 +95,9 @@ base::string16 ExtractNonVariationLabels(const base::string16& labels) { base::string16 CombineExperimentLabels(const base::string16& variation_labels, const base::string16& other_labels) { const base::string16 separator(1, google_update::kExperimentLabelSeparator); - DCHECK(!StartsWith(variation_labels, separator, false)); + DCHECK(!base::StartsWith(variation_labels, separator, false)); DCHECK(!EndsWith(variation_labels, separator, false)); - DCHECK(!StartsWith(other_labels, separator, false)); + DCHECK(!base::StartsWith(other_labels, separator, false)); DCHECK(!EndsWith(other_labels, separator, false)); // Note that if either label is empty, a separator is not necessary. base::string16 combined_labels = other_labels; diff --git a/chrome/installer/gcapi/gcapi.cc b/chrome/installer/gcapi/gcapi.cc index 43b76c7..a560b7b 100644 --- a/chrome/installer/gcapi/gcapi.cc +++ b/chrome/installer/gcapi/gcapi.cc @@ -366,9 +366,9 @@ BOOL CALLBACK ChromeWindowEnumProc(HWND hwnd, LPARAM lparam) { if (!params->shunted_hwnds.count(hwnd) && ::GetClassName(hwnd, window_class, arraysize(window_class)) && - StartsWith(window_class, kChromeWindowClassPrefix, false) && - ::SetWindowPos(hwnd, params->window_insert_after, params->x, - params->y, params->width, params->height, params->flags)) { + base::StartsWith(window_class, kChromeWindowClassPrefix, false) && + ::SetWindowPos(hwnd, params->window_insert_after, params->x, params->y, + params->width, params->height, params->flags)) { params->shunted_hwnds.insert(hwnd); params->success = true; } diff --git a/chrome/installer/gcapi/gcapi_omaha_experiment.cc b/chrome/installer/gcapi/gcapi_omaha_experiment.cc index c49de3d..30c0137 100644 --- a/chrome/installer/gcapi/gcapi_omaha_experiment.cc +++ b/chrome/installer/gcapi/gcapi_omaha_experiment.cc @@ -50,7 +50,7 @@ bool SetExperimentLabel(const wchar_t* brand_code, base::string16 new_labels; for (std::vector<base::string16>::const_iterator it = entries.begin(); it != entries.end(); ++it) { - if (!it->empty() && !StartsWith(*it, label + L"=", true)) { + if (!it->empty() && !base::StartsWith(*it, label + L"=", true)) { new_labels += *it; new_labels += google_update::kExperimentLabelSeparator; } diff --git a/chrome/installer/util/delete_after_reboot_helper.cc b/chrome/installer/util/delete_after_reboot_helper.cc index b298d6a..513cd3c 100644 --- a/chrome/installer/util/delete_after_reboot_helper.cc +++ b/chrome/installer/util/delete_after_reboot_helper.cc @@ -330,7 +330,7 @@ bool MatchPendingDeletePath(const base::FilePath& short_form_needle, // First chomp the prefix since that will mess up GetShortPathName. std::wstring prefix(L"\\??\\"); - if (StartsWith(match_path, prefix, false)) + if (base::StartsWith(match_path, prefix, false)) match_path = match_path.substr(4); // Get the short path name of the entry. @@ -338,7 +338,8 @@ bool MatchPendingDeletePath(const base::FilePath& short_form_needle, // Now compare the paths. If it isn't one we're looking for, add it // to the list to keep. - return StartsWith(short_match_path.value(), short_form_needle.value(), false); + return base::StartsWith(short_match_path.value(), short_form_needle.value(), + false); } // Removes all pending moves for the given |directory| and any contained diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc index a3861b8..f7dccea 100644 --- a/chrome/installer/util/install_util.cc +++ b/chrome/installer/util/install_util.cc @@ -379,7 +379,7 @@ bool InstallUtil::IsPerUserInstall(const base::FilePath& exe_path) { NOTREACHED(); return true; } - return !StartsWith(exe_path.value(), program_files_path.value(), false); + return !base::StartsWith(exe_path.value(), program_files_path.value(), false); } bool InstallUtil::IsMultiInstall(BrowserDistribution* dist, diff --git a/chrome/installer/util/shell_util_unittest.cc b/chrome/installer/util/shell_util_unittest.cc index 0294c43..68fc57d 100644 --- a/chrome/installer/util/shell_util_unittest.cc +++ b/chrome/installer/util/shell_util_unittest.cc @@ -979,7 +979,7 @@ TEST(ShellUtilTest, BuildAppModelIdLongEverything) { TEST(ShellUtilTest, GetUserSpecificRegistrySuffix) { base::string16 suffix; ASSERT_TRUE(ShellUtil::GetUserSpecificRegistrySuffix(&suffix)); - ASSERT_TRUE(StartsWith(suffix, L".", true)); + ASSERT_TRUE(base::StartsWith(suffix, L".", true)); ASSERT_EQ(27, suffix.length()); ASSERT_TRUE(base::ContainsOnlyChars(suffix.substr(1), L"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567")); @@ -988,7 +988,7 @@ TEST(ShellUtilTest, GetUserSpecificRegistrySuffix) { TEST(ShellUtilTest, GetOldUserSpecificRegistrySuffix) { base::string16 suffix; ASSERT_TRUE(ShellUtil::GetOldUserSpecificRegistrySuffix(&suffix)); - ASSERT_TRUE(StartsWith(suffix, L".", true)); + ASSERT_TRUE(base::StartsWith(suffix, L".", true)); wchar_t user_name[256]; DWORD size = arraysize(user_name); diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 258817d..f34a5c7 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -1512,7 +1512,7 @@ bool ChromeContentRendererClient::AllowPepperMediaStreamAPI( (EndsWith(url_host, "talkgadget.google.com", false) || EndsWith(url_host, "plus.google.com", false) || EndsWith(url_host, "plus.sandbox.google.com", false)) && - StartsWithASCII(url.path(), "/hangouts/", false)) { + base::StartsWithASCII(url.path(), "/hangouts/", false)) { return true; } // Allow access for tests. diff --git a/chrome/renderer/content_settings_observer.cc b/chrome/renderer/content_settings_observer.cc index 449d1b7..af4158b 100644 --- a/chrome/renderer/content_settings_observer.cc +++ b/chrome/renderer/content_settings_observer.cc @@ -474,18 +474,19 @@ bool ContentSettingsObserver::allowDisplayingInsecureContent( GURL frame_gurl(frame->document().url()); if (IsHostInDomain(origin_host, kGoogleDotCom)) { SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_GOOGLE); - if (StartsWithASCII(frame_gurl.path(), kGoogleSupportPathPrefix, false)) { + if (base::StartsWithASCII(frame_gurl.path(), kGoogleSupportPathPrefix, + false)) { SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_GOOGLE_SUPPORT); - } else if (StartsWithASCII(frame_gurl.path(), - kGoogleIntlPathPrefix, - false)) { + } else if (base::StartsWithASCII(frame_gurl.path(), kGoogleIntlPathPrefix, + false)) { SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_GOOGLE_INTL); } } if (origin_host == kWWWDotGoogleDotCom) { SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_WWW_GOOGLE); - if (StartsWithASCII(frame_gurl.path(), kGoogleReaderPathPrefix, false)) + if (base::StartsWithASCII(frame_gurl.path(), kGoogleReaderPathPrefix, + false)) SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_GOOGLE_READER); } else if (origin_host == kMailDotGoogleDotCom) { SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_MAIL_GOOGLE); @@ -531,18 +532,19 @@ bool ContentSettingsObserver::allowRunningInsecureContent( bool is_google = IsHostInDomain(origin_host, kGoogleDotCom); if (is_google) { SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_GOOGLE); - if (StartsWithASCII(frame_gurl.path(), kGoogleSupportPathPrefix, false)) { + if (base::StartsWithASCII(frame_gurl.path(), kGoogleSupportPathPrefix, + false)) { SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_GOOGLE_SUPPORT); - } else if (StartsWithASCII(frame_gurl.path(), - kGoogleIntlPathPrefix, - false)) { + } else if (base::StartsWithASCII(frame_gurl.path(), kGoogleIntlPathPrefix, + false)) { SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_GOOGLE_INTL); } } if (origin_host == kWWWDotGoogleDotCom) { SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_WWW_GOOGLE); - if (StartsWithASCII(frame_gurl.path(), kGoogleReaderPathPrefix, false)) + if (base::StartsWithASCII(frame_gurl.path(), kGoogleReaderPathPrefix, + false)) SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_GOOGLE_READER); } else if (origin_host == kMailDotGoogleDotCom) { SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_MAIL_GOOGLE); diff --git a/chrome/renderer/extensions/app_bindings.cc b/chrome/renderer/extensions/app_bindings.cc index 472d931..af65cc9 100644 --- a/chrome/renderer/extensions/app_bindings.cc +++ b/chrome/renderer/extensions/app_bindings.cc @@ -39,7 +39,7 @@ bool IsCheckoutURL(const std::string& url_spec) { if (checkout_url_prefix.empty()) checkout_url_prefix = "https://checkout.google.com/"; - return StartsWithASCII(url_spec, checkout_url_prefix, false); + return base::StartsWithASCII(url_spec, checkout_url_prefix, false); } bool CheckAccessToAppDetails(WebFrame* frame, v8::Isolate* isolate) { diff --git a/chrome/renderer/extensions/extension_localization_peer.cc b/chrome/renderer/extensions/extension_localization_peer.cc index 7208c2a..17b9756 100644 --- a/chrome/renderer/extensions/extension_localization_peer.cc +++ b/chrome/renderer/extensions/extension_localization_peer.cc @@ -55,8 +55,9 @@ ExtensionLocalizationPeer::CreateExtensionLocalizationPeer( // Return NULL if content is not text/css or it doesn't belong to extension // scheme. return (request_url.SchemeIs(extensions::kExtensionScheme) && - StartsWithASCII(mime_type, "text/css", false)) ? - new ExtensionLocalizationPeer(peer, message_sender, request_url) : NULL; + base::StartsWithASCII(mime_type, "text/css", false)) + ? new ExtensionLocalizationPeer(peer, message_sender, request_url) + : NULL; } void ExtensionLocalizationPeer::OnUploadProgress( diff --git a/chrome/renderer/extensions/webstore_bindings.cc b/chrome/renderer/extensions/webstore_bindings.cc index 1ab5810..a7b4b1c 100644 --- a/chrome/renderer/extensions/webstore_bindings.cc +++ b/chrome/renderer/extensions/webstore_bindings.cc @@ -160,8 +160,8 @@ bool WebstoreBindings::GetWebstoreItemIdFromFrame( if (webstore_url.scheme() != webstore_base_url.scheme() || webstore_url.host() != webstore_base_url.host() || - !StartsWithASCII( - webstore_url.path(), webstore_base_url.path(), true)) { + !base::StartsWithASCII(webstore_url.path(), webstore_base_url.path(), + true)) { *error = kInvalidWebstoreItemUrlError; return false; } diff --git a/chrome/renderer/page_load_histograms.cc b/chrome/renderer/page_load_histograms.cc index 0723709..729677c 100644 --- a/chrome/renderer/page_load_histograms.cc +++ b/chrome/renderer/page_load_histograms.cc @@ -179,17 +179,16 @@ bool ViaHeaderContains(WebFrame* frame, const std::string& via_value) { // purposes. // TODO(pmeenan): Remove the fuzzy logic when the referrer is reliable bool IsFromGoogleSearchResult(const GURL& url, const GURL& referrer) { - if (!StartsWithASCII(referrer.host(), "www.google.", true)) + if (!base::StartsWithASCII(referrer.host(), "www.google.", true)) return false; - if (StartsWithASCII(referrer.path(), "/url", true)) + if (base::StartsWithASCII(referrer.path(), "/url", true)) return true; bool is_possible_search_referrer = - referrer.path().empty() || - referrer.path() == "/" || - StartsWithASCII(referrer.path(), "/search", true) || - StartsWithASCII(referrer.path(), "/webhp", true); + referrer.path().empty() || referrer.path() == "/" || + base::StartsWithASCII(referrer.path(), "/search", true) || + base::StartsWithASCII(referrer.path(), "/webhp", true); if (is_possible_search_referrer && - !StartsWithASCII(url.host(), "www.google", true)) + !base::StartsWithASCII(url.host(), "www.google", true)) return true; return false; } diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc index 1e77c45..277e5a1 100644 --- a/chrome/renderer/searchbox/searchbox_extension.cc +++ b/chrome/renderer/searchbox/searchbox_extension.cc @@ -76,7 +76,7 @@ bool IsIconNTPEnabled() { if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableIconNtp)) return true; - return StartsWithASCII(group_name, "Enabled", true); + return base::StartsWithASCII(group_name, "Enabled", true); } // Converts string16 to V8 String. diff --git a/chrome/service/cloud_print/cloud_print_connector.cc b/chrome/service/cloud_print/cloud_print_connector.cc index fa78392..e1e4c13 100644 --- a/chrome/service/cloud_print/cloud_print_connector.cc +++ b/chrome/service/cloud_print/cloud_print_connector.cc @@ -418,7 +418,8 @@ void CloudPrintConnector::InitJobHandlerForPrinter( for (size_t index = 0; index < tags_list->GetSize(); index++) { std::string tag; if (tags_list->GetString(index, &tag) && - StartsWithASCII(tag, kCloudPrintServiceTagsHashTagName, false)) { + base::StartsWithASCII(tag, kCloudPrintServiceTagsHashTagName, + false)) { std::vector<std::string> tag_parts; base::SplitStringDontTrim(tag, '=', &tag_parts); DCHECK_EQ(tag_parts.size(), 2U); diff --git a/chrome/test/chromedriver/chrome/web_view_impl.cc b/chrome/test/chromedriver/chrome/web_view_impl.cc index 93be27e..576bea2 100644 --- a/chrome/test/chromedriver/chrome/web_view_impl.cc +++ b/chrome/test/chromedriver/chrome/web_view_impl.cc @@ -155,7 +155,7 @@ Status WebViewImpl::HandleReceivedEvents() { Status WebViewImpl::Load(const std::string& url) { // Javascript URLs will cause a hang while waiting for the page to stop // loading, so just disallow. - if (StartsWithASCII(url, "javascript:", false)) + if (base::StartsWithASCII(url, "javascript:", false)) return Status(kUnknownError, "unsupported protocol"); base::DictionaryValue params; params.SetString("url", url); diff --git a/chrome/test/chromedriver/performance_logger.cc b/chrome/test/chromedriver/performance_logger.cc index 800e8ec..2dceef9 100644 --- a/chrome/test/chromedriver/performance_logger.cc +++ b/chrome/test/chromedriver/performance_logger.cc @@ -52,7 +52,8 @@ bool ShouldRequestTraceEvents(const std::string& command) { // Returns whether the event belongs to one of kDomains. bool ShouldLogEvent(const std::string& method) { for (size_t i_domain = 0; i_domain < arraysize(kDomains); ++i_domain) { - if (StartsWithASCII(method, kDomains[i_domain], true /* case_sensitive */)) + if (base::StartsWithASCII(method, kDomains[i_domain], + true /* case_sensitive */)) return true; } return false; diff --git a/chrome/test/chromedriver/server/http_handler.cc b/chrome/test/chromedriver/server/http_handler.cc index 32cb7e6..77bed02 100644 --- a/chrome/test/chromedriver/server/http_handler.cc +++ b/chrome/test/chromedriver/server/http_handler.cc @@ -580,7 +580,7 @@ void HttpHandler::Handle(const net::HttpServerRequestInfo& request, return; std::string path = request.path; - if (!StartsWithASCII(path, url_base_, true)) { + if (!base::StartsWithASCII(path, url_base_, true)) { scoped_ptr<net::HttpServerResponseInfo> response( new net::HttpServerResponseInfo(net::HTTP_BAD_REQUEST)); response->SetBody("unhandled request", "text/plain"); diff --git a/chrome/tools/profile_reset/jtl_compiler_unittest.cc b/chrome/tools/profile_reset/jtl_compiler_unittest.cc index cb6fea2..c39e59a 100644 --- a/chrome/tools/profile_reset/jtl_compiler_unittest.cc +++ b/chrome/tools/profile_reset/jtl_compiler_unittest.cc @@ -113,7 +113,8 @@ TEST(JtlCompiler, InvalidOperationName) { JtlCompiler::CompileError error; EXPECT_FALSE( JtlCompiler::Compile(kSourceCode, kTestHashSeed, &bytecode, &error)); - EXPECT_THAT(error.context, testing::StartsWith("non_existent_instruction")); + EXPECT_THAT(error.context, + testing::base::StartsWith("non_existent_instruction")); EXPECT_EQ(2u, error.line_number); EXPECT_EQ(JtlCompiler::CompileError::INVALID_OPERATION_NAME, error.error_code); @@ -130,7 +131,7 @@ TEST(JtlCompiler, InvalidArgumentsCount) { JtlCompiler::CompileError error; EXPECT_FALSE(JtlCompiler::Compile( kSourceCodes[i], kTestHashSeed, &bytecode, &error)); - EXPECT_THAT(error.context, testing::StartsWith("store_bool")); + EXPECT_THAT(error.context, testing::base::StartsWith("store_bool")); EXPECT_EQ(1u, error.line_number); EXPECT_EQ(JtlCompiler::CompileError::INVALID_ARGUMENT_COUNT, error.error_code); @@ -162,7 +163,7 @@ TEST(JtlCompiler, InvalidArgumentType) { EXPECT_FALSE(JtlCompiler::Compile( cases[i].source_code, kTestHashSeed, &bytecode, &error)); EXPECT_THAT(error.context, - testing::StartsWith(cases[i].expected_context_prefix)); + testing::base::StartsWith(cases[i].expected_context_prefix)); EXPECT_EQ(2u, error.line_number); EXPECT_EQ(JtlCompiler::CompileError::INVALID_ARGUMENT_TYPE, error.error_code); @@ -183,7 +184,7 @@ TEST(JtlCompiler, InvalidArgumentValue) { EXPECT_FALSE(JtlCompiler::Compile( cases[i].source_code, kTestHashSeed, &bytecode, &error)); EXPECT_THAT(error.context, - testing::StartsWith(cases[i].expected_context_prefix)); + testing::base::StartsWith(cases[i].expected_context_prefix)); EXPECT_EQ(0u, error.line_number); EXPECT_EQ(JtlCompiler::CompileError::INVALID_ARGUMENT_VALUE, error.error_code); @@ -209,7 +210,7 @@ TEST(JtlCompiler, ParsingError) { JtlCompiler::CompileError error; EXPECT_FALSE( JtlCompiler::Compile(kSourceCode, kTestHashSeed, &bytecode, &error)); - EXPECT_THAT(error.context, testing::StartsWith("go")); + EXPECT_THAT(error.context, testing::base::StartsWith("go")); EXPECT_EQ(1u, error.line_number); EXPECT_EQ(JtlCompiler::CompileError::PARSING_ERROR, error.error_code); } diff --git a/chrome/tools/profile_reset/jtl_parser_unittest.cc b/chrome/tools/profile_reset/jtl_parser_unittest.cc index 76f6171..87b7ebc 100644 --- a/chrome/tools/profile_reset/jtl_parser_unittest.cc +++ b/chrome/tools/profile_reset/jtl_parser_unittest.cc @@ -43,7 +43,7 @@ void ExpectNextOperationToFail(JtlParser* parser, EXPECT_FALSE(parser->ParseNextOperation( &actual_name, &actual_args, &actual_ends_sentence)); EXPECT_THAT(parser->GetLastContext(), - testing::StartsWith(expected_context_prefix)); + testing::base::StartsWith(expected_context_prefix)); EXPECT_EQ(expected_line_number, parser->GetLastLineNumber()); } diff --git a/chrome/utility/importer/bookmark_html_reader.cc b/chrome/utility/importer/bookmark_html_reader.cc index ec192d3..0fa2c92 100644 --- a/chrome/utility/importer/bookmark_html_reader.cc +++ b/chrome/utility/importer/bookmark_html_reader.cc @@ -119,7 +119,7 @@ void ImportBookmarksFile( // multiple "<HR>" tags at the beginning of a single line. // See http://crbug.com/257474. static const char kHrTag[] = "<HR>"; - while (StartsWithASCII(line, kHrTag, false)) { + while (base::StartsWithASCII(line, kHrTag, false)) { line.erase(0, arraysize(kHrTag) - 1); base::TrimString(line, " ", &line); } @@ -205,7 +205,7 @@ void ImportBookmarksFile( } // Bookmarks in sub-folder are encapsulated with <DL> tag. - if (StartsWithASCII(line, "<DL>", false)) { + if (base::StartsWithASCII(line, "<DL>", false)) { has_subfolder = true; if (!last_folder.empty()) { path.push_back(last_folder); @@ -216,7 +216,7 @@ void ImportBookmarksFile( // Mark next folder empty as initial state. last_folder_is_empty = true; - } else if (StartsWithASCII(line, "</DL>", false)) { + } else if (base::StartsWithASCII(line, "</DL>", false)) { if (path.empty()) break; // Mismatch <DL>. @@ -278,9 +278,9 @@ namespace internal { bool ParseCharsetFromLine(const std::string& line, std::string* charset) { const char kCharset[] = "charset="; - if (StartsWithASCII(line, "<META", false) && + if (base::StartsWithASCII(line, "<META", false) && (line.find("CONTENT=\"") != std::string::npos || - line.find("content=\"") != std::string::npos)) { + line.find("content=\"") != std::string::npos)) { size_t begin = line.find(kCharset); if (begin == std::string::npos) return false; @@ -302,7 +302,7 @@ bool ParseFolderNameFromLine(const std::string& line, const char kToolbarFolderAttribute[] = "PERSONAL_TOOLBAR_FOLDER"; const char kAddDateAttribute[] = "ADD_DATE"; - if (!StartsWithASCII(line, kFolderOpen, true)) + if (!base::StartsWithASCII(line, kFolderOpen, true)) return false; size_t end = line.find(kFolderClose); @@ -361,7 +361,7 @@ bool ParseBookmarkFromLine(const std::string& line, post_data->clear(); *add_date = base::Time(); - if (!StartsWithASCII(line, kItemOpen, true)) + if (!base::StartsWithASCII(line, kItemOpen, true)) return false; size_t end = line.find(kItemClose); @@ -437,7 +437,7 @@ bool ParseMinimumBookmarkFromLine(const std::string& line, *url = GURL(); // Case-insensitive check of open tag. - if (!StartsWithASCII(line, kItemOpen, false)) + if (!base::StartsWithASCII(line, kItemOpen, false)) return false; // Find any close tag. diff --git a/chrome/utility/media_galleries/media_metadata_parser.cc b/chrome/utility/media_galleries/media_metadata_parser.cc index c5da99e..a39324e 100644 --- a/chrome/utility/media_galleries/media_metadata_parser.cc +++ b/chrome/utility/media_galleries/media_metadata_parser.cc @@ -166,8 +166,8 @@ MediaMetadataParser::MediaMetadataParser(media::DataSource* source, MediaMetadataParser::~MediaMetadataParser() {} void MediaMetadataParser::Start(const MetadataCallback& callback) { - if (StartsWithASCII(mime_type_, "audio/", true) || - StartsWithASCII(mime_type_, "video/", true)) { + if (base::StartsWithASCII(mime_type_, "audio/", true) || + base::StartsWithASCII(mime_type_, "video/", true)) { MediaMetadata* metadata = new MediaMetadata; metadata->mime_type = mime_type_; std::vector<AttachedImage>* attached_images = @@ -183,7 +183,7 @@ void MediaMetadataParser::Start(const MetadataCallback& callback) { return; } - if (StartsWithASCII(mime_type_, "image/", true)) { + if (base::StartsWithASCII(mime_type_, "image/", true)) { ImageMetadataExtractor* extractor = new ImageMetadataExtractor; extractor->Extract( source_, diff --git a/chrome/utility/media_galleries/picasa_album_table_reader.cc b/chrome/utility/media_galleries/picasa_album_table_reader.cc index f5a5b2b..94b4aa5 100644 --- a/chrome/utility/media_galleries/picasa_album_table_reader.cc +++ b/chrome/utility/media_galleries/picasa_album_table_reader.cc @@ -91,7 +91,7 @@ bool PicasaAlbumTableReader::Init() { if (category == kAlbumCategoryAlbum) { std::string token; if (!token_column.ReadString(i, &token) || token.empty() || - !StartsWithASCII(token, kAlbumTokenPrefix, false)) { + !base::StartsWithASCII(token, kAlbumTokenPrefix, false)) { continue; } diff --git a/chromeos/dbus/bluetooth_gatt_characteristic_service_provider.cc b/chromeos/dbus/bluetooth_gatt_characteristic_service_provider.cc index 39c95bf..d4e4c38 100644 --- a/chromeos/dbus/bluetooth_gatt_characteristic_service_provider.cc +++ b/chromeos/dbus/bluetooth_gatt_characteristic_service_provider.cc @@ -52,8 +52,8 @@ class BluetoothGattCharacteristicServiceProviderImpl DCHECK(!uuid_.empty()); DCHECK(object_path_.IsValid()); DCHECK(service_path_.IsValid()); - DCHECK(StartsWithASCII( - object_path_.value(), service_path_.value() + "/", true)); + DCHECK(base::StartsWithASCII(object_path_.value(), + service_path_.value() + "/", true)); exported_object_ = bus_->GetExportedObject(object_path_); diff --git a/chromeos/dbus/bluetooth_gatt_descriptor_service_provider.cc b/chromeos/dbus/bluetooth_gatt_descriptor_service_provider.cc index 8c49459..d09fd5e 100644 --- a/chromeos/dbus/bluetooth_gatt_descriptor_service_provider.cc +++ b/chromeos/dbus/bluetooth_gatt_descriptor_service_provider.cc @@ -50,8 +50,8 @@ class BluetoothGattDescriptorServiceProviderImpl DCHECK(!uuid_.empty()); DCHECK(object_path_.IsValid()); DCHECK(characteristic_path_.IsValid()); - DCHECK(StartsWithASCII( - object_path_.value(), characteristic_path_.value() + "/", true)); + DCHECK(base::StartsWithASCII(object_path_.value(), + characteristic_path_.value() + "/", true)); exported_object_ = bus_->GetExportedObject(object_path_); diff --git a/chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc b/chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc index 6301210..d77dc711 100644 --- a/chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc +++ b/chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc @@ -29,8 +29,8 @@ FakeBluetoothGattCharacteristicServiceProvider:: DCHECK(service_path_.IsValid()); DCHECK(!uuid.empty()); DCHECK(delegate_); - DCHECK(StartsWithASCII( - object_path_.value(), service_path_.value() + "/", true)); + DCHECK(base::StartsWithASCII(object_path_.value(), + service_path_.value() + "/", true)); // TODO(armansito): Do something with |flags| and |permissions|. diff --git a/chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc b/chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc index 83ea686..bb4c55e 100644 --- a/chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc +++ b/chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc @@ -29,8 +29,8 @@ FakeBluetoothGattDescriptorServiceProvider:: DCHECK(characteristic_path_.IsValid()); DCHECK(!uuid.empty()); DCHECK(delegate_); - DCHECK(StartsWithASCII( - object_path_.value(), characteristic_path_.value() + "/", true)); + DCHECK(base::StartsWithASCII(object_path_.value(), + characteristic_path_.value() + "/", true)); // TODO(armansito): Do something with |permissions|. diff --git a/chromeos/dbus/fake_shill_service_client.cc b/chromeos/dbus/fake_shill_service_client.cc index 7ee373e..990a37b 100644 --- a/chromeos/dbus/fake_shill_service_client.cc +++ b/chromeos/dbus/fake_shill_service_client.cc @@ -408,15 +408,15 @@ bool FakeShillServiceClient::SetServiceProperty(const std::string& service_path, base::DictionaryValue new_properties; std::string changed_property; bool case_sensitive = true; - if (StartsWithASCII(property, "Provider.", case_sensitive) || - StartsWithASCII(property, "OpenVPN.", case_sensitive) || - StartsWithASCII(property, "L2TPIPsec.", case_sensitive)) { + if (base::StartsWithASCII(property, "Provider.", case_sensitive) || + base::StartsWithASCII(property, "OpenVPN.", case_sensitive) || + base::StartsWithASCII(property, "L2TPIPsec.", case_sensitive)) { // These properties are only nested within the Provider dictionary if read // from Shill. Properties that start with "Provider" need to have that // stripped off, other properties are nested in the "Provider" dictionary // as-is. std::string key = property; - if (StartsWithASCII(property, "Provider.", case_sensitive)) + if (base::StartsWithASCII(property, "Provider.", case_sensitive)) key = property.substr(strlen("Provider.")); base::DictionaryValue* provider = new base::DictionaryValue; provider->SetWithoutPathExpansion(key, value.DeepCopy()); diff --git a/chromeos/dbus/session_manager_client.cc b/chromeos/dbus/session_manager_client.cc index 0e0d72a..a60a631 100644 --- a/chromeos/dbus/session_manager_client.cc +++ b/chromeos/dbus/session_manager_client.cc @@ -565,7 +565,7 @@ class SessionManagerClientImpl : public SessionManagerClient { LOG(ERROR) << "Invalid signal: " << signal->ToString(); return; } - const bool success = StartsWithASCII(result_string, "success", false); + const bool success = base::StartsWithASCII(result_string, "success", false); FOR_EACH_OBSERVER(Observer, observers_, OwnerKeySet(success)); } @@ -577,7 +577,7 @@ class SessionManagerClientImpl : public SessionManagerClient { LOG(ERROR) << "Invalid signal: " << signal->ToString(); return; } - const bool success = StartsWithASCII(result_string, "success", false); + const bool success = base::StartsWithASCII(result_string, "success", false); FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(success)); } diff --git a/chromeos/disks/disk_mount_manager.cc b/chromeos/disks/disk_mount_manager.cc index 9264a33..36e4c46 100644 --- a/chromeos/disks/disk_mount_manager.cc +++ b/chromeos/disks/disk_mount_manager.cc @@ -273,8 +273,8 @@ class DiskMountManagerImpl : public DiskMountManager { for (MountPointMap::iterator it = mount_points_.begin(); it != mount_points_.end(); ++it) { - if (StartsWithASCII(it->second.source_path, mount_path, - true /*case sensitive*/)) { + if (base::StartsWithASCII(it->second.source_path, mount_path, + true /*case sensitive*/)) { // TODO(tbarzic): Handle the case where this fails. UnmountPath(it->second.mount_path, UNMOUNT_OPTIONS_NONE, @@ -603,7 +603,7 @@ class DiskMountManagerImpl : public DiskMountManager { it != system_path_prefixes_.end(); ++it) { const std::string& prefix = *it; - if (StartsWithASCII(system_path, prefix, true)) + if (base::StartsWithASCII(system_path, prefix, true)) return prefix; } return base::EmptyString(); diff --git a/chromeos/settings/cros_settings_provider.cc b/chromeos/settings/cros_settings_provider.cc index 98faf71..dceed62 100644 --- a/chromeos/settings/cros_settings_provider.cc +++ b/chromeos/settings/cros_settings_provider.cc @@ -27,7 +27,7 @@ void CrosSettingsProvider::Set(const std::string& path, // It should not reach here from UI in the guest mode, but just in case. if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kGuestSession) && - !::StartsWithASCII(path, "cros.session.", true)) { + !::base::StartsWithASCII(path, "cros.session.", true)) { LOG(ERROR) << "Ignoring the guest request to change: " << path; return; } diff --git a/chromeos/system/version_loader.cc b/chromeos/system/version_loader.cc index 50cdaf4..4e6272c 100644 --- a/chromeos/system/version_loader.cc +++ b/chromeos/system/version_loader.cc @@ -78,7 +78,7 @@ std::string ParseFirmware(const std::string& contents) { std::vector<std::string> lines; base::SplitString(contents, '\n', &lines); for (size_t i = 0; i < lines.size(); ++i) { - if (StartsWithASCII(lines[i], kFirmwarePrefix, false)) { + if (base::StartsWithASCII(lines[i], kFirmwarePrefix, false)) { std::string str = lines[i].substr(std::string(kFirmwarePrefix).size()); size_t found = str.find_first_not_of("| "); if (found != std::string::npos) diff --git a/cloud_print/service/service_state.cc b/cloud_print/service/service_state.cc index 789d229..80dbd8c 100644 --- a/cloud_print/service/service_state.cc +++ b/cloud_print/service/service_state.cc @@ -199,7 +199,7 @@ std::string ServiceState::LoginToGoogle(const std::string& service, std::vector<std::string> lines; Tokenize(fetcher_delegate.data(), "\r\n", &lines); for (size_t i = 0; i < lines.size(); ++i) { - if (StartsWithASCII(lines[i], kAuthStart, false)) + if (base::StartsWithASCII(lines[i], kAuthStart, false)) return lines[i].substr(arraysize(kAuthStart) - 1); } diff --git a/cloud_print/service/win/service_utils.cc b/cloud_print/service/win/service_utils.cc index 6bced80..6932447 100644 --- a/cloud_print/service/win/service_utils.cc +++ b/cloud_print/service/win/service_utils.cc @@ -28,7 +28,7 @@ base::string16 GetLocalComputerName() { base::string16 ReplaceLocalHostInName(const base::string16& user_name) { static const wchar_t kLocalDomain[] = L".\\"; - if (StartsWith(user_name, kLocalDomain, true)) { + if (base::StartsWith(user_name, kLocalDomain, true)) { return GetLocalComputerName() + user_name.substr(arraysize(kLocalDomain) - 2); } diff --git a/components/autofill/content/browser/wallet/wallet_service_url.cc b/components/autofill/content/browser/wallet/wallet_service_url.cc index 3b0c2d5..e032ed3 100644 --- a/components/autofill/content/browser/wallet/wallet_service_url.cc +++ b/components/autofill/content/browser/wallet/wallet_service_url.cc @@ -207,9 +207,8 @@ bool IsSignInContinueUrl(const GURL& url, size_t* user_index) { bool IsSignInRelatedUrl(const GURL& url) { size_t unused; return url.GetOrigin() == GetAddAccountUrl().GetOrigin() || - StartsWith(base::UTF8ToUTF16(url.GetOrigin().host()), - base::ASCIIToUTF16("accounts."), - false) || + base::StartsWith(base::UTF8ToUTF16(url.GetOrigin().host()), + base::ASCIIToUTF16("accounts."), false) || IsSignInContinueUrl(url, &unused); } diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc index b6686c3..f73e591 100644 --- a/components/autofill/content/renderer/autofill_agent.cc +++ b/components/autofill/content/renderer/autofill_agent.cc @@ -97,9 +97,8 @@ void GetDataListSuggestions(const WebInputElement& element, } for (WebOptionElement option = options.firstItem().to<WebOptionElement>(); !option.isNull(); option = options.nextItem().to<WebOptionElement>()) { - if (!StartsWith(option.value(), prefix, false) || - option.value() == prefix || - !element.isValidValue(option.value())) + if (!base::StartsWith(option.value(), prefix, false) || + option.value() == prefix || !element.isValidValue(option.value())) continue; values->push_back(option.value()); diff --git a/components/autofill/content/renderer/form_autofill_util.cc b/components/autofill/content/renderer/form_autofill_util.cc index 3a00eb2..51a2251 100644 --- a/components/autofill/content/renderer/form_autofill_util.cc +++ b/components/autofill/content/renderer/form_autofill_util.cc @@ -1314,7 +1314,7 @@ bool UnownedFormElementsAndFieldSetsToFormData( std::string lang; if (!html_element.isNull()) lang = html_element.getAttribute("lang").utf8(); - if ((lang.empty() || StartsWithASCII(lang, "en", false)) && + if ((lang.empty() || base::StartsWithASCII(lang, "en", false)) && !MatchesPattern(document.title(), base::UTF8ToUTF16("payment|checkout|address|delivery|shipping"))) { return false; diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc index ea8944a..fd9ac7f 100644 --- a/components/autofill/content/renderer/password_autofill_agent.cc +++ b/components/autofill/content/renderer/password_autofill_agent.cc @@ -225,7 +225,7 @@ bool DoUsernamesMatch(const base::string16& username1, bool exact_match) { if (exact_match) return username1 == username2; - return StartsWith(username1, username2, true); + return base::StartsWith(username1, username2, true); } // Returns |true| if the given element is editable. Otherwise, returns |false|. @@ -288,21 +288,21 @@ bool GetSuggestionsStats(const PasswordFormFillData& fill_data, for (const auto& usernames : fill_data.other_possible_usernames) { for (size_t i = 0; i < usernames.second.size(); ++i) { if (show_all || - StartsWith(usernames.second[i], current_username, false)) { + base::StartsWith(usernames.second[i], current_username, false)) { *suggestions_present = true; return true; } } } - if (show_all || - StartsWith(fill_data.username_field.value, current_username, false)) { + if (show_all || base::StartsWith(fill_data.username_field.value, + current_username, false)) { *suggestions_present = true; return false; } for (const auto& login : fill_data.additional_logins) { - if (show_all || StartsWith(login.first, current_username, false)) { + if (show_all || base::StartsWith(login.first, current_username, false)) { *suggestions_present = true; return false; } diff --git a/components/autofill/content/renderer/password_form_conversion_utils.cc b/components/autofill/content/renderer/password_form_conversion_utils.cc index 24deefb..aebdbf5 100644 --- a/components/autofill/content/renderer/password_form_conversion_utils.cc +++ b/components/autofill/content/renderer/password_form_conversion_utils.cc @@ -376,7 +376,7 @@ void GetPasswordForm( nonscript_modified_values->find(username_element); if (username_iterator != nonscript_modified_values->end()) { base::string16 typed_username_value = username_iterator->second; - if (!StartsWith(username_value, typed_username_value, false)) { + if (!base::StartsWith(username_value, typed_username_value, false)) { // We check that |username_value| was not obtained by autofilling // |typed_username_value|. In case when it was, |typed_username_value| // is incomplete, so we should leave autofilled value. diff --git a/components/autofill/core/browser/autofill_download_manager.cc b/components/autofill/core/browser/autofill_download_manager.cc index 8774234..efcabc7 100644 --- a/components/autofill/core/browser/autofill_download_manager.cc +++ b/components/autofill/core/browser/autofill_download_manager.cc @@ -272,9 +272,9 @@ void AutofillDownloadManager::OnURLFetchComplete( case kHttpBadGateway: if (!source->GetResponseHeaders()->EnumerateHeader(NULL, "server", &server_header) || - StartsWithASCII(server_header.c_str(), - kAutofillQueryServerNameStartInHeader, - false) != 0) + base::StartsWithASCII(server_header.c_str(), + kAutofillQueryServerNameStartInHeader, + false) != 0) break; // Bad gateway was received from Autofill servers. Fall through to back // off. diff --git a/components/autofill/core/browser/form_structure.cc b/components/autofill/core/browser/form_structure.cc index b0e8d0c..19e0382 100644 --- a/components/autofill/core/browser/form_structure.cc +++ b/components/autofill/core/browser/form_structure.cc @@ -70,7 +70,7 @@ const int kNumberOfMismatchesThreshold = 3; bool IsAutofillFieldMetadataEnabled() { const std::string group_name = base::FieldTrialList::FindFullName("AutofillFieldMetadata"); - return StartsWithASCII(group_name, "Enabled", true); + return base::StartsWithASCII(group_name, "Enabled", true); } // Helper for |EncodeUploadRequest()| that creates a bit field corresponding to @@ -1145,7 +1145,7 @@ void FormStructure::ParseFieldTypesFromAutocompleteAttributes( // The preceding token, if any, may be a named section. const std::string kSectionPrefix = "section-"; if (!tokens.empty() && - StartsWithASCII(tokens.back(), kSectionPrefix, true)) { + base::StartsWithASCII(tokens.back(), kSectionPrefix, true)) { // Prepend this section name to the suffix set in the preceding block. section = tokens.back().substr(kSectionPrefix.size()) + section; tokens.pop_back(); diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc index dae8736..11ffafe 100644 --- a/components/autofill/core/browser/personal_data_manager.cc +++ b/components/autofill/core/browser/personal_data_manager.cc @@ -792,7 +792,7 @@ std::vector<Suggestion> PersonalDataManager::GetProfileSuggestions( continue; base::string16 value_canon = AutofillProfile::CanonicalizeProfileString(value); - if (StartsWith(value_canon, field_contents_canon, true)) { + if (base::StartsWith(value_canon, field_contents_canon, true)) { // Prefix match, add suggestion. matched_profiles.push_back(profile); suggestions.push_back(Suggestion(value)); @@ -866,7 +866,8 @@ std::vector<Suggestion> PersonalDataManager::GetCreditCardSuggestions( field_contents.size() >= 6)) { continue; } - } else if (!StartsWith(creditcard_field_value, field_contents, false)) { + } else if (!base::StartsWith(creditcard_field_value, field_contents, + false)) { continue; } diff --git a/components/bookmarks/browser/bookmark_utils.cc b/components/bookmarks/browser/bookmark_utils.cc index 28690f2..e9f32d4 100644 --- a/components/bookmarks/browser/bookmark_utils.cc +++ b/components/bookmarks/browser/bookmark_utils.cc @@ -262,7 +262,7 @@ void MakeTitleUnique(const BookmarkModel* model, for (int i = 0; i < parent->child_count(); i++) { const BookmarkNode* node = parent->GetChild(i); if (node->is_url() && (url == node->url()) && - StartsWith(node->GetTitle(), *title, false)) { + base::StartsWith(node->GetTitle(), *title, false)) { titles.insert(node->GetTitle()); } } diff --git a/components/browser_watcher/exit_code_watcher_win_unittest.cc b/components/browser_watcher/exit_code_watcher_win_unittest.cc index f9d495a..10ba2fd 100644 --- a/components/browser_watcher/exit_code_watcher_win_unittest.cc +++ b/components/browser_watcher/exit_code_watcher_win_unittest.cc @@ -98,9 +98,8 @@ class ExitCodeWatcherTest : public testing::Test { KEY_QUERY_VALUE); // The value name should encode the process id at the start. - EXPECT_TRUE(StartsWith(it.Name(), - base::StringPrintf(L"%d-", proc_id), - false)); + EXPECT_TRUE(base::StartsWith(it.Name(), base::StringPrintf(L"%d-", proc_id), + false)); DWORD value = 0; ASSERT_EQ(ERROR_SUCCESS, key.ReadValueDW(it.Name(), &value)); ASSERT_EQ(exit_code, value); diff --git a/components/content_settings/core/common/content_settings_pattern_parser.cc b/components/content_settings/core/common/content_settings_pattern_parser.cc index 8494bfd..ae7dcc3 100644 --- a/components/content_settings/core/common/content_settings_pattern_parser.cc +++ b/components/content_settings/core/common/content_settings_pattern_parser.cc @@ -130,7 +130,7 @@ void PatternParser::Parse(const std::string& pattern_spec, host_component.len); if (host == kHostWildcard) { builder->WithDomainWildcard(); - } else if (StartsWithASCII(host, kDomainWildcard, true)) { + } else if (base::StartsWithASCII(host, kDomainWildcard, true)) { host = host.substr(kDomainWildcardLength); builder->WithDomainWildcard(); builder->WithHost(host); diff --git a/components/cronet/android/test/native_test_server.cc b/components/cronet/android/test/native_test_server.cc index 9003b64..022b1c5 100644 --- a/components/cronet/android/test/native_test_server.cc +++ b/components/cronet/android/test/native_test_server.cc @@ -102,7 +102,7 @@ scoped_ptr<net::test_server::HttpResponse> NativeTestServerRequestHandler( return response.Pass(); } - if (StartsWithASCII(request.relative_url, kEchoHeaderPath, true)) { + if (base::StartsWithASCII(request.relative_url, kEchoHeaderPath, true)) { GURL url = g_test_server->GetURL(request.relative_url); auto it = request.headers.find(url.query()); if (it != request.headers.end()) { @@ -141,7 +141,7 @@ scoped_ptr<net::test_server::HttpResponse> SdchRequestHandler( DCHECK(get_data_dir); dir_path = dir_path.Append(FILE_PATH_LITERAL("test")); - if (StartsWithASCII(request.relative_url, kSdchPath, true)) { + if (base::StartsWithASCII(request.relative_url, kSdchPath, true)) { base::FilePath file_path = dir_path.Append("sdch/index"); scoped_ptr<CustomHttpResponse> response = ConstructResponseBasedOnFile(file_path).Pass(); @@ -162,7 +162,7 @@ scoped_ptr<net::test_server::HttpResponse> SdchRequestHandler( return response.Pass(); } - if (StartsWithASCII(request.relative_url, kSdchTestPath, true)) { + if (base::StartsWithASCII(request.relative_url, kSdchTestPath, true)) { auto avail_dictionary_header = request.headers.find("Avail-Dictionary"); if (avail_dictionary_header != request.headers.end()) { base::FilePath file_path = dir_path.Append( diff --git a/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc b/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc index c7c29f9..15e9dfe 100644 --- a/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc +++ b/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc @@ -369,7 +369,7 @@ TEST_F(EnhancedBookmarkModelTest, TestDoubleEncodeDecode) { TEST_F(EnhancedBookmarkModelTest, TestRemoteId) { const BookmarkNode* node = AddBookmark(); // Verify that the remote id starts with the correct prefix. - EXPECT_TRUE(StartsWithASCII(model_->GetRemoteId(node), "ebc_", true)); + EXPECT_TRUE(base::StartsWithASCII(model_->GetRemoteId(node), "ebc_", true)); // Getting the remote id for nodes that don't have them should return the // empty string. diff --git a/components/favicon/core/favicon_driver_impl.cc b/components/favicon/core/favicon_driver_impl.cc index c95bf3a..9007569 100644 --- a/components/favicon/core/favicon_driver_impl.cc +++ b/components/favicon/core/favicon_driver_impl.cc @@ -30,7 +30,7 @@ bool IsIconNTPEnabled() { if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableIconNtp)) return true; - return StartsWithASCII(group_name, "Enabled", true); + return base::StartsWithASCII(group_name, "Enabled", true); } #if defined(OS_ANDROID) || defined(OS_IOS) diff --git a/components/gcm_driver/registration_info.cc b/components/gcm_driver/registration_info.cc index 31f412d..5bae2fd 100644 --- a/components/gcm_driver/registration_info.cc +++ b/components/gcm_driver/registration_info.cc @@ -21,7 +21,8 @@ scoped_ptr<RegistrationInfo> RegistrationInfo::BuildFromString( std::string* registration_id) { scoped_ptr<RegistrationInfo> registration; - if (StartsWithASCII(serialzied_key, kInsanceIDSerializationPrefix, true)) + if (base::StartsWithASCII(serialzied_key, kInsanceIDSerializationPrefix, + true)) registration.reset(new InstanceIDTokenInfo); else registration.reset(new GCMRegistrationInfo); @@ -182,7 +183,8 @@ bool InstanceIDTokenInfo::Deserialize( if (serialized_key.empty() || serialized_value.empty()) return false; - if (!StartsWithASCII(serialized_key, kInsanceIDSerializationPrefix, true)) + if (!base::StartsWithASCII(serialized_key, kInsanceIDSerializationPrefix, + true)) return false; std::vector<std::string> fields; diff --git a/components/google/core/browser/google_url_tracker.cc b/components/google/core/browser/google_url_tracker.cc index 0b83430..770c9af 100644 --- a/components/google/core/browser/google_url_tracker.cc +++ b/components/google/core/browser/google_url_tracker.cc @@ -97,7 +97,7 @@ void GoogleURLTracker::OnURLFetchComplete(const net::URLFetcher* source) { std::string url_str; source->GetResponseAsString(&url_str); base::TrimWhitespace(url_str, base::TRIM_ALL, &url_str); - if (!StartsWithASCII(url_str, ".google.", false)) + if (!base::StartsWithASCII(url_str, ".google.", false)) return; GURL url("https://www" + url_str); if (!url.is_valid() || (url.path().length() > 1) || url.has_query() || diff --git a/components/google/core/browser/google_util.cc b/components/google/core/browser/google_util.cc index 9b16899..4d7d9d7 100644 --- a/components/google/core/browser/google_util.cc +++ b/components/google/core/browser/google_util.cc @@ -162,7 +162,8 @@ GURL CommandLineGoogleBaseURL() { bool StartsWithCommandLineGoogleBaseURL(const GURL& url) { GURL base_url(CommandLineGoogleBaseURL()); return base_url.is_valid() && - StartsWithASCII(url.possibly_invalid_spec(), base_url.spec(), true); + base::StartsWithASCII(url.possibly_invalid_spec(), base_url.spec(), + true); } bool IsGoogleHostname(const std::string& host, @@ -188,7 +189,7 @@ bool IsGoogleHomePageUrl(const GURL& url) { // Make sure the path is a known home page path. std::string path(url.path()); - return IsPathHomePageBase(path) || StartsWithASCII(path, "/ig", false); + return IsPathHomePageBase(path) || base::StartsWithASCII(path, "/ig", false); } bool IsGoogleSearchUrl(const GURL& url) { diff --git a/components/history/core/browser/history_database.cc b/components/history/core/browser/history_database.cc index 87653df..888a30a 100644 --- a/components/history/core/browser/history_database.cc +++ b/components/history/core/browser/history_database.cc @@ -209,7 +209,7 @@ TopHostsList HistoryDatabase::TopHosts(int num_hosts) { int64 visit_count = url_sql.ColumnInt64(1); std::string host = url.host(); - if (StartsWithASCII(host, "www.", true)) + if (base::StartsWithASCII(host, "www.", true)) host.assign(host, 4, std::string::npos); host_count[host] += visit_count; diff --git a/components/html_viewer/web_mime_registry_impl.cc b/components/html_viewer/web_mime_registry_impl.cc index 7954aba..a050693 100644 --- a/components/html_viewer/web_mime_registry_impl.cc +++ b/components/html_viewer/web_mime_registry_impl.cc @@ -44,7 +44,7 @@ WebMimeRegistryImpl::supportsImagePrefixedMIMEType( const blink::WebString& mime_type) { std::string ascii_mime_type = ToASCIIOrEmpty(mime_type); return (mime_util::IsSupportedImageMimeType(ascii_mime_type) || - (StartsWithASCII(ascii_mime_type, "image/", true) && + (base::StartsWithASCII(ascii_mime_type, "image/", true) && mime_util::IsSupportedNonImageMimeType(ascii_mime_type))) ? WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported; diff --git a/components/html_viewer/web_url_loader_impl.cc b/components/html_viewer/web_url_loader_impl.cc index ebaece9..48d291f 100644 --- a/components/html_viewer/web_url_loader_impl.cc +++ b/components/html_viewer/web_url_loader_impl.cc @@ -30,10 +30,10 @@ blink::WebURLResponse::HTTPVersion StatusLineToHTTPVersion( if (status_line.is_null()) return blink::WebURLResponse::HTTP_0_9; - if (StartsWithASCII(status_line, "HTTP/1.0", true)) + if (base::StartsWithASCII(status_line, "HTTP/1.0", true)) return blink::WebURLResponse::HTTP_1_0; - if (StartsWithASCII(status_line, "HTTP/1.1", true)) + if (base::StartsWithASCII(status_line, "HTTP/1.1", true)) return blink::WebURLResponse::HTTP_1_1; return blink::WebURLResponse::Unknown; diff --git a/components/invalidation/gcm_network_channel_unittest.cc b/components/invalidation/gcm_network_channel_unittest.cc index 34ab7fa..83ac630 100644 --- a/components/invalidation/gcm_network_channel_unittest.cc +++ b/components/invalidation/gcm_network_channel_unittest.cc @@ -232,7 +232,7 @@ void TestNetworkChannelURLFetcher::AddExtraRequestHeader( net::FakeURLFetcher::AddExtraRequestHeader(header_line); std::string header_name("echo-token: "); std::string echo_token; - if (StartsWithASCII(header_line, header_name, false)) { + if (base::StartsWithASCII(header_line, header_name, false)) { echo_token = header_line; ReplaceFirstSubstringAfterOffset( &echo_token, 0, header_name, std::string()); diff --git a/components/mime_util/mime_util.cc b/components/mime_util/mime_util.cc index 5e5d004..3841fbb 100644 --- a/components/mime_util/mime_util.cc +++ b/components/mime_util/mime_util.cc @@ -161,9 +161,10 @@ bool MimeUtil::IsSupportedNonImageMimeType(const std::string& mime_type) const { #if !defined(OS_IOS) media::IsSupportedMediaMimeType(mime_type) || #endif - (StartsWithASCII(mime_type, "text/", false /* case insensitive */) && + (base::StartsWithASCII(mime_type, "text/", + false /* case insensitive */) && !IsUnsupportedTextMimeType(mime_type)) || - (StartsWithASCII(mime_type, "application/", false) && + (base::StartsWithASCII(mime_type, "application/", false) && net::MatchesMimeType("application/*+json", mime_type)); } @@ -178,7 +179,7 @@ bool MimeUtil::IsSupportedJavascriptMimeType( } bool MimeUtil::IsSupportedMimeType(const std::string& mime_type) const { - return (StartsWithASCII(mime_type, "image/", false) && + return (base::StartsWithASCII(mime_type, "image/", false) && IsSupportedImageMimeType(mime_type)) || IsSupportedNonImageMimeType(mime_type); } diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc index fea1b3d..f407aa4 100644 --- a/components/nacl/renderer/ppb_nacl_private_impl.cc +++ b/components/nacl/renderer/ppb_nacl_private_impl.cc @@ -610,7 +610,7 @@ std::string PnaclComponentURLToFilename(const std::string& url) { // generated from ManifestResolveKey or PnaclResources::ReadResourceInfo. // So, it's safe to just use string parsing operations here instead of // URL-parsing ones. - DCHECK(StartsWithASCII(url, kPNaClTranslatorBaseUrl, true)); + DCHECK(base::StartsWithASCII(url, kPNaClTranslatorBaseUrl, true)); std::string r = url.substr(std::string(kPNaClTranslatorBaseUrl).length()); // Use white-listed-chars. diff --git a/components/omnibox/answers_cache.cc b/components/omnibox/answers_cache.cc index 00d8c3f..35cf5a3 100644 --- a/components/omnibox/answers_cache.cc +++ b/components/omnibox/answers_cache.cc @@ -23,7 +23,7 @@ AnswersQueryData AnswersCache::GetTopAnswerEntry(const base::string16& query) { base::string16 collapsed_query = base::CollapseWhitespace(query, false); for (Cache::iterator it = cache_.begin(); it != cache_.end(); ++it) { // If the query text starts with trimmed input, this is valid prefetch data. - if (StartsWith(it->full_query_text, collapsed_query, false)) { + if (base::StartsWith(it->full_query_text, collapsed_query, false)) { // Move the touched item to the front of the list. cache_.splice(cache_.begin(), cache_, it); return cache_.front(); diff --git a/components/omnibox/base_search_provider.cc b/components/omnibox/base_search_provider.cc index bb2db75..dbbedd4 100644 --- a/components/omnibox/base_search_provider.cc +++ b/components/omnibox/base_search_provider.cc @@ -244,7 +244,7 @@ AutocompleteMatch BaseSearchProvider::CreateSearchSuggestion( if (!input.prevent_inline_autocomplete() && !suggestion.received_after_last_keystroke() && (!in_keyword_mode || suggestion.from_keyword_provider()) && - StartsWith(suggestion.suggestion(), input.text(), false)) { + base::StartsWith(suggestion.suggestion(), input.text(), false)) { match.inline_autocompletion = suggestion.suggestion().substr(input.text().length()); match.allowed_to_be_default_match = true; diff --git a/components/omnibox/search_suggestion_parser.cc b/components/omnibox/search_suggestion_parser.cc index 26d1933..ecf580d 100644 --- a/components/omnibox/search_suggestion_parser.cc +++ b/components/omnibox/search_suggestion_parser.cc @@ -148,7 +148,7 @@ void SearchSuggestionParser::SuggestResult::ClassifyMatchContents( suggestion_.length() - match_contents_.length(); // Ensure the query starts with the input text, and ends with the match // contents, and the input text has an overlap with contents. - if (StartsWith(suggestion_, input_text, true) && + if (base::StartsWith(suggestion_, input_text, true) && EndsWith(suggestion_, match_contents_, true) && (input_text.length() > contents_index)) { lookup_text = input_text.substr(contents_index); diff --git a/components/omnibox/suggestion_answer.cc b/components/omnibox/suggestion_answer.cc index aec952e..db6c85a 100644 --- a/components/omnibox/suggestion_answer.cc +++ b/components/omnibox/suggestion_answer.cc @@ -106,11 +106,11 @@ bool SuggestionAnswer::ImageLine::ParseImageLine( // "//host/path", which is web-speak for "use the enclosing page's scheme", // but not a valid path of an URL. The GWS frontend commonly (always?) // redirects to HTTPS so we just default to that here. - image_line->image_url_ = GURL( - StartsWith(url_string, base::ASCIIToUTF16("//"), false) ? - (base::ASCIIToUTF16(url::kHttpsScheme) + base::ASCIIToUTF16(":") + - url_string) : - url_string); + image_line->image_url_ = + GURL(base::StartsWith(url_string, base::ASCIIToUTF16("//"), false) + ? (base::ASCIIToUTF16(url::kHttpsScheme) + + base::ASCIIToUTF16(":") + url_string) + : url_string); if (!image_line->image_url_.is_valid()) return false; diff --git a/components/omnibox/url_prefix.cc b/components/omnibox/url_prefix.cc index be5a5ef..b1fdcdb 100644 --- a/components/omnibox/url_prefix.cc +++ b/components/omnibox/url_prefix.cc @@ -71,7 +71,7 @@ const URLPrefix* URLPrefix::BestURLPrefix(const base::string16& text, bool URLPrefix::PrefixMatch(const URLPrefix& prefix, const base::string16& text, const base::string16& prefix_suffix) { - return StartsWith(text, prefix.prefix + prefix_suffix, false); + return base::StartsWith(text, prefix.prefix + prefix_suffix, false); } // static diff --git a/components/pairing/bluetooth_controller_pairing_controller.cc b/components/pairing/bluetooth_controller_pairing_controller.cc index 476b205..b843354 100644 --- a/components/pairing/bluetooth_controller_pairing_controller.cc +++ b/components/pairing/bluetooth_controller_pairing_controller.cc @@ -70,8 +70,8 @@ void BluetoothControllerPairingController::DeviceFound( device::BluetoothDevice* device) { DCHECK_EQ(current_stage_, STAGE_DEVICES_DISCOVERY); DCHECK(thread_checker_.CalledOnValidThread()); - if (StartsWith(device->GetName(), base::ASCIIToUTF16(kDeviceNamePrefix), - false)) { + if (base::StartsWith(device->GetName(), base::ASCIIToUTF16(kDeviceNamePrefix), + false)) { discovered_devices_.insert(device->GetAddress()); FOR_EACH_OBSERVER(ControllerPairingController::Observer, observers_, DiscoveredDevicesListChanged()); diff --git a/components/password_manager/core/browser/affiliation_utils.cc b/components/password_manager/core/browser/affiliation_utils.cc index 3cdc9ea..98c9099 100644 --- a/components/password_manager/core/browser/affiliation_utils.cc +++ b/components/password_manager/core/browser/affiliation_utils.cc @@ -302,7 +302,7 @@ bool IsAffiliationBasedMatchingEnabled(const base::CommandLine& command_line) { return false; if (command_line.HasSwitch(switches::kEnableAffiliationBasedMatching)) return true; - return StartsWithASCII(group_name, "Enabled", /*case_sensitive=*/false); + return base::StartsWithASCII(group_name, "Enabled", /*case_sensitive=*/false); } bool IsPropagatingPasswordChangesToWebCredentialsEnabled( diff --git a/components/password_manager/core/browser/password_autofill_manager.cc b/components/password_manager/core/browser/password_autofill_manager.cc index d585a47..a9b6644 100644 --- a/components/password_manager/core/browser/password_autofill_manager.cc +++ b/components/password_manager/core/browser/password_autofill_manager.cc @@ -64,8 +64,8 @@ void GetSuggestions(const autofill::PasswordFormFillData& fill_data, const base::string16& current_username, std::vector<autofill::Suggestion>* suggestions, bool show_all) { - if (show_all || - StartsWith(fill_data.username_field.value, current_username, false)) { + if (show_all || base::StartsWith(fill_data.username_field.value, + current_username, false)) { autofill::Suggestion suggestion( ReplaceEmptyUsername(fill_data.username_field.value)); suggestion.label = GetHumanReadableRealm(fill_data.preferred_realm); @@ -74,7 +74,7 @@ void GetSuggestions(const autofill::PasswordFormFillData& fill_data, } for (const auto& login : fill_data.additional_logins) { - if (show_all || StartsWith(login.first, current_username, false)) { + if (show_all || base::StartsWith(login.first, current_username, false)) { autofill::Suggestion suggestion(ReplaceEmptyUsername(login.first)); suggestion.label = GetHumanReadableRealm(login.second.realm); suggestion.frontend_id = autofill::POPUP_ITEM_ID_PASSWORD_ENTRY; @@ -85,7 +85,7 @@ void GetSuggestions(const autofill::PasswordFormFillData& fill_data, for (const auto& usernames : fill_data.other_possible_usernames) { for (size_t i = 0; i < usernames.second.size(); ++i) { if (show_all || - StartsWith(usernames.second[i], current_username, false)) { + base::StartsWith(usernames.second[i], current_username, false)) { autofill::Suggestion suggestion( ReplaceEmptyUsername(usernames.second[i])); suggestion.label = GetHumanReadableRealm(usernames.first.realm); diff --git a/components/password_manager/core/browser/password_form_manager.cc b/components/password_manager/core/browser/password_form_manager.cc index da366f2..9995a218 100644 --- a/components/password_manager/core/browser/password_form_manager.cc +++ b/components/password_manager/core/browser/password_form_manager.cc @@ -168,7 +168,7 @@ PasswordFormManager::MatchResultMask PasswordFormManager::DoesManage( origins_match = observed_form_.origin.host() == form.origin.host() && observed_form_.origin.port() == form.origin.port() && - StartsWithASCII(new_path, old_path, /*case_sensitive=*/true); + base::StartsWithASCII(new_path, old_path, /*case_sensitive=*/true); } if (!origins_match) @@ -392,7 +392,7 @@ void PasswordFormManager::OnRequestDone( // instead of explicitly handling empty path matches. bool is_credential_protected = observed_form_.scheme == PasswordForm::SCHEME_HTML && - StartsWithASCII("/", login->origin.path(), true) && + base::StartsWithASCII("/", login->origin.path(), true) && credential_scores[i] > 0 && !login->blacklisted_by_user; // Passwords generated on a signup form must show on a login form even if // there are better-matching saved credentials. TODO(gcasto): We don't diff --git a/components/policy/core/common/preg_parser_win.cc b/components/policy/core/common/preg_parser_win.cc index 9681347..4c13068 100644 --- a/components/policy/core/common/preg_parser_win.cc +++ b/components/policy/core/common/preg_parser_win.cc @@ -176,7 +176,7 @@ void HandleRecord(const base::string16& key_name, return; std::string value_name(base::UTF16ToUTF8(value)); - if (!StartsWithASCII(value_name, kActionTriggerPrefix, true)) { + if (!base::StartsWithASCII(value_name, kActionTriggerPrefix, true)) { scoped_ptr<base::Value> value; if (DecodePRegValue(type, data, &value)) dict->SetValue(value_name, value.Pass()); @@ -192,22 +192,25 @@ void HandleRecord(const base::string16& key_name, value != values.end(); ++value) { dict->RemoveValue(*value); } - } else if (StartsWithASCII(action_trigger, kActionTriggerDeleteKeys, true)) { + } else if (base::StartsWithASCII(action_trigger, kActionTriggerDeleteKeys, + true)) { std::vector<std::string> keys; Tokenize(DecodePRegStringValue(data), ";", &keys); for (std::vector<std::string>::const_iterator key(keys.begin()); key != keys.end(); ++key) { dict->RemoveKey(*key); } - } else if (StartsWithASCII(action_trigger, kActionTriggerDel, true)) { + } else if (base::StartsWithASCII(action_trigger, kActionTriggerDel, true)) { dict->RemoveValue( value_name.substr(arraysize(kActionTriggerPrefix) - 1 + arraysize(kActionTriggerDel) - 1)); - } else if (StartsWithASCII(action_trigger, kActionTriggerDelVals, true)) { + } else if (base::StartsWithASCII(action_trigger, kActionTriggerDelVals, + true)) { // Delete all values. dict->ClearValues(); - } else if (StartsWithASCII(action_trigger, kActionTriggerSecureKey, true) || - StartsWithASCII(action_trigger, kActionTriggerSoft, true)) { + } else if (base::StartsWithASCII(action_trigger, kActionTriggerSecureKey, + true) || + base::StartsWithASCII(action_trigger, kActionTriggerSoft, true)) { // Doesn't affect values. } else { LOG(ERROR) << "Bad action trigger " << value_name; @@ -295,7 +298,7 @@ bool ReadFile(const base::FilePath& file_path, break; // Process the record if it is within the |root| subtree. - if (StartsWith(key_name, root, false)) + if (base::StartsWith(key_name, root, false)) HandleRecord(key_name.substr(root.size()), value, type, data, dict); } diff --git a/components/proximity_auth/cryptauth/fake_secure_message_delegate.cc b/components/proximity_auth/cryptauth/fake_secure_message_delegate.cc index 5fa5c5f..d05361c 100644 --- a/components/proximity_auth/cryptauth/fake_secure_message_delegate.cc +++ b/components/proximity_auth/cryptauth/fake_secure_message_delegate.cc @@ -76,7 +76,7 @@ bool Verify(const std::string& signature, signing_key = key; } else { std::string prefix = kPrivateKeyPrefix; - bool is_private_key = StartsWithASCII(key, prefix, true); + bool is_private_key = base::StartsWithASCII(key, prefix, true); signing_key = is_private_key ? key.substr(prefix.size()) : prefix + key; } @@ -113,7 +113,7 @@ void FakeSecureMessageDelegate::DeriveKey(const std::string& private_key, // private key so it is equal to its corresponding public key. std::string prefix(kPrivateKeyPrefix); std::string normalized_private_key = - StartsWithASCII(private_key, prefix, true) + base::StartsWithASCII(private_key, prefix, true) ? private_key.substr(prefix.size()) : private_key; diff --git a/components/search_engines/template_url_service_util_unittest.cc b/components/search_engines/template_url_service_util_unittest.cc index 65b992a..f293983 100644 --- a/components/search_engines/template_url_service_util_unittest.cc +++ b/components/search_engines/template_url_service_util_unittest.cc @@ -95,7 +95,7 @@ TEST(TemplateURLServiceUtilTest, RemoveDuplicatePrepopulateIDs) { prepopulated_turls.size() + num_non_prepopulated_urls); for (TemplateURLService::TemplateURLVector::const_iterator itr = local_turls.begin(); itr != local_turls.end(); ++itr) { - EXPECT_TRUE( - StartsWith((*itr)->keyword(), base::ASCIIToUTF16("winner"), true)); + EXPECT_TRUE(base::StartsWith((*itr)->keyword(), + base::ASCIIToUTF16("winner"), true)); } } diff --git a/components/storage_monitor/portable_device_watcher_win.cc b/components/storage_monitor/portable_device_watcher_win.cc index 9b581bf..ed85073 100644 --- a/components/storage_monitor/portable_device_watcher_win.cc +++ b/components/storage_monitor/portable_device_watcher_win.cc @@ -301,7 +301,7 @@ bool IsMassStoragePortableDevice(const base::string16& pnp_device_id, const base::string16& device_name) { // Based on testing, if the pnp device id starts with "\\?\wpdbusenumroot#", // then the attached device belongs to a mass storage class. - if (StartsWith(pnp_device_id, L"\\\\?\\wpdbusenumroot#", false)) + if (base::StartsWith(pnp_device_id, L"\\\\?\\wpdbusenumroot#", false)) return true; // If the device is a volume mounted device, |device_name| will be diff --git a/components/suggestions/suggestions_service.cc b/components/suggestions/suggestions_service.cc index dde38a1..f8f1398 100644 --- a/components/suggestions/suggestions_service.cc +++ b/components/suggestions/suggestions_service.cc @@ -178,9 +178,8 @@ void SuggestionsService::UndoBlacklistURL( // static bool SuggestionsService::GetBlacklistedUrl(const net::URLFetcher& request, GURL* url) { - bool is_blacklist_request = StartsWithASCII(request.GetOriginalURL().spec(), - kSuggestionsBlacklistURLPrefix, - true); + bool is_blacklist_request = base::StartsWithASCII( + request.GetOriginalURL().spec(), kSuggestionsBlacklistURLPrefix, true); if (!is_blacklist_request) return false; // Extract the blacklisted URL from the blacklist request. diff --git a/components/translate/core/browser/translate_language_list.cc b/components/translate/core/browser/translate_language_list.cc index 959b576..1b1bfed 100644 --- a/components/translate/core/browser/translate_language_list.cc +++ b/components/translate/core/browser/translate_language_list.cc @@ -264,9 +264,9 @@ void TranslateLanguageList::SetSupportedLanguages( // }) // Where "sl(" is set in kLanguageListCallbackName, "tl" is // kTargetLanguagesKey and "al" kAlphaLanguagesKey. - if (!StartsWithASCII(language_list, - TranslateLanguageList::kLanguageListCallbackName, - false) || + if (!base::StartsWithASCII(language_list, + TranslateLanguageList::kLanguageListCallbackName, + false) || !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 diff --git a/components/translate/core/browser/translate_prefs.cc b/components/translate/core/browser/translate_prefs.cc index d31dab4..768be0e 100644 --- a/components/translate/core/browser/translate_prefs.cc +++ b/components/translate/core/browser/translate_prefs.cc @@ -509,8 +509,8 @@ void TranslatePrefs::CreateBlockedLanguages( const std::string& app_locale = TranslateDownloadManager::GetInstance()->application_locale(); std::string ui_lang = TranslateDownloadManager::GetLanguageCode(app_locale); - bool is_ui_english = ui_lang == "en" || - StartsWithASCII(ui_lang, "en-", false); + bool is_ui_english = + ui_lang == "en" || base::StartsWithASCII(ui_lang, "en-", false); for (std::vector<std::string>::const_iterator it = accept_languages.begin(); it != accept_languages.end(); ++it) { diff --git a/components/translate/core/language_detection/language_detection_util.cc b/components/translate/core/language_detection/language_detection_util.cc index 3cdbe7f..9556bb9 100644 --- a/components/translate/core/language_detection/language_detection_util.cc +++ b/components/translate/core/language_detection/language_detection_util.cc @@ -197,7 +197,8 @@ bool CanCLDComplementSubCode( // CLD agree that the language is Chinese and Content-Language doesn't know // which dialect is used, CLD language has priority. // TODO(hajimehoshi): How about the other dialects like zh-MO? - return page_language == "zh" && StartsWithASCII(cld_language, "zh-", false); + return page_language == "zh" && + base::StartsWithASCII(cld_language, "zh-", false); } } // namespace @@ -380,7 +381,7 @@ bool IsSameOrSimilarLanguages(const std::string& page_language, bool MaybeServerWrongConfiguration(const std::string& page_language, const std::string& cld_language) { // If |page_language| is not "en-*", respect it and just return false here. - if (!StartsWithASCII(page_language, "en", false)) + if (!base::StartsWithASCII(page_language, "en", false)) return false; // A server provides a language meta information representing "en-*". But it diff --git a/components/url_fixer/url_fixer.cc b/components/url_fixer/url_fixer.cc index eaf85b0..f20159d 100644 --- a/components/url_fixer/url_fixer.cc +++ b/components/url_fixer/url_fixer.cc @@ -436,8 +436,8 @@ std::string SegmentURLInternal(std::string* text, url::Parsed* parts) { if (!found_scheme) { // Couldn't determine the scheme, so just pick one. parts->scheme.reset(); - scheme = StartsWithASCII(*text, "ftp.", false) ? url::kFtpScheme - : url::kHttpScheme; + scheme = base::StartsWithASCII(*text, "ftp.", false) ? url::kFtpScheme + : url::kHttpScheme; } } @@ -527,7 +527,7 @@ GURL url_fixer::FixupURL(const std::string& text, if (scheme == kViewSourceScheme) { // Reject "view-source:view-source:..." to avoid deep recursion. std::string view_source(kViewSourceScheme + std::string(":")); - if (!StartsWithASCII(text, view_source + view_source, false)) { + if (!base::StartsWithASCII(text, view_source + view_source, false)) { return GURL(kViewSourceScheme + std::string(":") + FixupURL(trimmed.substr(scheme.length() + 1), desired_tld) .possibly_invalid_spec()); diff --git a/components/user_manager/user_image/default_user_images.cc b/components/user_manager/user_image/default_user_images.cc index 2d9936b..d4edf09 100644 --- a/components/user_manager/user_image/default_user_images.cc +++ b/components/user_manager/user_image/default_user_images.cc @@ -79,7 +79,7 @@ bool IsDefaultImageString(const std::string& s, const std::string& prefix, int* image_id) { DCHECK(image_id); - if (!StartsWithASCII(s, prefix, true)) + if (!base::StartsWithASCII(s, prefix, true)) return false; int image_index = -1; diff --git a/components/variations/net/variations_http_header_provider.cc b/components/variations/net/variations_http_header_provider.cc index fc0e089..fae7c95 100644 --- a/components/variations/net/variations_http_header_provider.cc +++ b/components/variations/net/variations_http_header_provider.cc @@ -97,7 +97,7 @@ bool VariationsHttpHeaderProvider::SetDefaultVariationIds( default_trigger_id_set_.clear(); return false; } - bool trigger_id = StartsWithASCII(*it, "t", true); + bool trigger_id = base::StartsWithASCII(*it, "t", true); // Remove the "t" prefix if it's there. std::string entry = trigger_id ? it->substr(1) : *it; diff --git a/content/browser/accessibility/dump_accessibility_browsertest_base.cc b/content/browser/accessibility/dump_accessibility_browsertest_base.cc index d09b852..e68a403 100644 --- a/content/browser/accessibility/dump_accessibility_browsertest_base.cc +++ b/content/browser/accessibility/dump_accessibility_browsertest_base.cc @@ -102,19 +102,19 @@ void DumpAccessibilityTestBase::ParseHtmlForExtraDirectives( const std::string& deny_str = AccessibilityTreeFormatter::GetDenyString(); const std::string& wait_str = "@WAIT-FOR:"; - if (StartsWithASCII(line, allow_empty_str, true)) { + if (base::StartsWithASCII(line, allow_empty_str, true)) { filters->push_back( Filter(base::UTF8ToUTF16(line.substr(allow_empty_str.size())), Filter::ALLOW_EMPTY)); - } else if (StartsWithASCII(line, allow_str, true)) { + } else if (base::StartsWithASCII(line, allow_str, true)) { filters->push_back(Filter(base::UTF8ToUTF16( line.substr(allow_str.size())), Filter::ALLOW)); - } else if (StartsWithASCII(line, deny_str, true)) { + } else if (base::StartsWithASCII(line, deny_str, true)) { filters->push_back(Filter(base::UTF8ToUTF16( line.substr(deny_str.size())), Filter::DENY)); - } else if (StartsWithASCII(line, wait_str, true)) { + } else if (base::StartsWithASCII(line, wait_str, true)) { *wait_for = line.substr(wait_str.size()); } } diff --git a/content/browser/download/download_stats.cc b/content/browser/download/download_stats.cc index d673f86..1dec4d6 100644 --- a/content/browser/download/download_stats.cc +++ b/content/browser/download/download_stats.cc @@ -467,14 +467,14 @@ void RecordDownloadMimeType(const std::string& mime_type_string) { // Do partial matches. if (download_content == DOWNLOAD_CONTENT_UNRECOGNIZED) { - if (StartsWithASCII(mime_type_string, "text/", true)) { + if (base::StartsWithASCII(mime_type_string, "text/", true)) { download_content = DOWNLOAD_CONTENT_TEXT; - } else if (StartsWithASCII(mime_type_string, "image/", true)) { + } else if (base::StartsWithASCII(mime_type_string, "image/", true)) { download_content = DOWNLOAD_CONTENT_IMAGE; RecordDownloadImageType(mime_type_string); - } else if (StartsWithASCII(mime_type_string, "audio/", true)) { + } else if (base::StartsWithASCII(mime_type_string, "audio/", true)) { download_content = DOWNLOAD_CONTENT_AUDIO; - } else if (StartsWithASCII(mime_type_string, "video/", true)) { + } else if (base::StartsWithASCII(mime_type_string, "video/", true)) { download_content = DOWNLOAD_CONTENT_VIDEO; } } diff --git a/content/browser/fileapi/fileapi_message_filter.cc b/content/browser/fileapi/fileapi_message_filter.cc index 9c10e43..bcd2ce6 100644 --- a/content/browser/fileapi/fileapi_message_filter.cc +++ b/content/browser/fileapi/fileapi_message_filter.cc @@ -598,8 +598,8 @@ void FileAPIMessageFilter::OnStartBuildingStream( const GURL& url, const std::string& content_type) { DCHECK_CURRENTLY_ON(BrowserThread::IO); // Only an internal Blob URL is expected here. See the BlobURL of the Blink. - if (!StartsWithASCII( - url.path(), "blobinternal%3A///", true /* case_sensitive */)) { + if (!base::StartsWithASCII(url.path(), "blobinternal%3A///", + true /* case_sensitive */)) { NOTREACHED() << "Malformed Stream URL: " << url.spec(); bad_message::ReceivedBadMessage(this, bad_message::FAMF_MALFORMED_STREAM_URL); diff --git a/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc b/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc index 26f2913..7470d4f 100644 --- a/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc +++ b/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc @@ -42,7 +42,7 @@ bool IsGamepad(udev_device* dev, int* index, std::string* path) { return false; static const char kJoystickRoot[] = "/dev/input/js"; - bool is_gamepad = StartsWithASCII(node_path, kJoystickRoot, true); + bool is_gamepad = base::StartsWithASCII(node_path, kJoystickRoot, true); if (!is_gamepad) return false; diff --git a/content/browser/loader/resource_dispatcher_host_browsertest.cc b/content/browser/loader/resource_dispatcher_host_browsertest.cc index bb333a5..0fa2733 100644 --- a/content/browser/loader/resource_dispatcher_host_browsertest.cc +++ b/content/browser/loader/resource_dispatcher_host_browsertest.cc @@ -103,7 +103,7 @@ IN_PROC_BROWSER_TEST_F(ResourceDispatcherHostBrowserTest, DynamicTitle1) { GURL url(embedded_test_server()->GetURL("/dynamic1.html")); base::string16 title; ASSERT_TRUE(GetPopupTitle(url, &title)); - EXPECT_TRUE(StartsWith(title, ASCIIToUTF16("My Popup Title"), true)) + EXPECT_TRUE(base::StartsWith(title, ASCIIToUTF16("My Popup Title"), true)) << "Actual title: " << title; } @@ -115,7 +115,7 @@ IN_PROC_BROWSER_TEST_F(ResourceDispatcherHostBrowserTest, DynamicTitle2) { GURL url(embedded_test_server()->GetURL("/dynamic2.html")); base::string16 title; ASSERT_TRUE(GetPopupTitle(url, &title)); - EXPECT_TRUE(StartsWith(title, ASCIIToUTF16("My Dynamic Title"), true)) + EXPECT_TRUE(base::StartsWith(title, ASCIIToUTF16("My Dynamic Title"), true)) << "Actual title: " << title; } @@ -266,7 +266,7 @@ namespace { scoped_ptr<net::test_server::HttpResponse> NoContentResponseHandler( const std::string& path, const net::test_server::HttpRequest& request) { - if (!StartsWithASCII(path, request.relative_url, true)) + if (!base::StartsWithASCII(path, request.relative_url, true)) return scoped_ptr<net::test_server::HttpResponse>(); scoped_ptr<net::test_server::BasicHttpResponse> http_response( @@ -443,7 +443,7 @@ namespace { scoped_ptr<net::test_server::HttpResponse> HandleRedirectRequest( const std::string& request_path, const net::test_server::HttpRequest& request) { - if (!StartsWithASCII(request.relative_url, request_path, true)) + if (!base::StartsWithASCII(request.relative_url, request_path, true)) return scoped_ptr<net::test_server::HttpResponse>(); scoped_ptr<net::test_server::BasicHttpResponse> http_response( diff --git a/content/browser/media/capture/web_contents_capture_util.cc b/content/browser/media/capture/web_contents_capture_util.cc index e1c5d52..d81690b 100644 --- a/content/browser/media/capture/web_contents_capture_util.cc +++ b/content/browser/media/capture/web_contents_capture_util.cc @@ -22,7 +22,7 @@ bool WebContentsCaptureUtil::ExtractTabCaptureTarget( int* render_process_id, int* main_render_frame_id) { static const char kDeviceScheme[] = "web-contents-media-stream://"; - if (!StartsWithASCII(device_id_param, kDeviceScheme, true)) + if (!base::StartsWithASCII(device_id_param, kDeviceScheme, true)) return false; const std::string device_id = device_id_param.substr( diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index ee8c6a1..db5ea5d 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -2251,7 +2251,7 @@ void RenderProcessHostImpl::SetBackgrounded(bool backgrounded) { // absence of field trials to get coverage on the perf waterfall. base::FieldTrial* trial = base::FieldTrialList::Find("BackgroundRendererProcesses"); - if (!trial || !StartsWithASCII(trial->group_name(), "Disallow", true)) { + if (!trial || !base::StartsWithASCII(trial->group_name(), "Disallow", true)) { child_process_launcher_->SetProcessBackgrounded(backgrounded); } #else diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index d06da9d..6eb9cf4a 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -2981,7 +2981,7 @@ extern NSString *NSTextInputReplacementRangeAttributeName; // We ignore commands that insert characters, because this was causing // strange behavior (e.g. tab always inserted a tab rather than moving to // the next field on the page). - if (!StartsWithASCII(command, "insert", false)) + if (!base::StartsWithASCII(command, "insert", false)) editCommands_.push_back(EditCommand(command, "")); } else { RenderWidgetHostImpl* rwh = renderWidgetHostView_->render_widget_host_; diff --git a/content/browser/service_worker/service_worker_database.cc b/content/browser/service_worker/service_worker_database.cc index 842080a..aeac92a 100644 --- a/content/browser/service_worker/service_worker_database.cc +++ b/content/browser/service_worker/service_worker_database.cc @@ -107,7 +107,7 @@ base::LazyInstance<ServiceWorkerEnv>::Leaky g_service_worker_env = bool RemovePrefix(const std::string& str, const std::string& prefix, std::string* out) { - if (!StartsWithASCII(str, prefix, true)) + if (!base::StartsWithASCII(str, prefix, true)) return false; if (out) *out = str.substr(prefix.size()); diff --git a/content/browser/service_worker/service_worker_utils.cc b/content/browser/service_worker/service_worker_utils.cc index 59748ee..7cfacce 100644 --- a/content/browser/service_worker/service_worker_utils.cc +++ b/content/browser/service_worker/service_worker_utils.cc @@ -36,7 +36,7 @@ bool PathContainsDisallowedCharacter(const GURL& url) { bool ServiceWorkerUtils::ScopeMatches(const GURL& scope, const GURL& url) { DCHECK(!scope.has_ref()); DCHECK(!url.has_ref()); - return StartsWithASCII(url.spec(), scope.spec(), true); + return base::StartsWithASCII(url.spec(), scope.spec(), true); } // static @@ -69,7 +69,7 @@ bool ServiceWorkerUtils::IsPathRestrictionSatisfied( } std::string scope_string = scope.path(); - if (!StartsWithASCII(scope_string, max_scope_string, true)) { + if (!base::StartsWithASCII(scope_string, max_scope_string, true)) { *error_message = "The path of the provided scope ('"; error_message->append(scope_string); error_message->append("') is not under the max scope allowed ("); diff --git a/content/browser/session_history_browsertest.cc b/content/browser/session_history_browsertest.cc index 2d81581..263d66d 100644 --- a/content/browser/session_history_browsertest.cc +++ b/content/browser/session_history_browsertest.cc @@ -28,7 +28,7 @@ namespace { scoped_ptr<net::test_server::HttpResponse> HandleEchoTitleRequest( const std::string& echotitle_path, const net::test_server::HttpRequest& request) { - if (!StartsWithASCII(request.relative_url, echotitle_path, true)) + if (!base::StartsWithASCII(request.relative_url, echotitle_path, true)) return scoped_ptr<net::test_server::HttpResponse>(); scoped_ptr<net::test_server::BasicHttpResponse> http_response( diff --git a/content/browser/tracing/tracing_ui.cc b/content/browser/tracing/tracing_ui.cc index c8a417e..8328330 100644 --- a/content/browser/tracing/tracing_ui.cc +++ b/content/browser/tracing/tracing_ui.cc @@ -204,7 +204,7 @@ bool OnBeginJSONRequest(const std::string& path, } const char* beginRecordingPath = "json/begin_recording?"; - if (StartsWithASCII(path, beginRecordingPath, true)) { + if (base::StartsWithASCII(path, beginRecordingPath, true)) { std::string data = path.substr(strlen(beginRecordingPath)); return BeginRecording(data, callback); } @@ -248,7 +248,7 @@ bool OnBeginJSONRequest(const std::string& path, bool OnTracingRequest(const std::string& path, const WebUIDataSource::GotDataCallback& callback) { - if (StartsWithASCII(path, "json/", true)) { + if (base::StartsWithASCII(path, "json/", true)) { if (!OnBeginJSONRequest(path, callback)) { std::string error("##ERROR##"); callback.Run(base::RefCountedString::TakeString(&error)); diff --git a/content/browser/webui/shared_resources_data_source.cc b/content/browser/webui/shared_resources_data_source.cc index e990648..56c341a 100644 --- a/content/browser/webui/shared_resources_data_source.cc +++ b/content/browser/webui/shared_resources_data_source.cc @@ -48,7 +48,7 @@ const ResourcesMap* CreateResourcesMap() { const int resource_id = kWebuiResources[i].value; AddResource(resource_name, resource_id, result); for (const char* (&alias)[2]: kPathAliases) { - if (StartsWithASCII(resource_name, alias[0], true)) { + if (base::StartsWithASCII(resource_name, alias[0], true)) { AddResource(alias[1] + resource_name.substr(strlen(alias[0])), resource_id, result); } diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc index 36525e1..78939bb 100644 --- a/content/child/blink_platform_impl.cc +++ b/content/child/blink_platform_impl.cc @@ -1026,8 +1026,8 @@ WebData BlinkPlatformImpl::loadResource(const char* name) { return WebData(); // Check the name prefix to see if it's an audio resource. - if (StartsWithASCII(name, "IRC_Composite", true) || - StartsWithASCII(name, "Composite", true)) + if (base::StartsWithASCII(name, "IRC_Composite", true) || + base::StartsWithASCII(name, "Composite", true)) return loadAudioSpatializationResource(name); // TODO(flackr): We should use a better than linear search here, a trie would diff --git a/content/child/multipart_response_delegate.cc b/content/child/multipart_response_delegate.cc index ff8bd58..2904d86 100644 --- a/content/child/multipart_response_delegate.cc +++ b/content/child/multipart_response_delegate.cc @@ -71,7 +71,7 @@ MultipartResponseDelegate::MultipartResponseDelegate( stop_sending_(false), has_sent_first_response_(false) { // Some servers report a boundary prefixed with "--". See bug 5786. - if (StartsWithASCII(boundary, "--", true)) { + if (base::StartsWithASCII(boundary, "--", true)) { boundary_.assign(boundary); } else { boundary_.append(boundary); diff --git a/content/child/npapi/plugin_host.cc b/content/child/npapi/plugin_host.cc index cdda9e4..e201ffb 100644 --- a/content/child/npapi/plugin_host.cc +++ b/content/child/npapi/plugin_host.cc @@ -464,7 +464,7 @@ static NPError PostURLNotify(NPP id, std::string file_path_ascii(buf); base::FilePath file_path; static const char kFileUrlPrefix[] = "file:"; - if (StartsWithASCII(file_path_ascii, kFileUrlPrefix, false)) { + if (base::StartsWithASCII(file_path_ascii, kFileUrlPrefix, false)) { GURL file_url(file_path_ascii); DCHECK(file_url.SchemeIsFile()); net::FileURLToFilePath(file_url, &file_path); diff --git a/content/child/simple_webmimeregistry_impl.cc b/content/child/simple_webmimeregistry_impl.cc index d3276e4..68d8755 100644 --- a/content/child/simple_webmimeregistry_impl.cc +++ b/content/child/simple_webmimeregistry_impl.cc @@ -42,7 +42,7 @@ WebMimeRegistry::SupportsType const WebString& mime_type) { std::string ascii_mime_type = ToASCIIOrEmpty(mime_type); return (mime_util::IsSupportedImageMimeType(ascii_mime_type) || - (StartsWithASCII(ascii_mime_type, "image/", true) && + (base::StartsWithASCII(ascii_mime_type, "image/", true) && mime_util::IsSupportedNonImageMimeType(ascii_mime_type))) ? WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported; diff --git a/content/common/appcache_interfaces.cc b/content/common/appcache_interfaces.cc index 7f3f547..c2c6192 100644 --- a/content/common/appcache_interfaces.cc +++ b/content/common/appcache_interfaces.cc @@ -107,7 +107,7 @@ bool AppCacheNamespace::IsMatch(const GURL& url) const { ReplaceSubstringsAfterOffset(&pattern, 0, "?", "\\?"); return MatchPattern(url.spec(), pattern); } - return StartsWithASCII(url.spec(), namespace_url.spec(), true); + return base::StartsWithASCII(url.spec(), namespace_url.spec(), true); } bool IsSchemeSupportedForAppCache(const GURL& url) { diff --git a/content/common/plugin_list_mac.mm b/content/common/plugin_list_mac.mm index 8400dce..d32f171 100644 --- a/content/common/plugin_list_mac.mm +++ b/content/common/plugin_list_mac.mm @@ -56,9 +56,9 @@ bool IsBlacklistedPlugin(const WebPluginInfo& info) { // Versions of Flip4Mac 2.3 before 2.3.6 often hang the renderer, so don't // load them. - if (StartsWith(info.name, - base::ASCIIToUTF16("Flip4Mac Windows Media"), false) && - StartsWith(info.version, base::ASCIIToUTF16("2.3"), false)) { + if (base::StartsWith(info.name, base::ASCIIToUTF16("Flip4Mac Windows Media"), + false) && + base::StartsWith(info.version, base::ASCIIToUTF16("2.3"), false)) { std::vector<base::string16> components; base::SplitString(info.version, '.', &components); int bugfix_version = 0; @@ -144,7 +144,8 @@ bool ReadPlistPluginInfo(const base::FilePath& filename, CFBundleRef bundle, // Remove PDF from the list of types handled by QuickTime, since it provides // a worse experience than just downloading the PDF. if (mime.mime_type == "application/pdf" && - StartsWithASCII(filename.BaseName().value(), "QuickTime", false)) { + base::StartsWithASCII(filename.BaseName().value(), "QuickTime", + false)) { continue; } diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc index c722393..821d975 100644 --- a/content/public/test/browser_test_utils.cc +++ b/content/public/test/browser_test_utils.cc @@ -231,7 +231,7 @@ scoped_ptr<net::test_server::HttpResponse> CrossSiteRedirectResponseHandler( const GURL& server_base_url, const net::test_server::HttpRequest& request) { std::string prefix("/cross-site/"); - if (!StartsWithASCII(request.relative_url, prefix, true)) + if (!base::StartsWithASCII(request.relative_url, prefix, true)) return scoped_ptr<net::test_server::HttpResponse>(); std::string params = request.relative_url.substr(prefix.length()); diff --git a/content/public/test/test_launcher.cc b/content/public/test/test_launcher.cc index fc65ebd..91fe680 100644 --- a/content/public/test/test_launcher.cc +++ b/content/public/test/test_launcher.cc @@ -182,12 +182,12 @@ bool WrapperTestLauncherDelegate::ShouldRunTest( const std::string& test_name) { all_test_names_.insert(test_case_name + "." + test_name); - if (StartsWithASCII(test_name, kManualTestPrefix, true) && + if (base::StartsWithASCII(test_name, kManualTestPrefix, true) && !base::CommandLine::ForCurrentProcess()->HasSwitch(kRunManualTestsFlag)) { return false; } - if (StartsWithASCII(test_name, kPreTestPrefix, true)) { + if (base::StartsWithASCII(test_name, kPreTestPrefix, true)) { // We will actually run PRE_ tests, but to ensure they run on the same shard // as dependent tests, handle all these details internally. return false; diff --git a/content/renderer/savable_resources.cc b/content/renderer/savable_resources.cc index 363cb59..929a25b 100644 --- a/content/renderer/savable_resources.cc +++ b/content/renderer/savable_resources.cc @@ -179,7 +179,7 @@ WebString GetSubResourceLinkFromElement(const WebElement& element) { // If value has content and not start with "javascript:" then return it, // otherwise return NULL. if (!value.isNull() && !value.isEmpty() && - !StartsWithASCII(value.utf8(), "javascript:", false)) + !base::StartsWithASCII(value.utf8(), "javascript:", false)) return value; return WebString(); diff --git a/dbus/string_util.cc b/dbus/string_util.cc index f35c9b3..0323e4a 100644 --- a/dbus/string_util.cc +++ b/dbus/string_util.cc @@ -14,7 +14,7 @@ bool IsValidObjectPath(const std::string& value) { const bool kCaseSensitive = true; // A valid object path begins with '/'. - if (!StartsWithASCII(value, "/", kCaseSensitive)) + if (!base::StartsWithASCII(value, "/", kCaseSensitive)) return false; // Elements are pieces delimited by '/'. For instance, "org", "chromium", diff --git a/extensions/browser/api/cast_channel/logger.cc b/extensions/browser/api/cast_channel/logger.cc index 9390210..38d8e61 100644 --- a/extensions/browser/api/cast_channel/logger.cc +++ b/extensions/browser/api/cast_channel/logger.cc @@ -251,7 +251,7 @@ void Logger::LogSocketEventForMessage(int channel_id, DCHECK(thread_checker_.CalledOnValidThread()); SocketEvent event = CreateEvent(event_type); - if (StartsWithASCII(message_namespace, kInternalNamespacePrefix, false)) + if (base::StartsWithASCII(message_namespace, kInternalNamespacePrefix, false)) event.set_message_namespace(message_namespace); event.set_details(details); diff --git a/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc b/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc index 49680ad..c428af9 100644 --- a/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc +++ b/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc @@ -422,12 +422,12 @@ bool HeaderMatcher::StringMatchTest::Matches( const std::string& str) const { switch (type_) { case kPrefix: - return StartsWithASCII(str, data_, case_sensitive_); + return base::StartsWithASCII(str, data_, case_sensitive_); case kSuffix: return EndsWith(str, data_, case_sensitive_); case kEquals: return str.size() == data_.size() && - StartsWithASCII(str, data_, case_sensitive_); + base::StartsWithASCII(str, data_, case_sensitive_); case kContains: if (!case_sensitive_) { return std::search(str.begin(), str.end(), data_.begin(), data_.end(), diff --git a/extensions/browser/api/web_request/web_request_api.cc b/extensions/browser/api/web_request/web_request_api.cc index 836cae3..082e3ef 100644 --- a/extensions/browser/api/web_request/web_request_api.cc +++ b/extensions/browser/api/web_request/web_request_api.cc @@ -137,8 +137,8 @@ int GetFrameId(bool is_main_frame, int frame_id) { bool IsWebRequestEvent(const std::string& event_name) { std::string web_request_event_name(event_name); - if (StartsWithASCII( - web_request_event_name, webview::kWebViewEventPrefix, true)) { + if (base::StartsWithASCII(web_request_event_name, + webview::kWebViewEventPrefix, true)) { web_request_event_name.replace( 0, strlen(webview::kWebViewEventPrefix), kWebRequestEventPrefix); } diff --git a/extensions/browser/api/web_request/web_request_permissions.cc b/extensions/browser/api/web_request/web_request_permissions.cc index ea46307..19d85b8 100644 --- a/extensions/browser/api/web_request/web_request_permissions.cc +++ b/extensions/browser/api/web_request/web_request_permissions.cc @@ -35,7 +35,7 @@ bool IsSensitiveURL(const GURL& url) { // This protects requests to several internal services such as sync, // extension update pings, captive portal detection, fraudulent certificate // reporting, autofill and others. - if (StartsWithASCII(host, kClient, true)) { + if (base::StartsWithASCII(host, kClient, true)) { bool match = true; for (std::string::const_iterator i = host.begin() + strlen(kClient), end = host.end() - strlen(kGoogleCom); i != end; ++i) { @@ -48,11 +48,12 @@ bool IsSensitiveURL(const GURL& url) { } // This protects requests to safe browsing, link doctor, and possibly // others. - sensitive_chrome_url = sensitive_chrome_url || + sensitive_chrome_url = + sensitive_chrome_url || EndsWith(url.host(), ".clients.google.com", true) || url.host() == "sb-ssl.google.com" || - (url.host() == "chrome.google.com" && - StartsWithASCII(url.path(), "/webstore", true)); + (url.host() == "chrome.google.com" && + base::StartsWithASCII(url.path(), "/webstore", true)); } GURL::Replacements replacements; replacements.ClearQuery(); diff --git a/extensions/browser/guest_view/web_view/web_view_apitest.cc b/extensions/browser/guest_view/web_view/web_view_apitest.cc index 369bc73..26e91b1 100644 --- a/extensions/browser/guest_view/web_view/web_view_apitest.cc +++ b/extensions/browser/guest_view/web_view/web_view_apitest.cc @@ -58,13 +58,13 @@ static scoped_ptr<net::test_server::HttpResponse> UserAgentResponseHandler( const std::string& path, const GURL& redirect_target, const net::test_server::HttpRequest& request) { - if (!StartsWithASCII(path, request.relative_url, true)) + if (!base::StartsWithASCII(path, request.relative_url, true)) return scoped_ptr<net::test_server::HttpResponse>(); std::map<std::string, std::string>::const_iterator it = request.headers.find("User-Agent"); EXPECT_TRUE(it != request.headers.end()); - if (!StartsWithASCII("foobar", it->second, true)) + if (!base::StartsWithASCII("foobar", it->second, true)) return scoped_ptr<net::test_server::HttpResponse>(); scoped_ptr<net::test_server::BasicHttpResponse> http_response( @@ -103,7 +103,7 @@ scoped_ptr<net::test_server::HttpResponse> RedirectResponseHandler( const std::string& path, const GURL& redirect_target, const net::test_server::HttpRequest& request) { - if (!StartsWithASCII(path, request.relative_url, true)) + if (!base::StartsWithASCII(path, request.relative_url, true)) return scoped_ptr<net::test_server::HttpResponse>(); scoped_ptr<net::test_server::BasicHttpResponse> http_response( @@ -117,7 +117,7 @@ scoped_ptr<net::test_server::HttpResponse> RedirectResponseHandler( scoped_ptr<net::test_server::HttpResponse> EmptyResponseHandler( const std::string& path, const net::test_server::HttpRequest& request) { - if (StartsWithASCII(path, request.relative_url, true)) { + if (base::StartsWithASCII(path, request.relative_url, true)) { return scoped_ptr<net::test_server::HttpResponse>(new EmptyHttpResponse); } diff --git a/extensions/browser/guest_view/web_view/web_view_guest.cc b/extensions/browser/guest_view/web_view/web_view_guest.cc index 73e5daa..add40d7 100644 --- a/extensions/browser/guest_view/web_view/web_view_guest.cc +++ b/extensions/browser/guest_view/web_view/web_view_guest.cc @@ -147,11 +147,11 @@ void ParsePartitionParam(const base::DictionaryValue& create_params, return; } - // Since the "persist:" prefix is in ASCII, StartsWith will work fine on + // Since the "persist:" prefix is in ASCII, base::StartsWith will work fine on // UTF-8 encoded |partition_id|. If the prefix is a match, we can safely // remove the prefix without splicing in the middle of a multi-byte codepoint. // We can use the rest of the string as UTF-8 encoded one. - if (StartsWithASCII(partition_str, "persist:", true)) { + if (base::StartsWithASCII(partition_str, "persist:", true)) { size_t index = partition_str.find(":"); CHECK(index != std::string::npos); // It is safe to do index + 1, since we tested for the full prefix above. diff --git a/extensions/browser/warning_set.cc b/extensions/browser/warning_set.cc index 54c1c8b..5cd7190 100644 --- a/extensions/browser/warning_set.cc +++ b/extensions/browser/warning_set.cc @@ -195,7 +195,7 @@ std::string Warning::GetLocalizedMessage(const ExtensionSet* extensions) const { std::vector<base::string16> final_parameters; for (size_t i = 0; i < message_parameters_.size(); ++i) { std::string message = message_parameters_[i]; - if (StartsWithASCII(message, kTranslate, true)) { + if (base::StartsWithASCII(message, kTranslate, true)) { std::string extension_id = message.substr(sizeof(kTranslate) - 1); const extensions::Extension* extension = extensions->GetByID(extension_id); diff --git a/extensions/common/csp_validator.cc b/extensions/common/csp_validator.cc index 2a28ebb..ced436e 100644 --- a/extensions/common/csp_validator.cc +++ b/extensions/common/csp_validator.cc @@ -57,7 +57,7 @@ struct DirectiveStatus { bool isNonWildcardTLD(const std::string& url, const std::string& scheme_and_separator, bool should_check_rcd) { - if (!StartsWithASCII(url, scheme_and_separator, true)) + if (!base::StartsWithASCII(url, scheme_and_separator, true)) return false; size_t start_of_host = scheme_and_separator.length(); @@ -133,14 +133,14 @@ void GetSecureDirectiveValues(const std::string& directive_name, 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) || + base::StartsWithASCII(source, "http://127.0.0.1:", true) || + base::StartsWithASCII(source, "http://localhost:", true) || isNonWildcardTLD(source, "https://", true) || isNonWildcardTLD(source, "chrome://", false) || isNonWildcardTLD(source, std::string(extensions::kExtensionScheme) + url::kStandardSchemeSeparator, false) || - StartsWithASCII(source, "chrome-extension-resource:", true)) { + base::StartsWithASCII(source, "chrome-extension-resource:", true)) { is_secure_csp_token = true; } else if ((options & OPTIONS_ALLOW_UNSAFE_EVAL) && source == "'unsafe-eval'") { diff --git a/extensions/common/extension.cc b/extensions/common/extension.cc index 1e973fc..d42fce6 100644 --- a/extensions/common/extension.cc +++ b/extensions/common/extension.cc @@ -154,7 +154,7 @@ GURL Extension::GetResourceURL(const GURL& extension_url, path = relative_path.substr(1); GURL ret_val = GURL(extension_url.spec() + path); - DCHECK(StartsWithASCII(ret_val.spec(), extension_url.spec(), false)); + DCHECK(base::StartsWithASCII(ret_val.spec(), extension_url.spec(), false)); return ret_val; } @@ -205,7 +205,7 @@ bool Extension::ParsePEMKeyBytes(const std::string& input, return false; std::string working = input; - if (StartsWithASCII(working, kKeyBeginHeaderMarker, true)) { + if (base::StartsWithASCII(working, kKeyBeginHeaderMarker, true)) { working = base::CollapseWhitespaceASCII(working, true); size_t header_pos = working.find(kKeyInfoEndMarker, sizeof(kKeyBeginHeaderMarker) - 1); diff --git a/extensions/common/extension_urls.cc b/extensions/common/extension_urls.cc index eeb1798..2b34178 100644 --- a/extensions/common/extension_urls.cc +++ b/extensions/common/extension_urls.cc @@ -20,9 +20,8 @@ const char kSchemaUtils[] = "schemaUtils"; bool IsSourceFromAnExtension(const base::string16& source) { return GURL(source).SchemeIs(kExtensionScheme) || - StartsWith(source, - base::ASCIIToUTF16("extensions::"), - true /* case-sensitive */); + base::StartsWith(source, base::ASCIIToUTF16("extensions::"), + true /* case-sensitive */); } } // namespace extensions diff --git a/extensions/common/permissions/permissions_info.cc b/extensions/common/permissions/permissions_info.cc index 44a8014..ad64fd5c 100644 --- a/extensions/common/permissions/permissions_info.cc +++ b/extensions/common/permissions/permissions_info.cc @@ -64,7 +64,7 @@ APIPermissionSet PermissionsInfo::GetAllByName( bool PermissionsInfo::HasChildPermissions(const std::string& name) const { NameMap::const_iterator i = name_map_.lower_bound(name + '.'); if (i == name_map_.end()) return false; - return StartsWithASCII(i->first, name + '.', true); + return base::StartsWithASCII(i->first, name + '.', true); } PermissionsInfo::PermissionsInfo() diff --git a/extensions/shell/common/shell_content_client_unittest.cc b/extensions/shell/common/shell_content_client_unittest.cc index 237d2dc..bf5779f 100644 --- a/extensions/shell/common/shell_content_client_unittest.cc +++ b/extensions/shell/common/shell_content_client_unittest.cc @@ -19,7 +19,8 @@ TEST_F(ShellContentClientTest, UserAgentFormat) { std::string user_agent = client.GetUserAgent(); // Must start with the usual Mozilla-compatibility string. - EXPECT_TRUE(StartsWithASCII(user_agent, "Mozilla/5.0", false)) << user_agent; + EXPECT_TRUE(base::StartsWithASCII(user_agent, "Mozilla/5.0", false)) + << user_agent; // Must contain a substring like "Chrome/1.2.3.4". EXPECT_TRUE(MatchPattern(user_agent, "*Chrome/*.*.*.*")) << user_agent; diff --git a/extensions/utility/unpacker_unittest.cc b/extensions/utility/unpacker_unittest.cc index 107a0cc..b323e01 100644 --- a/extensions/utility/unpacker_unittest.cc +++ b/extensions/utility/unpacker_unittest.cc @@ -168,8 +168,8 @@ TEST_F(UnpackerTest, BadPathError) { static_cast<TestExtensionsClient*>(ExtensionsClient::Get())); EXPECT_FALSE(unpacker_->Run()); - EXPECT_TRUE( - StartsWith(unpacker_->error_message(), ASCIIToUTF16(kExpected), false)) + EXPECT_TRUE(base::StartsWith(unpacker_->error_message(), + ASCIIToUTF16(kExpected), false)) << "Expected prefix: \"" << kExpected << "\", actual error: \"" << unpacker_->error_message() << "\""; } @@ -178,8 +178,8 @@ TEST_F(UnpackerTest, ImageDecodingError) { const char kExpected[] = "Could not decode image: "; SetupUnpacker("bad_image.crx"); EXPECT_FALSE(unpacker_->Run()); - EXPECT_TRUE( - StartsWith(unpacker_->error_message(), ASCIIToUTF16(kExpected), false)) + EXPECT_TRUE(base::StartsWith(unpacker_->error_message(), + ASCIIToUTF16(kExpected), false)) << "Expected prefix: \"" << kExpected << "\", actual error: \"" << unpacker_->error_message() << "\""; } diff --git a/google_apis/drive/test_util.cc b/google_apis/drive/test_util.cc index db14c9d..c621809 100644 --- a/google_apis/drive/test_util.cc +++ b/google_apis/drive/test_util.cc @@ -26,7 +26,7 @@ namespace test_util { bool RemovePrefix(const std::string& input, const std::string& prefix, std::string* output) { - if (!StartsWithASCII(input, prefix, true /* case sensitive */)) + if (!base::StartsWithASCII(input, prefix, true /* case sensitive */)) return false; *output = input.substr(prefix.size()); diff --git a/google_apis/gaia/fake_gaia.cc b/google_apis/gaia/fake_gaia.cc index 4c0db5a..1b5d408 100644 --- a/google_apis/gaia/fake_gaia.cc +++ b/google_apis/gaia/fake_gaia.cc @@ -102,7 +102,8 @@ bool GetAccessToken(const HttpRequest& request, std::map<std::string, std::string>::const_iterator auth_header_entry = request.headers.find("Authorization"); if (auth_header_entry != request.headers.end()) { - if (StartsWithASCII(auth_header_entry->second, auth_token_prefix, true)) { + if (base::StartsWithASCII(auth_header_entry->second, auth_token_prefix, + true)) { *access_token = auth_header_entry->second.substr( strlen(auth_token_prefix)); return true; diff --git a/google_apis/gaia/gaia_auth_fetcher.cc b/google_apis/gaia/gaia_auth_fetcher.cc index e1ef712..0ae6912 100644 --- a/google_apis/gaia/gaia_auth_fetcher.cc +++ b/google_apis/gaia/gaia_auth_fetcher.cc @@ -539,8 +539,8 @@ bool GaiaAuthFetcher::ParseClientLoginToOAuth2Cookie(const std::string& cookie, std::vector<std::string>::const_iterator iter; for (iter = parts.begin(); iter != parts.end(); ++iter) { const std::string& part = *iter; - if (StartsWithASCII( - part, kClientLoginToOAuth2CookiePartCodePrefix, false)) { + if (base::StartsWithASCII(part, kClientLoginToOAuth2CookiePartCodePrefix, + false)) { auth_code->assign(part.substr( kClientLoginToOAuth2CookiePartCodePrefixLength)); return true; diff --git a/google_apis/gcm/engine/gcm_store_impl.cc b/google_apis/gcm/engine/gcm_store_impl.cc index b90630a..1743d13 100644 --- a/google_apis/gcm/engine/gcm_store_impl.cc +++ b/google_apis/gcm/engine/gcm_store_impl.cc @@ -342,7 +342,7 @@ void GCMStoreImpl::Backend::Load(const LoadCallback& callback) { int gcm_registration_count = 0; int instance_id_token_count = 0; for (const auto& registration : result->registrations) { - if (StartsWithASCII(registration.first, "iid-", true)) + if (base::StartsWithASCII(registration.first, "iid-", true)) instance_id_token_count++; else gcm_registration_count++; diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc index 40f37a2..276cb7d 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc @@ -63,7 +63,7 @@ void NormalizeInitState(gpu::gles2::GLES2DecoderTestBase::InitState* init) { return; if (!init->extensions.empty()) init->extensions += " "; - if (StartsWithASCII(init->gl_version, "opengl es", false)) { + if (base::StartsWithASCII(init->gl_version, "opengl es", false)) { init->extensions += kVAOExtensions[0]; } else { #if !defined(OS_MACOSX) diff --git a/gpu/config/gpu_control_list.cc b/gpu/config/gpu_control_list.cc index fddcea4..2f4b6aa 100644 --- a/gpu/config/gpu_control_list.cc +++ b/gpu/config/gpu_control_list.cc @@ -1029,7 +1029,7 @@ bool GpuControlList::GpuControlListEntry::GLVersionInfoMismatch( gl_type = kGLTypeGLES; if (segments.size() > 3 && - StartsWithASCII(segments[3], "(ANGLE", false)) { + base::StartsWithASCII(segments[3], "(ANGLE", false)) { gl_type = kGLTypeANGLE; } } else { diff --git a/gpu/config/gpu_info_collector_linux.cc b/gpu/config/gpu_info_collector_linux.cc index 023c08b..413e949 100644 --- a/gpu/config/gpu_info_collector_linux.cc +++ b/gpu/config/gpu_info_collector_linux.cc @@ -56,7 +56,7 @@ std::string CollectDriverVersionATI() { base::StringTokenizer t(contents, "\r\n"); while (t.GetNext()) { std::string line = t.token(); - if (StartsWithASCII(line, "ReleaseVersion=", true)) { + if (base::StartsWithASCII(line, "ReleaseVersion=", true)) { size_t begin = line.find_first_of("0123456789"); if (begin != std::string::npos) { size_t end = line.find_first_not_of("0123456789.", begin); @@ -244,7 +244,7 @@ CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) { DCHECK(gpu_info); std::string gl_version = gpu_info->gl_version; - if (StartsWithASCII(gl_version, "OpenGL ES", true)) + if (base::StartsWithASCII(gl_version, "OpenGL ES", true)) gl_version = gl_version.substr(10); std::vector<std::string> pieces; base::SplitStringAlongWhitespace(gl_version, &pieces); diff --git a/gpu/config/gpu_test_expectations_parser.cc b/gpu/config/gpu_test_expectations_parser.cc index d210cbd..ca4031d 100644 --- a/gpu/config/gpu_test_expectations_parser.cc +++ b/gpu/config/gpu_test_expectations_parser.cc @@ -131,9 +131,9 @@ const char* kErrorMessage[] = { }; Token ParseToken(const std::string& word) { - if (StartsWithASCII(word, "//", false)) + if (base::StartsWithASCII(word, "//", false)) return kTokenComment; - if (StartsWithASCII(word, "0x", false)) + if (base::StartsWithASCII(word, "0x", false)) return kConfigGPUDeviceID; for (int32 i = 0; i < kNumberOfExactMatchTokens; ++i) { diff --git a/ios/chrome/app/safe_mode_util_unittest.cc b/ios/chrome/app/safe_mode_util_unittest.cc index 3164d59..1c9de67 100644 --- a/ios/chrome/app/safe_mode_util_unittest.cc +++ b/ios/chrome/app/safe_mode_util_unittest.cc @@ -27,7 +27,7 @@ TEST_F(SafeModeUtilTest, GetAllImages) { string lib_system_prefix("libSystem"); for (size_t i = 0; i < images.size(); ++i) { string base_name = base::FilePath(images[i]).BaseName().value(); - if (StartsWithASCII(base_name, lib_system_prefix, true)) { + if (base::StartsWithASCII(base_name, lib_system_prefix, true)) { found_lib_system = true; break; } diff --git a/ios/chrome/browser/experimental_flags.mm b/ios/chrome/browser/experimental_flags.mm index 6659c60..531f1f6 100644 --- a/ios/chrome/browser/experimental_flags.mm +++ b/ios/chrome/browser/experimental_flags.mm @@ -71,7 +71,7 @@ bool IsWKWebViewEnabled() { } // Check if the finch experiment is turned on. - return StartsWithASCII(group_name, "Enabled", false); + return base::StartsWithASCII(group_name, "Enabled", false); } size_t MemoryWedgeSizeInMB() { diff --git a/ios/net/clients/crn_forwarding_network_client_factory_unittest.mm b/ios/net/clients/crn_forwarding_network_client_factory_unittest.mm index 735c7f5..4364cdb 100644 --- a/ios/net/clients/crn_forwarding_network_client_factory_unittest.mm +++ b/ios/net/clients/crn_forwarding_network_client_factory_unittest.mm @@ -142,7 +142,7 @@ TEST_F(ForwardingNetworkClientFactoryTest, TestSubclassImplementations) { for (NSInteger i = 0; i < class_count; i++) { std::string class_name = class_getName(classes[i]); // Skip the test classes defined above. - if (StartsWithASCII(class_name, "TestFactory", false)) + if (base::StartsWithASCII(class_name, "TestFactory", false)) continue; Class subclass_super = classes[i]; diff --git a/media/base/android/media_codec_bridge.cc b/media/base/android/media_codec_bridge.cc index 14f3300..3d22752 100644 --- a/media/base/android/media_codec_bridge.cc +++ b/media/base/android/media_codec_bridge.cc @@ -246,10 +246,10 @@ bool MediaCodecBridge::IsKnownUnaccelerated(const std::string& mime_type, // devices while HW decoder video freezes and distortions are // investigated - http://crbug.com/446974. if (codec_name.length() > 0) { - return (StartsWithASCII(codec_name, "OMX.google.", true) || - StartsWithASCII(codec_name, "OMX.SEC.", true) || - StartsWithASCII(codec_name, "OMX.MTK.", true) || - StartsWithASCII(codec_name, "OMX.Exynos.", true)); + return (base::StartsWithASCII(codec_name, "OMX.google.", true) || + base::StartsWithASCII(codec_name, "OMX.SEC.", true) || + base::StartsWithASCII(codec_name, "OMX.MTK.", true) || + base::StartsWithASCII(codec_name, "OMX.Exynos.", true)); } return true; } diff --git a/media/base/android/media_player_bridge.cc b/media/base/android/media_player_bridge.cc index 29049cb..de32bc4 100644 --- a/media/base/android/media_player_bridge.cc +++ b/media/base/android/media_player_bridge.cc @@ -161,7 +161,7 @@ void MediaPlayerBridge::SetDataSource(const std::string& url) { DCHECK(j_context); const std::string data_uri_prefix("data:"); - if (StartsWithASCII(url, data_uri_prefix, true)) { + if (base::StartsWithASCII(url, data_uri_prefix, true)) { if (!Java_MediaPlayerBridge_setDataUriDataSource( env, j_media_player_bridge_.obj(), j_context, j_url_string.obj())) { OnMediaError(MEDIA_ERROR_FORMAT); diff --git a/media/base/key_systems.cc b/media/base/key_systems.cc index 1cd202c..6b4d0c3 100644 --- a/media/base/key_systems.cc +++ b/media/base/key_systems.cc @@ -674,12 +674,12 @@ EmeConfigRule KeySystemsImpl::GetContentTypeConfigRule( SupportedCodecs media_type_codec_mask = EME_CODEC_NONE; switch (media_type) { case EmeMediaType::AUDIO: - if (!StartsWithASCII(container_mime_type, "audio/", true)) + if (!base::StartsWithASCII(container_mime_type, "audio/", true)) return EmeConfigRule::NOT_SUPPORTED; media_type_codec_mask = audio_codec_mask_; break; case EmeMediaType::VIDEO: - if (!StartsWithASCII(container_mime_type, "video/", true)) + if (!base::StartsWithASCII(container_mime_type, "video/", true)) return EmeConfigRule::NOT_SUPPORTED; media_type_codec_mask = video_codec_mask_; break; diff --git a/media/base/mime_util.cc b/media/base/mime_util.cc index 030a4ee..83eef20 100644 --- a/media/base/mime_util.cc +++ b/media/base/mime_util.cc @@ -539,8 +539,8 @@ static bool ParseH264CodecID(const std::string& codec_id, bool* is_ambiguous) { // Make sure we have avc1.xxxxxx or avc3.xxxxxx if (codec_id.size() != 11 || - (!StartsWithASCII(codec_id, "avc1.", true) && - !StartsWithASCII(codec_id, "avc3.", true))) { + (!base::StartsWithASCII(codec_id, "avc1.", true) && + !base::StartsWithASCII(codec_id, "avc3.", true))) { return false; } diff --git a/media/filters/source_buffer_stream_unittest.cc b/media/filters/source_buffer_stream_unittest.cc index e360ba5..d08b6c17 100644 --- a/media/filters/source_buffer_stream_unittest.cc +++ b/media/filters/source_buffer_stream_unittest.cc @@ -501,7 +501,7 @@ class SourceBufferStreamTest : public testing::Test { bool is_duration_estimated = false; // Handle splice frame starts. - if (StartsWithASCII(timestamps[i], "S(", true)) { + if (base::StartsWithASCII(timestamps[i], "S(", true)) { CHECK(!splice_frame); splice_frame = true; // Remove the "S(" off of the token. diff --git a/media/renderers/video_renderer_impl.cc b/media/renderers/video_renderer_impl.cc index 95067fa..d688ca5 100644 --- a/media/renderers/video_renderer_impl.cc +++ b/media/renderers/video_renderer_impl.cc @@ -36,7 +36,8 @@ static bool ShouldUseVideoRenderingPath() { const bool disabled_via_cli = base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableNewVideoRenderer); - return !disabled_via_cli && !StartsWithASCII(group_name, "Disabled", true); + return !disabled_via_cli && + !base::StartsWithASCII(group_name, "Disabled", true); } VideoRendererImpl::VideoRendererImpl( diff --git a/media/video/capture/win/video_capture_device_factory_win.cc b/media/video/capture/win/video_capture_device_factory_win.cc index 8b018fb..8aba237 100644 --- a/media/video/capture/win/video_capture_device_factory_win.cc +++ b/media/video/capture/win/video_capture_device_factory_win.cc @@ -103,7 +103,7 @@ static bool IsDeviceBlackListed(const std::string& name) { DCHECK_EQ(BLACKLISTED_CAMERA_MAX + 1, static_cast<int>(arraysize(kBlacklistedCameraNames))); for (size_t i = 0; i < arraysize(kBlacklistedCameraNames); ++i) { - if (StartsWithASCII(name, kBlacklistedCameraNames[i], false)) { + if (base::StartsWithASCII(name, kBlacklistedCameraNames[i], false)) { DVLOG(1) << "Enumerated blacklisted device: " << name; UMA_HISTOGRAM_ENUMERATION("Media.VideoCapture.BlacklistedDevice", i, BLACKLISTED_CAMERA_MAX + 1); diff --git a/mojo/runner/shell_apptest.cc b/mojo/runner/shell_apptest.cc index a2bf37d..a675805 100644 --- a/mojo/runner/shell_apptest.cc +++ b/mojo/runner/shell_apptest.cc @@ -42,7 +42,7 @@ class GetHandler : public http_server::HttpHandler { http_server::HttpRequestPtr request, const Callback<void(http_server::HttpResponsePtr)>& callback) override { http_server::HttpResponsePtr response; - if (StartsWithASCII(request->relative_url, "/app", true)) { + if (base::StartsWithASCII(request->relative_url, "/app", true)) { response = http_server::CreateHttpResponse( 200, std::string(kPingable.data, kPingable.size)); response->content_type = "application/octet-stream"; diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc index 4c0d1e0..4468fc4 100644 --- a/net/base/mime_util.cc +++ b/net/base/mime_util.cc @@ -283,7 +283,7 @@ bool MimeUtil::MatchesMimeType(const std::string& mime_type_pattern, const std::string left(base_pattern.substr(0, star)); const std::string right(base_pattern.substr(star + 1)); - if (!StartsWithASCII(base_type, left, false)) + if (!base::StartsWithASCII(base_type, left, false)) return false; if (!right.empty() && !EndsWith(base_type, right, false)) @@ -330,7 +330,8 @@ bool MimeUtil::IsValidTopLevelMimeType(const std::string& type_string) const { return true; } - return type_string.size() > 2 && StartsWithASCII(type_string, "x-", false); + return type_string.size() > 2 && + base::StartsWithASCII(type_string, "x-", false); } //---------------------------------------------------------------------------- @@ -457,7 +458,8 @@ void GetExtensionsFromHardCodedMappings( const std::string& leading_mime_type, base::hash_set<base::FilePath::StringType>* extensions) { for (size_t i = 0; i < mappings_len; ++i) { - if (StartsWithASCII(mappings[i].mime_type, leading_mime_type, false)) { + if (base::StartsWithASCII(mappings[i].mime_type, leading_mime_type, + false)) { std::vector<string> this_extensions; base::SplitString(mappings[i].extensions, ',', &this_extensions); for (size_t j = 0; j < this_extensions.size(); ++j) { diff --git a/net/base/net_util.cc b/net/base/net_util.cc index 8820611..04733a8 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -256,7 +256,7 @@ bool IsCanonicalizedHostCompliant(const std::string& host) { base::string16 StripWWW(const base::string16& text) { const base::string16 www(base::ASCIIToUTF16("www.")); - return StartsWith(text, www, true) ? text.substr(www.length()) : text; + return base::StartsWith(text, www, true) ? text.substr(www.length()) : text; } base::string16 StripWWWFromHost(const GURL& url) { diff --git a/net/base/net_util_icu.cc b/net/base/net_util_icu.cc index 08be72f..01204a3 100644 --- a/net/base/net_util_icu.cc +++ b/net/base/net_util_icu.cc @@ -679,7 +679,8 @@ base::string16 FormatUrlWithAdjustments( // Reject "view-source:view-source:..." to avoid deep recursion. const char kViewSourceTwice[] = "view-source:view-source:"; if (url.SchemeIs(kViewSource) && - !StartsWithASCII(url.possibly_invalid_spec(), kViewSourceTwice, false)) { + !base::StartsWithASCII(url.possibly_invalid_spec(), kViewSourceTwice, + false)) { return FormatViewSourceUrl(url, languages, format_types, unescape_rules, new_parsed, prefix_end, adjustments); @@ -705,7 +706,7 @@ base::string16 FormatUrlWithAdjustments( // we avoid stripping "http://" in this case. bool omit_http = (format_types & kFormatUrlOmitHTTP) && base::EqualsASCII(url_string, kHTTP) && - !StartsWithASCII(url.host(), kFTP, true); + !base::StartsWithASCII(url.host(), kFTP, true); new_parsed->scheme = parsed.scheme; // Username & password. @@ -792,7 +793,8 @@ base::string16 FormatUrlWithAdjustments( &url_string, &new_parsed->ref, adjustments); // If we need to strip out http do it after the fact. - if (omit_http && StartsWith(url_string, base::ASCIIToUTF16(kHTTP), true)) { + if (omit_http && + base::StartsWith(url_string, base::ASCIIToUTF16(kHTTP), true)) { const size_t kHTTPSize = arraysize(kHTTP) - 1; url_string = url_string.substr(kHTTPSize); // Because offsets in the |adjustments| are already calculated with respect diff --git a/net/dns/host_resolver_impl.cc b/net/dns/host_resolver_impl.cc index 970ec1f..a074c3e 100644 --- a/net/dns/host_resolver_impl.cc +++ b/net/dns/host_resolver_impl.cc @@ -281,7 +281,7 @@ bool ConfigureAsyncDnsNoFallbackFieldTrial() { // otherwise (trial absent): return default. std::string group_name = base::FieldTrialList::FindFullName("AsyncDns"); if (!group_name.empty()) - return StartsWithASCII(group_name, "AsyncDnsNoFallback", false); + return base::StartsWithASCII(group_name, "AsyncDnsNoFallback", false); return kDefault; } diff --git a/net/filter/filter.cc b/net/filter/filter.cc index 4df0191..0e6544b 100644 --- a/net/filter/filter.cc +++ b/net/filter/filter.cc @@ -267,7 +267,7 @@ void Filter::FixupEncodingTypes( // supported server side on paths that only send HTML content, this mode has // never surfaced in the wild (and is unlikely to). // We will gather a lot of stats as we perform the fixups - if (StartsWithASCII(mime_type, kTextHtml, false)) { + if (base::StartsWithASCII(mime_type, kTextHtml, false)) { // Suspicious case: Advertised dictionary, but server didn't use sdch, and // we're HTML tagged. if (encoding_types->empty()) { diff --git a/net/ftp/ftp_directory_listing_parser_netware.cc b/net/ftp/ftp_directory_listing_parser_netware.cc index 20716ab..e8b635d 100644 --- a/net/ftp/ftp_directory_listing_parser_netware.cc +++ b/net/ftp/ftp_directory_listing_parser_netware.cc @@ -40,7 +40,7 @@ bool ParseFtpDirectoryListingNetware( const base::Time& current_time, std::vector<FtpDirectoryListingEntry>* entries) { if (!lines.empty() && - !StartsWith(lines[0], base::ASCIIToUTF16("total "), true)) { + !base::StartsWith(lines[0], base::ASCIIToUTF16("total "), true)) { return false; } diff --git a/net/ftp/ftp_directory_listing_parser_vms.cc b/net/ftp/ftp_directory_listing_parser_vms.cc index d73a54f..fb5ee47 100644 --- a/net/ftp/ftp_directory_listing_parser_vms.cc +++ b/net/ftp/ftp_directory_listing_parser_vms.cc @@ -210,7 +210,7 @@ bool ParseFtpDirectoryListingVms( if (lines[i].empty()) continue; - if (StartsWith(lines[i], base::ASCIIToUTF16("Total of "), true)) { + if (base::StartsWith(lines[i], base::ASCIIToUTF16("Total of "), true)) { // After the "total" line, all following lines must be empty. for (size_t j = i + 1; j < lines.size(); j++) if (!lines[j].empty()) diff --git a/net/http/http_auth_cache.cc b/net/http/http_auth_cache.cc index 51f9035..106e1ec 100644 --- a/net/http/http_auth_cache.cc +++ b/net/http/http_auth_cache.cc @@ -37,7 +37,7 @@ void CheckPathIsValid(const std::string& path) { bool IsEnclosingPath(const std::string& container, const std::string& path) { DCHECK(container.empty() || *(container.end() - 1) == '/'); return ((container.empty() && path.empty()) || - (!container.empty() && StartsWithASCII(path, container, true))); + (!container.empty() && base::StartsWithASCII(path, container, true))); } // Debug helper to check that |origin| arguments are properly formed. diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc index 257a88c..e729db3 100644 --- a/net/http/http_response_headers.cc +++ b/net/http/http_response_headers.cc @@ -102,8 +102,8 @@ bool ShouldUpdateHeader(const std::string::const_iterator& name_begin, return false; } for (size_t i = 0; i < arraysize(kNonUpdatedHeaderPrefixes); ++i) { - if (StartsWithASCII(std::string(name_begin, name_end), - kNonUpdatedHeaderPrefixes[i], false)) + if (base::StartsWithASCII(std::string(name_begin, name_end), + kNonUpdatedHeaderPrefixes[i], false)) return false; } return true; diff --git a/net/http/http_stream_factory.cc b/net/http/http_stream_factory.cc index 35083f0..e3d35b7 100644 --- a/net/http/http_stream_factory.cc +++ b/net/http/http_stream_factory.cc @@ -39,7 +39,7 @@ void HttpStreamFactory::ProcessAlternateProtocol( bool is_valid = true; for (size_t i = 0; i < alternate_protocol_values.size(); ++i) { const std::string& alternate_protocol_str = alternate_protocol_values[i]; - if (StartsWithASCII(alternate_protocol_str, "p=", true)) { + if (base::StartsWithASCII(alternate_protocol_str, "p=", true)) { if (!base::StringToDouble(alternate_protocol_str.substr(2), &probability) || probability < 0 || probability > 1) { diff --git a/net/http/http_util.cc b/net/http/http_util.cc index fa40ed7..b3819c21 100644 --- a/net/http/http_util.cc +++ b/net/http/http_util.cc @@ -353,8 +353,8 @@ const char* const kForbiddenHeaderFields[] = { // static bool HttpUtil::IsSafeHeader(const std::string& name) { std::string lower_name(base::StringToLowerASCII(name)); - if (StartsWithASCII(lower_name, "proxy-", true) || - StartsWithASCII(lower_name, "sec-", true)) + if (base::StartsWithASCII(lower_name, "proxy-", true) || + base::StartsWithASCII(lower_name, "sec-", true)) return false; for (size_t i = 0; i < arraysize(kForbiddenHeaderFields); ++i) { if (lower_name == kForbiddenHeaderFields[i]) diff --git a/net/proxy/proxy_bypass_rules.cc b/net/proxy/proxy_bypass_rules.cc index bb163ad..9dc40315 100644 --- a/net/proxy/proxy_bypass_rules.cc +++ b/net/proxy/proxy_bypass_rules.cc @@ -328,12 +328,12 @@ bool ProxyBypassRules::AddRuleFromStringInternal( // Special-case hostnames that begin with a period. // For example, we remap ".google.com" --> "*.google.com". - if (StartsWithASCII(raw, ".", false)) + if (base::StartsWithASCII(raw, ".", false)) raw = "*" + raw; // If suffix matching was asked for, make sure the pattern starts with a // wildcard. - if (use_hostname_suffix_matching && !StartsWithASCII(raw, "*", false)) + if (use_hostname_suffix_matching && !base::StartsWithASCII(raw, "*", false)) raw = "*" + raw; return AddRuleForHostname(scheme, raw, port); diff --git a/net/proxy/proxy_config_service_linux.cc b/net/proxy/proxy_config_service_linux.cc index be8068d..58ae1df 100644 --- a/net/proxy/proxy_config_service_linux.cc +++ b/net/proxy/proxy_config_service_linux.cc @@ -55,7 +55,7 @@ namespace { std::string FixupProxyHostScheme(ProxyServer::Scheme scheme, std::string host) { if (scheme == ProxyServer::SCHEME_SOCKS5 && - StartsWithASCII(host, "socks4://", false)) { + base::StartsWithASCII(host, "socks4://", false)) { // We default to socks 5, but if the user specifically set it to // socks4://, then use that. scheme = ProxyServer::SCHEME_SOCKS4; diff --git a/net/server/http_server_unittest.cc b/net/server/http_server_unittest.cc index aebe593..09b6bf4 100644 --- a/net/server/http_server_unittest.cc +++ b/net/server/http_server_unittest.cc @@ -270,9 +270,8 @@ TEST_F(HttpServerTest, Request) { ASSERT_EQ("/test", GetRequest(0).path); ASSERT_EQ("", GetRequest(0).data); ASSERT_EQ(0u, GetRequest(0).headers.size()); - ASSERT_TRUE(StartsWithASCII(GetRequest(0).peer.ToString(), - "127.0.0.1", - true)); + ASSERT_TRUE( + base::StartsWithASCII(GetRequest(0).peer.ToString(), "127.0.0.1", true)); } TEST_F(HttpServerTest, RequestWithHeaders) { @@ -443,7 +442,7 @@ TEST_F(HttpServerTest, Send200) { std::string response; ASSERT_TRUE(client.ReadResponse(&response)); - ASSERT_TRUE(StartsWithASCII(response, "HTTP/1.1 200 OK", true)); + ASSERT_TRUE(base::StartsWithASCII(response, "HTTP/1.1 200 OK", true)); ASSERT_TRUE(EndsWith(response, "Response!", true)); } @@ -592,7 +591,7 @@ TEST_F(HttpServerTest, MultipleRequestsOnSameConnection) { server_->Send200(client_connection_id, "Content for /test", "text/plain"); std::string response1; ASSERT_TRUE(client.ReadResponse(&response1)); - ASSERT_TRUE(StartsWithASCII(response1, "HTTP/1.1 200 OK", true)); + ASSERT_TRUE(base::StartsWithASCII(response1, "HTTP/1.1 200 OK", true)); ASSERT_TRUE(EndsWith(response1, "Content for /test", true)); client.Send("GET /test2 HTTP/1.1\r\n\r\n"); @@ -603,7 +602,7 @@ TEST_F(HttpServerTest, MultipleRequestsOnSameConnection) { server_->Send404(client_connection_id); std::string response2; ASSERT_TRUE(client.ReadResponse(&response2)); - ASSERT_TRUE(StartsWithASCII(response2, "HTTP/1.1 404 Not Found", true)); + ASSERT_TRUE(base::StartsWithASCII(response2, "HTTP/1.1 404 Not Found", true)); client.Send("GET /test3 HTTP/1.1\r\n\r\n"); ASSERT_TRUE(RunUntilRequestsReceived(3)); @@ -613,7 +612,7 @@ TEST_F(HttpServerTest, MultipleRequestsOnSameConnection) { server_->Send200(client_connection_id, "Content for /test3", "text/plain"); std::string response3; ASSERT_TRUE(client.ReadResponse(&response3)); - ASSERT_TRUE(StartsWithASCII(response3, "HTTP/1.1 200 OK", true)); + ASSERT_TRUE(base::StartsWithASCII(response3, "HTTP/1.1 200 OK", true)); ASSERT_TRUE(EndsWith(response3, "Content for /test3", true)); } diff --git a/net/ssl/ssl_cipher_suite_names.cc b/net/ssl/ssl_cipher_suite_names.cc index 87a3259..6a2dff1 100644 --- a/net/ssl/ssl_cipher_suite_names.cc +++ b/net/ssl/ssl_cipher_suite_names.cc @@ -349,7 +349,8 @@ bool ParseSSLCipherString(const std::string& cipher_string, uint16* cipher_suite) { int value = 0; if (cipher_string.size() == 6 && - StartsWithASCII(cipher_string, "0x", false /* case insensitive */) && + base::StartsWithASCII(cipher_string, "0x", + false /* case insensitive */) && base::HexStringToInt(cipher_string, &value)) { *cipher_suite = static_cast<uint16>(value); return true; diff --git a/net/test/embedded_test_server/embedded_test_server.cc b/net/test/embedded_test_server/embedded_test_server.cc index a6e95ae..e90ff2c 100644 --- a/net/test/embedded_test_server/embedded_test_server.cc +++ b/net/test/embedded_test_server/embedded_test_server.cc @@ -263,7 +263,7 @@ void EmbeddedTestServer::HandleRequest(HttpConnection* connection, GURL EmbeddedTestServer::GetURL(const std::string& relative_url) const { DCHECK(Started()) << "You must start the server first."; - DCHECK(StartsWithASCII(relative_url, "/", true /* case_sensitive */)) + DCHECK(base::StartsWithASCII(relative_url, "/", true /* case_sensitive */)) << relative_url; return base_url_.Resolve(relative_url); } diff --git a/net/tools/quic/quic_in_memory_cache.cc b/net/tools/quic/quic_in_memory_cache.cc index 302e198..8bf1713 100644 --- a/net/tools/quic/quic_in_memory_cache.cc +++ b/net/tools/quic/quic_in_memory_cache.cc @@ -128,9 +128,9 @@ void QuicInMemoryCache::InitializeFromDirectory(const string& cache_directory) { if (response_headers->GetNormalizedHeader("X-Original-Url", &base)) { response_headers->RemoveHeader("X-Original-Url"); // Remove the protocol so we can add it below. - if (StartsWithASCII(base, "https://", false)) { + if (base::StartsWithASCII(base, "https://", false)) { base = base.substr(8); - } else if (StartsWithASCII(base, "http://", false)) { + } else if (base::StartsWithASCII(base, "http://", false)) { base = base.substr(7); } } else { diff --git a/pdf/document_loader.cc b/pdf/document_loader.cc index 8801a5a..48d8352 100644 --- a/pdf/document_loader.cc +++ b/pdf/document_loader.cc @@ -29,7 +29,7 @@ bool GetByteRange(const std::string& headers, uint32_t* start, uint32_t* end) { while (it.GetNext()) { if (base::LowerCaseEqualsASCII(it.name(), "content-range")) { std::string range = it.values().c_str(); - if (StartsWithASCII(range, "bytes", false)) { + if (base::StartsWithASCII(range, "bytes", false)) { range = range.substr(strlen("bytes")); std::string::size_type pos = range.find('-'); std::string range_end; @@ -53,7 +53,7 @@ std::string GetMultiPartBoundary(const std::string& headers) { while (it.GetNext()) { if (base::LowerCaseEqualsASCII(it.name(), "content-type")) { std::string type = base::StringToLowerASCII(it.values()); - if (StartsWithASCII(type, "multipart/", true)) { + if (base::StartsWithASCII(type, "multipart/", true)) { const char* boundary = strstr(type.c_str(), "boundary="); if (!boundary) { NOTREACHED(); @@ -118,8 +118,8 @@ bool DocumentLoader::Init(const pp::URLLoader& loader, // This happens for PDFs not loaded from http(s) sources. if (response_headers == "Content-Type: text/plain") { - if (!StartsWithASCII(url, "http://", false) && - !StartsWithASCII(url, "https://", false)) { + if (!base::StartsWithASCII(url, "http://", false) && + !base::StartsWithASCII(url, "https://", false)) { type = "application/pdf"; } } @@ -147,7 +147,7 @@ bool DocumentLoader::Init(const pp::URLLoader& loader, } if (!type.empty() && !IsValidContentType(type)) return false; - if (StartsWithASCII(disposition, "attachment", false)) + if (base::StartsWithASCII(disposition, "attachment", false)) return false; if (content_length > 0) diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc index 52605e9..1672ec4 100644 --- a/pdf/pdfium/pdfium_engine.cc +++ b/pdf/pdfium/pdfium_engine.cc @@ -3917,7 +3917,7 @@ bool PDFiumEngineExports::RenderPDFPageToDC(const void* pdf_buffer, doc, "Creator", WriteInto(&creator, buffer_bytes + 1), buffer_bytes); } bool use_bitmap = false; - if (StartsWith(creator, L"cairo", false)) + if (base::StartsWith(creator, L"cairo", false)) use_bitmap = true; // Another temporary hack. Some PDFs seems to render very slowly if diff --git a/remoting/host/it2me/it2me_native_messaging_host.cc b/remoting/host/it2me/it2me_native_messaging_host.cc index 4c2cb3b..c1841f0 100644 --- a/remoting/host/it2me/it2me_native_messaging_host.cc +++ b/remoting/host/it2me/it2me_native_messaging_host.cc @@ -168,7 +168,8 @@ void It2MeNativeMessagingHost::ProcessConnect( // the authServiceWithToken field. But auth service part is always expected to // be set to oauth2. const char kOAuth2ServicePrefix[] = "oauth2:"; - if (!StartsWithASCII(auth_service_with_token, kOAuth2ServicePrefix, true)) { + if (!base::StartsWithASCII(auth_service_with_token, kOAuth2ServicePrefix, + true)) { SendErrorAndExit(response.Pass(), "Invalid 'authServiceWithToken': " + auth_service_with_token); return; diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc index 6035c17..eeb65be 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc @@ -1119,9 +1119,9 @@ void HostProcess::ApplyUsernamePolicy() { } std::string username = GetUsername(); - bool shutdown = username.empty() || - !StartsWithASCII(host_owner_, username + std::string("@"), - false); + bool shutdown = + username.empty() || + !base::StartsWithASCII(host_owner_, username + std::string("@"), false); #if defined(OS_MACOSX) // On Mac, we run as root at the login screen, so the username won't match. diff --git a/remoting/protocol/me2me_host_authenticator_factory.cc b/remoting/protocol/me2me_host_authenticator_factory.cc index d69930b..abf8541 100644 --- a/remoting/protocol/me2me_host_authenticator_factory.cc +++ b/remoting/protocol/me2me_host_authenticator_factory.cc @@ -129,7 +129,7 @@ scoped_ptr<Authenticator> Me2MeHostAuthenticatorFactory::CreateAuthenticator( // Verify that the client's jid is an ASCII string, and then check that the // client JID has the expected prefix. Comparison is case insensitive. if (!base::IsStringASCII(remote_jid) || - !StartsWithASCII(remote_jid, remote_jid_prefix + '/', false)) { + !base::StartsWithASCII(remote_jid, remote_jid_prefix + '/', false)) { LOG(ERROR) << "Rejecting incoming connection from " << remote_jid; return make_scoped_ptr(new RejectingAuthenticator()); } diff --git a/rlz/lib/rlz_lib.cc b/rlz/lib/rlz_lib.cc index 39bec27..14a4fae 100644 --- a/rlz/lib/rlz_lib.cc +++ b/rlz/lib/rlz_lib.cc @@ -422,7 +422,7 @@ bool IsPingResponseValid(const char* response, int* checksum_idx) { return false; } else { checksum_param = "crc32: "; // Empty response case. - if (!StartsWithASCII(response_string, checksum_param, true)) + if (!base::StartsWithASCII(response_string, checksum_param, true)) return false; checksum_index = 0; @@ -534,7 +534,8 @@ bool ParsePingResponse(Product product, const char* response) { std::string response_line; response_line = response_string.substr(line_begin, line_end - line_begin); - if (StartsWithASCII(response_line, kRlzCgiVariable, true)) { // An RLZ. + if (base::StartsWithASCII(response_line, kRlzCgiVariable, + true)) { // An RLZ. int separator_index = -1; if ((separator_index = response_line.find(": ")) < 0) continue; // Not a valid key-value pair. @@ -560,7 +561,7 @@ bool ParsePingResponse(Product product, const char* response) { if (IsAccessPointSupported(point)) SetAccessPointRlz(point, rlz_value.substr(0, rlz_length).c_str()); - } else if (StartsWithASCII(response_line, events_variable, true)) { + } else if (base::StartsWithASCII(response_line, events_variable, true)) { // Clear events which server parsed. std::vector<ReturnedEvent> event_array; GetEventsFromResponseString(response_line, events_variable, &event_array); @@ -568,7 +569,8 @@ bool ParsePingResponse(Product product, const char* response) { ClearProductEvent(product, event_array[i].access_point, event_array[i].event_type); } - } else if (StartsWithASCII(response_line, stateful_events_variable, true)) { + } else if (base::StartsWithASCII(response_line, stateful_events_variable, + true)) { // Record any stateful events the server send over. std::vector<ReturnedEvent> event_array; GetEventsFromResponseString(response_line, stateful_events_variable, diff --git a/rlz/win/lib/machine_deal.cc b/rlz/win/lib/machine_deal.cc index 9c83a4c..aeab4f4 100644 --- a/rlz/win/lib/machine_deal.cc +++ b/rlz/win/lib/machine_deal.cc @@ -103,7 +103,7 @@ bool GetResponseValue(const std::string& response_line, value->clear(); - if (!StartsWithASCII(response_line, response_key, true)) + if (!base::StartsWithASCII(response_line, response_key, true)) return false; std::vector<std::string> tokens; diff --git a/sandbox/linux/services/yama_unittests.cc b/sandbox/linux/services/yama_unittests.cc index a4100a6..204cfd6 100644 --- a/sandbox/linux/services/yama_unittests.cc +++ b/sandbox/linux/services/yama_unittests.cc @@ -30,7 +30,7 @@ bool HasLinux32Bug() { bool is_kernel_64bit = base::SysInfo::OperatingSystemArchitecture() == "x86_64"; bool is_linux = base::SysInfo::OperatingSystemName() == "Linux"; - bool is_3_dot_2 = StartsWithASCII( + bool is_3_dot_2 = base::StartsWithASCII( base::SysInfo::OperatingSystemVersion(), "3.2", /*case_sensitive=*/false); if (is_kernel_64bit && is_linux && is_3_dot_2) return true; diff --git a/storage/browser/blob/blob_url_request_job_factory.cc b/storage/browser/blob/blob_url_request_job_factory.cc index e09efe5..7efe280 100644 --- a/storage/browser/blob/blob_url_request_job_factory.cc +++ b/storage/browser/blob/blob_url_request_job_factory.cc @@ -78,7 +78,7 @@ scoped_ptr<BlobDataSnapshot> BlobProtocolHandler::LookupBlobData( // TODO(michaeln): Replace this use case and others like it with a BlobReader // impl that does not depend on urlfetching to perform this function. const std::string kPrefix("blob:uuid/"); - if (!StartsWithASCII(request->url().spec(), kPrefix, true)) + if (!base::StartsWithASCII(request->url().spec(), kPrefix, true)) return NULL; std::string uuid = request->url().spec().substr(kPrefix.length()); scoped_ptr<BlobDataHandle> handle = context_->GetBlobDataFromUUID(uuid); diff --git a/storage/browser/fileapi/obfuscated_file_util.cc b/storage/browser/fileapi/obfuscated_file_util.cc index 67421c1..34c0718 100644 --- a/storage/browser/fileapi/obfuscated_file_util.cc +++ b/storage/browser/fileapi/obfuscated_file_util.cc @@ -901,7 +901,7 @@ void ObfuscatedFileUtil::CloseFileSystemForOriginAndType( const std::string key_prefix = GetDirectoryDatabaseKey(origin, type_string); for (DirectoryMap::iterator iter = directories_.lower_bound(key_prefix); iter != directories_.end();) { - if (!StartsWithASCII(iter->first, key_prefix, true)) + if (!base::StartsWithASCII(iter->first, key_prefix, true)) break; DCHECK(type_string.empty() || iter->first == key_prefix); scoped_ptr<SandboxDirectoryDatabase> database(iter->second); @@ -925,7 +925,7 @@ void ObfuscatedFileUtil::DestroyDirectoryDatabase( const std::string key_prefix = GetDirectoryDatabaseKey(origin, type_string); for (DirectoryMap::iterator iter = directories_.lower_bound(key_prefix); iter != directories_.end();) { - if (!StartsWithASCII(iter->first, key_prefix, true)) + if (!base::StartsWithASCII(iter->first, key_prefix, true)) break; DCHECK(type_string.empty() || iter->first == key_prefix); scoped_ptr<SandboxDirectoryDatabase> database(iter->second); diff --git a/storage/browser/fileapi/sandbox_directory_database.cc b/storage/browser/fileapi/sandbox_directory_database.cc index 4543863..ed900ec 100644 --- a/storage/browser/fileapi/sandbox_directory_database.cc +++ b/storage/browser/fileapi/sandbox_directory_database.cc @@ -200,7 +200,7 @@ bool DatabaseCheckHelper::ScanDatabase() { scoped_ptr<leveldb::Iterator> itr(db_->NewIterator(leveldb::ReadOptions())); for (itr->SeekToFirst(); itr->Valid(); itr->Next()) { std::string key = itr->key().ToString(); - if (StartsWithASCII(key, kChildLookupPrefix, true)) { + if (base::StartsWithASCII(key, kChildLookupPrefix, true)) { // key: "CHILD_OF:<parent_id>:<name>" // value: "<child_id>" ++num_hierarchy_links_in_db_; @@ -475,8 +475,8 @@ bool SandboxDirectoryDatabase::ListChildren( scoped_ptr<leveldb::Iterator> iter(db_->NewIterator(leveldb::ReadOptions())); iter->Seek(child_key_prefix); children->clear(); - while (iter->Valid() && - StartsWithASCII(iter->key().ToString(), child_key_prefix, true)) { + while (iter->Valid() && base::StartsWithASCII(iter->key().ToString(), + child_key_prefix, true)) { std::string child_id_string = iter->value().ToString(); FileId child_id; if (!base::StringToInt64(child_id_string, &child_id)) { diff --git a/storage/browser/fileapi/sandbox_origin_database.cc b/storage/browser/fileapi/sandbox_origin_database.cc index 1f149e3..1a91b10 100644 --- a/storage/browser/fileapi/sandbox_origin_database.cc +++ b/storage/browser/fileapi/sandbox_origin_database.cc @@ -291,8 +291,8 @@ bool SandboxOriginDatabase::ListAllOrigins( std::string origin_key_prefix = OriginToOriginKey(std::string()); iter->Seek(origin_key_prefix); origins->clear(); - while (iter->Valid() && - StartsWithASCII(iter->key().ToString(), origin_key_prefix, true)) { + while (iter->Valid() && base::StartsWithASCII(iter->key().ToString(), + origin_key_prefix, true)) { std::string origin = iter->key().ToString().substr(origin_key_prefix.length()); base::FilePath path = StringToFilePath(iter->value().ToString()); diff --git a/testing/generate_gmock_mutant.py b/testing/generate_gmock_mutant.py index 9c5678c..45ac4ed 100755 --- a/testing/generate_gmock_mutant.py +++ b/testing/generate_gmock_mutant.py @@ -66,7 +66,7 @@ HEADER = """\ // // Will invoke mock.HandleFlowers("orchids", n, request) // // "orchids" is a pre-bound argument, and <n> and <request> are call-time // // arguments - they are not known until the OnRequest mock is invoked. -// EXPECT_CALL(mock, OnRequest(Ge(5), StartsWith("flower")) +// EXPECT_CALL(mock, OnRequest(Ge(5), base::StartsWith("flower")) // .Times(1) // .WillOnce(Invoke(CreateFunctor(&mock, &Mock::HandleFlowers, // string("orchids")))); diff --git a/testing/gmock_mutant.h b/testing/gmock_mutant.h index acc1ae9..6049d1d 100644 --- a/testing/gmock_mutant.h +++ b/testing/gmock_mutant.h @@ -57,7 +57,7 @@ // // Will invoke mock.HandleFlowers("orchids", n, request) // // "orchids" is a pre-bound argument, and <n> and <request> are call-time // // arguments - they are not known until the OnRequest mock is invoked. -// EXPECT_CALL(mock, OnRequest(Ge(5), StartsWith("flower")) +// EXPECT_CALL(mock, OnRequest(Ge(5), base::StartsWith("flower")) // .Times(1) // .WillOnce(Invoke(CreateFunctor(&mock, &Mock::HandleFlowers, // string("orchids")))); diff --git a/third_party/protobuf/src/google/protobuf/wire_format_unittest.cc b/third_party/protobuf/src/google/protobuf/wire_format_unittest.cc index 9822828..9422f9a 100644 --- a/third_party/protobuf/src/google/protobuf/wire_format_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/wire_format_unittest.cc @@ -848,7 +848,7 @@ bool ReadMessage(const string &wire_buffer, T *message) { return message->ParseFromArray(wire_buffer.data(), wire_buffer.size()); } -bool StartsWith(const string& s, const string& prefix) { +bool base::StartsWith(const string& s, const string& prefix) { return s.substr(0, prefix.length()) == prefix; } @@ -863,10 +863,11 @@ TEST(Utf8ValidationTest, WriteInvalidUTF8String) { } #ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED ASSERT_EQ(1, errors.size()); - EXPECT_TRUE(StartsWith(errors[0], - "String field contains invalid UTF-8 data when " - "serializing a protocol buffer. Use the " - "'bytes' type if you intend to send raw bytes.")); + EXPECT_TRUE( + base::StartsWith(errors[0], + "String field contains invalid UTF-8 data when " + "serializing a protocol buffer. Use the " + "'bytes' type if you intend to send raw bytes.")); #else ASSERT_EQ(0, errors.size()); #endif // GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED @@ -885,10 +886,11 @@ TEST(Utf8ValidationTest, ReadInvalidUTF8String) { } #ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED ASSERT_EQ(1, errors.size()); - EXPECT_TRUE(StartsWith(errors[0], - "String field contains invalid UTF-8 data when " - "parsing a protocol buffer. Use the " - "'bytes' type if you intend to send raw bytes.")); + EXPECT_TRUE( + base::StartsWith(errors[0], + "String field contains invalid UTF-8 data when " + "parsing a protocol buffer. Use the " + "'bytes' type if you intend to send raw bytes.")); #else ASSERT_EQ(0, errors.size()); diff --git a/third_party/zlib/google/zip_reader.cc b/third_party/zlib/google/zip_reader.cc index c9f728c..3acbb418 100644 --- a/third_party/zlib/google/zip_reader.cc +++ b/third_party/zlib/google/zip_reader.cc @@ -145,7 +145,8 @@ ZipReader::EntryInfo::EntryInfo(const std::string& file_name_in_zip, // We also consider that the file name is unsafe, if it's absolute. // On Windows, IsAbsolute() returns false for paths starting with "/". - if (file_path_.IsAbsolute() || StartsWithASCII(file_name_in_zip, "/", false)) + if (file_path_.IsAbsolute() || + base::StartsWithASCII(file_name_in_zip, "/", false)) is_unsafe_ = true; // Construct the last modified time. The timezone info is not present in diff --git a/tools/clang/blink_gc_plugin/Config.h b/tools/clang/blink_gc_plugin/Config.h index 197e294f..294e086 100644 --- a/tools/clang/blink_gc_plugin/Config.h +++ b/tools/clang/blink_gc_plugin/Config.h @@ -253,7 +253,8 @@ class Config { return name == kTraceImplName || name == kTraceAfterDispatchImplName; } - static bool StartsWith(const std::string& str, const std::string& prefix) { + static bool base::StartsWith(const std::string& str, + const std::string& prefix) { if (prefix.size() > str.size()) return false; return str.compare(0, prefix.size(), prefix) == 0; diff --git a/tools/gn/filesystem_utils.cc b/tools/gn/filesystem_utils.cc index 325cfc6..67bb6e2 100644 --- a/tools/gn/filesystem_utils.cc +++ b/tools/gn/filesystem_utils.cc @@ -748,7 +748,7 @@ OutputFile GetOutputDirForSourceDirAsOutputFile(const Settings* settings, const std::string& build_dir = settings->build_settings()->build_dir().value(); - if (StartsWithASCII(source_dir.value(), build_dir, true)) { + if (base::StartsWithASCII(source_dir.value(), build_dir, true)) { size_t build_dir_size = build_dir.size(); result.value().append(&source_dir.value()[build_dir_size], source_dir.value().size() - build_dir_size); diff --git a/tools/gn/header_checker.cc b/tools/gn/header_checker.cc index 665be949..d055243 100644 --- a/tools/gn/header_checker.cc +++ b/tools/gn/header_checker.cc @@ -37,7 +37,7 @@ struct PublicGeneratedPair { SourceFile RemoveRootGenDirFromFile(const Target* target, const SourceFile& file) { const SourceDir& gen = target->settings()->toolchain_gen_dir(); - if (!gen.is_null() && StartsWithASCII(file.value(), gen.value(), true)) + if (!gen.is_null() && base::StartsWithASCII(file.value(), gen.value(), true)) return SourceFile("//" + file.value().substr(gen.value().size())); return file; } diff --git a/tools/gn/input_conversion.cc b/tools/gn/input_conversion.cc index 3d9d355..e4c20a0 100644 --- a/tools/gn/input_conversion.cc +++ b/tools/gn/input_conversion.cc @@ -116,7 +116,7 @@ Value DoConvertInputToValue(const Settings* settings, return Value(); // Empty string means discard the result. const char kTrimPrefix[] = "trim "; - if (StartsWithASCII(input_conversion, kTrimPrefix, true)) { + if (base::StartsWithASCII(input_conversion, kTrimPrefix, true)) { std::string trimmed; base::TrimWhitespaceASCII(input, base::TRIM_ALL, &trimmed); diff --git a/tools/gn/target.cc b/tools/gn/target.cc index 2ea2859..0b189e6 100644 --- a/tools/gn/target.cc +++ b/tools/gn/target.cc @@ -217,7 +217,7 @@ std::string Target::GetComputedOutputName(bool include_prefix) const { const Tool* tool = toolchain_->GetToolForTargetFinalOutput(this); const std::string& prefix = tool->output_prefix(); // Only add the prefix if the name doesn't already have it. - if (!StartsWithASCII(name, prefix, true)) + if (!base::StartsWithASCII(name, prefix, true)) result = prefix; } diff --git a/ui/base/ime/chromeos/component_extension_ime_manager.cc b/ui/base/ime/chromeos/component_extension_ime_manager.cc index 5ed6933..0f3d95b 100644 --- a/ui/base/ime/chromeos/component_extension_ime_manager.cc +++ b/ui/base/ime/chromeos/component_extension_ime_manager.cc @@ -65,12 +65,12 @@ const char* kLoginLayoutWhitelist[] = { int GetInputMethodCategory(const std::string& id) { const std::string engine_id = chromeos::extension_ime_util::GetComponentIDByInputMethodID(id); - if (StartsWithASCII(engine_id, "xkb:", true)) + if (base::StartsWithASCII(engine_id, "xkb:", true)) return 0; - if (StartsWithASCII(engine_id, "vkd_", true)) + if (base::StartsWithASCII(engine_id, "vkd_", true)) return 1; if (engine_id.find("-t-i0-") != std::string::npos && - !StartsWithASCII(engine_id, "zh-", true)) { + !base::StartsWithASCII(engine_id, "zh-", true)) { return 2; } return 3; diff --git a/ui/base/ime/chromeos/extension_ime_util.cc b/ui/base/ime/chromeos/extension_ime_util.cc index 84a111c..f6960d4 100644 --- a/ui/base/ime/chromeos/extension_ime_util.cc +++ b/ui/base/ime/chromeos/extension_ime_util.cc @@ -61,28 +61,28 @@ std::string GetComponentIDByInputMethodID(const std::string& input_method_id) { } std::string GetInputMethodIDByEngineID(const std::string& engine_id) { - if (StartsWithASCII(engine_id, kComponentExtensionIMEPrefix, true) || - StartsWithASCII(engine_id, kExtensionIMEPrefix, true)) { + if (base::StartsWithASCII(engine_id, kComponentExtensionIMEPrefix, true) || + base::StartsWithASCII(engine_id, kExtensionIMEPrefix, true)) { return engine_id; } - if (StartsWithASCII(engine_id, "xkb:", true)) + if (base::StartsWithASCII(engine_id, "xkb:", true)) return GetComponentInputMethodID(kXkbExtensionId, engine_id); - if (StartsWithASCII(engine_id, "vkd_", true)) + if (base::StartsWithASCII(engine_id, "vkd_", true)) return GetComponentInputMethodID(kM17nExtensionId, engine_id); - if (StartsWithASCII(engine_id, "nacl_mozc_", true)) + if (base::StartsWithASCII(engine_id, "nacl_mozc_", true)) return GetComponentInputMethodID(kMozcExtensionId, engine_id); - if (StartsWithASCII(engine_id, "hangul_", true)) + if (base::StartsWithASCII(engine_id, "hangul_", true)) return GetComponentInputMethodID(kHangulExtensionId, engine_id); - if (StartsWithASCII(engine_id, "zh-", true) && + if (base::StartsWithASCII(engine_id, "zh-", true) && engine_id.find("pinyin") != std::string::npos) { return GetComponentInputMethodID(kChinesePinyinExtensionId, engine_id); } - if (StartsWithASCII(engine_id, "zh-", true) && + if (base::StartsWithASCII(engine_id, "zh-", true) && engine_id.find("zhuyin") != std::string::npos) { return GetComponentInputMethodID(kChineseZhuyinExtensionId, engine_id); } - if (StartsWithASCII(engine_id, "zh-", true) && + if (base::StartsWithASCII(engine_id, "zh-", true) && engine_id.find("cangjie") != std::string::npos) { return GetComponentInputMethodID(kChineseCangjieExtensionId, engine_id); } @@ -93,32 +93,30 @@ std::string GetInputMethodIDByEngineID(const std::string& engine_id) { } bool IsExtensionIME(const std::string& input_method_id) { - return StartsWithASCII(input_method_id, - kExtensionIMEPrefix, - true /* Case sensitive */) && - input_method_id.size() > kExtensionIMEPrefixLength + - kExtensionIdLength; + return base::StartsWithASCII(input_method_id, kExtensionIMEPrefix, + true /* Case sensitive */) && + input_method_id.size() > + kExtensionIMEPrefixLength + kExtensionIdLength; } bool IsComponentExtensionIME(const std::string& input_method_id) { - return StartsWithASCII(input_method_id, - kComponentExtensionIMEPrefix, - true /* Case sensitive */) && - input_method_id.size() > kComponentExtensionIMEPrefixLength + - kExtensionIdLength; + return base::StartsWithASCII(input_method_id, kComponentExtensionIMEPrefix, + true /* Case sensitive */) && + input_method_id.size() > + kComponentExtensionIMEPrefixLength + kExtensionIdLength; } bool IsMemberOfExtension(const std::string& input_method_id, const std::string& extension_id) { - return StartsWithASCII(input_method_id, - kExtensionIMEPrefix + extension_id, - true /* Case sensitive */); + return base::StartsWithASCII(input_method_id, + kExtensionIMEPrefix + extension_id, + true /* Case sensitive */); } bool IsKeyboardLayoutExtension(const std::string& input_method_id) { if (IsComponentExtensionIME(input_method_id)) - return StartsWithASCII(GetComponentIDByInputMethodID(input_method_id), - "xkb:", true); + return base::StartsWithASCII(GetComponentIDByInputMethodID(input_method_id), + "xkb:", true); return false; } diff --git a/ui/base/l10n/l10n_util.cc b/ui/base/l10n/l10n_util.cc index 6ed1d42..426c8b5 100644 --- a/ui/base/l10n/l10n_util.cc +++ b/ui/base/l10n/l10n_util.cc @@ -201,7 +201,7 @@ bool IsDuplicateName(const std::string& locale_name) { }; // Skip all the es_Foo other than es_419 for now. - if (StartsWithASCII(locale_name, "es_", false)) + if (base::StartsWithASCII(locale_name, "es_", false)) return !EndsWith(locale_name, "419", true); for (size_t i = 0; i < arraysize(kDuplicateNames); ++i) { @@ -539,7 +539,7 @@ base::string16 GetDisplayNameForLocale(const std::string& locale, // zh-Hant because the current Android Java API doesn't support scripts. // TODO(wangxianzhu): remove the special handling of zh-Hans and zh-Hant once // Android Java API supports scripts. - if (!StartsWithASCII(locale_code, "zh-Han", true)) { + if (!base::StartsWithASCII(locale_code, "zh-Han", true)) { display_name = GetDisplayNameForLocale(locale_code, display_locale); } else #endif diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc index 7c09a4d..a8a3214 100644 --- a/ui/base/x/x11_util.cc +++ b/ui/base/x/x11_util.cc @@ -1251,7 +1251,7 @@ WindowManagerName GuessWindowManager() { return WM_FLUXBOX; if (name == "i3") return WM_I3; - if (StartsWithASCII(name, "IceWM", true)) + if (base::StartsWithASCII(name, "IceWM", true)) return WM_ICE_WM; if (name == "ion3") return WM_ION3; diff --git a/ui/events/devices/device_util_linux.cc b/ui/events/devices/device_util_linux.cc index 858ee84..e53a1e4 100644 --- a/ui/events/devices/device_util_linux.cc +++ b/ui/events/devices/device_util_linux.cc @@ -17,7 +17,7 @@ namespace ui { InputDeviceType GetInputDeviceTypeFromPath(const base::FilePath& path) { DCHECK(!base::MessageLoopForUI::IsCurrent()); std::string event_node = path.BaseName().value(); - if (event_node.empty() || !StartsWithASCII(event_node, "event", false)) + if (event_node.empty() || !base::StartsWithASCII(event_node, "event", false)) return InputDeviceType::INPUT_DEVICE_UNKNOWN; // Find sysfs device path for this device. diff --git a/ui/events/ozone/device/udev/device_manager_udev.cc b/ui/events/ozone/device/udev/device_manager_udev.cc index 4e28e39..ca7daa2 100644 --- a/ui/events/ozone/device/udev/device_manager_udev.cc +++ b/ui/events/ozone/device/udev/device_manager_udev.cc @@ -162,10 +162,10 @@ scoped_ptr<DeviceEvent> DeviceManagerUdev::ProcessMessage(udev_device* device) { DeviceEvent::DeviceType device_type; if (!strcmp(subsystem, "input") && - StartsWithASCII(path, "/dev/input/event", true)) + base::StartsWithASCII(path, "/dev/input/event", true)) device_type = DeviceEvent::INPUT; else if (!strcmp(subsystem, "drm") && - StartsWithASCII(path, "/dev/dri/card", true)) + base::StartsWithASCII(path, "/dev/dri/card", true)) device_type = DeviceEvent::DISPLAY; else return nullptr; diff --git a/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc b/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc index 9c3a00e..3adb358 100644 --- a/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc +++ b/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc @@ -505,7 +505,7 @@ bool IsMatchTypeSupported(const std::string& match_type) { // Check if a match criteria is a device type one. bool IsMatchDeviceType(const std::string& match_type) { - return StartsWithASCII(match_type, "MatchIs", true); + return base::StartsWithASCII(match_type, "MatchIs", true); } // Parse a boolean value keyword (e.g., on/off, true/false). diff --git a/ui/gl/gl_version_info.cc b/ui/gl/gl_version_info.cc index aff97b8..5eff43a 100644 --- a/ui/gl/gl_version_info.cc +++ b/ui/gl/gl_version_info.cc @@ -50,7 +50,7 @@ GLVersionInfo::GLVersionInfo(const char* version_str, const char* renderer_str) &is_es, &is_es3); } if (renderer_str) { - is_angle = StartsWithASCII(renderer_str, "ANGLE", true); + is_angle = base::StartsWithASCII(renderer_str, "ANGLE", true); } } diff --git a/ui/oobe/oobe_md_ui.cc b/ui/oobe/oobe_md_ui.cc index 07e91b5..cb86c93 100644 --- a/ui/oobe/oobe_md_ui.cc +++ b/ui/oobe/oobe_md_ui.cc @@ -21,7 +21,7 @@ void SetUpDataSource(content::WebUIDataSource* source) { const size_t prefix_length = arraysize(prefix) - 1; for (size_t i = 0; i < kOobeResourcesSize; ++i) { std::string name = kOobeResources[i].name; - DCHECK(StartsWithASCII(name, prefix, true)); + DCHECK(base::StartsWithASCII(name, prefix, true)); source->AddResourcePath(name.substr(prefix_length), kOobeResources[i].value); } |