diff options
Diffstat (limited to 'chrome/browser')
84 files changed, 279 insertions, 190 deletions
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 " |