diff options
164 files changed, 700 insertions, 495 deletions
diff --git a/app/gtk_util.cc b/app/gtk_util.cc index 00b1b5b..63fa96a 100644 --- a/app/gtk_util.cc +++ b/app/gtk_util.cc @@ -9,7 +9,7 @@ #include "app/l10n_util.h" #include "base/env_var.h" #include "base/logging.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/xdg_util.h" namespace gtk_util { @@ -22,11 +22,11 @@ void GetWidgetSizeFromResources( double chars = 0; if (width) - StringToDouble(l10n_util::GetStringUTF8(width_chars), &chars); + base::StringToDouble(l10n_util::GetStringUTF8(width_chars), &chars); double lines = 0; if (height) - StringToDouble(l10n_util::GetStringUTF8(height_lines), &lines); + base::StringToDouble(l10n_util::GetStringUTF8(height_lines), &lines); GetWidgetSizeFromCharacters(widget, chars, lines, width, height); } diff --git a/base/string_number_conversions.cc b/base/string_number_conversions.cc index d340151..62599dd 100644 --- a/base/string_number_conversions.cc +++ b/base/string_number_conversions.cc @@ -398,3 +398,4 @@ bool HexStringToBytes(const std::string& input, std::vector<uint8>* output) { } } // namespace base + diff --git a/base/string_number_conversions.h b/base/string_number_conversions.h index 928cb8a..4d89e86 100644 --- a/base/string_number_conversions.h +++ b/base/string_number_conversions.h @@ -90,3 +90,4 @@ bool HexStringToBytes(const std::string& input, std::vector<uint8>* output); } // namespace base #endif // BASE_STRING_NUMBER_CONVERSIONS_H_ + diff --git a/base/sys_info_chromeos.cc b/base/sys_info_chromeos.cc index af204df..1cd9fb6 100644 --- a/base/sys_info_chromeos.cc +++ b/base/sys_info_chromeos.cc @@ -7,8 +7,8 @@ #include "base/basictypes.h" #include "base/file_path.h" #include "base/file_util.h" +#include "base/string_number_conversions.h" #include "base/string_tokenizer.h" -#include "base/string_util.h" namespace base { @@ -54,12 +54,12 @@ void SysInfo::ParseLsbRelease(const std::string& lsb_release, StringTokenizer tokenizer(version, "."); for (int i = 0; i < 3 && tokenizer.GetNext(); i++) { if (0 == i) { - *major_version = StringToInt(tokenizer.token()); + StringToInt(tokenizer.token(), major_version); *minor_version = *bugfix_version = 0; } else if (1 == i) { - *minor_version = StringToInt(tokenizer.token()); + StringToInt(tokenizer.token(), minor_version); } else { // 2 == i - *bugfix_version = StringToInt(tokenizer.token()); + StringToInt(tokenizer.token(), bugfix_version); } } } diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc index d24e209..5ae9d82 100644 --- a/chrome/browser/autocomplete/autocomplete.cc +++ b/chrome/browser/autocomplete/autocomplete.cc @@ -9,6 +9,7 @@ #include "app/l10n_util.h" #include "base/basictypes.h" #include "base/i18n/number_formatting.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "chrome/browser/autocomplete/history_url_provider.h" #include "chrome/browser/autocomplete/history_contents_provider.h" @@ -236,7 +237,7 @@ AutocompleteInput::Type AutocompleteInput::Parse( // number. If it's just garbage after a colon, this is a query. if (parts->port.is_nonempty()) { int port; - return (StringToInt(WideToUTF16( + return (base::StringToInt(WideToUTF8( text.substr(parts->port.begin, parts->port.len)), &port) && (port >= 0) && (port <= 65535)) ? URL : QUERY; } diff --git a/chrome/browser/autocomplete/autocomplete_unittest.cc b/chrome/browser/autocomplete/autocomplete_unittest.cc index 42963df..f8081e7 100644 --- a/chrome/browser/autocomplete/autocomplete_unittest.cc +++ b/chrome/browser/autocomplete/autocomplete_unittest.cc @@ -4,6 +4,7 @@ #include "base/message_loop.h" #include "base/scoped_ptr.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete.h" @@ -77,7 +78,7 @@ void TestProvider::AddResults(int start_at, int num) { AutocompleteMatch match(this, relevance_ - i, false, AutocompleteMatch::URL_WHAT_YOU_TYPED); - match.fill_into_edit = prefix_ + IntToWString(i); + match.fill_into_edit = prefix_ + UTF8ToWide(base::IntToString(i)); match.destination_url = GURL(WideToUTF8(match.fill_into_edit)); match.contents = match.fill_into_edit; diff --git a/chrome/browser/autocomplete_history_manager.cc b/chrome/browser/autocomplete_history_manager.cc index dab9363..c46217e 100644 --- a/chrome/browser/autocomplete_history_manager.cc +++ b/chrome/browser/autocomplete_history_manager.cc @@ -7,7 +7,7 @@ #include <vector> #include "base/string16.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "chrome/browser/autofill/credit_card.h" #include "chrome/browser/pref_service.h" #include "chrome/browser/profile.h" @@ -46,19 +46,21 @@ bool IsSSN(const string16& text) { string16 group_string = number_string.substr(3, 2); string16 serial_string = number_string.substr(5, 4); - int area = StringToInt(area_string); + int area; + if (!base::StringToInt(area_string, &area)) + return false; if (area < 1 || area == 666 || (area > 733 && area < 750) || area > 772) return false; - int group = StringToInt(group_string); - if (group == 0) + int group; + if (!base::StringToInt(group_string, &group) || group == 0) return false; - int serial = StringToInt(serial_string); - if (serial == 0) + int serial; + if (!base::StringToInt(serial_string, &serial) || serial == 0) return false; return true; diff --git a/chrome/browser/autofill/auto_fill_editor_gtk.cc b/chrome/browser/autofill/auto_fill_editor_gtk.cc index e909d62..9ce80da 100644 --- a/chrome/browser/autofill/auto_fill_editor_gtk.cc +++ b/chrome/browser/autofill/auto_fill_editor_gtk.cc @@ -799,16 +799,19 @@ void AutoFillCreditCardEditor::SetWidgetValues(CreditCard* card) { gtk_entry_set_text(GTK_ENTRY(number_), UTF16ToUTF8(card->ObfuscatedNumber()).c_str()); - int month = StringToInt( - UTF16ToUTF8(card->GetFieldText(AutoFillType(CREDIT_CARD_EXP_MONTH)))); + int month; + base::StringToInt(card->GetFieldText(AutoFillType(CREDIT_CARD_EXP_MONTH)), + &month); if (month >= 1 && month <= 12) { gtk_combo_box_set_active(GTK_COMBO_BOX(month_), month - 1); } else { gtk_combo_box_set_active(GTK_COMBO_BOX(month_), 0); } - int year = StringToInt(UTF16ToUTF8( - card->GetFieldText(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)))); + int year; + base::StringToInt( + card->GetFieldText(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)), + &year); if (year >= base_year_ && year < base_year_ + kNumYears) gtk_combo_box_set_active(GTK_COMBO_BOX(year_), year - base_year_); else diff --git a/chrome/browser/autofill/autofill_field.cc b/chrome/browser/autofill/autofill_field.cc index 3ba943a..9503f7c 100644 --- a/chrome/browser/autofill/autofill_field.cc +++ b/chrome/browser/autofill/autofill_field.cc @@ -6,7 +6,7 @@ #include "base/logging.h" #include "base/sha1.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" namespace { @@ -20,7 +20,7 @@ static std::string Hash32Bit(const std::string& str) { ((hash_bin[2] & 0xFF) << 8) | (hash_bin[3] & 0xFF); - return UintToString(hash32); + return base::UintToString(hash32); } } // namespace diff --git a/chrome/browser/autofill/form_structure.cc b/chrome/browser/autofill/form_structure.cc index 92df538..9c184c2 100644 --- a/chrome/browser/autofill/form_structure.cc +++ b/chrome/browser/autofill/form_structure.cc @@ -52,7 +52,7 @@ static std::string Hash64Bit(const std::string& str) { (((static_cast<uint64>(hash_bin[6])) & 0xFF) << 8) | ((static_cast<uint64>(hash_bin[7])) & 0xFF); - return Uint64ToString(hash64); + return base::Uint64ToString(hash64); } } // namespace @@ -429,7 +429,7 @@ bool FormStructure::EncodeFormRequest( field_element->SetAttr(buzz::QName(kAttributeSignature), field->FieldSignature()); field_element->SetAttr(buzz::QName(kAttributeAutoFillType), - IntToString(*type)); + base::IntToString(*type)); encompassing_xml_element->AddElement(field_element); } } else { diff --git a/chrome/browser/autofill/personal_data_manager.cc b/chrome/browser/autofill/personal_data_manager.cc index 981c20b..a058b78 100644 --- a/chrome/browser/autofill/personal_data_manager.cc +++ b/chrome/browser/autofill/personal_data_manager.cc @@ -8,6 +8,7 @@ #include <iterator> #include "base/logging.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "chrome/browser/autofill/autofill_manager.h" #include "chrome/browser/autofill/autofill_field.h" @@ -578,7 +579,7 @@ void PersonalDataManager::SetUniqueProfileLabels( // has an implicit index of 1. for (size_t i = 1; i < iter->second.size(); ++i) { string16 newlabel = iter->second[i]->Label() + - UintToString16(static_cast<unsigned int>(i + 1)); + base::UintToString16(static_cast<unsigned int>(i + 1)); iter->second[i]->set_label(newlabel); } } @@ -600,7 +601,7 @@ void PersonalDataManager::SetUniqueCreditCardLabels( // has an implicit index of 1. for (size_t i = 1; i < iter->second.size(); ++i) { string16 newlabel = iter->second[i]->Label() + - UintToString16(static_cast<unsigned int>(i + 1)); + base::UintToString16(static_cast<unsigned int>(i + 1)); iter->second[i]->set_label(newlabel); } } diff --git a/chrome/browser/autofill/select_control_handler.cc b/chrome/browser/autofill/select_control_handler.cc index dff9d97..d1f348e 100644 --- a/chrome/browser/autofill/select_control_handler.cc +++ b/chrome/browser/autofill/select_control_handler.cc @@ -8,7 +8,7 @@ #include "base/basictypes.h" #include "base/logging.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/string16.h" #include "chrome/browser/autofill/form_group.h" #include "webkit/glue/form_field.h" @@ -459,7 +459,7 @@ bool FillExpirationMonthSelectControl(const string16& value, return true; int index = 0; - if (!StringToInt(value, &index) || + if (!base::StringToInt(value, &index) || index <= 0 || static_cast<size_t>(index) >= arraysize(kMonthsFull)) return false; diff --git a/chrome/browser/bookmarks/bookmark_codec.cc b/chrome/browser/bookmarks/bookmark_codec.cc index a56636a..35ed181 100644 --- a/chrome/browser/bookmarks/bookmark_codec.cc +++ b/chrome/browser/bookmarks/bookmark_codec.cc @@ -193,7 +193,7 @@ bool BookmarkCodec::DecodeNode(const DictionaryValue& value, int64 id = 0; if (ids_valid_) { if (!value.GetString(kIdKey, &id_string) || - !StringToInt64(id_string, &id) || + !base::StringToInt64(id_string, &id) || ids_.count(id) != 0) { ids_valid_ = false; } else { @@ -209,8 +209,9 @@ bool BookmarkCodec::DecodeNode(const DictionaryValue& value, std::string date_added_string; if (!value.GetString(kDateAddedKey, &date_added_string)) date_added_string = base::Int64ToString(Time::Now().ToInternalValue()); - base::Time date_added = base::Time::FromInternalValue( - StringToInt64(date_added_string)); + int64 internal_time; + base::StringToInt64(date_added_string, &internal_time); + base::Time date_added = base::Time::FromInternalValue(internal_time); #if !defined(OS_WIN) // We changed the epoch for dates on Mac & Linux from 1970 to the Windows // one of 1601. We assume any number we encounter from before 1970 is using @@ -267,8 +268,9 @@ bool BookmarkCodec::DecodeNode(const DictionaryValue& value, } node->set_type(BookmarkNode::FOLDER); - node->set_date_group_modified(Time::FromInternalValue( - StringToInt64(last_modified_date))); + int64 internal_time; + base::StringToInt64(last_modified_date, &internal_time); + node->set_date_group_modified(Time::FromInternalValue(internal_time)); if (parent) parent->Add(parent->GetChildCount(), node); diff --git a/chrome/browser/bookmarks/bookmark_index_unittest.cc b/chrome/browser/bookmarks/bookmark_index_unittest.cc index 6225bc7..f631528 100644 --- a/chrome/browser/bookmarks/bookmark_index_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_index_unittest.cc @@ -6,6 +6,7 @@ #include <vector> #include "base/message_loop.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "chrome/browser/bookmarks/bookmark_index.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -70,8 +71,11 @@ class BookmarkIndexTest : public testing::Test { SplitString(match_strings[i], ',', &chunks); ASSERT_EQ(2U, chunks.size()); matches->push_back(Snippet::MatchPosition()); - matches->back().first = StringToInt(chunks[0]); - matches->back().second = StringToInt(chunks[1]); + int chunks0, chunks1; + base::StringToInt(chunks[0], &chunks0); + base::StringToInt(chunks[1], &chunks1); + matches->back().first = chunks0; + matches->back().second = chunks1; } } diff --git a/chrome/browser/bookmarks/bookmark_model_unittest.cc b/chrome/browser/bookmarks/bookmark_model_unittest.cc index 9d85f1f..515e475 100644 --- a/chrome/browser/bookmarks/bookmark_model_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_model_unittest.cc @@ -7,6 +7,7 @@ #include "app/tree_node_iterator.h" #include "app/tree_node_model.h" #include "base/hash_tables.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "chrome/browser/bookmarks/bookmark_codec.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -566,7 +567,7 @@ static void PopulateNodeImpl(const std::vector<std::wstring>& description, // in debugging. static int next_group_id = 1; TestNode* new_node = - new TestNode(IntToWString(next_group_id++), + new TestNode(UTF8ToWide(base::IntToString(next_group_id++)), BookmarkNode::FOLDER); parent->Add(parent->GetChildCount(), new_node); PopulateNodeImpl(description, index, new_node); diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 2a0eae5..490fb78 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -280,7 +280,7 @@ std::string AboutAbout() { #if defined(OS_CHROMEOS) std::string AboutNetwork(const std::string& query) { int refresh; - StringToInt(query, &refresh); + base::StringToInt(query, &refresh); return chromeos::CrosLibrary::Get()->GetNetworkLibrary()-> GetHtmlInfo(refresh); } diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc index 8dc4cec..58615eb 100644 --- a/chrome/browser/browser_init.cc +++ b/chrome/browser/browser_init.cc @@ -13,6 +13,7 @@ #include "base/histogram.h" #include "base/path_service.h" #include "base/scoped_ptr.h" +#include "base/string_number_conversions.h" #include "chrome/browser/automation/automation_provider.h" #include "chrome/browser/automation/automation_provider_list.h" #include "chrome/browser/automation/chrome_frame_automation_provider.h" @@ -499,16 +500,16 @@ bool BrowserInit::LaunchWithProfile::Launch(Profile* profile, if (command_line_.HasSwitch(switches::kRemoteShellPort)) { std::string port_str = command_line_.GetSwitchValueASCII(switches::kRemoteShellPort); - int64 port = StringToInt64(port_str); - if (port > 0 && port < 65535) + int64 port; + if (base::StringToInt64(port_str, &port) && port > 0 && port < 65535) g_browser_process->InitDebuggerWrapper(static_cast<int>(port), false); else DLOG(WARNING) << "Invalid remote shell port number " << port; } else if (command_line_.HasSwitch(switches::kRemoteDebuggingPort)) { std::string port_str = command_line_.GetSwitchValueASCII(switches::kRemoteDebuggingPort); - int64 port = StringToInt64(port_str); - if (port > 0 && port < 65535) + int64 port; + if (base::StringToInt64(port_str, &port) && port > 0 && port < 65535) g_browser_process->InitDebuggerWrapper(static_cast<int>(port), true); else DLOG(WARNING) << "Invalid http debugger port number " << port; @@ -940,7 +941,7 @@ bool BrowserInit::ProcessCmdLineImpl(const CommandLine& command_line, if (command_line.HasSwitch(switches::kRestoreLastSession)) { std::string restore_session_value( command_line.GetSwitchValueASCII(switches::kRestoreLastSession)); - StringToInt(restore_session_value, &expected_tab_count); + base::StringToInt(restore_session_value, &expected_tab_count); } else { expected_tab_count = std::max(1, static_cast<int>(command_line.args().size())); diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 277cac1..6f23885 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -20,6 +20,7 @@ #include "base/path_service.h" #include "base/platform_thread.h" #include "base/process_util.h" +#include "base/string_number_conversions.h" #include "base/string_piece.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" @@ -409,9 +410,10 @@ void InitializeNetworkOptions(const CommandLine& parsed_command_line) { parsed_command_line.GetSwitchValueASCII(switches::kHostRules)); if (parsed_command_line.HasSwitch(switches::kMaxSpdySessionsPerDomain)) { - int value = StringToInt( - parsed_command_line.GetSwitchValueASCII( - switches::kMaxSpdySessionsPerDomain)); + int value; + base::StringToInt(parsed_command_line.GetSwitchValueASCII( + switches::kMaxSpdySessionsPerDomain), + &value); net::SpdySessionPool::set_max_sessions_per_domain(value); } } @@ -643,8 +645,12 @@ void OptionallyRunChromeOSLoginManager(const CommandLine& parsed_command_line) { if (size_arg.size()) { std::vector<std::string> dimensions; SplitString(size_arg, ',', &dimensions); - if (dimensions.size() == 2) - size.SetSize(StringToInt(dimensions[0]), StringToInt(dimensions[1])); + if (dimensions.size() == 2) { + int width, height; + if (base::StringToInt(dimensions[0], &width) && + base::StringToInt(dimensions[1], &height)) + size.SetSize(width, height); + } } browser::ShowLoginWizard(first_screen, size); } diff --git a/chrome/browser/browser_main_posix.cc b/chrome/browser/browser_main_posix.cc index c3e028d..e6675f6 100644 --- a/chrome/browser/browser_main_posix.cc +++ b/chrome/browser/browser_main_posix.cc @@ -11,7 +11,7 @@ #include "base/command_line.h" #include "base/eintr_wrapper.h" #include "base/logging.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/chrome_thread.h" #include "chrome/common/chrome_switches.h" @@ -187,7 +187,7 @@ void BrowserMainPartsPosix::PreEarlyInitialization() { switches::kFileDescriptorLimit); int fd_limit = 0; if (!fd_limit_string.empty()) { - StringToInt(fd_limit_string, &fd_limit); + base::StringToInt(fd_limit_string, &fd_limit); } #if defined(OS_MACOSX) // We use quite a few file descriptors for our IPC, and the default limit on diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc index 3e961c3..bfadc0d 100644 --- a/chrome/browser/browser_shutdown.cc +++ b/chrome/browser/browser_shutdown.cc @@ -229,7 +229,7 @@ void ReadLastShutdownFile( std::string shutdown_ms_str; int64 shutdown_ms = 0; if (file_util::ReadFileToString(shutdown_ms_file, &shutdown_ms_str)) - shutdown_ms = StringToInt64(shutdown_ms_str); + base::StringToInt64(shutdown_ms_str, &shutdown_ms); file_util::Delete(shutdown_ms_file, false); if (type == NOT_VALID || shutdown_ms == 0 || num_procs == 0) diff --git a/chrome/browser/chromeos/boot_times_loader.cc b/chrome/browser/chromeos/boot_times_loader.cc index acdadce..6b68829 100644 --- a/chrome/browser/chromeos/boot_times_loader.cc +++ b/chrome/browser/chromeos/boot_times_loader.cc @@ -13,6 +13,7 @@ #include "base/message_loop.h" #include "base/process_util.h" #include "base/singleton.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/thread.h" #include "base/time.h" @@ -96,7 +97,7 @@ static bool GetTime(const std::string& log, double* value) { size_t chars_left = space_index != std::string::npos ? space_index : std::string::npos; std::string value_string = contents.substr(0, chars_left); - return StringToDouble(value_string, value); + return base::StringToDouble(value_string, value); } return false; } diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc index ba16587..a133c8d 100644 --- a/chrome/browser/chromeos/cros/network_library.cc +++ b/chrome/browser/chromeos/cros/network_library.cc @@ -52,8 +52,8 @@ static std::string ToHtmlTableRow(Network* network) { if (network->type() == TYPE_WIFI || network->type() == TYPE_CELLULAR) { WirelessNetwork* wireless = static_cast<WirelessNetwork*>(network); str += WrapWithTD(wireless->name()) + - WrapWithTD(IntToString(wireless->auto_connect())) + - WrapWithTD(IntToString(wireless->strength())); + WrapWithTD(base::IntToString(wireless->auto_connect())) + + WrapWithTD(base::IntToString(wireless->strength())); if (network->type() == TYPE_WIFI) { WifiNetwork* wifi = static_cast<WifiNetwork*>(network); str += WrapWithTD(wifi->GetEncryptionString()) + diff --git a/chrome/browser/chromeos/customization_document.cc b/chrome/browser/chromeos/customization_document.cc index 19410ec..90e5ce5 100644 --- a/chrome/browser/chromeos/customization_document.cc +++ b/chrome/browser/chromeos/customization_document.cc @@ -10,7 +10,7 @@ #include "base/file_util.h" #include "base/json/json_reader.h" #include "base/logging.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/values.h" // Manifest attributes names. @@ -93,8 +93,9 @@ bool StartupCustomizationDocument::ParseFromJsonValue( root->GetString(kBackgroundColorAttr, &background_color_string); if (!background_color_string.empty()) { if (background_color_string[0] == '#') { - background_color_ = static_cast<SkColor>( - 0xff000000 | HexStringToInt(background_color_string.substr(1))); + int background_int; + base::HexStringToInt(background_color_string.substr(1), &background_int); + background_color_ = static_cast<SkColor>(0xff000000 | background_int); } else { // Literal color constants are not supported yet. return false; diff --git a/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.cc b/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.cc index 889a85d..2f73048 100644 --- a/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.cc +++ b/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.cc @@ -5,7 +5,7 @@ #include "chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.h" #include "base/json/json_reader.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "chrome/browser/chromeos/cros_settings.h" namespace chromeos { @@ -39,7 +39,7 @@ void CoreChromeOSOptionsHandler::SetPref(const std::wstring& pref_name, break; case Value::TYPE_INTEGER: int int_value; - if (StringToInt(value_string, &int_value)) + if (base::StringToInt(value_string, &int_value)) cros_settings->SetInteger(pref_name, int_value); break; case Value::TYPE_STRING: diff --git a/chrome/browser/chromeos/dom_ui/language_chewing_options_handler.cc b/chrome/browser/chromeos/dom_ui/language_chewing_options_handler.cc index ba71eb2..9f8d780 100644 --- a/chrome/browser/chromeos/dom_ui/language_chewing_options_handler.cc +++ b/chrome/browser/chromeos/dom_ui/language_chewing_options_handler.cc @@ -8,7 +8,8 @@ #include "app/l10n_util.h" #include "base/logging.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" +#include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/chromeos/dom_ui/language_options_util.h" #include "chrome/browser/chromeos/language_preferences.h" @@ -38,10 +39,10 @@ void LanguageChewingOptionsHandler::GetLocalizedValues( l10n_util::GetString(preference.message_id)); localized_strings->SetString( GetTemplateDataMinName(preference), - IntToWString(preference.min_pref_value)); + UTF8ToWide(base::IntToString(preference.min_pref_value))); localized_strings->SetString( GetTemplateDataMaxName(preference), - IntToWString(preference.max_pref_value)); + UTF8ToWide(base::IntToString(preference.max_pref_value))); } for (size_t i = 0; i < arraysize(chromeos::kChewingMultipleChoicePrefs); @@ -79,8 +80,8 @@ void LanguageChewingOptionsHandler::GetLocalizedValues( localized_strings->SetString( GetTemplateDataMinName(chromeos::kChewingHsuSelKeyType), - IntToWString(hsu_sel_key_type_min)); + UTF8ToWide(base::IntToString(hsu_sel_key_type_min))); localized_strings->SetString( GetTemplateDataMaxName(chromeos::kChewingHsuSelKeyType), - IntToWString(hsu_sel_key_type_max)); + UTF8ToWide(base::IntToString(hsu_sel_key_type_max))); } diff --git a/chrome/browser/chromeos/login/network_screen_browsertest.cc b/chrome/browser/chromeos/login/network_screen_browsertest.cc index e31bac8..26ea327 100644 --- a/chrome/browser/chromeos/login/network_screen_browsertest.cc +++ b/chrome/browser/chromeos/login/network_screen_browsertest.cc @@ -8,7 +8,8 @@ #include "app/l10n_util.h" #include "base/message_loop.h" #include "base/scoped_ptr.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/cros/mock_login_library.h" #include "chrome/browser/chromeos/cros/mock_network_library.h" @@ -47,7 +48,7 @@ class DummyComboboxModel : public ComboboxModel { virtual int GetItemCount() { return 2; } virtual std::wstring GetItemAt(int index) { - return L"Item " + IntToWString(index); + return L"Item " + UTF16ToWideHack(base::IntToString16(index)); } }; diff --git a/chrome/browser/debugger/debugger_remote_service.cc b/chrome/browser/debugger/debugger_remote_service.cc index 74ac1e0..0809564 100644 --- a/chrome/browser/debugger/debugger_remote_service.cc +++ b/chrome/browser/debugger/debugger_remote_service.cc @@ -96,7 +96,7 @@ void DebuggerRemoteService::HandleMessage( return; } int32 tab_uid = -1; - StringToInt(destination, &tab_uid); + base::StringToInt(destination, &tab_uid); if (command == DebuggerRemoteServiceCommand::kAttach) { // TODO(apavlov): handle 0 for a new tab @@ -205,7 +205,7 @@ void DebuggerRemoteService::TabClosed(int32 tab_id) { void DebuggerRemoteService::AttachToTab(const std::string& destination, DictionaryValue* response) { int32 tab_uid = -1; - StringToInt(destination, &tab_uid); + base::StringToInt(destination, &tab_uid); if (tab_uid < 0) { // Bad tab_uid received from remote debugger (perhaps NaN) response->SetInteger(kResultWide, RESULT_UNKNOWN_TAB); @@ -249,7 +249,7 @@ void DebuggerRemoteService::AttachToTab(const std::string& destination, void DebuggerRemoteService::DetachFromTab(const std::string& destination, DictionaryValue* response) { int32 tab_uid = -1; - StringToInt(destination, &tab_uid); + base::StringToInt(destination, &tab_uid); if (tab_uid == -1) { // Bad tab_uid received from remote debugger (NaN) if (response != NULL) { diff --git a/chrome/browser/debugger/devtools_http_protocol_handler.cc b/chrome/browser/debugger/devtools_http_protocol_handler.cc index 28efa9c..8c5b0ad0 100644 --- a/chrome/browser/debugger/devtools_http_protocol_handler.cc +++ b/chrome/browser/debugger/devtools_http_protocol_handler.cc @@ -7,7 +7,7 @@ #include "base/compiler_specific.h" #include "base/logging.h" #include "base/message_loop_proxy.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/thread.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" @@ -218,7 +218,7 @@ void DevToolsHttpProtocolHandler::OnWebSocketRequestUI( } std::string page_id = request.path.substr(prefix.length()); int id = 0; - if (!StringToInt(page_id, &id)) { + if (!base::StringToInt(page_id, &id)) { Send500(socket, "Invalid page id: " + page_id); return; } diff --git a/chrome/browser/debugger/devtools_sanity_unittest.cc b/chrome/browser/debugger/devtools_sanity_unittest.cc index 4a254dd..ae6f636 100644 --- a/chrome/browser/debugger/devtools_sanity_unittest.cc +++ b/chrome/browser/debugger/devtools_sanity_unittest.cc @@ -1,9 +1,10 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/command_line.h" #include "base/path_service.h" +#include "base/string_util.h" #include "chrome/browser/browser.h" #include "chrome/browser/debugger/devtools_client_host.h" #include "chrome/browser/debugger/devtools_manager.h" diff --git a/chrome/browser/debugger/devtools_window.cc b/chrome/browser/debugger/devtools_window.cc index 7d0af47..91ace00 100644 --- a/chrome/browser/debugger/devtools_window.cc +++ b/chrome/browser/debugger/devtools_window.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/command_line.h" +#include "base/string_number_conversions.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_process.h" @@ -296,7 +297,7 @@ std::string SkColorToRGBAString(SkColor color) { // locale specific formatters (e.g., use , instead of . in German). return StringPrintf("rgba(%d,%d,%d,%s)", SkColorGetR(color), SkColorGetG(color), SkColorGetB(color), - DoubleToString(SkColorGetA(color) / 255.0).c_str()); + base::DoubleToString(SkColorGetA(color) / 255.0).c_str()); } GURL DevToolsWindow::GetDevToolsUrl() { diff --git a/chrome/browser/debugger/extension_ports_remote_service.cc b/chrome/browser/debugger/extension_ports_remote_service.cc index 72510b6..04302f1 100644 --- a/chrome/browser/debugger/extension_ports_remote_service.cc +++ b/chrome/browser/debugger/extension_ports_remote_service.cc @@ -180,7 +180,7 @@ void ExtensionPortsRemoteService::HandleMessage( int destination = -1; if (destinationString.size() != 0) - StringToInt(destinationString, &destination); + base::StringToInt(destinationString, &destination); if (command == kConnect) { if (destination != -1) // destination should be empty for this command. diff --git a/chrome/browser/debugger/inspectable_tab_proxy.cc b/chrome/browser/debugger/inspectable_tab_proxy.cc index 2c5924b..ec84066 100644 --- a/chrome/browser/debugger/inspectable_tab_proxy.cc +++ b/chrome/browser/debugger/inspectable_tab_proxy.cc @@ -1,9 +1,10 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/debugger/inspectable_tab_proxy.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" @@ -98,7 +99,7 @@ DevToolsClientHost* InspectableTabProxy::NewClientHost( void InspectableTabProxy::OnRemoteDebuggerDetached() { while (id_to_client_host_map_.size() > 0) { IdToClientHostMap::iterator it = id_to_client_host_map_.begin(); - it->second->debugger_remote_service()->DetachFromTab(IntToString(it->first), - NULL); + it->second->debugger_remote_service()->DetachFromTab( + base::IntToString(it->first), NULL); } } diff --git a/chrome/browser/dom_ui/app_launcher_handler.cc b/chrome/browser/dom_ui/app_launcher_handler.cc index 6895f75..8b229d9 100644 --- a/chrome/browser/dom_ui/app_launcher_handler.cc +++ b/chrome/browser/dom_ui/app_launcher_handler.cc @@ -6,7 +6,7 @@ #include "app/animation.h" #include "base/base64.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/app_launched_animation.h" @@ -32,7 +32,7 @@ bool ExtractInt(const ListValue* list, size_t index, int* out_int) { std::string string_value; if (list->GetString(index, &string_value)) { - *out_int = StringToInt(string_value); + base::StringToInt(string_value, out_int); return true; } diff --git a/chrome/browser/dom_ui/browser_options_handler.cc b/chrome/browser/dom_ui/browser_options_handler.cc index fda6802..a784533 100644 --- a/chrome/browser/dom_ui/browser_options_handler.cc +++ b/chrome/browser/dom_ui/browser_options_handler.cc @@ -7,7 +7,7 @@ #include "app/l10n_util.h" #include "base/basictypes.h" #include "base/scoped_ptr.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/custom_home_pages_table_model.h" @@ -205,7 +205,8 @@ void BrowserOptionsHandler::SetDefaultSearchEngine(const Value* value) { NOTREACHED(); return; } - int selected_index = StringToInt(string_value); + int selected_index; + base::StringToInt(string_value, &selected_index); std::vector<const TemplateURL*> model_urls = template_url_model_->GetTemplateURLs(); @@ -280,7 +281,8 @@ void BrowserOptionsHandler::RemoveStartupPages(const Value* value) { NOTREACHED(); return; } - int selected_index = StringToInt(string_value); + int selected_index; + base::StringToInt(string_value, &selected_index); if (selected_index < 0 || selected_index >= startup_custom_pages_table_model_->RowCount()) { NOTREACHED(); diff --git a/chrome/browser/dom_ui/core_options_handler.cc b/chrome/browser/dom_ui/core_options_handler.cc index e525080..af185f7 100644 --- a/chrome/browser/dom_ui/core_options_handler.cc +++ b/chrome/browser/dom_ui/core_options_handler.cc @@ -5,6 +5,7 @@ #include "chrome/browser/dom_ui/core_options_handler.h" #include "app/l10n_util.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/common/notification_service.h" @@ -141,7 +142,7 @@ void CoreOptionsHandler::SetPref(const std::wstring& pref_name, break; case Value::TYPE_INTEGER: int int_value; - if (StringToInt(value_string, &int_value)) + if (base::StringToInt(value_string, &int_value)) pref_service->SetInteger(pref_name.c_str(), int_value); break; case Value::TYPE_STRING: diff --git a/chrome/browser/dom_ui/dom_ui.cc b/chrome/browser/dom_ui/dom_ui.cc index 8b9c45f..82dcb4b 100644 --- a/chrome/browser/dom_ui/dom_ui.cc +++ b/chrome/browser/dom_ui/dom_ui.cc @@ -7,7 +7,7 @@ #include "base/i18n/rtl.h" #include "base/json/json_writer.h" #include "base/stl_util-inl.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/browser_theme_provider.h" @@ -148,7 +148,7 @@ bool DOMMessageHandler::ExtractIntegerValue(const Value* value, int* out_int) { const ListValue* list_value = static_cast<const ListValue*>(value); std::string string_value; if (list_value->GetString(0, &string_value)) { - *out_int = StringToInt(string_value); + base::StringToInt(string_value, out_int); return true; } } diff --git a/chrome/browser/dom_ui/history2_ui.cc b/chrome/browser/dom_ui/history2_ui.cc index 151186f..067fec3 100644 --- a/chrome/browser/dom_ui/history2_ui.cc +++ b/chrome/browser/dom_ui/history2_ui.cc @@ -10,8 +10,8 @@ #include "base/i18n/time_formatting.h" #include "base/message_loop.h" #include "base/singleton.h" +#include "base/string_number_conversions.h" #include "base/string_piece.h" -#include "base/string_util.h" #include "base/thread.h" #include "base/time.h" #include "base/values.h" @@ -321,7 +321,7 @@ void BrowsingHistoryHandler2::ExtractSearchHistoryArguments(const Value* value, static_cast<const StringValue*>(list_member); string16 string16_value; string_value->GetAsUTF16(&string16_value); - *month = StringToInt(string16_value); + base::StringToInt(string16_value, month); } } } diff --git a/chrome/browser/dom_ui/history_ui.cc b/chrome/browser/dom_ui/history_ui.cc index cb3b4cc..fc4fd63 100644 --- a/chrome/browser/dom_ui/history_ui.cc +++ b/chrome/browser/dom_ui/history_ui.cc @@ -10,8 +10,8 @@ #include "base/i18n/time_formatting.h" #include "base/message_loop.h" #include "base/singleton.h" +#include "base/string_number_conversions.h" #include "base/string_piece.h" -#include "base/string_util.h" #include "base/thread.h" #include "base/time.h" #include "base/values.h" @@ -321,7 +321,7 @@ void BrowsingHistoryHandler::ExtractSearchHistoryArguments(const Value* value, static_cast<const StringValue*>(list_member); string16 string16_value; string_value->GetAsUTF16(&string16_value); - *month = StringToInt(string16_value); + base::StringToInt(string16_value, month); } } } diff --git a/chrome/browser/dom_ui/most_visited_handler.cc b/chrome/browser/dom_ui/most_visited_handler.cc index 93c9d17..da59bd8 100644 --- a/chrome/browser/dom_ui/most_visited_handler.cc +++ b/chrome/browser/dom_ui/most_visited_handler.cc @@ -12,6 +12,7 @@ #include "base/md5.h" #include "base/singleton.h" #include "base/scoped_vector.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "base/thread.h" #include "base/values.h" @@ -269,7 +270,7 @@ void MostVisitedHandler::HandleAddPinnedURL(const Value* value) { r = list->GetString(4, &tmp_string); DCHECK(r) << "Missing index in addPinnedURL from the NTP Most Visited."; - index = StringToInt(tmp_string); + base::StringToInt(tmp_string, &index); AddPinnedURL(mvp, index); } diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index c033974..09da259 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -14,6 +14,7 @@ #include "base/histogram.h" #include "base/i18n/rtl.h" #include "base/singleton.h" +#include "base/string_number_conversions.h" #include "base/thread.h" #include "chrome/browser/browser.h" #include "chrome/browser/chrome_thread.h" @@ -196,7 +197,8 @@ void RecentlyClosedTabsHandler::HandleReopenTab(const Value* content) { static_cast<const StringValue*>(list_member); std::wstring wstring_value; if (string_value->GetAsString(&wstring_value)) { - int session_to_restore = StringToInt(WideToUTF16Hack(wstring_value)); + int session_to_restore; + base::StringToInt(WideToUTF8(wstring_value), &session_to_restore); tab_restore_service_->RestoreEntryById(browser, session_to_restore, true); // The current tab has been nuked at this point; don't touch any member diff --git a/chrome/browser/dom_ui/ntp_resource_cache.cc b/chrome/browser/dom_ui/ntp_resource_cache.cc index 38eb5c7..2cb54d5 100644 --- a/chrome/browser/dom_ui/ntp_resource_cache.cc +++ b/chrome/browser/dom_ui/ntp_resource_cache.cc @@ -69,7 +69,7 @@ std::string SkColorToRGBAString(SkColor color) { // locale specific formatters (e.g., use , instead of . in German). return StringPrintf("rgba(%d,%d,%d,%s)", SkColorGetR(color), SkColorGetG(color), SkColorGetB(color), - DoubleToString(SkColorGetA(color) / 255.0).c_str()); + base::DoubleToString(SkColorGetA(color) / 255.0).c_str()); } // Get the CSS string for the background position on the new tab page for the diff --git a/chrome/browser/dom_ui/shown_sections_handler.cc b/chrome/browser/dom_ui/shown_sections_handler.cc index 9bfd22e..b1ae3c8 100644 --- a/chrome/browser/dom_ui/shown_sections_handler.cc +++ b/chrome/browser/dom_ui/shown_sections_handler.cc @@ -6,7 +6,7 @@ #include "base/callback.h" #include "base/command_line.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/values.h" #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/pref_service.h" @@ -92,7 +92,8 @@ void ShownSectionsHandler::HandleSetShownSections(const Value* value) { bool r = list->GetString(0, &mode_string); DCHECK(r) << "Missing value in setShownSections from the NTP Most Visited."; - int mode = StringToInt(mode_string); + int mode; + base::StringToInt(mode_string, &mode); int old_mode = pref_service_->GetInteger(prefs::kNTPShownSections); if (old_mode != mode) { diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc index 240ccee..4aeb982 100644 --- a/chrome/browser/download/download_util.cc +++ b/chrome/browser/download/download_util.cc @@ -18,7 +18,7 @@ #include "base/i18n/time_formatting.h" #include "base/path_service.h" #include "base/singleton.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/browser_process.h" @@ -262,7 +262,7 @@ int GetBigProgressIconSize() { if (big_progress_icon_size == 0) { string16 locale_size_str = WideToUTF16Hack(l10n_util::GetString(IDS_DOWNLOAD_BIG_PROGRESS_SIZE)); - bool rc = StringToInt(locale_size_str, &big_progress_icon_size); + bool rc = base::StringToInt(locale_size_str, &big_progress_icon_size); if (!rc || big_progress_icon_size < kBigProgressIconSize) { NOTREACHED(); big_progress_icon_size = kBigProgressIconSize; diff --git a/chrome/browser/extensions/extension_bookmark_manager_api.cc b/chrome/browser/extensions/extension_bookmark_manager_api.cc index 2cbc471..19699f4 100644 --- a/chrome/browser/extensions/extension_bookmark_manager_api.cc +++ b/chrome/browser/extensions/extension_bookmark_manager_api.cc @@ -35,7 +35,7 @@ const BookmarkNode* GetNodeFromArguments(BookmarkModel* model, if (!args->GetString(0, &id_string)) return NULL; int64 id; - if (!StringToInt64(id_string, &id)) + if (!base::StringToInt64(id_string, &id)) return NULL; return model->GetNodeByID(id); } @@ -58,7 +58,7 @@ bool GetNodesFromArguments(BookmarkModel* model, const ListValue* args, if (!ids->GetString(i, &id_string)) return false; int64 id; - if (!StringToInt64(id_string, &id)) + if (!base::StringToInt64(id_string, &id)) return false; const BookmarkNode* node = model->GetNodeByID(id); if (!node) @@ -363,7 +363,7 @@ bool DropBookmarkManagerFunction::RunImpl() { std::string id_string; EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &id_string)); - if (!StringToInt64(id_string, &id)) { + if (!base::StringToInt64(id_string, &id)) { error_ = keys::kInvalidIdError; return false; } @@ -417,7 +417,7 @@ bool GetSubtreeBookmarkManagerFunction::RunImpl() { if (id_string == "") { node = model->root_node(); } else { - if (!StringToInt64(id_string, &id)) { + if (!base::StringToInt64(id_string, &id)) { error_ = keys::kInvalidIdError; return false; } diff --git a/chrome/browser/extensions/extension_devtools_events.cc b/chrome/browser/extensions/extension_devtools_events.cc index bec5577..67fb031 100644 --- a/chrome/browser/extensions/extension_devtools_events.cc +++ b/chrome/browser/extensions/extension_devtools_events.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,7 @@ #include <vector> +#include "base/string_number_conversions.h" #include "base/string_util.h" // These string constants and the formats used in this file must stay @@ -26,7 +27,7 @@ bool ExtensionDevToolsEvents::IsDevToolsEventName( // At this point we want something like "4.onPageEvent" std::vector<std::string> parts; SplitString(event_name.substr(strlen(kDevToolsEventPrefix)), '.', &parts); - if (parts.size() == 2 && StringToInt(parts[0], tab_id)) { + if (parts.size() == 2 && base::StringToInt(parts[0], tab_id)) { return true; } } diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc index 364d1b4..298327a 100644 --- a/chrome/browser/extensions/extension_install_ui.cc +++ b/chrome/browser/extensions/extension_install_ui.cc @@ -11,6 +11,7 @@ #include "base/command_line.h" #include "base/file_util.h" #include "base/rand_util.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_list.h" @@ -99,7 +100,7 @@ static void GetV2Warnings(Extension* extension, IDS_EXTENSION_PROMPT2_WARNING_4_OR_MORE_HOSTS, UTF8ToUTF16(*hosts.begin()), UTF8ToUTF16(*(++hosts.begin())), - IntToString16(hosts.size() - 2))); + base::IntToString16(hosts.size() - 2))); } } diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc index 8380543..1f4f3e8 100644 --- a/chrome/browser/extensions/extension_prefs.cc +++ b/chrome/browser/extensions/extension_prefs.cc @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/extensions/extension_prefs.h" + #include "base/string_util.h" #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/extensions/extension_prefs.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/pref_names.h" @@ -306,7 +307,7 @@ Time ExtensionPrefs::LastPingDayImpl(const DictionaryValue* dictionary) const { std::string string_value; int64 value; dictionary->GetString(kLastPingDay, &string_value); - if (StringToInt64(string_value, &value)) { + if (base::StringToInt64(string_value, &value)) { return Time::FromInternalValue(value); } } @@ -735,7 +736,7 @@ bool ExtensionPrefs::GetIdleInstallInfo(const std::string& extension_id, return false; int64 fetch_time_value; - if (!StringToInt64(fetch_time_string, &fetch_time_value)) + if (!base::StringToInt64(fetch_time_string, &fetch_time_value)) return false; if (crx_path) diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc index c371aea..3134000 100644 --- a/chrome/browser/extensions/extensions_service.cc +++ b/chrome/browser/extensions/extensions_service.cc @@ -10,6 +10,7 @@ #include "base/histogram.h" #include "base/stl_util-inl.h" #include "base/string16.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/time.h" #include "base/values.h" @@ -180,8 +181,9 @@ ExtensionsService::ExtensionsService(Profile* profile, if (autoupdate_enabled) { int update_frequency = kDefaultUpdateFrequencySeconds; if (command_line->HasSwitch(switches::kExtensionsUpdateFrequency)) { - update_frequency = StringToInt(command_line->GetSwitchValueASCII( - switches::kExtensionsUpdateFrequency)); + base::StringToInt(command_line->GetSwitchValueASCII( + switches::kExtensionsUpdateFrequency), + &update_frequency); } updater_ = new ExtensionUpdater(this, prefs, update_frequency); } diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc index 218e3dd..5dc2def 100644 --- a/chrome/browser/extensions/extensions_service_unittest.cc +++ b/chrome/browser/extensions/extensions_service_unittest.cc @@ -15,6 +15,7 @@ #include "base/path_service.h" #include "base/scoped_ptr.h" #include "base/string16.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/task.h" #include "base/version.h" @@ -537,7 +538,7 @@ class ExtensionsServiceTest msg += L" "; msg += pref_path; msg += L" == "; - msg += IntToWString(expected_val); + msg += UTF8ToWide(base::IntToString(expected_val)); const DictionaryValue* dict = prefs_->GetDictionary(L"extensions.settings"); @@ -580,7 +581,7 @@ class ExtensionsServiceTest msg += L" "; msg += pref_path; msg += L" = "; - msg += IntToWString(value); + msg += UTF8ToWide(base::IntToString(value)); const DictionaryValue* dict = prefs_->GetMutableDictionary(L"extensions.settings"); diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc index 24ca842..03d23dc 100644 --- a/chrome/browser/extensions/extensions_ui.cc +++ b/chrome/browser/extensions/extensions_ui.cc @@ -9,6 +9,7 @@ #include "base/base64.h" #include "base/callback.h" #include "base/file_util.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/thread.h" #include "chrome/browser/browser.h" @@ -67,7 +68,7 @@ static bool ShouldShowExtension(Extension* extension) { return true; } -} +} // namespace //////////////////////////////////////////////////////////////////////////////// // @@ -428,8 +429,8 @@ void ExtensionsDOMHandler::HandleInspectMessage(const Value* value) { CHECK(list->GetSize() == 2); CHECK(list->GetString(0, &render_process_id_str)); CHECK(list->GetString(1, &render_view_id_str)); - CHECK(StringToInt(render_process_id_str, &render_process_id)); - CHECK(StringToInt(render_view_id_str, &render_view_id)); + CHECK(base::StringToInt(render_process_id_str, &render_process_id)); + CHECK(base::StringToInt(render_view_id_str, &render_view_id)); RenderViewHost* host = RenderViewHost::FromID(render_process_id, render_view_id); if (!host) { diff --git a/chrome/browser/find_bar_host_browsertest.cc b/chrome/browser/find_bar_host_browsertest.cc index 8af828d..6e6d33b 100644 --- a/chrome/browser/find_bar_host_browsertest.cc +++ b/chrome/browser/find_bar_host_browsertest.cc @@ -4,6 +4,7 @@ #include "base/keyboard_codes.h" #include "base/message_loop.h" +#include "base/string_util.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_window.h" #include "chrome/browser/find_bar.h" diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc index ceed9bf..48c4d53 100644 --- a/chrome/browser/geolocation/geolocation_browsertest.cc +++ b/chrome/browser/geolocation/geolocation_browsertest.cc @@ -272,10 +272,10 @@ class GeolocationBrowserTest : public InProcessBrowserTest { void CheckGeoposition(const Geoposition& geoposition) { // Checks we have no error. CheckStringValueFromJavascript("0", "geoGetLastError()"); - CheckStringValueFromJavascript( - DoubleToString(geoposition.latitude), "geoGetLastPositionLatitude()"); - CheckStringValueFromJavascript( - DoubleToString(geoposition.longitude), "geoGetLastPositionLongitude()"); + CheckStringValueFromJavascript(base::DoubleToString(geoposition.latitude), + "geoGetLastPositionLatitude()"); + CheckStringValueFromJavascript(base::DoubleToString(geoposition.longitude), + "geoGetLastPositionLongitude()"); } void SetInfobarResponse(const GURL& requesting_url, bool allowed) { diff --git a/chrome/browser/geolocation/wifi_data_provider_linux.cc b/chrome/browser/geolocation/wifi_data_provider_linux.cc index 4bc3441..621e235 100644 --- a/chrome/browser/geolocation/wifi_data_provider_linux.cc +++ b/chrome/browser/geolocation/wifi_data_provider_linux.cc @@ -14,6 +14,7 @@ #include <glib.h> #include "base/scoped_ptr.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" namespace { @@ -294,7 +295,7 @@ bool NetworkManagerWlanApi::GetAccessPointsForAdapter( std::string mac = g_value_get_string(&mac_g_value.v); ReplaceSubstringsAfterOffset(&mac, 0U, ":", ""); std::vector<uint8> mac_bytes; - if (!HexStringToBytes(mac, &mac_bytes) || mac_bytes.size() != 6) { + if (!base::HexStringToBytes(mac, &mac_bytes) || mac_bytes.size() != 6) { DLOG(WARNING) << "Can't parse mac address (found " << mac_bytes.size() << " bytes) so using raw string: " << mac; access_point_data.mac_address = UTF8ToUTF16(mac); diff --git a/chrome/browser/gtk/certificate_viewer.cc b/chrome/browser/gtk/certificate_viewer.cc index ae6fef8..a533060 100644 --- a/chrome/browser/gtk/certificate_viewer.cc +++ b/chrome/browser/gtk/certificate_viewer.cc @@ -17,7 +17,7 @@ #include "base/i18n/time_formatting.h" #include "base/nss_util.h" #include "base/scoped_ptr.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/time.h" #include "base/utf_string_conversions.h" #include "chrome/browser/gtk/certificate_dialogs.h" @@ -394,7 +394,7 @@ void CertificateViewer::FillTreeStoreWithCertFields(GtkTreeStore* store, if (SEC_ASN1DecodeInteger(&cert->version, &version) == SECSuccess && version != ULONG_MAX) version_str = l10n_util::GetStringFUTF8(IDS_CERT_DETAILS_VERSION_FORMAT, - UintToString16(version + 1)); + base::UintToString16(version + 1)); GtkTreeIter iter; gtk_tree_store_append(store, &iter, &cert_iter); gtk_tree_store_set( diff --git a/chrome/browser/history/text_database.cc b/chrome/browser/history/text_database.cc index f2ae15b..2d2c8aa 100644 --- a/chrome/browser/history/text_database.cc +++ b/chrome/browser/history/text_database.cc @@ -13,6 +13,7 @@ #include "base/file_util.h" #include "base/histogram.h" #include "base/logging.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/diagnostics/sqlite_diagnostics.h" @@ -106,8 +107,9 @@ TextDatabase::DBIdent TextDatabase::FileNameToID(const FilePath& file_path) { return 0; } - int year = StringToInt(suffix.substr(0, 4)); - int month = StringToInt(suffix.substr(5, 2)); + int year, month; + base::StringToInt(suffix.substr(0, 4), &year); + base::StringToInt(suffix.substr(5, 2), &month); return year * 100 + month; } diff --git a/chrome/browser/importer/firefox2_importer.cc b/chrome/browser/importer/firefox2_importer.cc index 638d39e..dee56ba 100644 --- a/chrome/browser/importer/firefox2_importer.cc +++ b/chrome/browser/importer/firefox2_importer.cc @@ -14,6 +14,7 @@ #include "base/path_service.h" #include "base/stl_util-inl.h" #include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/history/history_types.h" @@ -483,7 +484,8 @@ bool Firefox2Importer::ParseBookmarkFromLine(const std::string& line, // Add date if (GetAttribute(attribute_list, kAddDateAttribute, &value)) { - int64 time = StringToInt64(value); + int64 time; + base::StringToInt64(value, &time); // Upper bound it at 32 bits. if (0 < time && time < (1LL << 32)) *add_date = Time::FromTimeT(time); diff --git a/chrome/browser/importer/firefox_importer_utils.cc b/chrome/browser/importer/firefox_importer_utils.cc index b9a7a74..c53d4d4 100644 --- a/chrome/browser/importer/firefox_importer_utils.cc +++ b/chrome/browser/importer/firefox_importer_utils.cc @@ -11,6 +11,7 @@ #include "base/file_util.h" #include "base/logging.h" #include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/search_engines/template_url.h" @@ -438,7 +439,7 @@ bool ParsePrefFile(const FilePath& pref_file, DictionaryValue* prefs) { // Or value could be an integer. int int_value = 0; - if (StringToInt(value, &int_value)) { + if (base::StringToInt(value, &int_value)) { prefs->SetInteger(ASCIIToWide(key), int_value); continue; } diff --git a/chrome/browser/importer/importer_bridge.cc b/chrome/browser/importer/importer_bridge.cc index 72a73a6..3a16dd6 100644 --- a/chrome/browser/importer/importer_bridge.cc +++ b/chrome/browser/importer/importer_bridge.cc @@ -184,7 +184,8 @@ void ExternalProcessImporterBridge::NotifyEnded() { std::wstring ExternalProcessImporterBridge::GetLocalizedString( int message_id) { std::wstring message; - localized_strings_->GetString(IntToWString(message_id), &message); + localized_strings_->GetString(ASCIIToWide(base::IntToString(message_id)), + &message); return message; } diff --git a/chrome/browser/importer/mork_reader.cc b/chrome/browser/importer/mork_reader.cc index 49dadb0..9115c8d 100644 --- a/chrome/browser/importer/mork_reader.cc +++ b/chrome/browser/importer/mork_reader.cc @@ -48,6 +48,7 @@ #include "base/i18n/icu_string_conversions.h" #include "base/logging.h" #include "base/message_loop.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "chrome/browser/history/history_types.h" #include "chrome/browser/importer/firefox_importer_utils.h" @@ -530,9 +531,10 @@ void AddToHistory(MorkReader::ColumnDataList* column_values, count = 1; row.set_visit_count(count); - time_t date = StringToInt64(values[kLastVisitColumn]); + int64 date; + base::StringToInt64(values[kLastVisitColumn], &date); if (date != 0) - row.set_last_visit(Time::FromTimeT(date/1000000)); + row.set_last_visit(Time::FromTimeT(date / 1000000)); bool is_typed = (values[kTypedColumn] == "1"); if (is_typed) diff --git a/chrome/browser/importer/toolbar_importer.cc b/chrome/browser/importer/toolbar_importer.cc index 4c2cf56..a50d4c9 100644 --- a/chrome/browser/importer/toolbar_importer.cc +++ b/chrome/browser/importer/toolbar_importer.cc @@ -7,6 +7,7 @@ #include <limits> #include "base/rand_util.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/first_run/first_run.h" @@ -231,7 +232,7 @@ void Toolbar5Importer::GetAuthenticationFromServer() { // Random number construction. int random = base::RandInt(0, std::numeric_limits<int>::max()); - std::string random_string = UintToString(random); + std::string random_string = base::UintToString(random); // Retrieve authorization token from the network. std::string url_string(kT5AuthorizationTokenUrl); @@ -264,7 +265,7 @@ void Toolbar5Importer::GetBookmarkDataFromServer(const std::string& response) { // the xml blob. We must tag the connection string with a random number. std::string conn_string = kT5FrontEndUrlTemplate; int random = base::RandInt(0, std::numeric_limits<int>::max()); - std::string random_string = UintToString(random); + std::string random_string = base::UintToString(random); conn_string.replace(conn_string.find(kRandomNumberToken), arraysize(kRandomNumberToken) - 1, random_string); @@ -520,7 +521,7 @@ bool Toolbar5Importer::ExtractTimeFromXmlReader( return false; } int64 timestamp; - if (!StringToInt64(buffer, ×tamp)) { + if (!base::StringToInt64(buffer, ×tamp)) { return false; } entry->creation_time = base::Time::FromTimeT(timestamp); diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index 998722e..8d1f250 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc @@ -3,9 +3,11 @@ // found in the LICENSE file. #include "chrome/browser/io_thread.h" + #include "base/command_line.h" #include "base/leak_tracker.h" #include "base/logging.h" +#include "base/string_number_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/gpu_process_host.h" @@ -37,7 +39,7 @@ net::HostResolver* CreateGlobalHostResolver() { // Parse the switch (it should be a positive integer formatted as decimal). int n; - if (StringToInt(s, &n) && n > 0) { + if (base::StringToInt(s, &n) && n > 0) { parallelism = static_cast<size_t>(n); } else { LOG(ERROR) << "Invalid switch for host resolver parallelism: " << s; diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc index a01dd24..712dee5 100644 --- a/chrome/browser/net/chrome_url_request_context.cc +++ b/chrome/browser/net/chrome_url_request_context.cc @@ -7,6 +7,7 @@ #include "base/command_line.h" #include "base/message_loop.h" #include "base/message_loop_proxy.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_thread.h" @@ -105,7 +106,7 @@ net::ProxyService* CreateProxyService( // Parse the switch (it should be a positive integer formatted as decimal). int n; - if (StringToInt(s, &n) && n > 0) { + if (base::StringToInt(s, &n) && n > 0) { num_pac_threads = static_cast<size_t>(n); } else { LOG(ERROR) << "Invalid switch for number of PAC threads: " << s; diff --git a/chrome/browser/password_manager/native_backend_gnome_x.cc b/chrome/browser/password_manager/native_backend_gnome_x.cc index aeaf40d..86da685 100644 --- a/chrome/browser/password_manager/native_backend_gnome_x.cc +++ b/chrome/browser/password_manager/native_backend_gnome_x.cc @@ -166,8 +166,8 @@ PasswordForm* FormFromAttributes(GnomeKeyringAttributeList* attrs) { form->ssl_valid = uint_attr_map["ssl_valid"]; form->preferred = uint_attr_map["preferred"]; int64 date_created = 0; - bool date_ok = StringToInt64(string_attr_map["date_created"], - &date_created); + bool date_ok = base::StringToInt64(string_attr_map["date_created"], + &date_created); DCHECK(date_ok); DCHECK_NE(date_created, 0); form->date_created = base::Time::FromTimeT(date_created); diff --git a/chrome/browser/pref_service.cc b/chrome/browser/pref_service.cc index 975750e..e8dd534 100644 --- a/chrome/browser/pref_service.cc +++ b/chrome/browser/pref_service.cc @@ -13,6 +13,7 @@ #include "base/logging.h" #include "base/message_loop.h" #include "base/stl_util-inl.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" #include "base/utf_string_conversions.h" @@ -44,20 +45,19 @@ Value* CreateLocaleDefaultValue(Value::ValueType type, int message_id) { } case Value::TYPE_INTEGER: { - return Value::CreateIntegerValue( - StringToInt(WideToUTF16Hack(resource_string))); - break; + int val; + base::StringToInt(WideToUTF8(resource_string), &val); + return Value::CreateIntegerValue(val); } case Value::TYPE_REAL: { - return Value::CreateRealValue( - StringToDouble(WideToUTF16Hack(resource_string))); - break; + double val; + base::StringToDouble(WideToUTF8(resource_string), &val); + return Value::CreateRealValue(val); } case Value::TYPE_STRING: { return Value::CreateStringValue(resource_string); - break; } default: { @@ -682,7 +682,7 @@ void PrefService::SetInt64(const wchar_t* path, int64 value) { } scoped_ptr<Value> old_value(GetPrefCopy(path)); - Value* new_value = Value::CreateStringValue(Int64ToWString(value)); + Value* new_value = Value::CreateStringValue(base::Int64ToString(value)); pref_value_store_->SetUserPrefValue(path, new_value); FireObserversIfChanged(path, old_value.get()); @@ -699,12 +699,15 @@ int64 PrefService::GetInt64(const wchar_t* path) const { std::wstring result(L"0"); bool rv = pref->GetValue()->GetAsString(&result); DCHECK(rv); - return StringToInt64(WideToUTF16Hack(result)); + + int64 val; + base::StringToInt64(WideToUTF8(result), &val); + return val; } void PrefService::RegisterInt64Pref(const wchar_t* path, int64 default_value) { Preference* pref = new Preference(pref_value_store_.get(), path, - Value::CreateStringValue(Int64ToWString(default_value))); + Value::CreateStringValue(base::Int64ToString(default_value))); RegisterPreference(pref); } diff --git a/chrome/browser/process_singleton_linux.cc b/chrome/browser/process_singleton_linux.cc index 885ed375..b4f8a04 100644 --- a/chrome/browser/process_singleton_linux.cc +++ b/chrome/browser/process_singleton_linux.cc @@ -57,6 +57,7 @@ #include "base/process_util.h" #include "base/safe_strerror_posix.h" #include "base/stl_util-inl.h" +#include "base/string_number_conversions.h" #include "base/sys_string_conversions.h" #include "base/utf_string_conversions.h" #include "base/time.h" @@ -259,7 +260,7 @@ bool ParseLockPath(const std::string& path, *hostname = real_path.substr(0, pos); const std::string& pid_str = real_path.substr(pos + 1); - if (!StringToInt(pid_str, pid)) + if (!base::StringToInt(pid_str, pid)) *pid = -1; return true; @@ -269,7 +270,7 @@ void DisplayProfileInUseError(const std::string& lock_path, const std::string& hostname, int pid) { std::wstring error = l10n_util::GetStringF(IDS_PROFILE_IN_USE_LINUX, - IntToWString(pid), + UTF8ToWide(base::IntToString(pid)), ASCIIToWide(hostname), base::SysNativeMBToWide(lock_path), l10n_util::GetString(IDS_PRODUCT_NAME)); diff --git a/chrome/browser/profile_impl.cc b/chrome/browser/profile_impl.cc index 0ca18c1..6c085f7 100644 --- a/chrome/browser/profile_impl.cc +++ b/chrome/browser/profile_impl.cc @@ -11,6 +11,7 @@ #include "base/file_util.h" #include "base/path_service.h" #include "base/scoped_ptr.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "chrome/browser/appcache/chrome_appcache_service.h" #include "chrome/browser/autocomplete/autocomplete_classifier.h" @@ -133,7 +134,7 @@ void GetCacheParameters(ContextType type, FilePath* cache_path, // By default we let the cache determine the right size. *max_size = 0; - if (!StringToInt(value, max_size)) { + if (!base::StringToInt(value, max_size)) { *max_size = 0; } else if (max_size < 0) { *max_size = 0; diff --git a/chrome/browser/profile_import_process_host.cc b/chrome/browser/profile_import_process_host.cc index 1926204..a5b84ee 100644 --- a/chrome/browser/profile_import_process_host.cc +++ b/chrome/browser/profile_import_process_host.cc @@ -7,7 +7,7 @@ #include "app/l10n_util.h" #include "base/command_line.h" #include "base/message_loop.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/values.h" #include "chrome/browser/importer/firefox_importer_utils.h" #include "chrome/browser/importer/importer_messages.h" @@ -35,20 +35,20 @@ bool ProfileImportProcessHost::StartProfileImportProcess( // in the external process. DictionaryValue localized_strings; localized_strings.SetString( - IntToWString(IDS_BOOKMARK_GROUP_FROM_FIREFOX), - l10n_util::GetString(IDS_BOOKMARK_GROUP_FROM_FIREFOX)); + base::IntToString(IDS_BOOKMARK_GROUP_FROM_FIREFOX), + l10n_util::GetStringUTF8(IDS_BOOKMARK_GROUP_FROM_FIREFOX)); localized_strings.SetString( - IntToWString(IDS_BOOKMARK_GROUP_FROM_SAFARI), - l10n_util::GetString(IDS_BOOKMARK_GROUP_FROM_SAFARI)); + base::IntToString(IDS_BOOKMARK_GROUP_FROM_SAFARI), + l10n_util::GetStringUTF8(IDS_BOOKMARK_GROUP_FROM_SAFARI)); localized_strings.SetString( - IntToWString(IDS_IMPORT_FROM_FIREFOX), - l10n_util::GetString(IDS_IMPORT_FROM_FIREFOX)); + base::IntToString(IDS_IMPORT_FROM_FIREFOX), + l10n_util::GetStringUTF8(IDS_IMPORT_FROM_FIREFOX)); localized_strings.SetString( - IntToWString(IDS_IMPORT_FROM_GOOGLE_TOOLBAR), - l10n_util::GetString(IDS_IMPORT_FROM_GOOGLE_TOOLBAR)); + base::IntToString(IDS_IMPORT_FROM_GOOGLE_TOOLBAR), + l10n_util::GetStringUTF8(IDS_IMPORT_FROM_GOOGLE_TOOLBAR)); localized_strings.SetString( - IntToWString(IDS_IMPORT_FROM_SAFARI), - l10n_util::GetString(IDS_IMPORT_FROM_SAFARI)); + base::IntToString(IDS_IMPORT_FROM_SAFARI), + l10n_util::GetStringUTF8(IDS_IMPORT_FROM_SAFARI)); Send(new ProfileImportProcessMsg_StartImport( profile_info, items, localized_strings, import_to_bookmark_bar)); diff --git a/chrome/browser/renderer_host/render_sandbox_host_linux.cc b/chrome/browser/renderer_host/render_sandbox_host_linux.cc index 1b07361..98e763b 100644 --- a/chrome/browser/renderer_host/render_sandbox_host_linux.cc +++ b/chrome/browser/renderer_host/render_sandbox_host_linux.cc @@ -340,7 +340,7 @@ class SandboxIPCProcess { sandbox_cmd.push_back(base::Int64ToString(inode)); CommandLine get_inode_cmd(sandbox_cmd); if (base::GetAppOutput(get_inode_cmd, &inode_output)) - StringToInt(inode_output, &pid); + base::StringToInt(inode_output, &pid); if (!pid) { LOG(ERROR) << "Could not get pid"; diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc index 693ff5e..c040770 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc @@ -23,7 +23,7 @@ #include "base/command_line.h" #include "base/logging.h" #include "base/message_loop.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/task.h" #include "base/time.h" #include "chrome/browser/gtk/gtk_util.h" @@ -333,7 +333,7 @@ class RenderWidgetHostViewGtkWidget { command_line->GetSwitchValueASCII(switches::kScrollPixels); if (!scroll_pixels_option.empty()) { double v; - if (StringToDouble(scroll_pixels_option, &v)) + if (base::StringToDouble(scroll_pixels_option, &v)) scroll_pixels = static_cast<float>(v); } DCHECK_GT(scroll_pixels, 0); diff --git a/chrome/browser/renderer_host/save_file_resource_handler.cc b/chrome/browser/renderer_host/save_file_resource_handler.cc index fe8aaf9..c46d1fb 100644 --- a/chrome/browser/renderer_host/save_file_resource_handler.cc +++ b/chrome/browser/renderer_host/save_file_resource_handler.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,7 +6,7 @@ #include "base/logging.h" #include "base/message_loop.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/download/save_file_manager.h" #include "net/base/io_buffer.h" @@ -115,5 +115,5 @@ void SaveFileResourceHandler::OnRequestClosed() { void SaveFileResourceHandler::set_content_length( const std::string& content_length) { - content_length_ = StringToInt64(content_length); + base::StringToInt64(content_length, &content_length_); } diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc index 0e0cf4b..be75c6d 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -11,6 +11,7 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/i18n/rtl.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/chrome_thread.h" @@ -332,7 +333,7 @@ void SafeBrowsingBlockingPage::CommandReceived(const std::string& cmd) { DCHECK(colon_index < command.size() - 1); std::string index_str = command.substr(colon_index + 1); command = command.substr(0, colon_index); - bool result = StringToInt(index_str, &element_index); + bool result = base::StringToInt(index_str, &element_index); DCHECK(result); } diff --git a/chrome/browser/search_engines/template_url_model.cc b/chrome/browser/search_engines/template_url_model.cc index 9e12822..ba8e38c 100644 --- a/chrome/browser/search_engines/template_url_model.cc +++ b/chrome/browser/search_engines/template_url_model.cc @@ -863,10 +863,16 @@ bool TemplateURLModel::LoadDefaultSearchProviderFromPrefs( (*default_provider)->set_short_name(name); (*default_provider)->SetURL(search_url, 0, 0); (*default_provider)->SetSuggestionsURL(suggest_url, 0, 0); - if (!id_string.empty()) - (*default_provider)->set_id(StringToInt64(id_string)); - if (!prepopulate_id.empty()) - (*default_provider)->set_prepopulate_id(StringToInt(prepopulate_id)); + if (!id_string.empty()) { + int64 value; + base::StringToInt64(id_string, &value); + (*default_provider)->set_id(value); + } + if (!prepopulate_id.empty()) { + int value; + base::StringToInt(prepopulate_id, &value); + (*default_provider)->set_prepopulate_id(value); + } return true; } diff --git a/chrome/browser/search_engines/template_url_parser.cc b/chrome/browser/search_engines/template_url_parser.cc index 06948cb..245ca3f 100644 --- a/chrome/browser/search_engines/template_url_parser.cc +++ b/chrome/browser/search_engines/template_url_parser.cc @@ -10,6 +10,7 @@ #include "base/logging.h" #include "base/scoped_ptr.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/search_engines/template_url.h" @@ -313,11 +314,11 @@ void ParseURL(const xmlChar** atts, ParsingContext* context) { } else if (name == kURLTemplateAttribute) { template_url = XMLCharToString(value); } else if (name == kURLIndexOffsetAttribute) { - index_offset = - std::max(1, StringToInt(WideToUTF16Hack(XMLCharToWide(value)))); + base::StringToInt(XMLCharToString(value), &index_offset); + index_offset = std::max(1, index_offset); } else if (name == kURLPageOffsetAttribute) { - page_offset = - std::max(1, StringToInt(WideToUTF16Hack(XMLCharToWide(value)))); + base::StringToInt(XMLCharToString(value), &page_offset); + page_offset = std::max(1, page_offset); } else if (name == kParamMethodAttribute) { is_post = LowerCaseEqualsASCII(XMLCharToString(value), "post"); } @@ -350,9 +351,9 @@ void ParseImage(const xmlChar** atts, ParsingContext* context) { if (name == kImageTypeAttribute) { type = XMLCharToWide(value); } else if (name == kImageWidthAttribute) { - width = StringToInt(WideToUTF16Hack(XMLCharToWide(value))); + base::StringToInt(XMLCharToString(value), &width); } else if (name == kImageHeightAttribute) { - height = StringToInt(WideToUTF16Hack(XMLCharToWide(value))); + base::StringToInt(XMLCharToString(value), &height); } attributes += 2; } diff --git a/chrome/browser/sessions/session_restore_uitest.cc b/chrome/browser/sessions/session_restore_uitest.cc index 655fd09..e084d9c 100644 --- a/chrome/browser/sessions/session_restore_uitest.cc +++ b/chrome/browser/sessions/session_restore_uitest.cc @@ -1,11 +1,11 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/command_line.h" #include "base/file_path.h" #include "base/scoped_ptr.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/defaults.h" #include "chrome/common/chrome_paths.h" @@ -39,7 +39,7 @@ class SessionRestoreUITest : public UITest { clear_profile_ = false; launch_arguments_.AppendSwitchASCII(switches::kRestoreLastSession, - IntToString(expected_tab_count)); + base::IntToString(expected_tab_count)); UITest::SetUp(); } diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc index f1dac7b..95b3e85 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc @@ -23,6 +23,7 @@ #include "base/path_service.h" #include "base/process_util.h" #include "base/scoped_temp_dir.h" +#include "base/string_number_conversions.h" #include "base/string_tokenizer.h" #include "base/string_util.h" #include "base/task.h" @@ -113,7 +114,7 @@ std::string CreateShortcutIcon( argv.push_back("user"); argv.push_back("--size"); - argv.push_back(IntToString(shortcut_info.favicon.width())); + argv.push_back(base::IntToString(shortcut_info.favicon.width())); argv.push_back(temp_file_path.value()); std::string icon_name = temp_file_path.BaseName().RemoveExtension().value(); diff --git a/chrome/browser/sync/glue/autofill_model_associator.cc b/chrome/browser/sync/glue/autofill_model_associator.cc index a373575..c4a83ca 100644 --- a/chrome/browser/sync/glue/autofill_model_associator.cc +++ b/chrome/browser/sync/glue/autofill_model_associator.cc @@ -8,6 +8,7 @@ #include "base/task.h" #include "base/time.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "chrome/browser/autofill/autofill_profile.h" #include "chrome/browser/chrome_thread.h" @@ -161,7 +162,7 @@ string16 AutofillModelAssociator::MakeUniqueLabel( const string16& non_unique_label, sync_api::BaseTransaction* trans) { int unique_id = 1; // Priming so we start by appending "2". while (unique_id++ < kMaxNumAttemptsToFindUniqueLabel) { - string16 suffix(UTF8ToUTF16(IntToString(unique_id))); + string16 suffix(base::IntToString16(unique_id)); string16 unique_label = non_unique_label + suffix; sync_api::ReadNode node(trans); if (node.InitByClientTagLookup(syncable::AUTOFILL, diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc index 56f8585..1418793 100644 --- a/chrome/browser/sync/profile_sync_service_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_unittest.cc @@ -8,6 +8,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "base/message_loop.h" #include "base/scoped_ptr.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/string16.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -771,16 +772,16 @@ TEST_F(ProfileSyncServiceTest, RepeatedMiddleInsertion) { // Test insertion in first half of range by repeatedly inserting in second // position. for (int i = 0; i < kTimesToInsert; ++i) { - std::wstring title = std::wstring(L"Pre-insertion ") + IntToWString(i); - model_->AddGroup(model_->other_node(), 1, title); + string16 title = ASCIIToUTF16("Pre-insertion ") + base::IntToString16(i); + model_->AddGroup(model_->other_node(), 1, UTF16ToWideHack(title)); count++; } // Test insertion in second half of range by repeatedly inserting in // second-to-last position. for (int i = 0; i < kTimesToInsert; ++i) { - std::wstring title = std::wstring(L"Post-insertion ") + IntToWString(i); - model_->AddGroup(model_->other_node(), count - 1, title); + string16 title = ASCIIToUTF16("Post-insertion ") + base::IntToString16(i); + model_->AddGroup(model_->other_node(), count - 1, UTF16ToWideHack(title)); count++; } diff --git a/chrome/browser/sync/syncable/directory_backing_store_unittest.cc b/chrome/browser/sync/syncable/directory_backing_store_unittest.cc index 972b5cd..c158f9a 100644 --- a/chrome/browser/sync/syncable/directory_backing_store_unittest.cc +++ b/chrome/browser/sync/syncable/directory_backing_store_unittest.cc @@ -13,6 +13,7 @@ #include "base/scoped_ptr.h" #include "base/scoped_temp_dir.h" #include "base/stl_util-inl.h" +#include "base/string_number_conversions.h" #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" #include "chrome/browser/sync/protocol/sync.pb.h" #include "chrome/browser/sync/syncable/directory_backing_store.h" @@ -772,7 +773,7 @@ TEST_F(DirectoryBackingStoreTest, MigrateVersion70To71) { "initial_sync_ended, last_download_timestamp FROM models")); ASSERT_TRUE(s.Step()); std::string model_id = s.ColumnString(0); - EXPECT_EQ("C2881000", HexEncode(model_id.data(), model_id.size())) + EXPECT_EQ("C2881000", base::HexEncode(model_id.data(), model_id.size())) << "Model ID is expected to be the empty BookmarkSpecifics proto."; EXPECT_EQ(true, s.ColumnBool(1)); EXPECT_EQ(694, s.ColumnInt64(2)); diff --git a/chrome/browser/sync/syncable/syncable.cc b/chrome/browser/sync/syncable/syncable.cc index 807abf6..b94550e 100644 --- a/chrome/browser/sync/syncable/syncable.cc +++ b/chrome/browser/sync/syncable/syncable.cc @@ -1581,7 +1581,7 @@ std::ostream& operator<<(std::ostream& s, const syncable::Blob& blob) { FastDump& operator<<(FastDump& dump, const syncable::Blob& blob) { if (blob.empty()) return dump; - string buffer(HexEncode(&blob[0], blob.size())); + string buffer(base::HexEncode(&blob[0], blob.size())); dump.out_->sputn(buffer.c_str(), buffer.size()); return dump; } diff --git a/chrome/browser/sync/util/crypto_helpers.cc b/chrome/browser/sync/util/crypto_helpers.cc index 801002c..b01e01f 100644 --- a/chrome/browser/sync/util/crypto_helpers.cc +++ b/chrome/browser/sync/util/crypto_helpers.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,6 +11,7 @@ #include "base/format_macros.h" #include "base/logging.h" #include "base/rand_util.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" using std::string; @@ -40,8 +41,8 @@ vector<uint8> MD5Calculator::GetDigest() { std::string MD5Calculator::GetHexDigest() { CalcDigest(); - string hex = HexEncode(reinterpret_cast<char*>(&bin_digest_.front()), - bin_digest_.size()); + string hex = base::HexEncode(reinterpret_cast<char*>(&bin_digest_.front()), + bin_digest_.size()); StringToLowerASCII(&hex); return hex; } diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc index 1d2907a..5860fb5 100644 --- a/chrome/browser/task_manager.cc +++ b/chrome/browser/task_manager.cc @@ -10,6 +10,7 @@ #include "base/i18n/number_formatting.h" #include "base/i18n/rtl.h" #include "base/process_util.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/thread.h" #include "chrome/browser/browser_list.h" @@ -166,7 +167,8 @@ std::wstring TaskManagerModel::GetResourcePhysicalMemory(int index) const { std::wstring TaskManagerModel::GetResourceProcessId(int index) const { DCHECK(index < ResourceCount()); - return IntToWString(base::GetProcId(resources_[index]->GetProcess())); + return UTF8ToWide(base::IntToString(base::GetProcId( + resources_[index]->GetProcess()))); } std::wstring TaskManagerModel::GetResourceGoatsTeleported(int index) const { diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc index 7025bf6..fae029c 100644 --- a/chrome/browser/views/about_chrome_view.cc +++ b/chrome/browser/views/about_chrome_view.cc @@ -13,6 +13,7 @@ #include "base/callback.h" #include "base/file_version_info.h" #include "base/i18n/rtl.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/metrics/user_metrics.h" @@ -803,7 +804,7 @@ void AboutChromeView::UpdateStatus(GoogleUpdateUpgradeResult result, profile_); check_button_status_ = CHECKBUTTON_HIDDEN; update_label_.SetText(l10n_util::GetStringF(IDS_UPGRADE_ERROR, - IntToWString(error_code))); + UTF8ToWide(base::IntToString(error_code)))); show_timeout_indicator = true; break; default: diff --git a/chrome/browser/views/find_bar_host_interactive_uitest.cc b/chrome/browser/views/find_bar_host_interactive_uitest.cc index 8c04ab7..d2934cb 100644 --- a/chrome/browser/views/find_bar_host_interactive_uitest.cc +++ b/chrome/browser/views/find_bar_host_interactive_uitest.cc @@ -4,6 +4,7 @@ #include "base/keyboard_codes.h" #include "base/message_loop.h" +#include "base/string_util.h" #include "chrome/browser/automation/ui_controls.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_window.h" diff --git a/chrome/browser/views/find_bar_view.cc b/chrome/browser/views/find_bar_view.cc index 5af5125..28c349a 100644 --- a/chrome/browser/views/find_bar_view.cc +++ b/chrome/browser/views/find_bar_view.cc @@ -8,7 +8,9 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/browser_theme_provider.h" #include "chrome/browser/find_bar_controller.h" #include "chrome/browser/find_bar_state.h" @@ -199,8 +201,8 @@ void FindBarView::UpdateForResult(const FindNotificationDetails& result, if (!find_text.empty() && have_valid_range) { match_count_text_->SetText( l10n_util::GetStringF(IDS_FIND_IN_PAGE_COUNT, - IntToWString(result.active_match_ordinal()), - IntToWString(result.number_of_matches()))); + UTF8ToWide(base::IntToString(result.active_match_ordinal())), + UTF8ToWide(base::IntToString(result.number_of_matches())))); UpdateMatchCountAppearance(result.number_of_matches() == 0 && result.final_update()); diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index b3f4180..0e11eaa 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -11,6 +11,8 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/i18n/rtl.h" +#include "base/string_number_conversions.h" +#include "base/utf_string_conversions.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/app_modal_dialog_queue.h" #include "chrome/browser/automation/ui_controls.h" @@ -288,7 +290,8 @@ class DownloadInProgressConfirmDialogDelegate : public views::DialogDelegate, } else { warning_text = l10n_util::GetStringF(IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_WARNING, - product_name_, IntToWString(download_count)); + product_name_, + UTF8ToWide(base::IntToString(download_count))); explanation_text = l10n_util::GetStringF( IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION, product_name_); diff --git a/chrome/browser/views/wrench_menu.cc b/chrome/browser/views/wrench_menu.cc index ae61b27..0980e9c 100644 --- a/chrome/browser/views/wrench_menu.cc +++ b/chrome/browser/views/wrench_menu.cc @@ -8,6 +8,7 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/browser.h" @@ -463,7 +464,8 @@ class WrenchMenu::ZoomView : public ScheduleAllView, increment_button_->SetEnabled(enable_increment); decrement_button_->SetEnabled(enable_decrement); zoom_label_->SetText(l10n_util::GetStringF( - IDS_ZOOM_PERCENT, IntToWString(zoom_percent))); + IDS_ZOOM_PERCENT, + UTF8ToWide(base::IntToString(zoom_percent)))); // If both increment and decrement are disabled, then we disable the zoom // label too. zoom_label_->SetEnabled(enable_increment || enable_decrement); diff --git a/chrome/browser/web_resource/web_resource_service.cc b/chrome/browser/web_resource/web_resource_service.cc index 9ddfa7e..860c44d 100644 --- a/chrome/browser/web_resource/web_resource_service.cc +++ b/chrome/browser/web_resource/web_resource_service.cc @@ -5,6 +5,7 @@ #include "base/command_line.h" #include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/time.h" #include "base/utf_string_conversions.h" #include "base/values.h" @@ -273,9 +274,11 @@ void WebResourceService::StartAfterDelay() { std::string last_update_pref = prefs_->GetString(prefs::kNTPTipsCacheUpdate); if (!last_update_pref.empty()) { + double last_update_value; + base::StringToDouble(last_update_pref, &last_update_value); int ms_until_update = kCacheUpdateDelay - static_cast<int>((base::Time::Now() - base::Time::FromDoubleT( - StringToDouble(last_update_pref))).InMilliseconds()); + last_update_value)).InMilliseconds()); delay = ms_until_update > kCacheUpdateDelay ? kCacheUpdateDelay : (ms_until_update < kStartResourceFetchDelay ? @@ -293,6 +296,6 @@ void WebResourceService::UpdateResourceCache(const std::string& json_data) { // Update resource server and cache update time in preferences. prefs_->SetString(prefs::kNTPTipsCacheUpdate, - DoubleToString(base::Time::Now().ToDoubleT())); + base::DoubleToString(base::Time::Now().ToDoubleT())); prefs_->SetString(prefs::kNTPTipsServer, web_resource_server_); } diff --git a/chrome/browser/zygote_host_linux.cc b/chrome/browser/zygote_host_linux.cc index 95db15a..4d9189f 100644 --- a/chrome/browser/zygote_host_linux.cc +++ b/chrome/browser/zygote_host_linux.cc @@ -163,7 +163,7 @@ void ZygoteHost::Init(const std::string& sandbox_cmd) { get_inode_cmdline.push_back(base::Int64ToString(inode)); CommandLine get_inode_cmd(get_inode_cmdline); if (base::GetAppOutput(get_inode_cmd, &inode_output)) { - StringToInt(inode_output, &pid_); + base::StringToInt(inode_output, &pid_); } } CHECK(pid_ > 0) << "Did not find zygote process (using sandbox binary " diff --git a/chrome/common/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc index 259849b..17c176d 100644 --- a/chrome/common/extensions/extension_unittest.cc +++ b/chrome/common/extensions/extension_unittest.cc @@ -14,6 +14,7 @@ #include "base/file_util.h" #include "base/i18n/rtl.h" #include "base/path_service.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/common/chrome_paths.h" @@ -123,7 +124,7 @@ TEST(ExtensionTest, InitFromValueInvalid) { DictionaryValue* icons = NULL; input_value->GetDictionary(keys::kIcons, &icons); ASSERT_FALSE(NULL == icons); - icons->SetInteger(ASCIIToWide(IntToString(128)), 42); + icons->SetInteger(ASCIIToWide(base::IntToString(128)), 42); EXPECT_FALSE(extension.InitFromValue(*input_value, true, &error)); EXPECT_TRUE(MatchPatternASCII(error, errors::kInvalidIconPath)); diff --git a/chrome/common/json_pref_store_unittest.cc b/chrome/common/json_pref_store_unittest.cc index 723a959..8f05fd8 100644 --- a/chrome/common/json_pref_store_unittest.cc +++ b/chrome/common/json_pref_store_unittest.cc @@ -7,6 +7,7 @@ #include "base/message_loop_proxy.h" #include "base/path_service.h" #include "base/scoped_ptr.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/thread.h" #include "base/utf_string_conversions.h" @@ -134,9 +135,12 @@ TEST_F(JsonPrefStoreTest, Basic) { EXPECT_TRUE(prefs->GetInteger(kMaxTabs, &integer)); EXPECT_EQ(10, integer); - prefs->SetString(kLongIntPref, Int64ToWString(214748364842LL)); + prefs->SetString(kLongIntPref, + UTF8ToWide(base::Int64ToString(214748364842LL))); EXPECT_TRUE(prefs->GetString(kLongIntPref, &string_value)); - EXPECT_EQ(214748364842LL, StringToInt64(WideToUTF16Hack(string_value))); + int64 value; + base::StringToInt64(WideToUTF8(string_value), &value); + EXPECT_EQ(214748364842LL, value); // Serialize and compare to expected output. FilePath output_file = input_file; diff --git a/chrome/installer/util/compat_checks.cc b/chrome/installer/util/compat_checks.cc index 2eaa2dd..3c13b21 100644 --- a/chrome/installer/util/compat_checks.cc +++ b/chrome/installer/util/compat_checks.cc @@ -1,10 +1,11 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/installer/util/compat_checks.h" #include "base/registry.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" namespace { @@ -27,11 +28,11 @@ bool ParseSEPVersion(const std::wstring& version, int* v0, int* v1, int* v2) { SplitString(version, L'.', &v); if (v.size() != 4) return false; - if (!StringToInt(v[0], v0)) + if (!base::StringToInt(v[0], v0)) return false; - if (!StringToInt(v[1], v1)) + if (!base::StringToInt(v[1], v1)) return false; - if (!StringToInt(v[2], v2)) + if (!base::StringToInt(v[2], v2)) return false; return true; } diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index d3ee31a..15e1d2a 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -18,6 +18,7 @@ #include "base/rand_util.h" #include "base/registry.h" #include "base/scoped_ptr.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "base/win_util.h" @@ -131,7 +132,7 @@ int GetDirectoryWriteAgeInHours(const wchar_t* path) { bool RelaunchSetup(const std::wstring& flag, int value, bool system_level_toast) { CommandLine cmd_line(CommandLine::ForCurrentProcess()->GetProgram()); - cmd_line.AppendSwitchASCII(WideToASCII(flag), IntToString(value)); + cmd_line.AppendSwitchASCII(WideToASCII(flag), base::IntToString(value)); if (system_level_toast) cmd_line.AppendSwitch( WideToASCII(installer_util::switches::kSystemLevelToast)); diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc index 36f6f1d..e56f1c6 100644 --- a/chrome/installer/util/google_update_settings.cc +++ b/chrome/installer/util/google_update_settings.cc @@ -4,8 +4,11 @@ #include "chrome/installer/util/google_update_settings.h" +#include <algorithm> + #include "base/command_line.h" #include "base/registry.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/time.h" #include "chrome/common/chrome_switches.h" @@ -101,17 +104,17 @@ int GoogleUpdateSettings::GetLastRunTime() { if (!ReadGoogleUpdateStrKey(google_update::kRegLastRunTimeField, &time_s)) return -1; int64 time_i; - if (!StringToInt64(time_s, &time_i)) + if (!base::StringToInt64(time_s, &time_i)) return -1; base::TimeDelta td = - base::Time::NowFromSystemTime() - base::Time::FromInternalValue(time_i); + base::Time::NowFromSystemTime() - base::Time::FromInternalValue(time_i); return td.InDays(); } bool GoogleUpdateSettings::SetLastRunTime() { int64 time = base::Time::NowFromSystemTime().ToInternalValue(); return WriteGoogleUpdateStrKey(google_update::kRegLastRunTimeField, - Int64ToWString(time)); + base::Int64ToString16(time)); } bool GoogleUpdateSettings::RemoveLastRunTime() { diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index dda1d1e..a8908c84 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -19,6 +19,7 @@ #include "base/registry.h" #include "base/scoped_ptr.h" #include "base/stl_util-inl.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/win_util.h" #include "chrome/common/chrome_constants.h" @@ -502,7 +503,7 @@ std::wstring ShellUtil::GetChromeIcon(const std::wstring& chrome_exe) { BrowserDistribution* dist = BrowserDistribution::GetDistribution(); std::wstring chrome_icon(chrome_exe); chrome_icon.append(L","); - chrome_icon.append(IntToWString(dist->GetIconIndex())); + chrome_icon.append(base::IntToString16(dist->GetIconIndex())); return chrome_icon; } diff --git a/chrome/installer/util/version.cc b/chrome/installer/util/version.cc index 6dfc205..94bc9c3 100644 --- a/chrome/installer/util/version.cc +++ b/chrome/installer/util/version.cc @@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/installer/util/version.h" + #include <vector> #include "base/format_macros.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" -#include "chrome/installer/util/version.h" installer::Version::Version(int64 major, int64 minor, int64 build, int64 patch) @@ -42,6 +44,10 @@ installer::Version* installer::Version::GetVersionFromString( return NULL; } - return new Version(StringToInt64(numbers[0]), StringToInt64(numbers[1]), - StringToInt64(numbers[2]), StringToInt64(numbers[3])); + int64 v0, v1, v2, v3; + base::StringToInt64(numbers[0], &v0); + base::StringToInt64(numbers[1], &v1); + base::StringToInt64(numbers[2], &v2); + base::StringToInt64(numbers[3], &v3); + return new Version(v0, v1, v2, v3); } diff --git a/chrome/renderer/localized_error.cc b/chrome/renderer/localized_error.cc index bcdd50f..b6cb9ae 100644 --- a/chrome/renderer/localized_error.cc +++ b/chrome/renderer/localized_error.cc @@ -7,7 +7,7 @@ #include "app/l10n_util.h" #include "base/i18n/rtl.h" #include "base/logging.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/values.h" #include "googleurl/src/gurl.h" #include "grit/generated_resources.h" @@ -183,7 +183,7 @@ void GetLocalizedErrorValues(const WebURLError& error, std::wstring details = l10n_util::GetString(options.details_resource_id); error_strings->SetString(L"details", l10n_util::GetStringF(IDS_ERRORPAGES_DETAILS_TEMPLATE, - IntToWString(-error_code), + ASCIIToWide(base::IntToString(-error_code)), ASCIIToWide(net::ErrorToString(error_code)), details)); diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc index 9916ca0..0fc4d82 100644 --- a/chrome/renderer/webplugin_delegate_pepper.cc +++ b/chrome/renderer/webplugin_delegate_pepper.cc @@ -28,6 +28,7 @@ #endif #include "base/scoped_ptr.h" #include "base/stats_counters.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/task.h" #include "base/time.h" @@ -609,7 +610,7 @@ NPError WebPluginDelegatePepper::Device2DGetStateContext( std::string hex_md5 = MD5DigestToBase16(md5_result); // Return the least significant 8 characters (i.e. 4 bytes) // of the 32 character hexadecimal result as an int. - *value = HexStringToInt(hex_md5.substr(24)); + base::HexStringToInt(hex_md5.substr(24), value); return NPERR_NO_ERROR; } return NPERR_GENERIC_ERROR; diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.cc b/chrome/test/automated_ui_tests/automated_ui_tests.cc index 85992bd..e7df26d 100644 --- a/chrome/test/automated_ui_tests/automated_ui_tests.cc +++ b/chrome/test/automated_ui_tests/automated_ui_tests.cc @@ -13,6 +13,7 @@ #include "base/logging.h" #include "base/path_service.h" #include "base/rand_util.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/time.h" #include "chrome/app/chrome_dll_resource.h" @@ -127,7 +128,7 @@ AutomatedUITest::AutomatedUITest() if (str.empty()) { post_action_delay_ = 1; } else { - post_action_delay_ = StringToInt(str); + base::StringToInt(str, &post_action_delay_); } } scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); @@ -146,8 +147,9 @@ void AutomatedUITest::RunReproduction() { int64 num_reproductions = 1; if (parsed_command_line.HasSwitch(kReproRepeatSwitch)) { - num_reproductions = StringToInt64( - parsed_command_line.GetSwitchValueASCII(kReproRepeatSwitch)); + base::StringToInt64( + parsed_command_line.GetSwitchValueASCII(kReproRepeatSwitch), + &num_reproductions); } std::vector<std::string> actions; SplitString(action_string, ',', &actions); diff --git a/chrome/test/automation/dom_automation_browsertest.cc b/chrome/test/automation/dom_automation_browsertest.cc index 7085395..dbaa1ef 100644 --- a/chrome/test/automation/dom_automation_browsertest.cc +++ b/chrome/test/automation/dom_automation_browsertest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/ref_counted.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "chrome/test/automation/dom_element_proxy.h" #include "chrome/test/automation/javascript_execution_controller.h" @@ -45,8 +46,10 @@ IN_PROC_BROWSER_TEST_F(DOMAutomationTest, FindByXPath) { std::vector<DOMElementProxyRef> elements; ASSERT_TRUE(main_doc->FindElements(By::XPath("//div"), &elements)); ASSERT_EQ(2u, elements.size()); - for (size_t i = 0; i < elements.size(); i++) - ASSERT_NO_FATAL_FAILURE(elements[i]->EnsureNameMatches(UintToString(i))); + for (size_t i = 0; i < elements.size(); i++) { + ASSERT_NO_FATAL_FAILURE(elements[i]->EnsureNameMatches( + base::UintToString(i))); + } // Find 0 elements. ASSERT_FALSE(main_doc->FindElement(By::XPath("//nosuchtag"))); @@ -90,8 +93,10 @@ IN_PROC_BROWSER_TEST_F(DOMAutomationTest, FindBySelectors) { std::vector<DOMElementProxyRef> elements; ASSERT_TRUE(main_doc->FindElements(By::Selectors(".myclass"), &elements)); ASSERT_EQ(2u, elements.size()); - for (size_t i = 0; i < elements.size(); i++) - ASSERT_NO_FATAL_FAILURE(elements[i]->EnsureNameMatches(UintToString(i))); + for (size_t i = 0; i < elements.size(); i++) { + ASSERT_NO_FATAL_FAILURE(elements[i]->EnsureNameMatches( + base::UintToString(i))); + } // Find 0 elements. ASSERT_FALSE(main_doc->FindElement(By::Selectors("#nosuchid"))); @@ -131,8 +136,10 @@ IN_PROC_BROWSER_TEST_F(DOMAutomationTest, FindByText) { std::vector<DOMElementProxyRef> elements; ASSERT_TRUE(main_doc->FindElements(By::Text("div_text"), &elements)); ASSERT_EQ(2u, elements.size()); - for (size_t i = 0; i < elements.size(); i++) - ASSERT_NO_FATAL_FAILURE(elements[i]->EnsureNameMatches(UintToString(i))); + for (size_t i = 0; i < elements.size(); i++) { + ASSERT_NO_FATAL_FAILURE(elements[i]->EnsureNameMatches( + base::UintToString(i))); + } // Find 0 elements. ASSERT_FALSE(main_doc->FindElement(By::Text("nosuchtext"))); diff --git a/chrome/test/automation/extension_proxy.cc b/chrome/test/automation/extension_proxy.cc index 66aa8e8..29fd54c 100644 --- a/chrome/test/automation/extension_proxy.cc +++ b/chrome/test/automation/extension_proxy.cc @@ -4,6 +4,7 @@ #include "chrome/test/automation/extension_proxy.h" +#include "base/string_number_conversions.h" #include "chrome/test/automation/automation_messages.h" #include "chrome/test/automation/automation_proxy.h" #include "chrome/test/automation/browser_proxy.h" @@ -94,7 +95,7 @@ bool ExtensionProxy::GetBrowserActionIndex(int* index) { // Do not modify |index| until we are sure we can get the value, just to be // nice to the caller. int converted_index; - if (!StringToInt(index_string, &converted_index)) { + if (!base::StringToInt(index_string, &converted_index)) { LOG(ERROR) << "Received index string could not be converted to int: " << index_string; return false; diff --git a/chrome/test/live_sync/bookmark_model_verifier.cc b/chrome/test/live_sync/bookmark_model_verifier.cc index 365f55b4..ba2904a 100644 --- a/chrome/test/live_sync/bookmark_model_verifier.cc +++ b/chrome/test/live_sync/bookmark_model_verifier.cc @@ -9,6 +9,7 @@ #include "app/tree_node_iterator.h" #include "base/rand_util.h" +#include "base/string_number_conversions.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/test/live_sync/live_bookmarks_sync_test.h" @@ -155,9 +156,9 @@ const BookmarkNode* BookmarkModelVerifier::AddNonEmptyGroup( if (random_int > 40) { wstring child_bm_title(bm_folder->GetTitle()); child_bm_title.append(L"-ChildBM"); - child_bm_title.append(IntToWString(index)); + child_bm_title.append(UTF8ToWide(base::IntToString(index))); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* child_nofavicon_bm = AddURL(model, bm_folder, child_index, child_bm_title, GURL(url)); @@ -166,7 +167,7 @@ const BookmarkNode* BookmarkModelVerifier::AddNonEmptyGroup( // Remaining % of time - Add Bookmark folders wstring child_bmfolder_title(bm_folder->GetTitle()); child_bmfolder_title.append(L"-ChildBMFolder"); - child_bmfolder_title.append(IntToWString(index)); + child_bmfolder_title.append(UTF8ToWide(base::IntToString(index))); const BookmarkNode* child_bm_folder = AddGroup(model, bm_folder, child_index, child_bmfolder_title); EXPECT_TRUE(child_bm_folder != NULL); diff --git a/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc b/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc index 79bcb50..35f2053 100644 --- a/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc +++ b/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/rand_util.h" +#include "base/string_number_conversions.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/test/live_sync/live_bookmarks_sync_test.h" -#include "base/rand_util.h" using std::string; using std::wstring; @@ -18,6 +19,12 @@ using std::wstring; // SC/MC - SingleClient / MultiClient. // Suffix Number - Indicates test scribe testcase ID. +// TODO(brettw) this file should be converted to string16 and use +// IntToString16 instead. +static std::wstring IntToWStringHack(int val) { + return UTF8ToWide(base::IntToString(val)); +} + IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, Sanity) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; BookmarkModelVerifier* v = verifier_helper(); @@ -257,9 +264,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add some GetBookmarkModel(without favicon) for (int index = 0; index < 20; index++) { wstring title(L"TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_bar0, index, title, GURL(url)); @@ -267,9 +274,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, } for (int index = 0; index < 10; index++) { wstring title(L"TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_other0, index, title, GURL(url)); @@ -298,9 +305,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // To create randomness in order, 40% of time add bookmarks if (random_int > 60) { wstring title(L"BB - TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_bar0, index, title, GURL(url)); @@ -308,7 +315,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, } else { // Remaining % of time - Add Bookmark folders wstring title(L"BB - TestBMFolder"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); const BookmarkNode* bm_folder = v->AddGroup(bm0, bm_bar0, index, title); int random_int2 = base::RandInt(1, 100); @@ -317,9 +324,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, for (int index = 0; index < 20; index++) { wstring child_title(title); child_title.append(L" - ChildTestBM"); - child_title.append(IntToWString(index)); + child_title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_folder, index, child_title, GURL(url)); @@ -331,9 +338,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, LOG(INFO) << "Adding several bookmarks under other bookmarks"; for (int index = 0; index < 10; index++) { wstring title(L"Other - TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl-other"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_other0, index, title, GURL(url)); @@ -504,9 +511,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // To create randomness in order, 85% of time add bookmarks if (random_int > 15) { wstring title(L"Test BMFolder - ChildTestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, test_bm_folder, index, @@ -515,7 +522,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, } else { // Remaining % of time - Add Bookmark folders wstring title(L"Test BMFolder - ChildTestBMFolder"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); const BookmarkNode* bm_folder = v->AddGroup(bm0, test_bm_folder, index, title); ASSERT_TRUE(bm_folder != NULL); @@ -552,9 +559,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add few bookmarks under bookmark_bar. for (int index = 1; index < 15; index++) { wstring title(L"TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_bar0, index, title, GURL(url)); @@ -570,9 +577,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // To create randomness in order, 85% of time add bookmarks if (random_int > 15) { wstring title(L"Test BMFolder - ChildTestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, test_bm_folder, index, @@ -581,7 +588,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, } else { // Remaining % of time - Add Bookmark folders wstring title(L"Test BMFolder - ChildTestBMFolder"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); const BookmarkNode* bm_folder = v->AddGroup(bm0, test_bm_folder, index, title); ASSERT_TRUE(bm_folder != NULL); @@ -678,9 +685,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add some GetBookmarkModel(without favicon) for (int index = 0; index < 20; index++) { wstring title(L"TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL( bm0, bm_bar0, index, @@ -718,9 +725,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add some GetBookmarkModel(without favicon) to this folder for (int index = 0; index < 10; index++) { wstring title(L"TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_folder_one, index, title, GURL(url)); @@ -757,9 +764,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add some GetBookmarkModel(without favicon) to this folder for (int index = 0; index < 10; index++) { wstring title(L"TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL( bm0, bm_folder_one, @@ -798,9 +805,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add some GetBookmarkModel(without favicon) to this folder for (int index = 0; index < 10; index++) { wstring title(L"TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_folder_one, index, title, GURL(url)); @@ -837,9 +844,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add some GetBookmarkModel(without favicon) to this folder for (int index = 0; index < 10; index++) { wstring title(L"TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_folder_one, index, title, GURL(url)); @@ -911,9 +918,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // To create randomness in order, 40% of time add bookmarks if (random_int > 60) { wstring title(L"BB - TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_bar0, index, title, GURL(url)); @@ -921,7 +928,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, } else { // Remaining % of time - Add Bookmark folders wstring title(L"BB - TestBMFolder"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); const BookmarkNode* bm_folder = v->AddGroup(bm0, bm_bar0, index, title); ASSERT_TRUE(bm_folder != NULL); @@ -967,9 +974,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // To create randomness in order, 40% of time add bookmarks if (random_int > 60) { wstring title(L"BB - TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_bar0, index, title, GURL(url)); @@ -977,7 +984,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, } else { // Remaining % of time - Add Bookmark folders wstring title(L"BB - TestBMFolder"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); const BookmarkNode* bm_folder = v->AddGroup(bm0, bm_bar0, index, title); ASSERT_TRUE(bm_folder != NULL); @@ -987,9 +994,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add some bookmarks(without favicon) to bm_folder_one ('TestFolder') for (int index = 0; index < 15; index++) { wstring title(L"Level2 - TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_folder_one, index, title, GURL(url)); @@ -1032,9 +1039,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // To create randomness in order, 40% of time add bookmarks if (random_int > 60) { wstring title(L"BB - TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_bar0, index, title, GURL(url)); @@ -1042,7 +1049,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, } else { // Remaining % of time - Add Bookmark folders wstring title(L"BB - TestBMFolder"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); const BookmarkNode* bm_folder = v->AddGroup(bm0, bm_bar0, index, title); ASSERT_TRUE(bm_folder != NULL); @@ -1056,9 +1063,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // To create randomness in order, 40% of time add bookmarks if (random_int > 60) { wstring title(L"Level2 - TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_folder_one, index, title, GURL(url)); @@ -1066,7 +1073,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, } else { // Remaining % of time - Add Bookmark folders wstring title(L"Level2 - TestBMFolder"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); const BookmarkNode* l2_bm_folder = v->AddGroup(bm0, bm_folder_one, index, title); int random_int2 = base::RandInt(1, 100); @@ -1078,9 +1085,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // To create randomness in order, 40% of time add bookmarks if (random_int3 > 60) { wstring title(L"Level3 - TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, l2_bm_folder, index2, title, GURL(url)); @@ -1088,7 +1095,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, } else { // Remaining % of time - Add Bookmark folders wstring title(L"Level3 - TestBMFolder"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); const BookmarkNode* l3_bm_folder = v->AddGroup(bm0, l2_bm_folder, index2, title); ASSERT_TRUE(l3_bm_folder != NULL); @@ -1127,9 +1134,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add few bookmarks under bookmark_bar. for (int index = 1; index < 11; index++) { wstring title(L"TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_bar0, index, title, GURL(url)); @@ -1145,9 +1152,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // To create randomness in order, 80% of time add bookmarks if (random_int > 20) { wstring title(L"Test BMFolder - ChildTestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, test_bm_folder, index, title, @@ -1156,7 +1163,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, } else { // Remaining % of time - Add Bookmark folders wstring title(L"Test BMFolder - ChildTestBMFolder"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); const BookmarkNode* bm_folder = v->AddGroup(bm0, test_bm_folder, index, title); ASSERT_TRUE(bm_folder != NULL); @@ -1220,9 +1227,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add 10 bookmarks like 0123456789 for (int index = 0; index < 10; index++) { wstring title(L"BM-"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl-"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_bar0, index, title, GURL(url)); @@ -1263,9 +1270,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add some GetBookmarkModel(without favicon) to bookmark bar for (int index = 2; index < 10; index++) { wstring title(L"BB - TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_bar0, index, title, GURL(url)); @@ -1308,9 +1315,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add some GetBookmarkModel(without favicon) to bm_folder_one for (int index = 0; index < 10; index++) { wstring title(L"BB - TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_folder_one, index, title, GURL(url)); @@ -1361,9 +1368,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add few bookmarks under child_folder. for (int index = 0; index < 10; index++) { wstring title(L"TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, child_folder, index, title, GURL(url)); @@ -1473,15 +1480,15 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, wstring title(bm_folder->GetTitle()); title.append(L"-BM"); string url("http://www.nofaviconurl-"); - title.append(IntToWString(index)); - url.append(IntToString(index)); + title.append(IntToWStringHack(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_folder, index, title, GURL(url)); ASSERT_TRUE(nofavicon_bm != NULL); } wstring title(L"Test BMFolder-"); - title.append(IntToWString(level)); + title.append(IntToWStringHack(level)); bm_folder = v->AddGroup(bm0, bm_folder, bm_folder->GetChildCount(), title); @@ -1541,15 +1548,15 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, wstring title(bm_folder->GetTitle()); title.append(L"-BM"); string url("http://www.nofaviconurl-"); - title.append(IntToWString(index)); - url.append(IntToString(index)); + title.append(IntToWStringHack(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_folder, index, title, GURL(url)); ASSERT_TRUE(nofavicon_bm != NULL); } wstring title(L"Test BMFolder-"); - title.append(IntToWString(level)); + title.append(IntToWStringHack(level)); bm_folder = v->AddGroup(bm0, bm_folder, bm_folder->GetChildCount(), title); @@ -1612,15 +1619,15 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, wstring title(bm_folder->GetTitle()); title.append(L"-BM"); string url("http://www.nofaviconurl-"); - title.append(IntToWString(index)); - url.append(IntToString(index)); + title.append(IntToWStringHack(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_folder, index, title, GURL(url)); ASSERT_TRUE(nofavicon_bm != NULL); } wstring title(L"Test BMFolder-"); - title.append(IntToWString(level)); + title.append(IntToWStringHack(level)); bm_folder = v->AddGroup(bm0, bm_folder, bm_folder->GetChildCount(), title); @@ -1667,15 +1674,15 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, wstring title(bm_folder->GetTitle()); title.append(L"-BM"); string url("http://www.nofaviconurl-"); - title.append(IntToWString(index)); - url.append(IntToString(index)); + title.append(IntToWStringHack(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_folder, index, title, GURL(url)); ASSERT_TRUE(nofavicon_bm != NULL); } wstring title(L"Test BMFolder-"); - title.append(IntToWString(level)); + title.append(IntToWStringHack(level)); bm_folder = v->AddGroup(bm0, bm_folder, bm_folder->GetChildCount(), title); @@ -1691,8 +1698,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, wstring title(bm_folder->GetTitle()); title.append(L"-BM"); string url("http://www.nofaviconurl-"); - title.append(IntToWString(index)); - url.append(IntToString(index)); + title.append(IntToWStringHack(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, my_bm_folder, index, title, GURL(url)); @@ -1734,15 +1741,15 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, wstring title(bm_folder->GetTitle()); title.append(L"-BM"); string url("http://www.nofaviconurl-"); - title.append(IntToWString(index)); - url.append(IntToString(index)); + title.append(IntToWStringHack(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, bm_folder, index, title, GURL(url)); ASSERT_TRUE(nofavicon_bm != NULL); } wstring title(L"Test BMFolder-"); - title.append(IntToWString(level)); + title.append(IntToWStringHack(level)); bm_folder = v->AddGroup(bm0, bm_folder, bm_folder->GetChildCount(), title); @@ -1758,8 +1765,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, wstring title(bm_folder->GetTitle()); title.append(L"-BM"); string url("http://www.nofaviconurl-"); - title.append(IntToWString(index)); - url.append(IntToString(index)); + title.append(IntToWStringHack(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm = v->AddURL(bm0, my_bm_folder, index, title, GURL(url)); @@ -1826,7 +1833,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add 10 non-empty bookmark folders like 0123456789 for (int index = 0; index < 10; index++) { wstring title(L"BM Folder"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); const BookmarkNode* child_bm_folder = v->AddNonEmptyGroup( bm0, bm_bar0, index, title, 10); ASSERT_TRUE(child_bm_folder != NULL); @@ -1901,9 +1908,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add same bookmarks (without favicon) to both clients. for (int index = 0; index < 3; index++) { wstring title(L"TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm_client0 = bm0->AddURL(bm_bar0, index, title, GURL(url)); @@ -1916,9 +1923,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add some different bookmarks (without favicon) to client1. for (int index = 3; index < 11 ; index++) { wstring title(L"Client1-TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.client1-nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm_client0 = bm0->AddURL(bm_bar0, index, title, GURL(url)); @@ -1928,9 +1935,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add some different bookmarks (without favicon) to client2. for (int index = 3; index < 11 ; index++) { wstring title(L"Client2-TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.Client2-nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm_client1 = bm1->AddURL(bm_bar1, index, title, GURL(url)); @@ -1963,9 +1970,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add same bookmarks (without favicon) to both clients. for (int index = 0; index < 3 ; index++) { wstring title(L"TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm_client0 = bm0->AddURL(bm_bar0, index, title, GURL(url)); @@ -1978,9 +1985,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add some different bookmarks (without favicon) to client2. for (int index = 3; index < 5 ; index++) { wstring title(L"Client2-TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.client2-nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm_client1 = bm1->AddURL(bm_bar1, index, title, GURL(url)); @@ -2013,9 +2020,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add same bookmarks (without favicon) to both clients. for (int index = 0; index < 3 ; index++) { wstring title(L"TestBookmark"); - title.append(IntToWString(index)); + title.append(IntToWStringHack(index)); string url("http://www.nofaviconurl"); - url.append(IntToString(index)); + url.append(base::IntToString(index)); url.append(".com"); const BookmarkNode* nofavicon_bm_client0 = bm0->AddURL(bm_bar0, index, title, GURL(url)); diff --git a/chrome/test/page_cycler/page_cycler_test.cc b/chrome/test/page_cycler/page_cycler_test.cc index a980139..f2308e1 100644 --- a/chrome/test/page_cycler/page_cycler_test.cc +++ b/chrome/test/page_cycler/page_cycler_test.cc @@ -356,7 +356,7 @@ static bool HasDatabaseErrors(const std::string timings) { if (new_pos == std::string::npos) new_pos = timings.length(); time_str = timings.substr(pos, new_pos - pos); - if (!StringToInt(time_str, &time)) { + if (!base::StringToInt(time_str, &time)) { LOG(ERROR) << "Invalid time reported: " << time_str; return true; } diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc index 148eb54..abf83ca 100644 --- a/chrome/test/reliability/page_load_test.cc +++ b/chrome/test/reliability/page_load_test.cc @@ -43,6 +43,7 @@ #include "base/keyboard_codes.h" #include "base/i18n/time_formatting.h" #include "base/path_service.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/test/test_file_util.h" #include "base/time.h" @@ -455,7 +456,7 @@ class PageLoadTest : public UITest { FilePath ConstructSavedDebugLogPath(const FilePath& debug_log_path, int index) { std::string suffix("_"); - suffix.append(IntToString(index)); + suffix.append(base::IntToString(index)); return debug_log_path.InsertBeforeExtensionASCII(suffix); } diff --git a/chrome/test/startup/shutdown_test.cc b/chrome/test/startup/shutdown_test.cc index b49fbf1..78f82bd 100644 --- a/chrome/test/startup/shutdown_test.cc +++ b/chrome/test/startup/shutdown_test.cc @@ -6,6 +6,7 @@ #include "base/file_util.h" #include "base/path_service.h" #include "base/platform_thread.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/sys_info.h" #include "base/time.h" @@ -72,7 +73,7 @@ class ShutdownTest : public UITest { scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); std::string numCyclesEnv; if (env->GetEnv(env_vars::kStartupTestsNumCycles, &numCyclesEnv) && - StringToInt(numCyclesEnv, &numCycles)) { + base::StringToInt(numCyclesEnv, &numCycles)) { if (numCycles <= kNumCyclesMax) { LOG(INFO) << env_vars::kStartupTestsNumCycles << " set in environment, so setting numCycles to " diff --git a/chrome/test/startup/startup_test.cc b/chrome/test/startup/startup_test.cc index ef25566..366be92 100644 --- a/chrome/test/startup/startup_test.cc +++ b/chrome/test/startup/startup_test.cc @@ -109,7 +109,7 @@ class StartupTest : public UITest { scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); std::string numCyclesEnv; if (env->GetEnv(env_vars::kStartupTestsNumCycles, &numCyclesEnv) && - StringToInt(numCyclesEnv, &numCycles)) { + base::StringToInt(numCyclesEnv, &numCycles)) { if (numCycles <= kNumCyclesMax) { LOG(INFO) << env_vars::kStartupTestsNumCycles << " set in environment, so setting numCycles to " @@ -163,7 +163,7 @@ class StartupTest : public UITest { std::vector<std::string> version_numbers; SplitString(server_version, '.', &version_numbers); int chrome_buildnum = 0; - ASSERT_TRUE(StringToInt(version_numbers[2], &chrome_buildnum)); + ASSERT_TRUE(base::StringToInt(version_numbers[2], &chrome_buildnum)); if (chrome_buildnum < 368) { num_tabs = 0; } @@ -284,7 +284,7 @@ void StartupTest::RunPerfTestWithManyTabs(const char* graph, const char* trace, // and each time, UITest::SetUp will wait for |tab_count| tabs to // finish loading. launch_arguments_.AppendSwitchASCII(switches::kRestoreLastSession, - IntToString(tab_count)); + base::IntToString(tab_count)); } RunStartupTest(graph, trace, WARM, NOT_IMPORTANT, UITest::DEFAULT_THEME, tab_count, nth_timed_tab); diff --git a/chrome/test/test_launcher/out_of_proc_test_runner.cc b/chrome/test/test_launcher/out_of_proc_test_runner.cc index 8f675b8..2401a36 100644 --- a/chrome/test/test_launcher/out_of_proc_test_runner.cc +++ b/chrome/test/test_launcher/out_of_proc_test_runner.cc @@ -7,6 +7,7 @@ #include "base/command_line.h" #include "base/logging.h" #include "base/process_util.h" +#include "base/string_number_conversions.h" #include "base/test/test_suite.h" #include "chrome/test/test_launcher/test_runner.h" #include "chrome/test/unit/chrome_test_suite.h" @@ -87,7 +88,8 @@ class OutOfProcTestRunner : public tests::TestRunner { if (cmd_line->HasSwitch(kTestTerminateTimeoutFlag)) { std::wstring timeout_str( cmd_line->GetSwitchValue(kTestTerminateTimeoutFlag)); - int timeout = StringToInt(WideToUTF16Hack(timeout_str)); + int timeout; + base::StringToInt(WideToUTF8(timeout_str), &timeout); test_terminate_timeout_ms = std::max(test_terminate_timeout_ms, timeout); } diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc index 60e423a..547aff0 100644 --- a/chrome/test/testing_profile.cc +++ b/chrome/test/testing_profile.cc @@ -7,7 +7,7 @@ #include "build/build_config.h" #include "base/command_line.h" #include "base/message_loop_proxy.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "chrome/common/url_constants.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/dom_ui/ntp_resource_cache.h" @@ -164,7 +164,7 @@ TestingProfile::TestingProfile(int count) last_session_exited_cleanly_(true) { PathService::Get(base::DIR_TEMP, &path_); path_ = path_.Append(FILE_PATH_LITERAL("TestingProfilePath")); - path_ = path_.AppendASCII(IntToString(count)); + path_ = path_.AppendASCII(base::IntToString(count)); file_util::Delete(path_, true); file_util::CreateDirectory(path_); } diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index b37793f..d5c898b 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -214,27 +214,31 @@ void UITestBase::InitializeTimeouts() { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(kUiTestTimeout)) { std::wstring timeout_str = command_line.GetSwitchValue(kUiTestTimeout); - int timeout = StringToInt(WideToUTF16Hack(timeout_str)); + int timeout; + base::StringToInt(WideToUTF8(timeout_str), &timeout); command_execution_timeout_ms_ = std::max(kCommandExecutionTimeout, timeout); } if (command_line.HasSwitch(kUiTestActionTimeout)) { std::wstring act_str = command_line.GetSwitchValue(kUiTestActionTimeout); - int act_timeout = StringToInt(WideToUTF16Hack(act_str)); + int act_timeout; + base::StringToInt(WideToUTF8(act_str), &act_timeout); action_timeout_ms_ = std::max(kWaitForActionMsec, act_timeout); } if (command_line.HasSwitch(kUiTestActionMaxTimeout)) { std::wstring action_max_str = command_line.GetSwitchValue(kUiTestActionMaxTimeout); - int max_timeout = StringToInt(WideToUTF16Hack(action_max_str)); + int max_timeout; + base::StringToInt(WideToUTF8(action_max_str), &max_timeout); action_max_timeout_ms_ = std::max(kWaitForActionMaxMsec, max_timeout); } if (CommandLine::ForCurrentProcess()->HasSwitch(kUiTestSleepTimeout)) { std::wstring sleep_timeout_str = CommandLine::ForCurrentProcess()->GetSwitchValue(kUiTestSleepTimeout); - int sleep_timeout = StringToInt(WideToUTF16Hack(sleep_timeout_str)); + int sleep_timeout; + base::StringToInt(WideToUTF8(sleep_timeout_str), &sleep_timeout); sleep_timeout_ms_ = std::max(kWaitForActionMsec, sleep_timeout); } @@ -242,7 +246,8 @@ void UITestBase::InitializeTimeouts() { std::wstring terminate_timeout_str = CommandLine::ForCurrentProcess()->GetSwitchValue( kUiTestTerminateTimeout); - int terminate_timeout = StringToInt(WideToUTF16Hack(terminate_timeout_str)); + int terminate_timeout; + base::StringToInt(WideToUTF8(terminate_timeout_str), &terminate_timeout); terminate_timeout_ms_ = std::max(kWaitForActionMsec, terminate_timeout); } } @@ -348,7 +353,7 @@ void UITestBase::StartHttpServerWithPort(const FilePath& root_directory, #endif if (port) - cmd_line->AppendSwitchASCII("port", IntToString(port)); + cmd_line->AppendSwitchASCII("port", base::IntToString(port)); RunCommand(*cmd_line.get()); } @@ -921,7 +926,7 @@ void UITestBase::PrintResult(const std::string& measurement, size_t value, const std::string& units, bool important) { - PrintResultsImpl(measurement, modifier, trace, UintToString(value), + PrintResultsImpl(measurement, modifier, trace, base::UintToString(value), "", "", units, important); } diff --git a/chrome/test/ui/ui_test_suite.cc b/chrome/test/ui/ui_test_suite.cc index 7d19a2a..dbcc191 100644 --- a/chrome/test/ui/ui_test_suite.cc +++ b/chrome/test/ui/ui_test_suite.cc @@ -9,6 +9,7 @@ #include "base/env_var.h" #include "base/path_service.h" #include "base/process_util.h" +#include "base/string_number_conversions.h" #include "chrome/common/env_vars.h" // Timeout for the test in milliseconds. UI tests only. @@ -51,7 +52,9 @@ void UITestSuite::Initialize() { std::wstring test_timeout = parsed_command_line.GetSwitchValue(UITestSuite::kTestTimeout); if (!test_timeout.empty()) { - UITest::set_test_timeout_ms(StringToInt(WideToUTF16Hack(test_timeout))); + int timeout; + base::StringToInt(WideToUTF8(test_timeout), &timeout); + UITest::set_test_timeout_ms(timeout); } #if defined(OS_WIN) diff --git a/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp b/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp index 8c59747..97419a2 100644 --- a/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp +++ b/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp @@ -46,6 +46,7 @@ #include "app/l10n_util.h" #include "base/i18n/number_formatting.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "chrome/third_party/mozilla_security_manager/nsNSSCertTrust.h" #include "grit/generated_resources.h" @@ -712,7 +713,7 @@ std::string ProcessUserNotice(SECItem* der_notice) { if (itemList != notice->noticeReference.noticeNumbers) rv += ", "; rv += '#'; - rv += UTF16ToUTF8(UintToString16(number)); + rv += UTF16ToUTF8(base::UintToString16(number)); } itemList++; } @@ -1073,9 +1074,9 @@ std::string ProcessSubjectPublicKeyInfo(CERTSubjectPublicKeyInfo* spki) { case rsaKey: { rv = l10n_util::GetStringFUTF8( IDS_CERT_RSA_PUBLIC_KEY_DUMP_FORMAT, - UintToString16(key->u.rsa.modulus.len * 8), + base::UintToString16(key->u.rsa.modulus.len * 8), UTF8ToUTF16(ProcessRawBytes(&key->u.rsa.modulus)), - UintToString16(key->u.rsa.publicExponent.len * 8), + base::UintToString16(key->u.rsa.publicExponent.len * 8), UTF8ToUTF16(ProcessRawBytes(&key->u.rsa.publicExponent))); break; } diff --git a/chrome_frame/test/test_with_web_server.h b/chrome_frame/test/test_with_web_server.h index 18e7086..862b271 100644 --- a/chrome_frame/test/test_with_web_server.h +++ b/chrome_frame/test/test_with_web_server.h @@ -8,6 +8,7 @@ #include <windows.h> #include <string> +#include "base/string_util.h" #include "chrome_frame/test/http_server.h" #include "chrome_frame/test/test_server.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/courgette/adjustment_method.cc b/courgette/adjustment_method.cc index 930dc59..e82d669 100644 --- a/courgette/adjustment_method.cc +++ b/courgette/adjustment_method.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,6 +13,7 @@ #include "base/basictypes.h" #include "base/logging.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "courgette/assembly_program.h" @@ -183,7 +184,7 @@ static std::string ToString(Node* node) { s += StringPrintf("%u", node->count_); s += " @"; - s += Uint64ToString(node->edges_in_frequency_order.size()); + s += base::Uint64ToString(node->edges_in_frequency_order.size()); s += "}"; return s; } diff --git a/courgette/courgette_tool.cc b/courgette/courgette_tool.cc index ef9fa71..30714d3 100644 --- a/courgette/courgette_tool.cc +++ b/courgette/courgette_tool.cc @@ -10,8 +10,9 @@ #include "base/command_line.h" #include "base/file_util.h" #include "base/logging.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" - +#include "base/utf_string_conversions.h" #include "courgette/third_party/bsdiff.h" #include "courgette/courgette.h" #include "courgette/streams.h" @@ -234,7 +235,7 @@ void DisassembleAdjustDiff(const std::wstring& model_file, if (status != courgette::OK) Problem("-xxx failed."); WriteSinkToFile(&patch_stream, - output_file_root + L"-" + IntToWString(i)); + output_file_root + L"-" + UTF8ToWide(base::IntToString(i))); } } @@ -339,11 +340,6 @@ void ApplyBSDiffPatch(const std::wstring& old_file, WriteSinkToFile(&new_stream, new_file); } -bool WideStringToInt(const std::wstring& str, int *output) { - string16 copy(str.begin(), str.end()); - return StringToInt(copy, output); -} - int main(int argc, const char* argv[]) { base::AtExitManager at_exit_manager; CommandLine::Init(argc, argv); @@ -374,7 +370,7 @@ int main(int argc, const char* argv[]) { int repeat_count = 1; std::string repeat_switch = command_line.GetSwitchValueASCII("repeat"); if (!repeat_switch.empty()) - if (!StringToInt(repeat_switch, &repeat_count)) + if (!base::StringToInt(repeat_switch, &repeat_count)) repeat_count = 1; if (cmd_dis + cmd_asm + cmd_disadj + cmd_make_patch + cmd_apply_patch + diff --git a/gfx/window_impl.cc b/gfx/window_impl.cc index 86eecce..74e0e20 100644 --- a/gfx/window_impl.cc +++ b/gfx/window_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,7 +7,7 @@ #include <list> #include "base/singleton.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/win_util.h" namespace gfx { @@ -61,8 +61,8 @@ class ClassRegistrar { } } - name->assign(std::wstring(WindowImpl::kBaseClassName) + - IntToWString(registered_count_++)); + name->assign(string16(WindowImpl::kBaseClassName) + + base::IntToString16(registered_count_++)); return false; } 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 51e666e..a157de9 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc @@ -3,10 +3,12 @@ // found in the LICENSE file. #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" + #include <algorithm> #include <string> + #include "app/gfx/gl/gl_mock.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "gpu/command_buffer/common/gles2_cmd_format.h" #include "gpu/command_buffer/common/gles2_cmd_utils.h" #include "gpu/command_buffer/service/cmd_buffer_engine.h" @@ -531,7 +533,7 @@ void GLES2DecoderTestBase::SetupShader( } for (GLsizei jj = 1; jj < info.size; ++jj) { std::string element_name( - std::string(base_name) + "[" + IntToString(jj) + "]"); + std::string(base_name) + "[" + base::IntToString(jj) + "]"); EXPECT_CALL(*gl_, GetUniformLocation(program_service_id, StrEq(element_name))) .WillOnce(Return(info.location + jj * 2)) diff --git a/gpu/command_buffer/service/program_manager_unittest.cc b/gpu/command_buffer/service/program_manager_unittest.cc index 4acb7b1..a6b5614 100644 --- a/gpu/command_buffer/service/program_manager_unittest.cc +++ b/gpu/command_buffer/service/program_manager_unittest.cc @@ -3,9 +3,12 @@ // found in the LICENSE file. #include "gpu/command_buffer/service/program_manager.h" + #include <algorithm> + #include "app/gfx/gl/gl_mock.h" #include "base/scoped_ptr.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -245,7 +248,7 @@ class ProgramManagerWithShaderTest : public testing::Test { } for (GLsizei jj = 1; jj < info.size; ++jj) { std::string element_name( - std::string(base_name) + "[" + IntToString(jj) + "]"); + std::string(base_name) + "[" + base::IntToString(jj) + "]"); EXPECT_CALL(*gl_, GetUniformLocation(service_id, StrEq(element_name))) .WillOnce(Return(info.location + jj * 2)) diff --git a/media/filters/ffmpeg_video_decode_engine.cc b/media/filters/ffmpeg_video_decode_engine.cc index 2413b7f..34d05bf 100644 --- a/media/filters/ffmpeg_video_decode_engine.cc +++ b/media/filters/ffmpeg_video_decode_engine.cc @@ -5,7 +5,7 @@ #include "media/filters/ffmpeg_video_decode_engine.h" #include "base/command_line.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/task.h" #include "media/base/buffers.h" #include "media/base/callback.h" @@ -69,7 +69,7 @@ void FFmpegVideoDecodeEngine::Initialize( const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); std::string threads(cmd_line->GetSwitchValueASCII(switches::kVideoThreads)); if ((!threads.empty() && - !StringToInt(threads, &decode_threads)) || + !base::StringToInt(threads, &decode_threads)) || decode_threads < 0 || decode_threads > kMaxDecodeThreads) { decode_threads = kDecodeThreads; } diff --git a/media/tools/media_bench/media_bench.cc b/media/tools/media_bench/media_bench.cc index dae6921..51af940 100644 --- a/media/tools/media_bench/media_bench.cc +++ b/media/tools/media_bench/media_bench.cc @@ -25,7 +25,7 @@ #include "base/file_path.h" #include "base/file_util.h" #include "base/md5.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/time.h" #include "base/utf_string_conversions.h" #include "media/base/djb2.h" @@ -150,7 +150,7 @@ int main(int argc, const char** argv) { int video_threads = 0; std::string threads(cmd_line->GetSwitchValueASCII(switches::kVideoThreads)); if (!threads.empty() && - !StringToInt(threads, &video_threads)) { + !base::StringToInt(threads, &video_threads)) { video_threads = 0; } @@ -158,7 +158,7 @@ int main(int argc, const char** argv) { int verbose_level = AV_LOG_FATAL; std::string verbose(cmd_line->GetSwitchValueASCII(switches::kVerbose)); if (!verbose.empty() && - !StringToInt(verbose, &verbose_level)) { + !base::StringToInt(verbose, &verbose_level)) { verbose_level = AV_LOG_FATAL; } @@ -166,7 +166,7 @@ int main(int argc, const char** argv) { int max_frames = 0; std::string frames_opt(cmd_line->GetSwitchValueASCII(switches::kFrames)); if (!frames_opt.empty() && - !StringToInt(frames_opt, &max_frames)) { + !base::StringToInt(frames_opt, &max_frames)) { max_frames = 0; } @@ -174,7 +174,7 @@ int main(int argc, const char** argv) { int max_loops = 0; std::string loop_opt(cmd_line->GetSwitchValueASCII(switches::kLoop)); if (!loop_opt.empty() && - !StringToInt(loop_opt, &max_loops)) { + !base::StringToInt(loop_opt, &max_loops)) { max_loops = 0; } @@ -209,7 +209,7 @@ int main(int argc, const char** argv) { int skip = 0; if (cmd_line->HasSwitch(switches::kSkip)) { std::string skip_opt(cmd_line->GetSwitchValueASCII(switches::kSkip)); - if (!StringToInt(skip_opt, &skip)) { + if (!base::StringToInt(skip_opt, &skip)) { skip = 0; } } diff --git a/media/tools/omx_test/omx_test.cc b/media/tools/omx_test/omx_test.cc index 777f55a..8740f57 100644 --- a/media/tools/omx_test/omx_test.cc +++ b/media/tools/omx_test/omx_test.cc @@ -13,8 +13,9 @@ #include "base/command_line.h" #include "base/message_loop.h" #include "base/scoped_ptr.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/time.h" +#include "base/utf_string_conversions.h" #include "media/base/data_buffer.h" #include "media/base/media.h" #include "media/base/video_frame.h" @@ -219,8 +220,11 @@ static bool HasSwitch(const char* name) { } static int GetIntSwitch(const char* name) { - if (HasSwitch(name)) - return StringToInt(GetStringSwitch(name)); + if (HasSwitch(name)) { + int val; + base::StringToInt(GetStringSwitch(name), &val); + return val; + } return 0; } diff --git a/media/tools/scaler_bench/scaler_bench.cc b/media/tools/scaler_bench/scaler_bench.cc index 2208a17..8c3570b 100644 --- a/media/tools/scaler_bench/scaler_bench.cc +++ b/media/tools/scaler_bench/scaler_bench.cc @@ -11,7 +11,7 @@ #include "base/command_line.h" #include "base/scoped_vector.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/time.h" #include "media/base/video_frame.h" #include "media/base/yuv_convert.h" @@ -156,37 +156,37 @@ int main(int argc, const char** argv) { std::string source_width_param(cmd_line->GetSwitchValueASCII("src-w")); if (!source_width_param.empty() && - !StringToInt(source_width_param, &source_width)) { + !base::StringToInt(source_width_param, &source_width)) { source_width = 0; } std::string source_height_param(cmd_line->GetSwitchValueASCII("src-h")); if (!source_height_param.empty() && - !StringToInt(source_height_param, &source_height)) { + !base::StringToInt(source_height_param, &source_height)) { source_height = 0; } std::string dest_width_param(cmd_line->GetSwitchValueASCII("dest-w")); if (!dest_width_param.empty() && - !StringToInt(dest_width_param, &dest_width)) { + !base::StringToInt(dest_width_param, &dest_width)) { dest_width = 0; } std::string dest_height_param(cmd_line->GetSwitchValueASCII("dest-h")); if (!dest_height_param.empty() && - !StringToInt(dest_height_param, &dest_height)) { + !base::StringToInt(dest_height_param, &dest_height)) { dest_height = 0; } std::string frames_param(cmd_line->GetSwitchValueASCII("frames")); if (!frames_param.empty() && - !StringToInt(frames_param, &num_frames)) { + !base::StringToInt(frames_param, &num_frames)) { num_frames = 0; } std::string buffers_param(cmd_line->GetSwitchValueASCII("buffers")); if (!buffers_param.empty() && - !StringToInt(buffers_param, &num_buffers)) { + !base::StringToInt(buffers_param, &num_buffers)) { num_buffers = 0; } diff --git a/media/tools/wav_ola_test/wav_ola_test.cc b/media/tools/wav_ola_test/wav_ola_test.cc index 0c6b214..633f849 100644 --- a/media/tools/wav_ola_test/wav_ola_test.cc +++ b/media/tools/wav_ola_test/wav_ola_test.cc @@ -16,7 +16,7 @@ #include "base/command_line.h" #include "base/file_util.h" #include "base/ref_counted.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "media/base/data_buffer.h" #include "media/filters/audio_renderer_algorithm_ola.h" @@ -90,7 +90,7 @@ int main(int argc, const char** argv) { #else const std::string& filename_str = filenames[0]; #endif - if (!StringToDouble(filename_str, &playback_rate)) + if (!base::StringToDouble(filename_str, &playback_rate)) playback_rate = 0.0; // Open input file. diff --git a/net/base/net_util.cc b/net/base/net_util.cc index 7ba8a10..e25eb50 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -45,6 +45,7 @@ #include "base/path_service.h" #include "base/singleton.h" #include "base/stl_util-inl.h" +#include "base/string_number_conversions.h" #include "base/string_piece.h" #include "base/string_tokenizer.h" #include "base/string_util.h" @@ -1660,9 +1661,12 @@ void SetExplicitlyAllowedPorts(const std::wstring& allowed_ports) { return; if (i == size || allowed_ports[i] == kComma) { size_t length = i - last; - if (length > 0) - ports.insert(StringToInt(WideToASCII( - allowed_ports.substr(last, length)))); + if (length > 0) { + int port; + base::StringToInt(WideToUTF8(allowed_ports.substr(last, length)), + &port); + ports.insert(port); + } last = i + 1; } } @@ -1887,7 +1891,7 @@ bool ParseCIDRBlock(const std::string& cidr_literal, // Parse the prefix length. int number_of_bits = -1; - if (!StringToInt(parts[1], &number_of_bits)) + if (!base::StringToInt(parts[1], &number_of_bits)) return false; // Make sure the prefix length is in a valid range. diff --git a/net/base/net_util_unittest.cc b/net/base/net_util_unittest.cc index 84cb4f4..98e2b05 100644 --- a/net/base/net_util_unittest.cc +++ b/net/base/net_util_unittest.cc @@ -6,6 +6,7 @@ #include "base/file_path.h" #include "base/format_macros.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" #include "base/utf_string_conversions.h" @@ -460,7 +461,7 @@ std::string DumpIPNumber(const net::IPAddressNumber& v) { for (size_t i = 0; i < v.size(); ++i) { if (i != 0) out.append(","); - out.append(IntToString(static_cast<int>(v[i]))); + out.append(base::IntToString(static_cast<int>(v[i]))); } return out; } diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc index 6a8709b..07c839a 100644 --- a/net/base/sdch_manager.cc +++ b/net/base/sdch_manager.cc @@ -2,14 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "net/base/sdch_manager.h" + #include "base/base64.h" #include "base/field_trial.h" #include "base/histogram.h" #include "base/logging.h" #include "base/sha2.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "net/base/registry_controlled_domain.h" -#include "net/base/sdch_manager.h" #include "net/url_request/url_request_http_job.h" using base::Time; @@ -240,9 +242,12 @@ bool SdchManager::AddSdchDictionary(const std::string& dictionary_text, if (value != "1.0") return false; } else if (name == "max-age") { - expiration = Time::Now() + TimeDelta::FromSeconds(StringToInt64(value)); + int64 seconds; + base::StringToInt64(value, &seconds); + expiration = Time::Now() + TimeDelta::FromSeconds(seconds); } else if (name == "port") { - int port = StringToInt(value); + int port; + base::StringToInt(value, &port); if (port >= 0) ports.insert(port); } diff --git a/net/base/transport_security_state.cc b/net/base/transport_security_state.cc index a450560..985a940 100644 --- a/net/base/transport_security_state.cc +++ b/net/base/transport_security_state.cc @@ -10,6 +10,7 @@ #include "base/logging.h" #include "base/scoped_ptr.h" #include "base/sha2.h" +#include "base/string_number_conversions.h" #include "base/string_tokenizer.h" #include "base/string_util.h" #include "base/values.h" @@ -140,7 +141,7 @@ bool TransportSecurityState::ParseHeader(const std::string& value, case AFTER_MAX_AGE_EQUALS: if (IsAsciiWhitespace(*tokenizer.token_begin())) continue; - if (!StringToInt(tokenizer.token(), &max_age_candidate)) + if (!base::StringToInt(tokenizer.token(), &max_age_candidate)) return false; if (max_age_candidate < 0) return false; diff --git a/net/disk_cache/stress_cache.cc b/net/disk_cache/stress_cache.cc index b153659..c7f469c 100644 --- a/net/disk_cache/stress_cache.cc +++ b/net/disk_cache/stress_cache.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -22,8 +22,10 @@ #include "base/path_service.h" #include "base/platform_thread.h" #include "base/process_util.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/thread.h" +#include "base/utf_string_conversions.h" #include "net/base/net_errors.h" #include "net/base/test_completion_callback.h" #include "net/base/io_buffer.h" @@ -42,7 +44,7 @@ int RunSlave(int iteration) { PathService::Get(base::FILE_EXE, &exe); CommandLine cmdline(exe); - cmdline.AppendLooseValue(ASCIIToWide(IntToString(iteration))); + cmdline.AppendLooseValue(UTF8ToWide(base::IntToString(iteration))); base::ProcessHandle handle; if (!base::LaunchApp(cmdline, false, false, &handle)) { diff --git a/net/ftp/ftp_ctrl_response_buffer.cc b/net/ftp/ftp_ctrl_response_buffer.cc index 8ea58cc..c9ee5dd 100644 --- a/net/ftp/ftp_ctrl_response_buffer.cc +++ b/net/ftp/ftp_ctrl_response_buffer.cc @@ -5,7 +5,8 @@ #include "net/ftp/ftp_ctrl_response_buffer.h" #include "base/logging.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" +//#include "base/string_util.h" #include "net/base/net_errors.h" namespace net { @@ -69,7 +70,7 @@ FtpCtrlResponseBuffer::ParsedLine FtpCtrlResponseBuffer::ParseLine( ParsedLine result; if (line.length() >= 3) { - if (StringToInt(line.substr(0, 3), &result.status_code)) + if (base::StringToInt(line.substr(0, 3), &result.status_code)) result.has_status_code = (100 <= result.status_code && result.status_code <= 599); if (result.has_status_code && line.length() >= 4 && line[3] == ' ') { diff --git a/net/ftp/ftp_directory_listing_buffer_unittest.cc b/net/ftp/ftp_directory_listing_buffer_unittest.cc index c3c55d0..f07f535 100644 --- a/net/ftp/ftp_directory_listing_buffer_unittest.cc +++ b/net/ftp/ftp_directory_listing_buffer_unittest.cc @@ -7,6 +7,7 @@ #include "base/file_util.h" #include "base/format_macros.h" #include "base/path_service.h" +#include "base/string_number_conversions.h" #include "base/string_tokenizer.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" @@ -86,15 +87,17 @@ TEST(FtpDirectoryListingBufferTest, Parse) { for (size_t i = 0; i < lines.size() / 8; i++) { std::string type(lines[8 * i]); std::string name(lines[8 * i + 1]); - int64 size = StringToInt64(lines[8 * i + 2]); + int64 size; + base::StringToInt64(lines[8 * i + 2], &size); SCOPED_TRACE(StringPrintf("Filename: %s", name.c_str())); - int year = StringToInt(lines[8 * i + 3]); - int month = StringToInt(lines[8 * i + 4]); - int day_of_month = StringToInt(lines[8 * i + 5]); - int hour = StringToInt(lines[8 * i + 6]); - int minute = StringToInt(lines[8 * i + 7]); + int year, month, day_of_month, hour, minute; + base::StringToInt(lines[8 * i + 3], &year); + base::StringToInt(lines[8 * i + 4], &month); + base::StringToInt(lines[8 * i + 5], &day_of_month); + base::StringToInt(lines[8 * i + 6], &hour); + base::StringToInt(lines[8 * i + 7], &minute); ASSERT_TRUE(buffer.EntryAvailable()); net::FtpDirectoryListingEntry entry = buffer.PopEntry(); diff --git a/net/ftp/ftp_directory_listing_parser_ls.cc b/net/ftp/ftp_directory_listing_parser_ls.cc index 55f7844..969d26a 100644 --- a/net/ftp/ftp_directory_listing_parser_ls.cc +++ b/net/ftp/ftp_directory_listing_parser_ls.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this +// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this // source code is governed by a BSD-style license that can be found in the // LICENSE file. @@ -6,6 +6,7 @@ #include <vector> +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "net/ftp/ftp_util.h" @@ -107,7 +108,7 @@ bool FtpDirectoryListingParserLs::ConsumeLine(const string16& line) { received_total_line_ = true; int total_number; - if (!StringToInt(columns[1], &total_number)) + if (!base::StringToInt(columns[1], &total_number)) return false; if (total_number < 0) return false; @@ -137,7 +138,7 @@ bool FtpDirectoryListingParserLs::ConsumeLine(const string16& line) { entry.type = FtpDirectoryListingEntry::FILE; } - if (!StringToInt64(columns[2 + column_offset], &entry.size)) + if (!base::StringToInt64(columns[2 + column_offset], &entry.size)) return false; if (entry.size < 0) return false; diff --git a/net/ftp/ftp_directory_listing_parser_mlsd.cc b/net/ftp/ftp_directory_listing_parser_mlsd.cc index 7715dd3..656ae73 100644 --- a/net/ftp/ftp_directory_listing_parser_mlsd.cc +++ b/net/ftp/ftp_directory_listing_parser_mlsd.cc @@ -8,6 +8,7 @@ #include <vector> #include "base/stl_util-inl.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" @@ -26,15 +27,15 @@ bool MlsdDateListingToTime(const string16& text, base::Time* time) { if (text.length() < 14) return false; - if (!StringToInt(text.substr(0, 4), &time_exploded.year)) + if (!base::StringToInt(text.substr(0, 4), &time_exploded.year)) return false; - if (!StringToInt(text.substr(4, 2), &time_exploded.month)) + if (!base::StringToInt(text.substr(4, 2), &time_exploded.month)) return false; - if (!StringToInt(text.substr(6, 2), &time_exploded.day_of_month)) + if (!base::StringToInt(text.substr(6, 2), &time_exploded.day_of_month)) return false; - if (!StringToInt(text.substr(8, 2), &time_exploded.hour)) + if (!base::StringToInt(text.substr(8, 2), &time_exploded.hour)) return false; - if (!StringToInt(text.substr(10, 2), &time_exploded.minute)) + if (!base::StringToInt(text.substr(10, 2), &time_exploded.minute)) return false; // We don't know the time zone of the server, so just use local time. @@ -95,7 +96,7 @@ bool FtpDirectoryListingParserMlsd::ConsumeLine(const string16& line) { entry.type = FtpDirectoryListingEntry::FILE; if (!ContainsKey(facts, "size")) return false; - if (!StringToInt64(facts["size"], &entry.size)) + if (!base::StringToInt64(facts["size"], &entry.size)) return false; } else { // Ignore other types of entries. They are either not interesting for us diff --git a/net/ftp/ftp_directory_listing_parser_netware.cc b/net/ftp/ftp_directory_listing_parser_netware.cc index 60c6c6a..eb6518c 100644 --- a/net/ftp/ftp_directory_listing_parser_netware.cc +++ b/net/ftp/ftp_directory_listing_parser_netware.cc @@ -6,6 +6,7 @@ #include <vector> +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "net/ftp/ftp_util.h" @@ -68,7 +69,7 @@ bool FtpDirectoryListingParserNetware::ConsumeLine(const string16& line) { if (!LooksLikeNetwarePermissionsListing(columns[1])) return false; - if (!StringToInt64(columns[3], &entry.size)) + if (!base::StringToInt64(columns[3], &entry.size)) return false; if (entry.size < 0) return false; diff --git a/net/ftp/ftp_directory_listing_parser_vms.cc b/net/ftp/ftp_directory_listing_parser_vms.cc index f8d3fbb..90fd466 100644 --- a/net/ftp/ftp_directory_listing_parser_vms.cc +++ b/net/ftp/ftp_directory_listing_parser_vms.cc @@ -6,8 +6,9 @@ #include <vector> -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" +#include "base/string_util.h" #include "net/ftp/ftp_util.h" namespace { @@ -23,7 +24,7 @@ bool ParseVmsFilename(const string16& raw_filename, string16* parsed_filename, if (listing_parts.size() != 2) return false; int version_number; - if (!StringToInt(listing_parts[1], &version_number)) + if (!base::StringToInt(listing_parts[1], &version_number)) return false; if (version_number < 0) return false; @@ -52,7 +53,7 @@ bool ParseVmsFilesize(const string16& input, int64* size) { // best information we have. const int kBlockSize = 512; - if (StringToInt64(input, size)) { + if (base::StringToInt64(input, size)) { *size *= kBlockSize; return true; } @@ -63,9 +64,9 @@ bool ParseVmsFilesize(const string16& input, int64* size) { return false; int64 blocks_used, blocks_allocated; - if (!StringToInt64(parts[0], &blocks_used)) + if (!base::StringToInt64(parts[0], &blocks_used)) return false; - if (!StringToInt64(parts[1], &blocks_allocated)) + if (!base::StringToInt64(parts[1], &blocks_allocated)) return false; if (blocks_used > blocks_allocated) return false; @@ -126,12 +127,12 @@ bool VmsDateListingToTime(const std::vector<string16>& columns, SplitString(columns[1], '-', &date_parts); if (date_parts.size() != 3) return false; - if (!StringToInt(date_parts[0], &time_exploded.day_of_month)) + if (!base::StringToInt(date_parts[0], &time_exploded.day_of_month)) return false; if (!net::FtpUtil::ThreeLetterMonthToNumber(date_parts[1], &time_exploded.month)) return false; - if (!StringToInt(date_parts[2], &time_exploded.year)) + if (!base::StringToInt(date_parts[2], &time_exploded.year)) return false; // Time can be in format HH:MM, HH:MM:SS, or HH:MM:SS.mm. Try to recognize the @@ -147,9 +148,9 @@ bool VmsDateListingToTime(const std::vector<string16>& columns, SplitString(time_column, ':', &time_parts); if (time_parts.size() != 2) return false; - if (!StringToInt(time_parts[0], &time_exploded.hour)) + if (!base::StringToInt(time_parts[0], &time_exploded.hour)) return false; - if (!StringToInt(time_parts[1], &time_exploded.minute)) + if (!base::StringToInt(time_parts[1], &time_exploded.minute)) return false; // We don't know the time zone of the server, so just use local time. diff --git a/net/ftp/ftp_directory_listing_parser_windows.cc b/net/ftp/ftp_directory_listing_parser_windows.cc index 890ffc5..08131539 100644 --- a/net/ftp/ftp_directory_listing_parser_windows.cc +++ b/net/ftp/ftp_directory_listing_parser_windows.cc @@ -6,6 +6,7 @@ #include <vector> +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "net/ftp/ftp_util.h" @@ -22,11 +23,11 @@ bool WindowsDateListingToTime(const std::vector<string16>& columns, SplitString(columns[0], '-', &date_parts); if (date_parts.size() != 3) return false; - if (!StringToInt(date_parts[0], &time_exploded.month)) + if (!base::StringToInt(date_parts[0], &time_exploded.month)) return false; - if (!StringToInt(date_parts[1], &time_exploded.day_of_month)) + if (!base::StringToInt(date_parts[1], &time_exploded.day_of_month)) return false; - if (!StringToInt(date_parts[2], &time_exploded.year)) + if (!base::StringToInt(date_parts[2], &time_exploded.year)) return false; if (time_exploded.year < 0) return false; @@ -44,9 +45,9 @@ bool WindowsDateListingToTime(const std::vector<string16>& columns, SplitString(columns[1].substr(0, 5), ':', &time_parts); if (time_parts.size() != 2) return false; - if (!StringToInt(time_parts[0], &time_exploded.hour)) + if (!base::StringToInt(time_parts[0], &time_exploded.hour)) return false; - if (!StringToInt(time_parts[1], &time_exploded.minute)) + if (!base::StringToInt(time_parts[1], &time_exploded.minute)) return false; if (!time_exploded.HasValidValues()) return false; @@ -91,7 +92,7 @@ bool FtpDirectoryListingParserWindows::ConsumeLine(const string16& line) { entry.size = -1; } else { entry.type = FtpDirectoryListingEntry::FILE; - if (!StringToInt64(columns[2], &entry.size)) + if (!base::StringToInt64(columns[2], &entry.size)) return false; if (entry.size < 0) return false; diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc index 85cac4b..f4de8ab 100644 --- a/net/ftp/ftp_network_transaction.cc +++ b/net/ftp/ftp_network_transaction.cc @@ -6,6 +6,7 @@ #include "base/compiler_specific.h" #include "base/histogram.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "net/base/connection_type_histograms.h" @@ -978,7 +979,7 @@ int FtpNetworkTransaction::ProcessResponseSIZE( if (response.lines.size() != 1) return Stop(ERR_INVALID_RESPONSE); int64 size; - if (!StringToInt64(response.lines[0], &size)) + if (!base::StringToInt64(response.lines[0], &size)) return Stop(ERR_INVALID_RESPONSE); if (size < 0) return Stop(ERR_INVALID_RESPONSE); diff --git a/net/ftp/ftp_util.cc b/net/ftp/ftp_util.cc index 79e6b71..269a063 100644 --- a/net/ftp/ftp_util.cc +++ b/net/ftp/ftp_util.cc @@ -7,6 +7,7 @@ #include <vector> #include "base/logging.h" +#include "base/string_number_conversions.h" #include "base/string_tokenizer.h" #include "base/string_util.h" #include "base/time.h" @@ -155,18 +156,18 @@ bool FtpUtil::LsDateListingToTime(const string16& month, const string16& day, if (!ThreeLetterMonthToNumber(month, &time_exploded.month)) return false; - if (!StringToInt(day, &time_exploded.day_of_month)) + if (!base::StringToInt(day, &time_exploded.day_of_month)) return false; - if (!StringToInt(rest, &time_exploded.year)) { + if (!base::StringToInt(rest, &time_exploded.year)) { // Maybe it's time. Does it look like time (MM:HH)? if (rest.length() != 5 || rest[2] != ':') return false; - if (!StringToInt(rest.substr(0, 2), &time_exploded.hour)) + if (!base::StringToInt(rest.substr(0, 2), &time_exploded.hour)) return false; - if (!StringToInt(rest.substr(3, 2), &time_exploded.minute)) + if (!base::StringToInt(rest.substr(3, 2), &time_exploded.minute)) return false; // Guess the year. diff --git a/net/http/http_chunked_decoder.cc b/net/http/http_chunked_decoder.cc index 1f6ef0d..1ac7a60 100644 --- a/net/http/http_chunked_decoder.cc +++ b/net/http/http_chunked_decoder.cc @@ -41,6 +41,7 @@ #include "net/http/http_chunked_decoder.h" #include "base/logging.h" +#include "base/string_number_conversions.h" #include "base/string_piece.h" #include "base/string_util.h" #include "net/base/net_errors.h" @@ -188,7 +189,7 @@ bool HttpChunkedDecoder::ParseChunkSize(const char* start, int len, int* out) { return false; int parsed_number; - bool ok = HexStringToInt(std::string(start, len), &parsed_number); + bool ok = base::HexStringToInt(std::string(start, len), &parsed_number); if (ok && parsed_number >= 0) { *out = parsed_number; return true; diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index ee98cca..060b9e1 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -100,7 +100,7 @@ void BuildRequestHeaders(const HttpRequestInfo* request_info, if (upload_data_stream) { request_headers->SetHeader( HttpRequestHeaders::kContentLength, - Uint64ToString(upload_data_stream->size())); + base::Uint64ToString(upload_data_stream->size())); } else if (request_info->method == "POST" || request_info->method == "PUT" || request_info->method == "HEAD") { // An empty POST/PUT request still needs a content length. As for HEAD, @@ -156,7 +156,7 @@ void ProcessAlternateProtocol(const HttpResponseHeaders& headers, } int port; - if (!StringToInt(port_protocol_vector[0], &port) || + if (!base::StringToInt(port_protocol_vector[0], &port) || port <= 0 || port >= 1 << 16) { DLOG(WARNING) << HttpAlternateProtocols::kHeader << " header has unrecognizable port: " diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc index 08f397d..ba85ac72 100644 --- a/net/http/http_response_headers.cc +++ b/net/http/http_response_headers.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,6 +13,7 @@ #include "base/logging.h" #include "base/pickle.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/time.h" #include "net/base/escape.h" @@ -591,7 +592,7 @@ void HttpResponseHeaders::ParseStatusLine( raw_headers_.push_back(' '); raw_headers_.append(code, p); raw_headers_.push_back(' '); - response_code_ = static_cast<int>(StringToInt64(std::string(code, p))); + base::StringToInt(std::string(code, p), &response_code_); // Skip whitespace. while (*p == ' ') @@ -965,8 +966,9 @@ bool HttpResponseHeaders::GetMaxAgeValue(TimeDelta* result) const { if (LowerCaseEqualsASCII(value.begin(), value.begin() + kMaxAgePrefixLen, kMaxAgePrefix)) { - *result = TimeDelta::FromSeconds( - StringToInt64(value.substr(kMaxAgePrefixLen))); + int64 seconds; + base::StringToInt64(value.substr(kMaxAgePrefixLen), &seconds); + *result = TimeDelta::FromSeconds(seconds); return true; } } @@ -980,7 +982,9 @@ bool HttpResponseHeaders::GetAgeValue(TimeDelta* result) const { if (!EnumerateHeader(NULL, "Age", &value)) return false; - *result = TimeDelta::FromSeconds(StringToInt64(value)); + int64 seconds; + base::StringToInt64(value, &seconds); + *result = TimeDelta::FromSeconds(seconds); return true; } @@ -1071,7 +1075,7 @@ int64 HttpResponseHeaders::GetContentLength() const { return -1; int64 result; - bool ok = StringToInt64(content_length_val, &result); + bool ok = base::StringToInt64(content_length_val, &result); if (!ok || result < 0) return -1; @@ -1138,7 +1142,7 @@ bool HttpResponseHeaders::GetContentRange(int64* first_byte_position, byte_range_resp_spec.begin() + minus_position; HttpUtil::TrimLWS(&first_byte_pos_begin, &first_byte_pos_end); - bool ok = StringToInt64( + bool ok = base::StringToInt64( std::string(first_byte_pos_begin, first_byte_pos_end), first_byte_position); @@ -1149,7 +1153,7 @@ bool HttpResponseHeaders::GetContentRange(int64* first_byte_position, byte_range_resp_spec.end(); HttpUtil::TrimLWS(&last_byte_pos_begin, &last_byte_pos_end); - ok &= StringToInt64( + ok &= base::StringToInt64( std::string(last_byte_pos_begin, last_byte_pos_end), last_byte_position); if (!ok) { @@ -1174,7 +1178,7 @@ bool HttpResponseHeaders::GetContentRange(int64* first_byte_position, if (LowerCaseEqualsASCII(instance_length_begin, instance_length_end, "*")) { return false; - } else if (!StringToInt64( + } else if (!base::StringToInt64( std::string(instance_length_begin, instance_length_end), instance_length)) { *instance_length = -1; diff --git a/net/http/http_util.cc b/net/http/http_util.cc index 8168102..83c17ab 100644 --- a/net/http/http_util.cc +++ b/net/http/http_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,6 +10,7 @@ #include <algorithm> #include "base/logging.h" +#include "base/string_number_conversions.h" #include "base/string_piece.h" #include "base/string_util.h" #include "net/base/net_util.h" @@ -244,7 +245,7 @@ bool HttpUtil::ParseRangeHeader(const std::string& ranges_specifier, // Try to obtain first-byte-pos. if (!first_byte_pos.empty()) { int64 first_byte_position = -1; - if (!StringToInt64(first_byte_pos, &first_byte_position)) + if (!base::StringToInt64(first_byte_pos, &first_byte_position)) return false; range.set_first_byte_position(first_byte_position); } @@ -259,7 +260,7 @@ bool HttpUtil::ParseRangeHeader(const std::string& ranges_specifier, // We have last-byte-pos or suffix-byte-range-spec in this case. if (!last_byte_pos.empty()) { int64 last_byte_position; - if (!StringToInt64(last_byte_pos, &last_byte_position)) + if (!base::StringToInt64(last_byte_pos, &last_byte_position)) return false; if (range.HasFirstBytePosition()) range.set_last_byte_position(last_byte_position); diff --git a/net/proxy/proxy_bypass_rules.cc b/net/proxy/proxy_bypass_rules.cc index e273d67..8ebc79e 100644 --- a/net/proxy/proxy_bypass_rules.cc +++ b/net/proxy/proxy_bypass_rules.cc @@ -5,6 +5,7 @@ #include "net/proxy/proxy_bypass_rules.h" #include "base/logging.h" +#include "base/string_number_conversions.h" #include "base/string_tokenizer.h" #include "base/string_util.h" #include "net/base/net_util.h" @@ -253,7 +254,7 @@ bool ProxyBypassRules::AddRuleFromStringInternal( host = raw; port = -1; if (pos_colon != std::string::npos) { - if (!StringToInt(raw.substr(pos_colon + 1), &port) || + if (!base::StringToInt(raw.substr(pos_colon + 1), &port) || (port < 0 || port > 0xFFFF)) { return false; // Port was invalid. } diff --git a/net/proxy/proxy_config_service_linux.cc b/net/proxy/proxy_config_service_linux.cc index c2f9a94..e38083d 100644 --- a/net/proxy/proxy_config_service_linux.cc +++ b/net/proxy/proxy_config_service_linux.cc @@ -633,7 +633,9 @@ class GConfSettingGetterImplKDE const char* mode = "none"; indirect_manual_ = false; auto_no_pac_ = false; - switch (StringToInt(value)) { + int int_value; + base::StringToInt(value, &int_value); + switch (int_value) { case 0: // No proxy, or maybe kioslaverc syntax error. break; case 1: // Manual configuration. @@ -664,12 +666,15 @@ class GConfSettingGetterImplKDE // We count "true" or any nonzero number as true, otherwise false. // Note that if the value is not actually numeric StringToInt() // will return 0, which we count as false. - reversed_bypass_list_ = (value == "true" || StringToInt(value)); + int int_value; + base::StringToInt(value, &int_value); + reversed_bypass_list_ = (value == "true" || int_value); } else if (key == "NoProxyFor") { AddHostList("/system/http_proxy/ignore_hosts", value); } else if (key == "AuthMode") { // Check for authentication, just so we can warn. - int mode = StringToInt(value); + int mode; + base::StringToInt(value, &mode); if (mode) { // ProxyConfig does not support authentication parameters, but // Chrome will prompt for the password later. So we ignore this. diff --git a/net/server/http_listen_socket.cc b/net/server/http_listen_socket.cc index cdc6c71..6f60add 100644 --- a/net/server/http_listen_socket.cc +++ b/net/server/http_listen_socket.cc @@ -13,6 +13,7 @@ #include "base/compiler_specific.h" #include "base/logging.h" #include "base/md5.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "net/server/http_listen_socket.h" #include "net/server/http_server_request_info.h" @@ -81,7 +82,7 @@ uint32 WebSocketKeyFingerprint(const std::string& str) { if (spaces == 0) return 0; int64 number = 0; - if (!StringToInt64(result, &number)) + if (!base::StringToInt64(result, &number)) return 0; return htonl(static_cast<uint32>(number / spaces)); } diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc index bc3669d..6ca6477 100644 --- a/net/socket/client_socket_pool_base_unittest.cc +++ b/net/socket/client_socket_pool_base_unittest.cc @@ -10,6 +10,7 @@ #include "base/platform_thread.h" #include "base/ref_counted.h" #include "base/scoped_vector.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "net/base/net_log.h" #include "net/base/net_log_unittest.h" @@ -887,7 +888,8 @@ TEST_F(ClientSocketPoolBaseTest, CancelStalledSocketAtSocketLimit) { ClientSocketHandle handles[kDefaultMaxSockets]; TestCompletionCallback callbacks[kDefaultMaxSockets]; for (int i = 0; i < kDefaultMaxSockets; ++i) { - EXPECT_EQ(OK, handles[i].Init(IntToString(i), params_, kDefaultPriority, + EXPECT_EQ(OK, handles[i].Init(base::IntToString(i), params_, + kDefaultPriority, &callbacks[i], pool_, BoundNetLog())); } @@ -919,7 +921,7 @@ TEST_F(ClientSocketPoolBaseTest, CancelPendingSocketAtSocketLimit) { ClientSocketHandle handles[kDefaultMaxSockets]; for (int i = 0; i < kDefaultMaxSockets; ++i) { TestCompletionCallback callback; - EXPECT_EQ(ERR_IO_PENDING, handles[i].Init(IntToString(i), params_, + EXPECT_EQ(ERR_IO_PENDING, handles[i].Init(base::IntToString(i), params_, kDefaultPriority, &callback, pool_, BoundNetLog())); } @@ -998,7 +1000,7 @@ TEST_F(ClientSocketPoolBaseTest, CloseIdleSocketAtSocketLimitDeleteGroup) { for (int i = 0; i < kDefaultMaxSockets; ++i) { ClientSocketHandle handle; TestCompletionCallback callback; - EXPECT_EQ(OK, handle.Init(IntToString(i), params_, kDefaultPriority, + EXPECT_EQ(OK, handle.Init(base::IntToString(i), params_, kDefaultPriority, &callback, pool_, BoundNetLog())); } diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc index 2d9fe39..6a328cf 100644 --- a/net/spdy/spdy_http_stream.cc +++ b/net/spdy/spdy_http_stream.cc @@ -10,6 +10,7 @@ #include "base/logging.h" #include "base/message_loop.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "net/base/load_flags.h" #include "net/base/net_util.h" @@ -118,7 +119,7 @@ void CreateSpdyHeadersFromHttpRequest( // TODO(lzheng): reduce the code duplication between spdy and http here. if (info.upload_data) { (*headers)["content-length"] = - Int64ToString(info.upload_data->GetContentLength()); + base::Int64ToString(info.upload_data->GetContentLength()); } else if (info.method == "POST" || info.method == "PUT" || info.method == "HEAD") { // An empty POST/PUT request still needs a content length. As for HEAD, diff --git a/net/spdy/spdy_test_util.cc b/net/spdy/spdy_test_util.cc index 2b75b0c..94b9889 100644 --- a/net/spdy/spdy_test_util.cc +++ b/net/spdy/spdy_test_util.cc @@ -7,6 +7,7 @@ #include <string> #include "base/basictypes.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "net/http/http_network_transaction.h" #include "net/spdy/spdy_framer.h" @@ -410,7 +411,7 @@ spdy::SpdyFrame* ConstructSpdyPost(int64 content_length, 0, // Length spdy::DATA_FLAG_NONE // Data Flags }; - std::string length_str = Int64ToString(content_length); + std::string length_str = base::Int64ToString(content_length); const char* post_headers[] = { "method", "POST", diff --git a/net/test/test_server.h b/net/test/test_server.h index 20fda58..3b21339 100644 --- a/net/test/test_server.h +++ b/net/test/test_server.h @@ -14,7 +14,8 @@ #include "base/file_path.h" #include "base/process_util.h" #include "base/ref_counted.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" +//#include "base/string_util.h" #include "googleurl/src/gurl.h" #if defined(OS_WIN) @@ -197,7 +198,7 @@ class BaseTestServer : public base::RefCounted<BaseTestServer> { scheme_.push_back('s'); host_name_ = host_name; - port_str_ = IntToString(port); + port_str_ = base::IntToString(port); return true; } diff --git a/net/tools/crash_cache/crash_cache.cc b/net/tools/crash_cache/crash_cache.cc index 1d11013..561f092 100644 --- a/net/tools/crash_cache/crash_cache.cc +++ b/net/tools/crash_cache/crash_cache.cc @@ -16,8 +16,10 @@ #include "base/message_loop.h" #include "base/path_service.h" #include "base/process_util.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/thread.h" +#include "base/utf_string_conversions.h" #include "net/base/net_errors.h" #include "net/base/test_completion_callback.h" #include "net/disk_cache/backend_impl.h" @@ -43,7 +45,7 @@ int RunSlave(RankCrashes action) { PathService::Get(base::FILE_EXE, &exe); CommandLine cmdline(exe); - cmdline.AppendLooseValue(ASCIIToWide(IntToString(action))); + cmdline.AppendLooseValue(UTF8ToWide(base::IntToString(action))); base::ProcessHandle handle; if (!base::LaunchApp(cmdline, false, false, &handle)) { diff --git a/net/tools/fetch/fetch_client.cc b/net/tools/fetch/fetch_client.cc index 8863dd7..15d6e16 100644 --- a/net/tools/fetch/fetch_client.cc +++ b/net/tools/fetch/fetch_client.cc @@ -9,6 +9,7 @@ #include "base/message_loop.h" #include "base/singleton.h" #include "base/stats_counters.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "net/base/completion_callback.h" #include "net/base/host_resolver.h" @@ -125,8 +126,10 @@ int main(int argc, char**argv) { if (!url.length()) usage(argv[0]); int client_limit = 1; - if (parsed_command_line.HasSwitch("n")) - StringToInt(parsed_command_line.GetSwitchValueASCII("n"), &client_limit); + if (parsed_command_line.HasSwitch("n")) { + base::StringToInt(parsed_command_line.GetSwitchValueASCII("n"), + &client_limit); + } bool use_cache = parsed_command_line.HasSwitch("use-cache"); // Do work here. diff --git a/net/tools/hresolv/hresolv.cc b/net/tools/hresolv/hresolv.cc index d524bd7..3a0a902 100644 --- a/net/tools/hresolv/hresolv.cc +++ b/net/tools/hresolv/hresolv.cc @@ -28,6 +28,7 @@ #include "base/file_path.h" #include "base/file_util.h" #include "base/message_loop.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/thread.h" #include "base/time.h" @@ -324,7 +325,7 @@ bool ParseCommandLine(CommandLine* command_line, CommandLineOptions* options) { options->async = command_line->HasSwitch(kAsync); if (command_line->HasSwitch(kCacheSize)) { std::string cache_size = command_line->GetSwitchValueASCII(kCacheSize); - bool valid_size = StringToInt(cache_size, &options->cache_size); + bool valid_size = base::StringToInt(cache_size, &options->cache_size); if (valid_size) { valid_size = options->cache_size >= 0; } @@ -336,7 +337,7 @@ bool ParseCommandLine(CommandLine* command_line, CommandLineOptions* options) { if (command_line->HasSwitch(kCacheTtl)) { std::string cache_ttl = command_line->GetSwitchValueASCII(kCacheTtl); - bool valid_ttl = StringToInt(cache_ttl, &options->cache_ttl); + bool valid_ttl = base::StringToInt(cache_ttl, &options->cache_ttl); if (valid_ttl) { valid_ttl = options->cache_ttl >= 0; } @@ -400,7 +401,7 @@ bool ReadHostsAndTimesFromFile(const FilePath& path, } case 2: { int timestamp; - if (!StringToInt(tokens[1], ×tamp)) { + if (!base::StringToInt(tokens[1], ×tamp)) { // Unexpected value - keep going. } if (timestamp < previous_timestamp) { diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc index 11fc46d5..e1e64a2 100644 --- a/net/url_request/url_request_job.cc +++ b/net/url_request/url_request_job.cc @@ -6,6 +6,7 @@ #include "base/histogram.h" #include "base/message_loop.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "net/base/auth.h" #include "net/base/io_buffer.h" @@ -495,7 +496,7 @@ void URLRequestJob::NotifyHeadersComplete() { std::string content_length; request_->GetResponseHeaderByName("content-length", &content_length); if (!content_length.empty()) - expected_content_size_ = StringToInt64(content_length); + base::StringToInt64(content_length, &expected_content_size_); } else { // Chrome today only sends "Accept-Encoding" for compression schemes. // So, if there is a filter on the response, we know that the content diff --git a/net/websockets/websocket_throttle.cc b/net/websockets/websocket_throttle.cc index 9e33cad..88383cb 100644 --- a/net/websockets/websocket_throttle.cc +++ b/net/websockets/websocket_throttle.cc @@ -10,7 +10,7 @@ #include "base/message_loop.h" #include "base/ref_counted.h" #include "base/singleton.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "net/base/io_buffer.h" #include "net/base/sys_addrinfo.h" #include "net/socket_stream/socket_stream.h" @@ -25,21 +25,21 @@ static std::string AddrinfoToHashkey(const struct addrinfo* addrinfo) { reinterpret_cast<const sockaddr_in*>(addrinfo->ai_addr); return StringPrintf("%d:%s", addrinfo->ai_family, - HexEncode(&addr->sin_addr, 4).c_str()); + base::HexEncode(&addr->sin_addr, 4).c_str()); } case AF_INET6: { const struct sockaddr_in6* const addr6 = reinterpret_cast<const sockaddr_in6*>(addrinfo->ai_addr); return StringPrintf("%d:%s", addrinfo->ai_family, - HexEncode(&addr6->sin6_addr, - sizeof(addr6->sin6_addr)).c_str()); + base::HexEncode(&addr6->sin6_addr, + sizeof(addr6->sin6_addr)).c_str()); } default: return StringPrintf("%d:%s", addrinfo->ai_family, - HexEncode(addrinfo->ai_addr, - addrinfo->ai_addrlen).c_str()); + base::HexEncode(addrinfo->ai_addr, + addrinfo->ai_addrlen).c_str()); } } diff --git a/printing/image.cc b/printing/image.cc index 77f5d5e..21ffd99 100644 --- a/printing/image.cc +++ b/printing/image.cc @@ -6,7 +6,7 @@ #include "base/file_util.h" #include "base/md5.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "gfx/codec/png_codec.h" #include "gfx/rect.h" #include "skia/ext/platform_device.h" @@ -96,7 +96,7 @@ Image::Image(const Image& image) std::string Image::checksum() const { MD5Digest digest; MD5Sum(&data_[0], data_.size(), &digest); - return HexEncode(&digest, sizeof(digest)); + return base::HexEncode(&digest, sizeof(digest)); } bool Image::SaveToPng(const FilePath& filepath) const { diff --git a/printing/page_overlays.cc b/printing/page_overlays.cc index 89353da..68c184b 100644 --- a/printing/page_overlays.cc +++ b/printing/page_overlays.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,7 @@ #include "app/text_elider.h" #include "base/logging.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "printing/printed_document.h" @@ -169,21 +170,21 @@ std::wstring PageOverlays::ReplaceVariables(const std::wstring& input, offset = ReplaceKey(&output, offset, wcslen(kPage), - IntToWString(page.page_number())); + UTF8ToWide(base::IntToString(page.page_number()))); } else if (0 == output.compare(offset, wcslen(kPageCount), kPageCount)) { offset = ReplaceKey(&output, offset, wcslen(kPageCount), - IntToWString(document.page_count())); + UTF8ToWide(base::IntToString(document.page_count()))); } else if (0 == output.compare(offset, wcslen(kPageOnTotal), kPageOnTotal)) { std::wstring replacement; - replacement = IntToWString(page.page_number()); + replacement = UTF8ToWide(base::IntToString(page.page_number())); replacement += L"/"; - replacement += IntToWString(document.page_count()); + replacement += UTF8ToWide(base::IntToString(document.page_count())); offset = ReplaceKey(&output, offset, wcslen(kPageOnTotal), diff --git a/views/controls/table/table_view_unittest.cc b/views/controls/table/table_view_unittest.cc index bee0c19..c6954fa 100644 --- a/views/controls/table/table_view_unittest.cc +++ b/views/controls/table/table_view_unittest.cc @@ -7,7 +7,7 @@ #include "app/table_model.h" #include "app/table_model_observer.h" #include "base/message_loop.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" #include "views/controls/table/table_view.h" @@ -94,7 +94,7 @@ int TestTableModel::RowCount() { } std::wstring TestTableModel::GetText(int row, int column_id) { - return IntToWString(rows_[row][column_id]); + return UTF8ToWide(base::IntToString(rows_[row][column_id])); } void TestTableModel::SetObserver(TableModelObserver* observer) { diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc index 4b23932..955a83a 100644 --- a/views/focus/focus_manager_unittest.cc +++ b/views/focus/focus_manager_unittest.cc @@ -7,7 +7,8 @@ #include "app/combobox_model.h" #include "base/keyboard_codes.h" #include "base/logging.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" +#include "base/utf_string_conversions.h" #include "gfx/rect.h" #include "third_party/skia/include/core/SkColor.h" #include "views/background.h" @@ -322,7 +323,7 @@ class DummyComboboxModel : public ComboboxModel { virtual int GetItemCount() { return 10; } virtual std::wstring GetItemAt(int index) { - return L"Item " + IntToWString(index); + return L"Item " + UTF16ToWideHack(base::IntToString16(index)); } }; diff --git a/webkit/database/database_tracker.cc b/webkit/database/database_tracker.cc index d109064..a37c2a0 100644 --- a/webkit/database/database_tracker.cc +++ b/webkit/database/database_tracker.cc @@ -214,7 +214,8 @@ FilePath DatabaseTracker::GetFullDBFilePath( if (id < 0) return FilePath(); - FilePath file_name = FilePath::FromWStringHack(Int64ToWString(id)); + FilePath file_name = FilePath::FromWStringHack( + UTF8ToWide(base::Int64ToString(id))); return db_dir_.Append(FilePath::FromWStringHack( UTF16ToWide(GetOriginDirectory(origin_identifier)))).Append(file_name); } diff --git a/webkit/glue/plugins/test/plugin_geturl_test.cc b/webkit/glue/plugins/test/plugin_geturl_test.cc index f321b4b..e9b1c33 100644 --- a/webkit/glue/plugins/test/plugin_geturl_test.cc +++ b/webkit/glue/plugins/test/plugin_geturl_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,7 @@ #include "base/basictypes.h" #include "base/file_util.h" +#include "base/string_number_conversions.h" // url for "self". The %22%22 is to make a statement for javascript to // evaluate and return. @@ -357,7 +358,7 @@ void PluginGetURLTest::URLNotify(const char* url, NPReason reason, void* data) { case BOGUS_URL_STREAM_ID: if (reason != NPRES_NETWORK_ERR) { std::string err = "BOGUS_URL received unexpected URLNotify status: "; - err.append(IntToString(reason)); + err.append(base::IntToString(reason)); SetError(err); } tests_in_progress_--; diff --git a/webkit/glue/plugins/test/plugin_test.h b/webkit/glue/plugins/test/plugin_test.h index f06307ea..eed6e3f 100644 --- a/webkit/glue/plugins/test/plugin_test.h +++ b/webkit/glue/plugins/test/plugin_test.h @@ -1,12 +1,13 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_PORT_PLUGINS_TEST_PLUGIN_TEST_H__ -#define WEBKIT_PORT_PLUGINS_TEST_PLUGIN_TEST_H__ +#ifndef WEBKIT_PORT_PLUGINS_TEST_PLUGIN_TEST_H_ +#define WEBKIT_PORT_PLUGINS_TEST_PLUGIN_TEST_H_ #include <string> +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "third_party/npapi/bindings/npapi.h" #include "third_party/npapi/bindings/nphostapi.h" @@ -82,9 +83,9 @@ class PluginTest { if (val1 != val2) { std::string err; err = "Expected Equal for '"; - err.append(IntToString(val1)); + err.append(base::IntToString(val1)); err.append("' and '"); - err.append(IntToString(val2)); + err.append(base::IntToString(val2)); err.append("'"); SetError(err); } @@ -128,4 +129,4 @@ class PluginTest { } // namespace NPAPIClient -#endif // WEBKIT_PORT_PLUGINS_TEST_PLUGIN_TEST_H__ +#endif // WEBKIT_PORT_PLUGINS_TEST_PLUGIN_TEST_H_ diff --git a/webkit/tools/test_shell/event_sending_controller.cc b/webkit/tools/test_shell/event_sending_controller.cc index 10fb325..6104c72 100644 --- a/webkit/tools/test_shell/event_sending_controller.cc +++ b/webkit/tools/test_shell/event_sending_controller.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -26,6 +26,7 @@ #include "base/logging.h" #include "base/message_loop.h" #include "base/time.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" @@ -580,7 +581,7 @@ void EventSendingController::keyDown( for (int i = 1; i <= 24; ++i) { std::wstring function_key_name; function_key_name += L"F"; - function_key_name += IntToWString(i); + function_key_name += UTF8ToWide(base::IntToString(i)); if (function_key_name == code_str) { code = base::VKEY_F1 + (i - 1); break; diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index 79d3dff..d6cc4b8 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -13,6 +13,7 @@ #include "base/logging.h" #include "base/message_loop.h" #include "base/path_service.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" @@ -1021,7 +1022,7 @@ int32 LayoutTestController::CppVariantToInt32(const CppVariant& value) { return value.ToInt32(); else if (value.isString()) { int number; - if (StringToInt(value.ToString(), &number)) + if (base::StringToInt(value.ToString(), &number)) return number; } LogErrorToConsole("Invalid value for preference. Expected integer value."); diff --git a/webkit/tools/test_shell/listener_leak_test.cc b/webkit/tools/test_shell/listener_leak_test.cc index 12f336f..6f2fc4d 100644 --- a/webkit/tools/test_shell/listener_leak_test.cc +++ b/webkit/tools/test_shell/listener_leak_test.cc @@ -5,6 +5,7 @@ #include "base/file_path.h" #include "base/file_util.h" #include "base/path_service.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "v8/include/v8.h" @@ -43,7 +44,7 @@ static int GetNumObjects(int log_skip, const std::string& constructor) { size_t j = v8_log.find(",", i); CHECK(j != std::string::npos); int num_objects; - CHECK(StringToInt(v8_log.substr(i, j - i), &num_objects)); + CHECK(base::StringToInt(v8_log.substr(i, j - i), &num_objects)); return num_objects; } diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc index f71dc00..e5bdb85 100644 --- a/webkit/tools/test_shell/test_shell_main.cc +++ b/webkit/tools/test_shell/test_shell_main.cc @@ -206,8 +206,8 @@ int main(int argc, char* argv[]) { if (parsed_command_line.HasSwitch(test_shell::kTestShellTimeOut)) { const std::wstring timeout_str = parsed_command_line.GetSwitchValue( test_shell::kTestShellTimeOut); - int timeout_ms = - static_cast<int>(StringToInt64(WideToUTF16Hack(timeout_str.c_str()))); + int timeout_ms; + base::StringToInt(WideToUTF8(timeout_str), &timeout_ms); if (timeout_ms > 0) TestShell::SetFileTestTimeout(timeout_ms); } diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index 25ebd83..e5e23c3 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -13,6 +13,7 @@ #include "base/process_util.h" #include "base/string_util.h" #include "base/trace_event.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "gfx/native_widget_types.h" #include "gfx/point.h" @@ -255,13 +256,13 @@ std::string GetRangeDescription(const WebRange& range) { int exception = 0; std::string str = "range from "; int offset = range.startOffset(); - str.append(IntToString(offset)); + str.append(base::IntToString(offset)); str.append(" of "); WebNode container = range.startContainer(exception); str.append(GetNodeDescription(container, exception)); str.append(" to "); offset = range.endOffset(); - str.append(IntToString(offset)); + str.append(base::IntToString(offset)); str.append(" of "); container = range.endContainer(exception); str.append(GetNodeDescription(container, exception)); |