diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-03 14:39:42 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-03 14:39:42 +0000 |
commit | c9c07779224d9dd320323943a569dbf2e416a411 (patch) | |
tree | a040e1ca03410c7cb37547b16b5a0fb8bea67dde /chrome | |
parent | be1ce6a7b2fa7e9622e5b249abd5fab478b6ca05 (diff) | |
download | chromium_src-c9c07779224d9dd320323943a569dbf2e416a411.zip chromium_src-c9c07779224d9dd320323943a569dbf2e416a411.tar.gz chromium_src-c9c07779224d9dd320323943a569dbf2e416a411.tar.bz2 |
Remove number conversion functions from string_util. These moved to string_number_conversions.
TEST=it compiles
BUG=none
Review URL: http://codereview.chromium.org/3054036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54747 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/cocoa/authorization_util.mm | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/find_bar_text_field_cell.mm | 8 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run_win.cc | 7 | ||||
-rw-r--r-- | chrome/browser/views/autofill_profiles_view_win.cc | 3 | ||||
-rw-r--r-- | chrome/common/extensions/extension.cc | 2 | ||||
-rw-r--r-- | chrome/default_plugin/plugin_database_handler.cc | 8 | ||||
-rw-r--r-- | chrome/installer/setup/setup_main.cc | 7 | ||||
-rw-r--r-- | chrome/installer/setup/uninstall.cc | 3 | ||||
-rw-r--r-- | chrome/service/cloud_print/print_system_cups.cc | 5 | ||||
-rw-r--r-- | chrome/test/chrome_process_util_mac.cc | 9 | ||||
-rw-r--r-- | chrome/test/mini_installer_test/chrome_mini_installer.cc | 12 | ||||
-rw-r--r-- | chrome/test/pyautolib/pyautolib.cc | 34 | ||||
-rw-r--r-- | chrome/test/ui/ui_test_suite.cc | 4 |
13 files changed, 63 insertions, 42 deletions
diff --git a/chrome/browser/cocoa/authorization_util.mm b/chrome/browser/cocoa/authorization_util.mm index a879db2..fdd4387 100644 --- a/chrome/browser/cocoa/authorization_util.mm +++ b/chrome/browser/cocoa/authorization_util.mm @@ -13,6 +13,7 @@ #include "base/eintr_wrapper.h" #include "base/logging.h" #import "base/mac_util.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "chrome/browser/cocoa/scoped_authorizationref.h" @@ -118,7 +119,7 @@ OSStatus ExecuteWithPrivilegesAndGetPID(AuthorizationRef authorization, --line_length; } std::string line(line_c, line_length); - if (!StringToInt(line, &line_pid)) { + if (!base::StringToInt(line, &line_pid)) { // StringToInt may have set line_pid to something, but if the conversion // was imperfect, use -1. LOG(ERROR) << "ExecuteWithPrivilegesAndGetPid: funny line: " << line; diff --git a/chrome/browser/cocoa/find_bar_text_field_cell.mm b/chrome/browser/cocoa/find_bar_text_field_cell.mm index 9b52c5f..9c41ad5 100644 --- a/chrome/browser/cocoa/find_bar_text_field_cell.mm +++ b/chrome/browser/cocoa/find_bar_text_field_cell.mm @@ -6,6 +6,7 @@ #include "app/l10n_util.h" #include "base/logging.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" #include "grit/generated_resources.h" @@ -65,9 +66,10 @@ CGFloat WidthForResults(NSAttributedString* resultsString) { - (void)setActiveMatch:(NSInteger)current of:(NSInteger)total { NSString* results = - base::SysWideToNSString(l10n_util::GetStringF(IDS_FIND_IN_PAGE_COUNT, - IntToWString(current), - IntToWString(total))); + base::SysUTF16ToNSString(l10n_util::GetStringFUTF16( + IDS_FIND_IN_PAGE_COUNT, + base::IntToString16(current), + base::IntToString16(total))); resultsString_.reset([[NSAttributedString alloc] initWithString:results attributes:[self resultsAttributes:(total > 0)]]); diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc index d885ad7..9e2c87c 100644 --- a/chrome/browser/first_run/first_run_win.cc +++ b/chrome/browser/first_run/first_run_win.cc @@ -24,6 +24,7 @@ #include "base/process_util.h" #include "base/registry.h" #include "base/scoped_comptr_win.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/win_util.h" #include "chrome/common/chrome_constants.h" @@ -591,13 +592,13 @@ bool DecodeImportParams(const std::wstring& encoded, if (v.size() != 3) return false; - if (!StringToInt(v[0], browser_type)) + if (!base::StringToInt(v[0], browser_type)) return false; - if (!StringToInt(v[1], options)) + if (!base::StringToInt(v[1], options)) return false; - *window = reinterpret_cast<HWND>(StringToInt64(v[2])); + *window = reinterpret_cast<HWND>(base::StringToInt64(v[2])); return true; } diff --git a/chrome/browser/views/autofill_profiles_view_win.cc b/chrome/browser/views/autofill_profiles_view_win.cc index ffd477e..7b05966 100644 --- a/chrome/browser/views/autofill_profiles_view_win.cc +++ b/chrome/browser/views/autofill_profiles_view_win.cc @@ -1050,7 +1050,8 @@ void AutoFillProfilesView::EditableSetViewContents::InitCreditCardFields( combo_box_billing_ = new views::Combobox(billing_model_); combo_box_billing_->set_listener(this); int billing_id = -1; - if (StringToInt(temporary_info_.credit_card.billing_address(), &billing_id)) + if (base::StringToInt(temporary_info_.credit_card.billing_address(), + &billing_id)) combo_box_billing_->SetSelectedItem(billing_model_->GetIndex(billing_id)); billing_model_->UsedWithComboBox(combo_box_billing_); diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index d1a2d79..1860d6d 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -213,7 +213,7 @@ bool Extension::GenerateId(const std::string& input, std::string* output) { SHA256_Update(&ctx, ubuf, input.length()); uint8 hash[Extension::kIdSize]; SHA256_End(&ctx, hash, NULL, sizeof(hash)); - *output = StringToLowerASCII(HexEncode(hash, sizeof(hash))); + *output = StringToLowerASCII(base::HexEncode(hash, sizeof(hash))); ConvertHexadecimalToIDAlphabet(output); return true; diff --git a/chrome/default_plugin/plugin_database_handler.cc b/chrome/default_plugin/plugin_database_handler.cc index ab79752..cc070754 100644 --- a/chrome/default_plugin/plugin_database_handler.cc +++ b/chrome/default_plugin/plugin_database_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. @@ -14,6 +14,7 @@ #include "base/file_util.h" #include "base/path_service.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/time.h" #include "base/utf_string_conversions.h" @@ -336,8 +337,9 @@ bool PluginDatabaseHandler::ReadPluginInfo(_xmlNode* plugin_node, plugin_download_url_for_display_node->children; if (url_for_display_val) { int url_for_display = 0; - StringToInt(reinterpret_cast<const char*>(url_for_display_val->content), - &url_for_display); + base::StringToInt( + reinterpret_cast<const char*>(url_for_display_val->content), + &url_for_display); if (url_for_display != 0) plugin_detail->download_url_for_display = true; } diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index 3cbd522..08e9ae5 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.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. @@ -16,6 +16,7 @@ #include "base/process_util.h" #include "base/registry.h" #include "base/scoped_handle_win.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "base/win_util.h" @@ -521,7 +522,9 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, // Launch the inactive user toast experiment. std::wstring flavor = cmd_line.GetSwitchValue(installer_util::switches::kInactiveUserToast); - dist->InactiveUserToastExperiment(StringToInt(flavor), + int flavor_int; + base::StringToInt(flavor, &flavor_int); + dist->InactiveUserToastExperiment(flavor_int, cmd_line.HasSwitch(installer_util::switches::kSystemLevelToast)); return true; } else if (cmd_line.HasSwitch(installer_util::switches::kSystemLevelToast)) { diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 7b6150c..bbee52e 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -9,6 +9,7 @@ #include "base/file_util.h" #include "base/path_service.h" #include "base/registry.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/win_util.h" #include "chrome/common/result_codes.h" @@ -38,7 +39,7 @@ namespace { void CloseAllChromeProcesses() { for (int j = 0; j < 4; ++j) { std::wstring wnd_class(L"Chrome_WidgetWin_"); - wnd_class.append(IntToWString(j)); + wnd_class.append(base::IntToString16(j)); HWND window = FindWindowEx(NULL, NULL, wnd_class.c_str(), NULL); while (window) { HWND tmpWnd = window; diff --git a/chrome/service/cloud_print/print_system_cups.cc b/chrome/service/cloud_print/print_system_cups.cc index 265e1d3..c1085e4 100644 --- a/chrome/service/cloud_print/print_system_cups.cc +++ b/chrome/service/cloud_print/print_system_cups.cc @@ -20,6 +20,7 @@ #include "base/logging.h" #include "base/message_loop.h" #include "base/rand_util.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/task.h" #include "base/utf_string_conversions.h" @@ -298,7 +299,7 @@ void PrintSystemCUPS::EnumeratePrinters(PrinterList* printer_list) { const char* state = cupsGetOption(kCUPSPrinterStateOpt, printer.num_options, printer.options); if (state != NULL) - StringToInt(state, &printer_info.printer_status); + base::StringToInt(state, &printer_info.printer_status); // Store printer options. for (int opt_index = 0; opt_index < printer.num_options; opt_index++) { @@ -467,7 +468,7 @@ std::string PrintSystem::GenerateProxyId() { // unique for this user. Rand may return the same number. We'll need to change // this in the future. std::string id("CP_PROXY_"); - id += Uint64ToString(base::RandUint64()); + id += base::Uint64ToString(base::RandUint64()); return id; } diff --git a/chrome/test/chrome_process_util_mac.cc b/chrome/test/chrome_process_util_mac.cc index d920735..21e8746 100644 --- a/chrome/test/chrome_process_util_mac.cc +++ b/chrome/test/chrome_process_util_mac.cc @@ -9,6 +9,7 @@ #include "base/command_line.h" #include "base/process_util.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" MacChromeProcessInfoList GetRunningMacProcessInfo( @@ -45,9 +46,11 @@ MacChromeProcessInfoList GetRunningMacProcessInfo( SplitString(line, ' ', &values); if (values.size() == 3) { MacChromeProcessInfo proc_info; - proc_info.pid = StringToInt(values[0]); - proc_info.rsz_in_kb = StringToInt(values[1]); - proc_info.vsz_in_kb = StringToInt(values[2]); + int pid; + base::StringToInt(values[0], &pid); + proc_info.pid = pid; + base::StringToInt(values[1], &proc_info.rsz_in_kb); + base::StringToInt(values[2], &proc_info.vsz_in_kb); if (proc_info.pid && proc_info.rsz_in_kb && proc_info.vsz_in_kb) result.push_back(proc_info); } diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.cc b/chrome/test/mini_installer_test/chrome_mini_installer.cc index 931fb52..3bbe078 100644 --- a/chrome/test/mini_installer_test/chrome_mini_installer.cc +++ b/chrome/test/mini_installer_test/chrome_mini_installer.cc @@ -9,6 +9,7 @@ #include "base/platform_thread.h" #include "base/process_util.h" #include "base/registry.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/google_update_constants.h" @@ -633,10 +634,13 @@ void ChromeMiniInstaller::LaunchBrowser(const std::wstring& launch_path, bool ChromeMiniInstaller::VerifyOverInstall( const std::wstring& value_before_overinstall, const std::wstring& value_after_overinstall) { - int64 reg_key_value_before_overinstall = StringToInt64( - value_before_overinstall); - int64 reg_key_value_after_overinstall = StringToInt64( - value_after_overinstall); + int64 reg_key_value_before_overinstall; + base::StringToInt64(value_before_overinstall, + ®_key_value_before_overinstall); + int64 reg_key_value_after_overinstall; + base::StringToInt64(value_after_overinstall, + ®_key_value_after_overinstall); + // Compare to see if the version is less. printf("Reg Key value before overinstall is%ls\n", value_before_overinstall.c_str()); diff --git a/chrome/test/pyautolib/pyautolib.cc b/chrome/test/pyautolib/pyautolib.cc index 58ac2dd..76c32fe 100644 --- a/chrome/test/pyautolib/pyautolib.cc +++ b/chrome/test/pyautolib/pyautolib.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/scoped_ptr.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/test/automation/extension_proxy.h" @@ -10,6 +11,11 @@ #include "chrome/test/pyautolib/pyautolib.h" #include "googleurl/src/gurl.h" +static int64 StringToId(const std::wstring& str) { + int64 id; + base::StringToInt64(WideToUTF8(str), &id); + return id; +} // PyUITestSuiteBase PyUITestSuiteBase::PyUITestSuiteBase(int argc, char** argv) @@ -209,28 +215,27 @@ std::string PyUITestBase::_GetBookmarksAsJSON() { } bool PyUITestBase::AddBookmarkGroup(std::wstring& parent_id, int index, - std::wstring& title) { + std::wstring& title) { scoped_refptr<BrowserProxy> browser_proxy = automation()->GetBrowserWindow(0); // Window doesn't matter. EXPECT_TRUE(browser_proxy.get()); if (!browser_proxy.get()) return false; - return browser_proxy->AddBookmarkGroup(StringToInt64(WideToUTF16(parent_id)), - index, title); + return browser_proxy->AddBookmarkGroup(StringToId(parent_id), index, title); } bool PyUITestBase::AddBookmarkURL(std::wstring& parent_id, int index, - std::wstring& title, std::wstring& url) { + std::wstring& title, std::wstring& url) { scoped_refptr<BrowserProxy> browser_proxy = automation()->GetBrowserWindow(0); // Window doesn't matter. EXPECT_TRUE(browser_proxy.get()); if (!browser_proxy.get()) return false; - return browser_proxy->AddBookmarkURL(StringToInt64(WideToUTF16(parent_id)), + return browser_proxy->AddBookmarkURL(StringToId(parent_id), index, title, - GURL(WideToUTF16(url))); + GURL(WideToUTF8(url))); } bool PyUITestBase::ReparentBookmark( @@ -241,10 +246,9 @@ bool PyUITestBase::ReparentBookmark( if (!browser_proxy.get()) return false; - return browser_proxy->ReparentBookmark( - StringToInt64(WideToUTF16(id)), - StringToInt64(WideToUTF16(new_parent_id)), - index); + return browser_proxy->ReparentBookmark(StringToId(id), + StringToId(new_parent_id), + index); } bool PyUITestBase::SetBookmarkTitle(std::wstring& id, std::wstring& title) { @@ -254,8 +258,7 @@ bool PyUITestBase::SetBookmarkTitle(std::wstring& id, std::wstring& title) { if (!browser_proxy.get()) return false; - return browser_proxy->SetBookmarkTitle(StringToInt64(WideToUTF16(id)), - title); + return browser_proxy->SetBookmarkTitle(StringToId(id), title); } bool PyUITestBase::SetBookmarkURL(std::wstring& id, std::wstring& url) { @@ -265,8 +268,7 @@ bool PyUITestBase::SetBookmarkURL(std::wstring& id, std::wstring& url) { if (!browser_proxy.get()) return false; - return browser_proxy->SetBookmarkURL(StringToInt64(WideToUTF16(id)), - GURL(WideToUTF16(url))); + return browser_proxy->SetBookmarkURL(StringToId(id), GURL(WideToUTF8(url))); } bool PyUITestBase::RemoveBookmark(std::wstring& id) { @@ -276,7 +278,7 @@ bool PyUITestBase::RemoveBookmark(std::wstring& id) { if (!browser_proxy.get()) return false; - return browser_proxy->RemoveBookmark(StringToInt64(WideToUTF16(id))); + return browser_proxy->RemoveBookmark(StringToId(id)); } scoped_refptr<BrowserProxy> PyUITestBase::GetBrowserWindow(int window_index) { @@ -284,7 +286,7 @@ scoped_refptr<BrowserProxy> PyUITestBase::GetBrowserWindow(int window_index) { } std::string PyUITestBase::_SendJSONRequest(int window_index, - std::string& request) { + std::string& request) { scoped_refptr<BrowserProxy> browser_proxy = automation()->GetBrowserWindow(window_index); EXPECT_TRUE(browser_proxy.get()); diff --git a/chrome/test/ui/ui_test_suite.cc b/chrome/test/ui/ui_test_suite.cc index b74593d..5ba7f1f 100644 --- a/chrome/test/ui/ui_test_suite.cc +++ b/chrome/test/ui/ui_test_suite.cc @@ -63,12 +63,12 @@ void UITestSuite::Initialize() { std::wstring batch_count_str = parsed_command_line.GetSwitchValue(UITestSuite::kBatchCount); if (!batch_count_str.empty()) { - batch_count = StringToInt(WideToUTF16Hack(batch_count_str)); + base::StringToInt(WideToUTF16Hack(batch_count_str), &batch_count); } std::wstring batch_index_str = parsed_command_line.GetSwitchValue(UITestSuite::kBatchIndex); if (!batch_index_str.empty()) { - batch_index = StringToInt(WideToUTF16Hack(batch_index_str)); + base::StringToInt(WideToUTF16Hack(batch_index_str), &batch_index); } if (batch_count > 0 && batch_index >= 0 && batch_index < batch_count) { // Running UI test in parallel. Gtest supports running tests in shards, |