diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-03 22:05:28 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-03 22:05:28 +0000 |
commit | 466c986d6754aa9fb92edc781cd3eade36c41ed1 (patch) | |
tree | 330365d2d56ee88037e53840fe47f106fd568c49 | |
parent | f8ddd9000a2e654d930805b01dcbb9d9bfb90e88 (diff) | |
download | chromium_src-466c986d6754aa9fb92edc781cd3eade36c41ed1.zip chromium_src-466c986d6754aa9fb92edc781cd3eade36c41ed1.tar.gz chromium_src-466c986d6754aa9fb92edc781cd3eade36c41ed1.tar.bz2 |
Move RemoveChars, ReplaceChars, TrimString, and TruncateUTF8ToByteSize to base namespace.
BUG=
R=viettrungluu@chromium.org
Review URL: https://codereview.chromium.org/102843002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238465 0039d316-1c4b-4281-b951-d872f2087c98
82 files changed, 144 insertions, 143 deletions
diff --git a/apps/shell_window.cc b/apps/shell_window.cc index ada3c81..e0b01a5 100644 --- a/apps/shell_window.cc +++ b/apps/shell_window.cc @@ -384,11 +384,11 @@ gfx::Rect ShellWindow::GetClientBounds() const { return bounds; } -string16 ShellWindow::GetTitle() const { +base::string16 ShellWindow::GetTitle() const { // WebContents::GetTitle() will return the page's URL if there's no <title> // specified. However, we'd prefer to show the name of the extension in that // case, so we directly inspect the NavigationEntry's title. - string16 title; + base::string16 title; if (!web_contents() || !web_contents()->GetController().GetActiveEntry() || web_contents()->GetController().GetActiveEntry()->GetTitle().empty()) { @@ -396,8 +396,8 @@ string16 ShellWindow::GetTitle() const { } else { title = web_contents()->GetTitle(); } - const char16 kBadChars[] = { '\n', 0 }; - RemoveChars(title, kBadChars, &title); + const base::char16 kBadChars[] = { '\n', 0 }; + base::RemoveChars(title, kBadChars, &title); return title; } diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc index 8d1499d..e0d9587 100644 --- a/ash/system/user/tray_user.cc +++ b/ash/system/user/tray_user.cc @@ -481,12 +481,12 @@ PublicAccountUserDetails::PublicAccountUserDetails(SystemTrayItem* owner, // user. base::string16 display_name = Shell::GetInstance()->session_state_delegate()->GetUserDisplayName(0); - RemoveChars(display_name, kDisplayNameMark, &display_name); + base::RemoveChars(display_name, kDisplayNameMark, &display_name); display_name = kDisplayNameMark[0] + display_name + kDisplayNameMark[0]; // Retrieve the domain managing the device and wrap it with markers. base::string16 domain = UTF8ToUTF16( Shell::GetInstance()->system_tray_delegate()->GetEnterpriseDomain()); - RemoveChars(domain, kDisplayNameMark, &domain); + base::RemoveChars(domain, kDisplayNameMark, &domain); base::i18n::WrapStringWithLTRFormatting(&domain); // Retrieve the label text, inserting the display name and domain. text_ = l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_PUBLIC_LABEL, diff --git a/base/strings/string_util.cc b/base/strings/string_util.cc index 1d85de8..cee124b 100644 --- a/base/strings/string_util.cc +++ b/base/strings/string_util.cc @@ -116,8 +116,6 @@ const string16& EmptyString16() { return EmptyStrings::GetInstance()->s16; } -} // namespace base - template<typename STR> bool ReplaceCharsT(const STR& input, const typename STR::value_type replace_chars[], @@ -230,8 +228,8 @@ void TruncateUTF8ToByteSize(const std::string& input, int32 prev = char_index; uint32 code_point = 0; CBU8_NEXT(data, char_index, truncation_length, code_point); - if (!base::IsValidCharacter(code_point) || - !base::IsValidCodepoint(code_point)) { + if (!IsValidCharacter(code_point) || + !IsValidCodepoint(code_point)) { char_index = prev - 1; } else { break; @@ -244,16 +242,18 @@ void TruncateUTF8ToByteSize(const std::string& input, output->clear(); } +} // namespace base + TrimPositions TrimWhitespace(const base::string16& input, TrimPositions positions, base::string16* output) { - return TrimStringT(input, base::kWhitespaceUTF16, positions, output); + return base::TrimStringT(input, base::kWhitespaceUTF16, positions, output); } TrimPositions TrimWhitespaceASCII(const std::string& input, TrimPositions positions, std::string* output) { - return TrimStringT(input, base::kWhitespaceASCII, positions, output); + return base::TrimStringT(input, base::kWhitespaceASCII, positions, output); } // This function is only for backward-compatibility. diff --git a/base/strings/string_util.h b/base/strings/string_util.h index 442db8e..7b4b219 100644 --- a/base/strings/string_util.h +++ b/base/strings/string_util.h @@ -148,22 +148,12 @@ BASE_EXPORT extern const char kWhitespaceASCII[]; // Null-terminated string representing the UTF-8 byte order mark. BASE_EXPORT extern const char kUtf8ByteOrderMark[]; -} // namespace base - -#if defined(OS_WIN) -#include "base/strings/string_util_win.h" -#elif defined(OS_POSIX) -#include "base/strings/string_util_posix.h" -#else -#error Define string operations appropriately for your platform -#endif - // Removes characters in |remove_chars| from anywhere in |input|. Returns true // if any characters were removed. |remove_chars| must be null-terminated. // NOTE: Safe to use the same variable for both |input| and |output|. -BASE_EXPORT bool RemoveChars(const base::string16& input, - const base::char16 remove_chars[], - base::string16* output); +BASE_EXPORT bool RemoveChars(const string16& input, + const char16 remove_chars[], + string16* output); BASE_EXPORT bool RemoveChars(const std::string& input, const char remove_chars[], std::string* output); @@ -173,10 +163,10 @@ BASE_EXPORT bool RemoveChars(const std::string& input, // the |replace_with| string. Returns true if any characters were replaced. // |replace_chars| must be null-terminated. // NOTE: Safe to use the same variable for both |input| and |output|. -BASE_EXPORT bool ReplaceChars(const base::string16& input, - const base::char16 replace_chars[], - const base::string16& replace_with, - base::string16* output); +BASE_EXPORT bool ReplaceChars(const string16& input, + const char16 replace_chars[], + const string16& replace_with, + string16* output); BASE_EXPORT bool ReplaceChars(const std::string& input, const char replace_chars[], const std::string& replace_with, @@ -185,9 +175,9 @@ BASE_EXPORT bool ReplaceChars(const std::string& input, // Removes characters in |trim_chars| from the beginning and end of |input|. // |trim_chars| must be null-terminated. // NOTE: Safe to use the same variable for both |input| and |output|. -BASE_EXPORT bool TrimString(const base::string16& input, - const base::char16 trim_chars[], - base::string16* output); +BASE_EXPORT bool TrimString(const string16& input, + const char16 trim_chars[], + string16* output); BASE_EXPORT bool TrimString(const std::string& input, const char trim_chars[], std::string* output); @@ -198,6 +188,16 @@ BASE_EXPORT void TruncateUTF8ToByteSize(const std::string& input, const size_t byte_size, std::string* output); +} // namespace base + +#if defined(OS_WIN) +#include "base/strings/string_util_win.h" +#elif defined(OS_POSIX) +#include "base/strings/string_util_posix.h" +#else +#error Define string operations appropriately for your platform +#endif + // Trims any whitespace from either end of the input string. Returns where // whitespace was found. // The non-wide version has two functions: diff --git a/chrome/browser/autocomplete/autocomplete_match.cc b/chrome/browser/autocomplete/autocomplete_match.cc index 3346d35..6d5544d 100644 --- a/chrome/browser/autocomplete/autocomplete_match.cc +++ b/chrome/browser/autocomplete/autocomplete_match.cc @@ -325,7 +325,7 @@ string16 AutocompleteMatch::SanitizeString(const string16& text) { // omnibox_custom_bindings.js. string16 result; TrimWhitespace(text, TRIM_LEADING, &result); - RemoveChars(result, kInvalidChars, &result); + base::RemoveChars(result, kInvalidChars, &result); return result; } diff --git a/chrome/browser/autocomplete/builtin_provider.cc b/chrome/browser/autocomplete/builtin_provider.cc index 33151b1..a2fffe3 100644 --- a/chrome/browser/autocomplete/builtin_provider.cc +++ b/chrome/browser/autocomplete/builtin_provider.cc @@ -93,7 +93,8 @@ void BuiltinProvider::Start(const AutocompleteInput& input, !url.has_query() && !url.has_ref()) { // Include the path for sub-pages (e.g. "chrome://settings/browser"). string16 host_and_path = UTF8ToUTF16(url.host() + url.path()); - TrimString(host_and_path, ASCIIToUTF16("/").c_str(), &host_and_path); + base::TrimString(host_and_path, ASCIIToUTF16("/").c_str(), + &host_and_path); size_t match_length = kChrome.length() + host_and_path.length(); for (Builtins::const_iterator i(builtins_.begin()); (i != builtins_.end()) && (matches_.size() < kMaxMatches); ++i) { diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc index b44ee90..433309e 100644 --- a/chrome/browser/bookmarks/bookmark_model.cc +++ b/chrome/browser/bookmarks/bookmark_model.cc @@ -74,7 +74,7 @@ void BookmarkNode::SetTitle(const string16& title) { // Replace newlines and other problematic whitespace characters in // folder/bookmark names with spaces. string16 trimmed_title; - ReplaceChars(title, kInvalidChars, ASCIIToUTF16(" "), &trimmed_title); + base::ReplaceChars(title, kInvalidChars, ASCIIToUTF16(" "), &trimmed_title); ui::TreeNode<BookmarkNode>::SetTitle(trimmed_title); } diff --git a/chrome/browser/chromeos/drive/file_system_util.cc b/chrome/browser/chromeos/drive/file_system_util.cc index 29ee8ac..48b70cc 100644 --- a/chrome/browser/chromeos/drive/file_system_util.cc +++ b/chrome/browser/chromeos/drive/file_system_util.cc @@ -304,7 +304,7 @@ std::string NormalizeFileName(const std::string& input) { std::string output; if (!base::ConvertToUtf8AndNormalize(input, base::kCodepageUTF8, &output)) output = input; - ReplaceChars(output, kSlash, std::string(kEscapedChars), &output); + base::ReplaceChars(output, kSlash, std::string(kEscapedChars), &output); if (!output.empty() && output.find_first_not_of(kDot, 0) == std::string::npos) output = kEscapedChars; return output; diff --git a/chrome/browser/chromeos/login/hwid_checker.cc b/chrome/browser/chromeos/login/hwid_checker.cc index e34bfc7..d004a6a 100644 --- a/chrome/browser/chromeos/login/hwid_checker.cc +++ b/chrome/browser/chromeos/login/hwid_checker.cc @@ -67,7 +67,7 @@ bool IsCorrectExceptionalHWID(const std::string& hwid) { if (bom.length() < 2) return false; std::string hwid_without_dashes; - RemoveChars(hwid, "-", &hwid_without_dashes); + base::RemoveChars(hwid, "-", &hwid_without_dashes); LOG_ASSERT(hwid_without_dashes.length() >= 2); std::string not_checksum = hwid_without_dashes.substr(0, hwid_without_dashes.length() - 2); @@ -95,7 +95,7 @@ bool IsCorrectHWIDv3(const std::string& hwid) { std::string not_checksum, checksum; if (!RE2::FullMatch(hwid, regex, ¬_checksum, &checksum)) return false; - RemoveChars(not_checksum, "-", ¬_checksum); + base::RemoveChars(not_checksum, "-", ¬_checksum); return CalculateHWIDv3Checksum(not_checksum) == checksum; } diff --git a/chrome/browser/chromeos/system/syslogs_provider.cc b/chrome/browser/chromeos/system/syslogs_provider.cc index 5cbba5d..3b38b80 100644 --- a/chrome/browser/chromeos/system/syslogs_provider.cc +++ b/chrome/browser/chromeos/system/syslogs_provider.cc @@ -79,7 +79,7 @@ std::string ReadValue(std::string* data) { // // If we use TrimWhitespace, we will incorrectly trim the new line // and assume that KEY1's value is "KEY2=VALUE" rather than empty. - TrimString(*data, " \t", data); + base::TrimString(*data, " \t", data); // If multiline value if (StartsWithASCII(*data, std::string(kMultilineQuote), false)) { diff --git a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc index c90a0d9..628650f 100644 --- a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc +++ b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc @@ -42,7 +42,7 @@ const char kPnaclManifestName[] = "PNaCl Translator"; // Keep in sync with chrome/browser/nacl_host/nacl_file_host. std::string SanitizeForPath(const std::string& input) { std::string result; - ReplaceChars(input, "-", "_", &result); + base::ReplaceChars(input, "-", "_", &result); return result; } diff --git a/chrome/browser/download/download_path_reservation_tracker.cc b/chrome/browser/download/download_path_reservation_tracker.cc index 18ef800..a924164 100644 --- a/chrome/browser/download/download_path_reservation_tracker.cc +++ b/chrome/browser/download/download_path_reservation_tracker.cc @@ -125,7 +125,7 @@ bool TruncateFileName(base::FilePath* path, size_t limit) { base::FilePath::StringType truncated; #if defined(OS_CHROMEOS) || defined(OS_MACOSX) // UTF-8. - TruncateUTF8ToByteSize(name, limit, &truncated); + base::TruncateUTF8ToByteSize(name, limit, &truncated); #elif defined(OS_WIN) // UTF-16. DCHECK(name.size() > limit); diff --git a/chrome/browser/drive/fake_drive_service.cc b/chrome/browser/drive/fake_drive_service.cc index 0fe40e1..83b0de2 100644 --- a/chrome/browser/drive/fake_drive_service.cc +++ b/chrome/browser/drive/fake_drive_service.cc @@ -83,7 +83,7 @@ bool EntryMatchWithQuery(const ResourceEntry& entry, std::string key, value; const std::string& token = tokenizer.token(); if (token.find(':') == std::string::npos) { - TrimString(token, "\"'", &value); + base::TrimString(token, "\"'", &value); } else { base::StringTokenizer key_value(token, ":"); key_value.set_quote_chars("\"'"); @@ -92,7 +92,7 @@ bool EntryMatchWithQuery(const ResourceEntry& entry, key = key_value.token(); if (!key_value.GetNext()) return false; - TrimString(key_value.token(), "\"'", &value); + base::TrimString(key_value.token(), "\"'", &value); } // TODO(peria): Deal with other attributes than title. diff --git a/chrome/browser/extensions/api/networking_private/networking_private_crypto.cc b/chrome/browser/extensions/api/networking_private/networking_private_crypto.cc index 2698452..7d91ca3 100644 --- a/chrome/browser/extensions/api/networking_private/networking_private_crypto.cc +++ b/chrome/browser/extensions/api/networking_private/networking_private_crypto.cc @@ -128,7 +128,7 @@ bool NetworkingPrivateCrypto::VerifyCredentials( std::string subject_name(common_name); PORT_Free(common_name); std::string translated_mac; - RemoveChars(connected_mac, ":", &translated_mac); + base::RemoveChars(connected_mac, ":", &translated_mac); if (!EndsWith(subject_name, translated_mac, false)) { LOG(ERROR) << "MAC addresses don't match."; return false; diff --git a/chrome/browser/extensions/extension_context_menu_model.cc b/chrome/browser/extensions/extension_context_menu_model.cc index d28bdea..0a578b9 100644 --- a/chrome/browser/extensions/extension_context_menu_model.cc +++ b/chrome/browser/extensions/extension_context_menu_model.cc @@ -169,7 +169,7 @@ void ExtensionContextMenuModel::InitMenu(const Extension* extension) { std::string extension_name = extension->name(); // Ampersands need to be escaped to avoid being treated like // mnemonics in the menu. - ReplaceChars(extension_name, "&", "&&", &extension_name); + base::ReplaceChars(extension_name, "&", "&&", &extension_name); AddItem(NAME, UTF8ToUTF16(extension_name)); AddSeparator(ui::NORMAL_SEPARATOR); AddItemWithStringId(CONFIGURE, IDS_EXTENSIONS_OPTIONS_MENU_ITEM); diff --git a/chrome/browser/extensions/suspicious_extension_bubble_controller.cc b/chrome/browser/extensions/suspicious_extension_bubble_controller.cc index ea36445..421ef84 100644 --- a/chrome/browser/extensions/suspicious_extension_bubble_controller.cc +++ b/chrome/browser/extensions/suspicious_extension_bubble_controller.cc @@ -132,8 +132,8 @@ string16 SuspiciousExtensionBubbleController::GetOverflowText( // this string, whereas we should have used $1. It was discovered too late, // so we do the substitution by hand in that case. if (overflow_string.find(ASCIIToUTF16("#")) != string16::npos) { - ReplaceChars(overflow_string, ASCIIToUTF16("#").c_str(), - overflow_count, &new_string); + base::ReplaceChars(overflow_string, ASCIIToUTF16("#").c_str(), + overflow_count, &new_string); } else { new_string = l10n_util::GetStringFUTF16( IDS_EXTENSIONS_SUSPICIOUS_DISABLED_AND_N_MORE, diff --git a/chrome/browser/extensions/suspicious_extension_bubble_controller_unittest.cc b/chrome/browser/extensions/suspicious_extension_bubble_controller_unittest.cc index 11b83d3..6920797 100644 --- a/chrome/browser/extensions/suspicious_extension_bubble_controller_unittest.cc +++ b/chrome/browser/extensions/suspicious_extension_bubble_controller_unittest.cc @@ -137,21 +137,21 @@ TEST_F(SuspiciousExtensionBubbleTest, MAYBE_ControllerTest) { "\"manifest_version\": 2}"; std::string extension_data; - ReplaceChars(basic_extension, "#", "1", &extension_data); + base::ReplaceChars(basic_extension, "#", "1", &extension_data); scoped_refptr<Extension> my_test_extension1( CreateExtension( Manifest::COMMAND_LINE, extension_data, "Autogenerated 1")); - ReplaceChars(basic_extension, "#", "2", &extension_data); + base::ReplaceChars(basic_extension, "#", "2", &extension_data); scoped_refptr<Extension> my_test_extension2( CreateExtension( Manifest::COMMAND_LINE, extension_data, "Autogenerated 2")); - ReplaceChars(basic_extension, "#", "3", &extension_data); + base::ReplaceChars(basic_extension, "#", "3", &extension_data); scoped_refptr<Extension> regular_extension( CreateExtension( Manifest::COMMAND_LINE, diff --git a/chrome/browser/feedback/feedback_data.cc b/chrome/browser/feedback/feedback_data.cc index 365fbbe..e5dde6a 100644 --- a/chrome/browser/feedback/feedback_data.cc +++ b/chrome/browser/feedback/feedback_data.cc @@ -56,8 +56,8 @@ std::string LogsToString(const FeedbackData::SystemLogsMap& sys_info) { if (FeedbackData::BelowCompressionThreshold(value)) continue; - TrimString(key, "\n ", &key); - TrimString(value, "\n ", &value); + base::TrimString(key, "\n ", &key); + base::TrimString(value, "\n ", &value); if (value.find("\n") != std::string::npos) { syslogs_string.append( diff --git a/chrome/browser/guestview/adview/adview_guest.cc b/chrome/browser/guestview/adview/adview_guest.cc index 44acbd9..0cdeccd 100644 --- a/chrome/browser/guestview/adview/adview_guest.cc +++ b/chrome/browser/guestview/adview/adview_guest.cc @@ -65,7 +65,7 @@ void AdViewGuest::DidFailProvisionalLoad( content::RenderViewHost* render_view_host) { // Translate the |error_code| into an error string. std::string error_type; - RemoveChars(net::ErrorToString(error_code), "net::", &error_type); + base::RemoveChars(net::ErrorToString(error_code), "net::", &error_type); scoped_ptr<DictionaryValue> args(new DictionaryValue()); args->SetBoolean(guestview::kIsTopLevel, is_main_frame); diff --git a/chrome/browser/guestview/webview/webview_guest.cc b/chrome/browser/guestview/webview/webview_guest.cc index 6c51c7d..1bb061e 100644 --- a/chrome/browser/guestview/webview/webview_guest.cc +++ b/chrome/browser/guestview/webview/webview_guest.cc @@ -583,7 +583,7 @@ void WebViewGuest::DidFailProvisionalLoad( content::RenderViewHost* render_view_host) { // Translate the |error_code| into an error string. std::string error_type; - RemoveChars(net::ErrorToString(error_code), "net::", &error_type); + base::RemoveChars(net::ErrorToString(error_code), "net::", &error_type); LoadAbort(is_main_frame, validated_url, error_type); } diff --git a/chrome/browser/media_galleries/fileapi/itunes_data_provider.cc b/chrome/browser/media_galleries/fileapi/itunes_data_provider.cc index 56af6d4..c5ed53b 100644 --- a/chrome/browser/media_galleries/fileapi/itunes_data_provider.cc +++ b/chrome/browser/media_galleries/fileapi/itunes_data_provider.cc @@ -31,7 +31,7 @@ namespace { // Colon and slash are not allowed in filenames, replace them with underscore. std::string EscapeBadCharacters(const std::string& input) { std::string result; - ReplaceChars(input, ":/", "_", &result); + base::ReplaceChars(input, ":/", "_", &result); return result; } diff --git a/chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.cc b/chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.cc index 2d74f1d..424365a 100644 --- a/chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.cc +++ b/chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.cc @@ -178,7 +178,7 @@ MTPDeviceDelegateImplLinux::MTPDeviceDelegateImplLinux( weak_ptr_factory_(this) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); DCHECK(!device_path_.empty()); - RemoveChars(device_location, kRootPath, &storage_name_); + base::RemoveChars(device_location, kRootPath, &storage_name_); DCHECK(!storage_name_.empty()); } diff --git a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc index 09bf2b0..1119a17e 100644 --- a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc +++ b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc @@ -44,7 +44,7 @@ bool GetStorageInfoOnUIThread(const string16& storage_path, DCHECK(pnp_device_id); DCHECK(storage_object_id); string16 storage_device_id; - RemoveChars(storage_path, L"\\\\", &storage_device_id); + base::RemoveChars(storage_path, L"\\\\", &storage_device_id); DCHECK(!storage_device_id.empty()); // TODO(gbillock): Take the StorageMonitor as an argument. StorageMonitor* monitor = StorageMonitor::GetInstance(); diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc index 18183c4..f286d1f 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -971,7 +971,7 @@ void MetricsLog::WriteBluetoothProto( std::string vendor_prefix_str; uint64 vendor_prefix; - RemoveChars(address.substr(0, 9), ":", &vendor_prefix_str); + base::RemoveChars(address.substr(0, 9), ":", &vendor_prefix_str); DCHECK_EQ(6U, vendor_prefix_str.size()); base::HexStringToUInt64(vendor_prefix_str, &vendor_prefix); diff --git a/chrome/browser/nacl_host/nacl_browser_delegate_impl.cc b/chrome/browser/nacl_host/nacl_browser_delegate_impl.cc index d5171a15..a0e92bd 100644 --- a/chrome/browser/nacl_host/nacl_browser_delegate_impl.cc +++ b/chrome/browser/nacl_host/nacl_browser_delegate_impl.cc @@ -138,7 +138,7 @@ bool NaClBrowserDelegateImpl::MapUrlToLocalFilePath( if (!use_blocking_api) { if (file_url.SchemeIs(extensions::kExtensionScheme)) { std::string path = file_url.path(); - TrimString(path, "/", &path); // Remove first slash + base::TrimString(path, "/", &path); // Remove first slash *file_path = extension->path().AppendASCII(path); return true; } diff --git a/chrome/browser/password_manager/login_database.cc b/chrome/browser/password_manager/login_database.cc index 442a008..b35599e 100644 --- a/chrome/browser/password_manager/login_database.cc +++ b/chrome/browser/password_manager/login_database.cc @@ -500,12 +500,12 @@ bool LoginDatabase::GetLogins(const PasswordForm& form, s.Assign(db_.GetUniqueStatement(extended_sql_query.c_str())); // We need to escape . in the domain. Since the domain has already been // sanitized using GURL, we do not need to escape any other characters. - ReplaceChars(registered_domain, ".", "\\.", ®istered_domain); + base::ReplaceChars(registered_domain, ".", "\\.", ®istered_domain); std::string scheme = signon_realm.scheme(); // We need to escape . in the scheme. Since the scheme has already been // sanitized using GURL, we do not need to escape any other characters. // The scheme soap.beep is an example with '.'. - ReplaceChars(scheme, ".", "\\.", &scheme); + base::ReplaceChars(scheme, ".", "\\.", &scheme); const std::string port = signon_realm.port(); // For a signon realm such as http://foo.bar/, this regexp will match // domains on the form http://foo.bar/, http://www.foo.bar/, diff --git a/chrome/browser/policy/cloud/component_cloud_policy_browsertest.cc b/chrome/browser/policy/cloud/component_cloud_policy_browsertest.cc index e143e1d..5f19e12 100644 --- a/chrome/browser/policy/cloud/component_cloud_policy_browsertest.cc +++ b/chrome/browser/policy/cloud/component_cloud_policy_browsertest.cc @@ -88,8 +88,8 @@ const char kTestPolicy2JSON[] = "{\"Another\":\"turn_it_off\"}"; bool Base64Encode(const std::string& value, std::string* encoded) { if (value.empty() || !base::Base64Encode(value, encoded)) return false; - ReplaceChars(*encoded, "+", "-", encoded); - ReplaceChars(*encoded, "/", "_", encoded); + base::ReplaceChars(*encoded, "+", "-", encoded); + base::ReplaceChars(*encoded, "/", "_", encoded); return true; } diff --git a/chrome/browser/policy/cloud/resource_cache.cc b/chrome/browser/policy/cloud/resource_cache.cc index 79b5531..4a9932a 100644 --- a/chrome/browser/policy/cloud/resource_cache.cc +++ b/chrome/browser/policy/cloud/resource_cache.cc @@ -23,8 +23,8 @@ bool Base64Encode(const std::string& value, std::string* encoded) { DCHECK(!value.empty()); if (value.empty() || !base::Base64Encode(value, encoded)) return false; - ReplaceChars(*encoded, "+", "-", encoded); - ReplaceChars(*encoded, "/", "_", encoded); + base::ReplaceChars(*encoded, "+", "-", encoded); + base::ReplaceChars(*encoded, "/", "_", encoded); return true; } @@ -49,8 +49,8 @@ bool Base64Encode(const std::set<std::string>& input, // emtpy. bool Base64Decode(const std::string& encoded, std::string* value) { std::string buffer; - ReplaceChars(encoded, "-", "+", &buffer); - ReplaceChars(buffer, "_", "/", &buffer); + base::ReplaceChars(encoded, "-", "+", &buffer); + base::ReplaceChars(buffer, "_", "/", &buffer); return base::Base64Decode(buffer, value) && !value->empty(); } diff --git a/chrome/browser/profile_resetter/jtl_interpreter_unittest.cc b/chrome/browser/profile_resetter/jtl_interpreter_unittest.cc index af9ab5c..a5c0003 100644 --- a/chrome/browser/profile_resetter/jtl_interpreter_unittest.cc +++ b/chrome/browser/profile_resetter/jtl_interpreter_unittest.cc @@ -46,7 +46,7 @@ std::string EncodeUint32(uint32 value) { #define INIT_INTERPRETER(program_param, escaped_json_param) \ const char* escaped_json = escaped_json_param; \ std::string json; \ - ReplaceChars(escaped_json, "'", "\"", &json); \ + base::ReplaceChars(escaped_json, "'", "\"", &json); \ scoped_ptr<Value> json_value(ParseJson(json)); \ JtlInterpreter interpreter( \ seed, \ diff --git a/chrome/browser/profile_resetter/resettable_settings_snapshot.cc b/chrome/browser/profile_resetter/resettable_settings_snapshot.cc index 895d5ae..64df1d5 100644 --- a/chrome/browser/profile_resetter/resettable_settings_snapshot.cc +++ b/chrome/browser/profile_resetter/resettable_settings_snapshot.cc @@ -138,7 +138,7 @@ std::string SerializeSettingsReport(const ResettableSettingsSnapshot& snapshot, extensions.begin(); i != extensions.end(); ++i) { // Replace "\"" to simplify server-side analysis. std::string ext_name; - ReplaceChars(i->second, "\"", "\'", &ext_name); + base::ReplaceChars(i->second, "\"", "\'", &ext_name); list->AppendString(i->first + ";" + ext_name); } dict.Set(kEnabledExtensions, list); diff --git a/chrome/browser/safe_browsing/safe_browsing_util.cc b/chrome/browser/safe_browsing/safe_browsing_util.cc index faf6767..aff62a0 100644 --- a/chrome/browser/safe_browsing/safe_browsing_util.cc +++ b/chrome/browser/safe_browsing/safe_browsing_util.cc @@ -341,7 +341,7 @@ void CanonicalizeUrl(const GURL& url, : std::string(); const char kCharsToTrim[] = "."; std::string host_without_end_dots; - TrimString(host, kCharsToTrim, &host_without_end_dots); + base::TrimString(host, kCharsToTrim, &host_without_end_dots); // 4. In hostname, replace consecutive dots with a single dot. std::string host_without_consecutive_dots(RemoveConsecutiveChars( diff --git a/chrome/browser/search/iframe_source.cc b/chrome/browser/search/iframe_source.cc index 58a5c06..b44ed30 100644 --- a/chrome/browser/search/iframe_source.cc +++ b/chrome/browser/search/iframe_source.cc @@ -64,7 +64,7 @@ bool IframeSource::GetOrigin( return false; *origin = contents->GetURL().GetOrigin().spec(); // Origin should not include a trailing slash. That is part of the path. - TrimString(*origin, "/", origin); + base::TrimString(*origin, "/", origin); return true; } diff --git a/chrome/browser/search_engines/template_url_service.cc b/chrome/browser/search_engines/template_url_service.cc index 55a8419..553805d 100644 --- a/chrome/browser/search_engines/template_url_service.cc +++ b/chrome/browser/search_engines/template_url_service.cc @@ -217,7 +217,7 @@ void LogDuplicatesHistogram( for (TemplateURLService::TemplateURLVector::const_iterator it = template_urls.begin(); it != template_urls.end(); ++it) { std::string keyword = UTF16ToASCII((*it)->keyword()); - TrimString(keyword, "_", &keyword); + base::TrimString(keyword, "_", &keyword); duplicates[keyword]++; } diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc index 61a0092..ad1a65a 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc @@ -680,7 +680,7 @@ base::FilePath GetExtensionShortcutFilename(const base::FilePath& profile_path, file_util::ReplaceIllegalCharactersInPath(&filename, '_'); // Spaces in filenames break xdg-desktop-menu // (see https://bugs.freedesktop.org/show_bug.cgi?id=66605). - ReplaceChars(filename, " ", "_", &filename); + base::ReplaceChars(filename, " ", "_", &filename); return base::FilePath(filename.append(".desktop")); } @@ -696,7 +696,7 @@ std::vector<base::FilePath> GetExistingProfileShortcutFilenames( file_util::ReplaceIllegalCharactersInPath(&suffix, '_'); // Spaces in filenames break xdg-desktop-menu // (see https://bugs.freedesktop.org/show_bug.cgi?id=66605). - ReplaceChars(suffix, " ", "_", &suffix); + base::ReplaceChars(suffix, " ", "_", &suffix); std::string glob = prefix + "*" + suffix + ".desktop"; base::FileEnumerator files(directory, false, base::FileEnumerator::FILES, diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index b9e75e8..3ded399 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -372,7 +372,7 @@ void DevToolsInspectElementAt(RenderViewHost* rvh, int x, int y) { // Helper function to escape "&" as "&&". void EscapeAmpersands(string16* text) { const char16 ampersand[] = {'&', 0}; - ReplaceChars(*text, ampersand, ASCIIToUTF16("&&"), text); + base::ReplaceChars(*text, ampersand, ASCIIToUTF16("&&"), text); } } // namespace @@ -1015,8 +1015,8 @@ void RenderViewContextMenu::AppendSearchProvider() { if (params_.selection_text.empty()) return; - ReplaceChars(params_.selection_text, AutocompleteMatch::kInvalidChars, - ASCIIToUTF16(" "), ¶ms_.selection_text); + base::ReplaceChars(params_.selection_text, AutocompleteMatch::kInvalidChars, + ASCIIToUTF16(" "), ¶ms_.selection_text); AutocompleteMatch match; AutocompleteClassifierFactory::GetForProfile(profile_)->Classify( diff --git a/chrome/browser/ui/gtk/gtk_util.cc b/chrome/browser/ui/gtk/gtk_util.cc index 1dbe43e..22bd231 100644 --- a/chrome/browser/ui/gtk/gtk_util.cc +++ b/chrome/browser/ui/gtk/gtk_util.cc @@ -947,7 +947,7 @@ string16 GetStockPreferencesMenuLabel() { string16 preferences; if (gtk_stock_lookup(GTK_STOCK_PREFERENCES, &stock_item)) { const char16 kUnderscore[] = { '_', 0 }; - RemoveChars(UTF8ToUTF16(stock_item.label), kUnderscore, &preferences); + base::RemoveChars(UTF8ToUTF16(stock_item.label), kUnderscore, &preferences); } return preferences; } diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc index 9c52e64..85e4679 100644 --- a/chrome/browser/ui/sync/one_click_signin_helper.cc +++ b/chrome/browser/ui/sync/one_click_signin_helper.cc @@ -860,7 +860,7 @@ void OneClickSigninHelper::ShowInfoBarIfPossible(net::URLRequest* request, const std::string& key = pair.first; const std::string& value = pair.second; if (key == "email") { - TrimString(value, "\"", &email); + base::TrimString(value, "\"", &email); } else if (key == "sessionindex") { session_index = value; } diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc index d340be4..427a0a3 100644 --- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc +++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc @@ -131,7 +131,7 @@ bool Base64StringToHashes(const std::string& hashes_str, for (size_t i = 0; i != vector_hash_str.size(); ++i) { std::string hash_str; - RemoveChars(vector_hash_str[i], " \t\r\n", &hash_str); + base::RemoveChars(vector_hash_str[i], " \t\r\n", &hash_str); net::HashValue hash; // Skip past unrecognized hash algos // But return false on malformatted input diff --git a/chrome/browser/ui/webui/version_handler.cc b/chrome/browser/ui/webui/version_handler.cc index 638ff0b..b46de41 100644 --- a/chrome/browser/ui/webui/version_handler.cc +++ b/chrome/browser/ui/webui/version_handler.cc @@ -96,7 +96,7 @@ void VersionHandler::HandleRequestVersionInfo(const ListValue* args) { for (size_t i = 0; i < active_groups.size(); ++i) { std::string line = active_groups[i].trial_name + ":" + active_groups[i].group_name; - ReplaceChars(line, "-", kNonBreakingHyphenUTF8String, &line); + base::ReplaceChars(line, "-", kNonBreakingHyphenUTF8String, &line); variations.push_back(line); } #else diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index 893ee6f..49193af 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc @@ -231,7 +231,7 @@ void GetIconsInfo(const WebApplicationInfo& app_info, #if defined(OS_LINUX) std::string GetWMClassFromAppName(std::string app_name) { file_util::ReplaceIllegalCharactersInPath(&app_name, '_'); - TrimString(app_name, "_", &app_name); + base::TrimString(app_name, "_", &app_name); return app_name; } #endif diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm index f7372ce..2388f78 100644 --- a/chrome/browser/web_applications/web_app_mac.mm +++ b/chrome/browser/web_applications/web_app_mac.mm @@ -704,8 +704,8 @@ base::FilePath WebAppShortcutCreator::GetAppBundleById( std::string WebAppShortcutCreator::GetBundleIdentifier() const { // Replace spaces in the profile path with hyphen. std::string normalized_profile_path; - ReplaceChars(info_.profile_path.BaseName().value(), - " ", "-", &normalized_profile_path); + base::ReplaceChars(info_.profile_path.BaseName().value(), + " ", "-", &normalized_profile_path); // This matches APP_MODE_APP_BUNDLE_ID in chrome/chrome.gyp. std::string bundle_id = diff --git a/chrome/common/localized_error.cc b/chrome/common/localized_error.cc index 67cdca1..132ae38 100644 --- a/chrome/common/localized_error.cc +++ b/chrome/common/localized_error.cc @@ -574,7 +574,7 @@ void LocalizedError::GetStrings(int error_code, // Non-internationalized error string, for debugging Chrome itself. std::string ascii_error_string = net::ErrorToString(error_code); // Remove the leading "net::" from the returned string. - RemoveChars(ascii_error_string, "net:", &ascii_error_string); + base::RemoveChars(ascii_error_string, "net:", &ascii_error_string); error_string = ASCIIToUTF16(ascii_error_string); } else if (error_domain == chrome_common_net::kDnsProbeErrorDomain) { std::string ascii_error_string = diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc index 5049fdc..5c4f305 100644 --- a/chrome/installer/setup/install.cc +++ b/chrome/installer/setup/install.cc @@ -289,9 +289,9 @@ installer::InstallShortcutOperation GetAppLauncherShortcutOperation( namespace installer { void EscapeXmlAttributeValueInSingleQuotes(string16* att_value) { - ReplaceChars(*att_value, L"&", L"&", att_value); - ReplaceChars(*att_value, L"'", L"'", att_value); - ReplaceChars(*att_value, L"<", L"<", att_value); + base::ReplaceChars(*att_value, L"&", L"&", att_value); + base::ReplaceChars(*att_value, L"'", L"'", att_value); + base::ReplaceChars(*att_value, L"<", L"<", att_value); } bool CreateVisualElementsManifest(const base::FilePath& src_path, diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 2b4aafd..2802b49 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -1690,7 +1690,7 @@ string16 ShellUtil::BuildAppModelId( } } // No spaces are allowed in the AppUserModelId according to MSDN. - ReplaceChars(app_id, L" ", L"_", &app_id); + base::ReplaceChars(app_id, L" ", L"_", &app_id); return app_id; } diff --git a/chrome/renderer/safe_browsing/phishing_url_feature_extractor.cc b/chrome/renderer/safe_browsing/phishing_url_feature_extractor.cc index 11d8568..e353636 100644 --- a/chrome/renderer/safe_browsing/phishing_url_feature_extractor.cc +++ b/chrome/renderer/safe_browsing/phishing_url_feature_extractor.cc @@ -30,8 +30,9 @@ bool PhishingUrlFeatureExtractor::ExtractFeatures(const GURL& url, if (!features->AddBooleanFeature(features::kUrlHostIsIpAddress)) return false; } else { + // Remove any leading/trailing dots. std::string host; - TrimString(url.host(), ".", &host); // Remove any leading/trailing dots. + base::TrimString(url.host(), ".", &host); // TODO(bryner): Ensure that the url encoding is consistent with // the features in the model. diff --git a/chrome/test/chromedriver/chrome/log.cc b/chrome/test/chromedriver/chrome/log.cc index 62be86d..75ed25b 100644 --- a/chrome/test/chromedriver/chrome/log.cc +++ b/chrome/test/chromedriver/chrome/log.cc @@ -87,7 +87,7 @@ std::string PrettyPrintValue(const base::Value& value) { base::JSONWriter::WriteWithOptions( &value, base::JSONWriter::OPTIONS_PRETTY_PRINT, &json); #if defined(OS_WIN) - RemoveChars(json, "\r", &json); + base::RemoveChars(json, "\r", &json); #endif // Remove the trailing newline. if (json.length()) diff --git a/chrome/test/chromedriver/chrome_launcher.cc b/chrome/test/chromedriver/chrome_launcher.cc index 239ae95..bbd88a3 100644 --- a/chrome/test/chromedriver/chrome_launcher.cc +++ b/chrome/test/chromedriver/chrome_launcher.cc @@ -480,7 +480,7 @@ Status ProcessExtension(const std::string& extension, // 'encoded lines be no more than 76 characters long'. Just remove any // newlines. std::string extension_base64; - RemoveChars(extension, "\n", &extension_base64); + base::RemoveChars(extension, "\n", &extension_base64); std::string decoded_extension; if (!base::Base64Decode(extension_base64, &decoded_extension)) return Status(kUnknownError, "cannot base64 decode"); diff --git a/chrome/test/chromedriver/util.cc b/chrome/test/chromedriver/util.cc index 454949e..911de01 100644 --- a/chrome/test/chromedriver/util.cc +++ b/chrome/test/chromedriver/util.cc @@ -76,7 +76,7 @@ bool Base64Decode(const std::string& base64, // Some WebDriver client base64 encoders follow RFC 1521, which require that // 'encoded lines be no more than 76 characters long'. Just remove any // newlines. - RemoveChars(copy, "\n", ©); + base::RemoveChars(copy, "\n", ©); return base::Base64Decode(copy, bytes); } diff --git a/chrome/test/ppapi/ppapi_test.cc b/chrome/test/ppapi/ppapi_test.cc index a33e45c..66b9bba 100644 --- a/chrome/test/ppapi/ppapi_test.cc +++ b/chrome/test/ppapi/ppapi_test.cc @@ -49,14 +49,12 @@ PPAPITestMessageHandler::PPAPITestMessageHandler() { TestMessageHandler::MessageResponse PPAPITestMessageHandler::HandleMessage( const std::string& json) { - std::string trimmed; - TrimString(json, "\"", &trimmed); - if (trimmed == "...") { - return CONTINUE; - } else { - message_ = trimmed; - return DONE; - } + std::string trimmed; + base::TrimString(json, "\"", &trimmed); + if (trimmed == "...") + return CONTINUE; + message_ = trimmed; + return DONE; } void PPAPITestMessageHandler::Reset() { diff --git a/chrome/utility/importer/bookmark_html_reader.cc b/chrome/utility/importer/bookmark_html_reader.cc index d8fa9ac..11b7c22 100644 --- a/chrome/utility/importer/bookmark_html_reader.cc +++ b/chrome/utility/importer/bookmark_html_reader.cc @@ -110,7 +110,7 @@ void ImportBookmarksFile( (cancellation_callback.is_null() || !cancellation_callback.Run()); ++i) { std::string line; - TrimString(lines[i], " ", &line); + base::TrimString(lines[i], " ", &line); // Remove "<HR>" if |line| starts with it. "<HR>" is the bookmark entries // separator in Firefox that Chrome does not support. Note that there can be @@ -119,7 +119,7 @@ void ImportBookmarksFile( static const char kHrTag[] = "<HR>"; while (StartsWithASCII(line, kHrTag, false)) { line.erase(0, arraysize(kHrTag) - 1); - TrimString(line, " ", &line); + base::TrimString(line, " ", &line); } // Get the encoding of the bookmark file. diff --git a/chrome/utility/media_galleries/iphoto_library_parser.cc b/chrome/utility/media_galleries/iphoto_library_parser.cc index c42a53f..cd52a6b 100644 --- a/chrome/utility/media_galleries/iphoto_library_parser.cc +++ b/chrome/utility/media_galleries/iphoto_library_parser.cc @@ -278,7 +278,7 @@ bool IPhotoLibraryParser::Parse(const std::string& library_xml) { album = album_info.photo_ids; // Strip / from album name and dedupe any collisions. std::string name; - ReplaceChars(album_info.name, "//", " ", &name); + base::ReplaceChars(album_info.name, "//", " ", &name); if (!ContainsKey(library_.albums, name)) { library_.albums[name] = album; } else { diff --git a/chromeos/system/name_value_pairs_parser.cc b/chromeos/system/name_value_pairs_parser.cc index 31ba010..b5e11f4 100644 --- a/chromeos/system/name_value_pairs_parser.cc +++ b/chromeos/system/name_value_pairs_parser.cc @@ -91,8 +91,8 @@ bool NameValuePairsParser::ParseNameValuePairsWithComments( std::string key; std::string value; - TrimString(pair.substr(0, eq_pos), kTrimChars, &key); - TrimString(pair.substr(eq_pos + 1, value_size), kTrimChars, &value); + base::TrimString(pair.substr(0, eq_pos), kTrimChars, &key); + base::TrimString(pair.substr(eq_pos + 1, value_size), kTrimChars, &value); if (!key.empty()) { AddNameValuePair(key, value); diff --git a/cloud_print/gcp20/prototype/printer.cc b/cloud_print/gcp20/prototype/printer.cc index cafb446..dc9d042 100644 --- a/cloud_print/gcp20/prototype/printer.cc +++ b/cloud_print/gcp20/prototype/printer.cc @@ -413,7 +413,7 @@ bool Printer::CheckXPrivetTokenHeader(const std::string& token) const { const base::DictionaryValue& Printer::GetCapabilities() { if (!state_.cdd.get()) { std::string cdd_string; - ReplaceChars(kCdd, "'", "\"", &cdd_string); + base::ReplaceChars(kCdd, "'", "\"", &cdd_string); scoped_ptr<base::Value> json_val(base::JSONReader::Read(cdd_string)); base::DictionaryValue* json = NULL; CHECK(json_val->GetAsDictionary(&json)); diff --git a/components/autofill/core/browser/autofill_field.cc b/components/autofill/core/browser/autofill_field.cc index f80774f..4323e8f 100644 --- a/components/autofill/core/browser/autofill_field.cc +++ b/components/autofill/core/browser/autofill_field.cc @@ -169,16 +169,16 @@ bool FillCreditCardTypeSelectControl(const base::string16& value, FormFieldData* field) { // Try stripping off spaces. base::string16 value_stripped; - RemoveChars(StringToLowerASCII(value), base::kWhitespaceUTF16, - &value_stripped); + base::RemoveChars(StringToLowerASCII(value), base::kWhitespaceUTF16, + &value_stripped); for (size_t i = 0; i < field->option_values.size(); ++i) { base::string16 option_value_lowercase; - RemoveChars(StringToLowerASCII(field->option_values[i]), - base::kWhitespaceUTF16, &option_value_lowercase); + base::RemoveChars(StringToLowerASCII(field->option_values[i]), + base::kWhitespaceUTF16, &option_value_lowercase); base::string16 option_contents_lowercase; - RemoveChars(StringToLowerASCII(field->option_contents[i]), - base::kWhitespaceUTF16, &option_contents_lowercase); + base::RemoveChars(StringToLowerASCII(field->option_contents[i]), + base::kWhitespaceUTF16, &option_contents_lowercase); // Perform a case-insensitive comparison; but fill the form with the // original text, not the lowercased version. @@ -292,7 +292,7 @@ void FillStreetAddress(const base::string16& value, const char16 kNewline[] = { '\n', 0 }; const base::string16 separator = l10n_util::GetStringUTF16(IDS_AUTOFILL_ADDRESS_LINE_SEPARATOR); - ReplaceChars(value, kNewline, separator, &one_line_value); + base::ReplaceChars(value, kNewline, separator, &one_line_value); field->value = one_line_value; } diff --git a/components/autofill/core/browser/autofill_profile.cc b/components/autofill/core/browser/autofill_profile.cc index 2f7e43a..29f85772 100644 --- a/components/autofill/core/browser/autofill_profile.cc +++ b/components/autofill/core/browser/autofill_profile.cc @@ -671,7 +671,7 @@ base::string16 AutofillProfile::ConstructInferredLabel( const char16 kNewline[] = { '\n', 0 }; const base::string16 newline_separator = l10n_util::GetStringUTF16(IDS_AUTOFILL_ADDRESS_LINE_SEPARATOR); - ReplaceChars(label, kNewline, newline_separator, &label); + base::ReplaceChars(label, kNewline, newline_separator, &label); return label; } diff --git a/components/autofill/core/browser/credit_card.cc b/components/autofill/core/browser/credit_card.cc index 9617798..92e82c3 100644 --- a/components/autofill/core/browser/credit_card.cc +++ b/components/autofill/core/browser/credit_card.cc @@ -133,9 +133,9 @@ CreditCard::~CreditCard() {} // static const base::string16 CreditCard::StripSeparators(const base::string16& number) { - const char16 kSeparators[] = {'-', ' ', '\0'}; + const base::char16 kSeparators[] = {'-', ' ', '\0'}; base::string16 stripped; - RemoveChars(number, kSeparators, &stripped); + base::RemoveChars(number, kSeparators, &stripped); return stripped; } diff --git a/components/autofill/core/browser/phone_number.cc b/components/autofill/core/browser/phone_number.cc index 82889b7..28c8981 100644 --- a/components/autofill/core/browser/phone_number.cc +++ b/components/autofill/core/browser/phone_number.cc @@ -20,7 +20,7 @@ namespace { const char16 kPhoneNumberSeparators[] = { ' ', '.', '(', ')', '-', 0 }; void StripPunctuation(base::string16* number) { - RemoveChars(*number, kPhoneNumberSeparators, number); + base::RemoveChars(*number, kPhoneNumberSeparators, number); } // Returns the region code for this phone number, which is an ISO 3166 2-letter diff --git a/components/autofill/core/browser/validation.cc b/components/autofill/core/browser/validation.cc index a8aef35..57a096e 100644 --- a/components/autofill/core/browser/validation.cc +++ b/components/autofill/core/browser/validation.cc @@ -157,7 +157,7 @@ bool IsValidZip(const base::string16& text) { bool IsSSN(const string16& text) { string16 number_string; - RemoveChars(text, kSSNSeparators, &number_string); + base::RemoveChars(text, kSSNSeparators, &number_string); // A SSN is of the form AAA-GG-SSSS (A = area number, G = group number, S = // serial number). The validation we do here is simply checking if the area, diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc index 3dd07d8..b14caf6 100644 --- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc +++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc @@ -161,7 +161,7 @@ void DumpAccessibilityTreeTest::RunTest( // Tolerate Windows-style line endings (\r\n) in the expected file: // normalize by deleting all \r from the file (if any) to leave only \n. std::string expected_contents; - RemoveChars(expected_contents_raw, "\r", &expected_contents); + base::RemoveChars(expected_contents_raw, "\r", &expected_contents); if (!expected_contents.compare(0, strlen(kMarkSkipFile), kMarkSkipFile)) { printf("Skipping this test on this platform.\n"); diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index b869217..182fd2c 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc @@ -1377,7 +1377,8 @@ void BrowserPluginGuest::OnNavigateGuest( if (scheme_is_blocked || !url.is_valid()) { if (delegate_) { std::string error_type; - RemoveChars(net::ErrorToString(net::ERR_ABORTED), "net::", &error_type); + base::RemoveChars(net::ErrorToString(net::ERR_ABORTED), "net::", + &error_type); delegate_->LoadAbort(true /* is_top_level */, url, error_type); } return; diff --git a/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc b/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc index 148ec49..d466dde 100644 --- a/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc +++ b/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc @@ -186,7 +186,7 @@ void GamepadPlatformDataFetcherLinux::RefreshDevice(udev_device* dev) { mapper ? "STANDARD GAMEPAD " : "", vendor_id, product_id); - TruncateUTF8ToByteSize(id, WebGamepad::idLengthCap - 1, &id); + base::TruncateUTF8ToByteSize(id, WebGamepad::idLengthCap - 1, &id); base::string16 tmp16 = UTF8ToUTF16(id); memset(pad.id, 0, sizeof(pad.id)); tmp16.copy(pad.id, arraysize(pad.id) - 1); diff --git a/content/common/page_state_serialization_unittest.cc b/content/common/page_state_serialization_unittest.cc index 288644a..c0c98d3 100644 --- a/content/common/page_state_serialization_unittest.cc +++ b/content/common/page_state_serialization_unittest.cc @@ -208,7 +208,7 @@ class PageStateSerializationTest : public testing::Test { } std::string trimmed_contents; - EXPECT_TRUE(RemoveChars(file_contents, "\r\n", &trimmed_contents)); + EXPECT_TRUE(base::RemoveChars(file_contents, "\r\n", &trimmed_contents)); std::string encoded; EXPECT_TRUE(base::Base64Decode(trimmed_contents, &encoded)); diff --git a/content/public/common/webplugininfo.cc b/content/public/common/webplugininfo.cc index fe2a02e..9f0c42f 100644 --- a/content/public/common/webplugininfo.cc +++ b/content/public/common/webplugininfo.cc @@ -74,7 +74,7 @@ void WebPluginInfo::CreateVersionFromString( // Remove spaces and ')' from the version string, // Replace any instances of 'r', ',' or '(' with a dot. std::string version = UTF16ToASCII(version_string); - RemoveChars(version, ") ", &version); + base::RemoveChars(version, ") ", &version); std::replace(version.begin(), version.end(), 'd', '.'); std::replace(version.begin(), version.end(), 'r', '.'); std::replace(version.begin(), version.end(), ',', '.'); diff --git a/dbus/message.cc b/dbus/message.cc index b52528d..918b860 100644 --- a/dbus/message.cc +++ b/dbus/message.cc @@ -172,7 +172,7 @@ std::string Message::ToStringInternal(const std::string& indent, output += indent + "string \"" + value + "\"\n"; } else { std::string truncated; - TruncateUTF8ToByteSize(value, kTruncateLength, &truncated); + base::TruncateUTF8ToByteSize(value, kTruncateLength, &truncated); base::StringAppendF(&truncated, "... (%" PRIuS " bytes in total)", value.size()); output += indent + "string \"" + truncated + "\"\n"; diff --git a/device/bluetooth/bluetooth_profile_chromeos.cc b/device/bluetooth/bluetooth_profile_chromeos.cc index ba6bd5c..31e165e8d 100644 --- a/device/bluetooth/bluetooth_profile_chromeos.cc +++ b/device/bluetooth/bluetooth_profile_chromeos.cc @@ -90,7 +90,7 @@ void BluetoothProfileChromeOS::Init( // The object path is relatively meaningless, but has to be unique, so we // use the UUID of the profile. std::string uuid_path; - ReplaceChars(uuid, ":-", "_", &uuid_path); + base::ReplaceChars(uuid, ":-", "_", &uuid_path); object_path_ = dbus::ObjectPath("/org/chromium/bluetooth_profile/" + uuid_path); diff --git a/google_apis/cup/client_update_protocol.cc b/google_apis/cup/client_update_protocol.cc index e730557..0ff3d8f 100644 --- a/google_apis/cup/client_update_protocol.cc +++ b/google_apis/cup/client_update_protocol.cc @@ -138,7 +138,7 @@ std::string UrlSafeB64Encode(const std::vector<uint8>& data) { break; } } - TrimString(result, "=", &result); + base::TrimString(result, "=", &result); return result; } diff --git a/google_apis/gaia/gaia_auth_util.cc b/google_apis/gaia/gaia_auth_util.cc index a8cad86..ca2d66e 100644 --- a/google_apis/gaia/gaia_auth_util.cc +++ b/google_apis/gaia/gaia_auth_util.cc @@ -25,7 +25,7 @@ std::string CanonicalizeEmail(const std::string& email_address) { if (parts.size() != 2U) NOTREACHED() << "expecting exactly one @, but got " << parts.size(); else if (parts[1] == kGmailDomain) // only strip '.' for gmail accounts. - RemoveChars(parts[0], ".", &parts[0]); + base::RemoveChars(parts[0], ".", &parts[0]); std::string new_email = StringToLowerASCII(JoinString(parts, at)); VLOG(1) << "Canonicalized " << email_address << " to " << new_email; return new_email; diff --git a/gpu/config/gpu_info_collector_mac.mm b/gpu/config/gpu_info_collector_mac.mm index 1f7fad1..c216439 100644 --- a/gpu/config/gpu_info_collector_mac.mm +++ b/gpu/config/gpu_info_collector_mac.mm @@ -190,7 +190,7 @@ bool CollectBasicGraphicsInfo(GPUInfo* gpu_info) { int32 model_major = 0, model_minor = 0; base::mac::ParseModelIdentifier(base::mac::GetModelIdentifier(), &model_name, &model_major, &model_minor); - ReplaceChars(model_name, " ", "_", &gpu_info->machine_model); + base::ReplaceChars(model_name, " ", "_", &gpu_info->machine_model); gpu_info->machine_model += " " + base::IntToString(model_major) + "." + base::IntToString(model_minor); diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc index 8eba45a..b1ebfec 100644 --- a/net/base/mime_util.cc +++ b/net/base/mime_util.cc @@ -668,7 +668,7 @@ void MimeUtil::ParseCodecString(const std::string& codecs, std::vector<std::string>* codecs_out, bool strip) { std::string no_quote_codecs; - TrimString(codecs, "\"", &no_quote_codecs); + base::TrimString(codecs, "\"", &no_quote_codecs); base::SplitString(no_quote_codecs, ',', codecs_out); if (!strip) diff --git a/net/base/net_util.cc b/net/base/net_util.cc index e5200e7..4a4ff52 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -773,7 +773,7 @@ void SanitizeGeneratedFileName(base::FilePath::StringType* filename, if (trimmed) filename->insert(filename->end(), trimmed, kReplace[0]); } - TrimString(*filename, FILE_PATH_LITERAL("."), filename); + base::TrimString(*filename, FILE_PATH_LITERAL("."), filename); if (filename->empty()) return; // Replace any path information by changing path separators. diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc index 86e042b..23a0432 100644 --- a/net/ftp/ftp_network_transaction.cc +++ b/net/ftp/ftp_network_transaction.cc @@ -835,7 +835,7 @@ int FtpNetworkTransaction::ProcessResponseSYST( // Remove all whitespace, to correctly handle cases like fancy "V M S" // response instead of "VMS". - RemoveChars(line, base::kWhitespaceASCII, &line); + base::RemoveChars(line, base::kWhitespaceASCII, &line); // The "magic" strings we test for below have been gathered by an // empirical study. VMS needs to come first because some VMS systems diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 0029541..18abdea 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -112,7 +112,7 @@ bool GetHeaders(base::DictionaryValue* params, std::string* headers) { return false; std::string double_quote_headers; base::JSONWriter::Write(header_list, &double_quote_headers); - ReplaceChars(double_quote_headers, "\"", "'", headers); + base::ReplaceChars(double_quote_headers, "\"", "'", headers); return true; } diff --git a/net/proxy/proxy_resolver_v8.cc b/net/proxy/proxy_resolver_v8.cc index a4943bd..553857f 100644 --- a/net/proxy/proxy_resolver_v8.cc +++ b/net/proxy/proxy_resolver_v8.cc @@ -276,7 +276,7 @@ bool SortIpAddressList(const std::string& ip_address_list, // Strip all whitespace (mimics IE behavior). std::string cleaned_ip_address_list; - RemoveChars(ip_address_list, " \t", &cleaned_ip_address_list); + base::RemoveChars(ip_address_list, " \t", &cleaned_ip_address_list); if (cleaned_ip_address_list.empty()) return false; diff --git a/net/test/embedded_test_server/http_request.cc b/net/test/embedded_test_server/http_request.cc index 8ac76d3..f1bf302 100644 --- a/net/test/embedded_test_server/http_request.cc +++ b/net/test/embedded_test_server/http_request.cc @@ -21,7 +21,7 @@ size_t kRequestSizeLimit = 64 * 1024 * 1024; // 64 mb. // Helper function used to trim tokens in http request headers. std::string Trim(const std::string& value) { std::string result; - TrimString(value, " \t", &result); + base::TrimString(value, " \t", &result); return result; } diff --git a/net/tools/gdig/gdig.cc b/net/tools/gdig/gdig.cc index 54f0509..db0704c 100644 --- a/net/tools/gdig/gdig.cc +++ b/net/tools/gdig/gdig.cc @@ -126,7 +126,7 @@ bool LoadReplayLog(const base::FilePath& file_path, ReplayLog* replay_log) { // smarter line splitter, but this particular use does not need to target // efficiency. std::string replay_log_contents; - RemoveChars(original_replay_log_contents, "\r", &replay_log_contents); + base::RemoveChars(original_replay_log_contents, "\r", &replay_log_contents); std::vector<std::string> lines; base::SplitString(replay_log_contents, '\n', &lines); diff --git a/sync/engine/commit_util.cc b/sync/engine/commit_util.cc index 701e335..1081446 100644 --- a/sync/engine/commit_util.cc +++ b/sync/engine/commit_util.cc @@ -105,7 +105,7 @@ void BuildCommitItem( // Note: Truncation is also performed in WriteNode::SetTitle(..). But this // call is still necessary to handle any title changes that might originate // elsewhere, or already be persisted in the directory. - TruncateUTF8ToByteSize(name, 255, &name); + base::TruncateUTF8ToByteSize(name, 255, &name); sync_entry->set_name(name); // Set the non_unique_name. If we do, the server ignores diff --git a/sync/internal_api/write_node.cc b/sync/internal_api/write_node.cc index 079987a..55f56b7 100644 --- a/sync/internal_api/write_node.cc +++ b/sync/internal_api/write_node.cc @@ -58,7 +58,7 @@ void WriteNode::SetTitle(const std::wstring& title) { new_legal_title = kEncryptedString; } else { SyncAPINameToServerName(WideToUTF8(title), &new_legal_title); - TruncateUTF8ToByteSize(new_legal_title, 255, &new_legal_title); + base::TruncateUTF8ToByteSize(new_legal_title, 255, &new_legal_title); } std::string current_legal_title; diff --git a/testing/android/native_test_util.cc b/testing/android/native_test_util.cc index c814e6f..7d5f025 100644 --- a/testing/android/native_test_util.cc +++ b/testing/android/native_test_util.cc @@ -17,7 +17,7 @@ void ParseArgsFromString(const std::string& command_line, tokenizer.set_quote_chars("\""); while (tokenizer.GetNext()) { std::string token; - RemoveChars(tokenizer.token(), "\"", &token); + base::RemoveChars(tokenizer.token(), "\"", &token); args->push_back(token); } } diff --git a/tools/gn/ninja_script_target_writer.cc b/tools/gn/ninja_script_target_writer.cc index 97f2552..f2004e3 100644 --- a/tools/gn/ninja_script_target_writer.cc +++ b/tools/gn/ninja_script_target_writer.cc @@ -72,7 +72,7 @@ std::string NinjaScriptTargetWriter::WriteRuleDefinition( // there will be only one invocation so we can use a simple name. std::string target_label = target_->label().GetUserVisibleName(true); std::string custom_rule_name(target_label); - ReplaceChars(custom_rule_name, ":/()", "_", &custom_rule_name); + base::ReplaceChars(custom_rule_name, ":/()", "_", &custom_rule_name); custom_rule_name.append("_rule"); if (settings_->IsWin()) { diff --git a/ui/base/accelerators/menu_label_accelerator_util_linux.cc b/ui/base/accelerators/menu_label_accelerator_util_linux.cc index 21697ea..0a00f82 100644 --- a/ui/base/accelerators/menu_label_accelerator_util_linux.cc +++ b/ui/base/accelerators/menu_label_accelerator_util_linux.cc @@ -55,7 +55,7 @@ std::string RemoveWindowsStyleAccelerators(const std::string& label) { // underscores doubled, making the string that appears to the user just |x|. std::string EscapeWindowsStyleAccelerators(const std::string& label) { std::string ret; - ReplaceChars(label, "&", "&&", &ret); + base::ReplaceChars(label, "&", "&&", &ret); return ret; } diff --git a/webkit/child/multipart_response_delegate.cc b/webkit/child/multipart_response_delegate.cc index 550aab3..a1e5702 100644 --- a/webkit/child/multipart_response_delegate.cc +++ b/webkit/child/multipart_response_delegate.cc @@ -319,7 +319,7 @@ bool MultipartResponseDelegate::ReadMultipartBoundary( // The byte range response can have quoted boundary strings. This is legal // as per MIME specifications. Individual data fragements however don't // contain quoted boundary strings. - TrimString(*multipart_boundary, "\"", multipart_boundary); + base::TrimString(*multipart_boundary, "\"", multipart_boundary); return true; } diff --git a/webkit/child/weburlloader_impl.cc b/webkit/child/weburlloader_impl.cc index 2267ac8..9ecf69a 100644 --- a/webkit/child/weburlloader_impl.cc +++ b/webkit/child/weburlloader_impl.cc @@ -547,7 +547,7 @@ void WebURLLoaderImpl::Context::OnReceivedResponse( std::string boundary; net::HttpUtil::ParseContentType(content_type, &mime_type, &charset, &had_charset, &boundary); - TrimString(boundary, " \"", &boundary); + base::TrimString(boundary, " \"", &boundary); // If there's no boundary, just handle the request normally. In the gecko // code, nsMultiMixedConv::OnStartRequest throws an exception. |