diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-25 00:53:42 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-25 00:53:42 +0000 |
commit | c91b9d414c56955f3ca405fd66c6f567fc16d9fc (patch) | |
tree | 293205b4a78c5ce8571edcb4ae26e1b9880d8e51 | |
parent | 036a5f386e1204a861f3b24201bd0f89d359f29c (diff) | |
download | chromium_src-c91b9d414c56955f3ca405fd66c6f567fc16d9fc.zip chromium_src-c91b9d414c56955f3ca405fd66c6f567fc16d9fc.tar.gz chromium_src-c91b9d414c56955f3ca405fd66c6f567fc16d9fc.tar.bz2 |
Update uses of UTF conversions in chrome/installer, chrome/renderer, chrome/service, chrome/test, chrome/third_party, chrome/tools, chrome/utility to use the base:: namespace.
BUG=330556
TEST=no change
TBR=ben@chromium.org
Review URL: https://codereview.chromium.org/119103004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242472 0039d316-1c4b-4281-b951-d872f2087c98
95 files changed, 272 insertions, 227 deletions
diff --git a/chrome/installer/gcapi/gcapi_last_run_test.cc b/chrome/installer/gcapi/gcapi_last_run_test.cc index 02a1974..503bb5f 100644 --- a/chrome/installer/gcapi/gcapi_last_run_test.cc +++ b/chrome/installer/gcapi/gcapi_last_run_test.cc @@ -27,7 +27,7 @@ class GCAPILastRunTest : public ::testing::Test { void SetUp() { // Override keys - this is undone during destruction. std::wstring hkcu_override = base::StringPrintf( - L"hkcu_override\\%ls", ASCIIToWide(base::GenerateGUID())); + L"hkcu_override\\%ls", base::ASCIIToWide(base::GenerateGUID())); override_manager_.OverrideRegistry(HKEY_CURRENT_USER, hkcu_override); // Create the client state key in the right places. diff --git a/chrome/installer/gcapi/gcapi_omaha_experiment.cc b/chrome/installer/gcapi/gcapi_omaha_experiment.cc index 4b64a77..d8c3087 100644 --- a/chrome/installer/gcapi/gcapi_omaha_experiment.cc +++ b/chrome/installer/gcapi/gcapi_omaha_experiment.cc @@ -45,7 +45,7 @@ bool SetExperimentLabel(const wchar_t* brand_code, std::vector<base::string16> entries; base::SplitStringUsingSubstr( original_labels, - ASCIIToUTF16(google_update::kExperimentLabelSep), + base::ASCIIToUTF16(google_update::kExperimentLabelSep), &entries); // Keep all labels, but the one we want to add/replace. @@ -54,7 +54,7 @@ bool SetExperimentLabel(const wchar_t* brand_code, it != entries.end(); ++it) { if (!it->empty() && !StartsWith(*it, label + L"=", true)) { new_labels += *it; - new_labels += ASCIIToUTF16(google_update::kExperimentLabelSep); + new_labels += base::ASCIIToUTF16(google_update::kExperimentLabelSep); } } diff --git a/chrome/installer/gcapi/gcapi_omaha_experiment_test.cc b/chrome/installer/gcapi/gcapi_omaha_experiment_test.cc index a464141..98fcf66 100644 --- a/chrome/installer/gcapi/gcapi_omaha_experiment_test.cc +++ b/chrome/installer/gcapi/gcapi_omaha_experiment_test.cc @@ -12,6 +12,8 @@ #include "chrome/installer/util/google_update_settings.h" #include "testing/gtest/include/gtest/gtest.h" +using base::ASCIIToUTF16; + namespace { const wchar_t kBrand[] = L"ABCD"; diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc index 41c8fe0..6d75274 100644 --- a/chrome/installer/setup/install.cc +++ b/chrome/installer/setup/install.cc @@ -45,6 +45,8 @@ // Build-time generated include file. #include "registered_dlls.h" // NOLINT +using base::ASCIIToUTF16; +using base::UTF16ToUTF8; using installer::InstallerState; using installer::InstallationState; using installer::Product; diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc index b6a2892..8daa86a 100644 --- a/chrome/installer/setup/install_worker.cc +++ b/chrome/installer/setup/install_worker.cc @@ -52,6 +52,7 @@ #include "chrome_frame/chrome_tab.h" #endif +using base::ASCIIToWide; using base::win::RegKey; namespace installer { diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index efb473e..71e9a01 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -1162,7 +1162,7 @@ bool HandleNonInstallCmdLineOptions(const InstallationState& original_state, ++it) { const Product& product = **it; installer::InactiveUserToastExperiment( - flavor, ASCIIToUTF16(experiment_group), product, + flavor, base::ASCIIToUTF16(experiment_group), product, installer_state->target_path()); } } diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index f8e4c3c..66614ca 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -1117,7 +1117,7 @@ InstallStatus UninstallProduct(const InstallationState& original_state, } auto_launch_util::DisableAllAutoStartFeatures( - ASCIIToUTF16(chrome::kInitialProfile)); + base::ASCIIToUTF16(chrome::kInitialProfile)); // If user-level chrome is self-destructing as a result of encountering a // system-level chrome, retarget owned non-default shortcuts (app shortcuts, diff --git a/chrome/installer/util/auto_launch_util.cc b/chrome/installer/util/auto_launch_util.cc index 42c0831..857f8e0 100644 --- a/chrome/installer/util/auto_launch_util.cc +++ b/chrome/installer/util/auto_launch_util.cc @@ -19,6 +19,9 @@ #include "chrome/installer/util/util_constants.h" #include "crypto/sha2.h" +using base::ASCIIToUTF16; +using base::ASCIIToWide; + namespace auto_launch_util { // The prefix of the Chrome Auto-launch key under the Run key. diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index 2ca7780..ea9b2ea 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -92,8 +92,8 @@ void GoogleChromeDistribution::DoPostUninstallOperations( iexplore = iexplore.AppendASCII("iexplore.exe"); base::string16 command = iexplore.value() + L" " + GetUninstallSurveyUrl() + - L"&" + kVersionParam + L"=" + UTF8ToWide(version.GetString()) + L"&" + - kOSParam + L"=" + os_version; + L"&" + kVersionParam + L"=" + base::UTF8ToWide(version.GetString()) + + L"&" + kOSParam + L"=" + os_version; base::string16 uninstall_metrics; if (installer::ExtractUninstallMetricsFromFile(local_data_path, diff --git a/chrome/installer/util/google_update_experiment_util.cc b/chrome/installer/util/google_update_experiment_util.cc index 50e81ffd..2171b47 100644 --- a/chrome/installer/util/google_update_experiment_util.cc +++ b/chrome/installer/util/google_update_experiment_util.cc @@ -50,14 +50,15 @@ base::string16 BuildExperimentDateString(const base::Time& current_time) { then.year += 1; DCHECK(then.HasValidValues()); - return UTF8ToUTF16(base::StringPrintf("%s, %02d %s %d %02d:%02d:%02d GMT", - kDays[then.day_of_week], - then.day_of_month, - kMonths[then.month - 1], - then.year, - then.hour, - then.minute, - then.second)); + return base::UTF8ToUTF16( + base::StringPrintf("%s, %02d %s %d %02d:%02d:%02d GMT", + kDays[then.day_of_week], + then.day_of_month, + kMonths[then.month - 1], + then.year, + then.hour, + then.minute, + then.second)); } } // namespace installer diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc index 3c535f1..8160989 100644 --- a/chrome/installer/util/google_update_settings.cc +++ b/chrome/installer/util/google_update_settings.cc @@ -279,12 +279,12 @@ bool GoogleUpdateSettings::SetCollectStatsConsentAtLevel(bool system_install, bool GoogleUpdateSettings::GetMetricsId(std::string* metrics_id) { std::wstring metrics_id_w; bool rv = ReadGoogleUpdateStrKey(google_update::kRegMetricsId, &metrics_id_w); - *metrics_id = WideToUTF8(metrics_id_w); + *metrics_id = base::WideToUTF8(metrics_id_w); return rv; } bool GoogleUpdateSettings::SetMetricsId(const std::string& metrics_id) { - std::wstring metrics_id_w = UTF8ToWide(metrics_id); + std::wstring metrics_id_w = base::UTF8ToWide(metrics_id); return WriteGoogleUpdateStrKey(google_update::kRegMetricsId, metrics_id_w); } @@ -596,7 +596,7 @@ base::Version GoogleUpdateSettings::GetGoogleUpdateVersion( KEY_QUERY_VALUE) == ERROR_SUCCESS && key.ReadValue(google_update::kRegGoogleUpdateVersion, &version) == ERROR_SUCCESS) { - return base::Version(UTF16ToUTF8(version)); + return base::Version(base::UTF16ToUTF8(version)); } return base::Version(); diff --git a/chrome/installer/util/google_update_settings_unittest.cc b/chrome/installer/util/google_update_settings_unittest.cc index 06e8b8b..58feba6 100644 --- a/chrome/installer/util/google_update_settings_unittest.cc +++ b/chrome/installer/util/google_update_settings_unittest.cc @@ -749,7 +749,7 @@ TEST_P(GetGoogleUpdateVersion, TestEmptyValue) { TEST_P(GetGoogleUpdateVersion, TestRealValue) { RegKey(root_key_, google_update::kRegPathGoogleUpdate, KEY_SET_VALUE) .WriteValue(google_update::kRegGoogleUpdateVersion, kDummyVersion); - base::Version expected(UTF16ToUTF8(kDummyVersion)); + base::Version expected(base::UTF16ToUTF8(kDummyVersion)); EXPECT_TRUE(expected.Equals( GoogleUpdateSettings::GetGoogleUpdateVersion(system_install_))); // Make sure that there's no value in the other level (user or system). diff --git a/chrome/installer/util/installation_validator.cc b/chrome/installer/util/installation_validator.cc index a70e1c0..2dd063a 100644 --- a/chrome/installer/util/installation_validator.cc +++ b/chrome/installer/util/installation_validator.cc @@ -560,7 +560,8 @@ void InstallationValidator::ValidateUninstallCommand( bool* is_valid) { DCHECK(is_valid); - ValidateSetupPath(ctx, command.GetProgram(), ASCIIToUTF16("uninstaller"), + ValidateSetupPath(ctx, command.GetProgram(), + base::ASCIIToUTF16("uninstaller"), is_valid); const bool is_multi_install = ctx.state.is_multi_install(); @@ -583,7 +584,7 @@ void InstallationValidator::ValidateRenameCommand(const ProductContext& ctx, DCHECK(!ctx.state.rename_cmd().empty()); CommandLine command = CommandLine::FromString(ctx.state.rename_cmd()); - base::string16 name(ASCIIToUTF16("in-use renamer")); + base::string16 name(base::ASCIIToUTF16("in-use renamer")); ValidateSetupPath(ctx, command.GetProgram(), name, is_valid); @@ -726,7 +727,8 @@ void InstallationValidator::ValidateProduct( ProductContext ctx(machine_state, system_install, product_state, rules); ValidateUninstallCommand(ctx, ctx.state.uninstall_command(), - ASCIIToUTF16("Google Update uninstall command"), + base::ASCIIToUTF16( + "Google Update uninstall command"), is_valid); ValidateOldVersionValues(ctx, is_valid); diff --git a/chrome/installer/util/installer_state.cc b/chrome/installer/util/installer_state.cc index b0ba708..544c53e 100644 --- a/chrome/installer/util/installer_state.cc +++ b/chrome/installer/util/installer_state.cc @@ -582,7 +582,7 @@ bool InstallerState::AreBinariesInUse( base::FilePath InstallerState::GetInstallerDirectory( const base::Version& version) const { - return target_path().Append(ASCIIToWide(version.GetString())) + return target_path().Append(base::ASCIIToWide(version.GetString())) .Append(kInstallerDir); } diff --git a/chrome/installer/util/installer_state_unittest.cc b/chrome/installer/util/installer_state_unittest.cc index 276314e..d618c85 100644 --- a/chrome/installer/util/installer_state_unittest.cc +++ b/chrome/installer/util/installer_state_unittest.cc @@ -274,9 +274,9 @@ TEST_F(InstallerStateTest, Basic) { EXPECT_FALSE(installer_dir.empty()); base::FilePath new_version_dir(installer_state.target_path().Append( - UTF8ToWide(new_version.GetString()))); + base::UTF8ToWide(new_version.GetString()))); base::FilePath old_version_dir(installer_state.target_path().Append( - UTF8ToWide(old_version.GetString()))); + base::UTF8ToWide(old_version.GetString()))); EXPECT_FALSE(base::PathExists(new_version_dir)); EXPECT_FALSE(base::PathExists(old_version_dir)); @@ -359,7 +359,8 @@ TEST_F(InstallerStateTest, WithProduct) { EXPECT_TRUE(chrome_key.Valid()); if (chrome_key.Valid()) { chrome_key.WriteValue(google_update::kRegVersionField, - UTF8ToWide(current_version.GetString()).c_str()); + base::UTF8ToWide( + current_version.GetString()).c_str()); machine_state.Initialize(); // TODO(tommi): Also test for when there exists a new_chrome.exe. base::Version found_version( @@ -524,11 +525,12 @@ TEST_F(InstallerStateTest, RemoveOldVersionDirs) { installer_state.target_path().Append(L"1.2.3.4"), installer_state.target_path().Append(L"1.2.3.5"), installer_state.target_path().Append(L"1.2.3.6"), - installer_state.target_path().Append(ASCIIToWide(kOldVersion)), - installer_state.target_path().Append(ASCIIToWide(kOldChromeExeVersion)), + installer_state.target_path().Append(base::ASCIIToWide(kOldVersion)), + installer_state.target_path().Append( + base::ASCIIToWide(kOldChromeExeVersion)), installer_state.target_path().Append(L"2.1.1.0"), - installer_state.target_path().Append(ASCIIToWide(kChromeExeVersion)), - installer_state.target_path().Append(ASCIIToWide(kNewVersion)), + installer_state.target_path().Append(base::ASCIIToWide(kChromeExeVersion)), + installer_state.target_path().Append(base::ASCIIToWide(kNewVersion)), installer_state.target_path().Append(L"3.9.1.1"), }; @@ -688,7 +690,7 @@ class InstallerStateCriticalVersionTest : public ::testing::Test { CommandLine::FromString(L"setup.exe") : CommandLine::FromString( L"setup.exe --critical-update-version=" + - ASCIIToWide(version->GetString())); + base::ASCIIToWide(version->GetString())); prefs_.reset(new MasterPreferences(cmd_line_)); machine_state_.Initialize(); installer_state_.Initialize(cmd_line_, *prefs_, machine_state_); diff --git a/chrome/installer/util/logging_installer.cc b/chrome/installer/util/logging_installer.cc index 80442aa..5839989 100644 --- a/chrome/installer/util/logging_installer.cc +++ b/chrome/installer/util/logging_installer.cc @@ -115,7 +115,7 @@ base::FilePath GetLogFilePath(const installer::MasterPreferences& prefs) { std::string path; prefs.GetString(installer::master_preferences::kLogFile, &path); if (!path.empty()) - return base::FilePath(UTF8ToWide(path)); + return base::FilePath(base::UTF8ToWide(path)); static const base::FilePath::CharType kLogFilename[] = FILE_PATH_LITERAL("chrome_installer.log"); diff --git a/chrome/installer/util/product_unittest.cc b/chrome/installer/util/product_unittest.cc index d4db0e3..36d9239 100644 --- a/chrome/installer/util/product_unittest.cc +++ b/chrome/installer/util/product_unittest.cc @@ -110,7 +110,8 @@ TEST_F(ProductTest, MAYBE_ProductInstallBasic) { const char kCurrentVersion[] = "1.2.3.4"; base::Version current_version(kCurrentVersion); version_key.WriteValue(google_update::kRegVersionField, - UTF8ToWide(current_version.GetString()).c_str()); + base::UTF8ToWide( + current_version.GetString()).c_str()); // We started out with a non-msi product. machine_state.Initialize(); diff --git a/chrome/installer/util/self_cleaning_temp_dir_unittest.cc b/chrome/installer/util/self_cleaning_temp_dir_unittest.cc index a752f17..7366211 100644 --- a/chrome/installer/util/self_cleaning_temp_dir_unittest.cc +++ b/chrome/installer/util/self_cleaning_temp_dir_unittest.cc @@ -34,7 +34,7 @@ std::wstring GetRandomFilename() { // Replace the first digit with the letter 'R' (for "random", get it?). result[0] = 'R'; - return ASCIIToWide(result); + return base::ASCIIToWide(result); } } // namespace diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 57e0736..d02ee80 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -379,11 +379,14 @@ class RegistryEntry { // Note: not using CommandLine since it has ambiguous rules for quoting // strings. entries->push_back(new RegistryEntry(install_info, kReinstallCommand, - quoted_exe_path + L" --" + ASCIIToWide(switches::kMakeDefaultBrowser))); + quoted_exe_path + L" --" + + base::ASCIIToWide(switches::kMakeDefaultBrowser))); entries->push_back(new RegistryEntry(install_info, L"HideIconsCommand", - quoted_exe_path + L" --" + ASCIIToWide(switches::kHideIcons))); + quoted_exe_path + L" --" + + base::ASCIIToWide(switches::kHideIcons))); entries->push_back(new RegistryEntry(install_info, L"ShowIconsCommand", - quoted_exe_path + L" --" + ASCIIToWide(switches::kShowIcons))); + quoted_exe_path + L" --" + + base::ASCIIToWide(switches::kShowIcons))); entries->push_back(new RegistryEntry(install_info, L"IconsVisible", 1)); // Register with Default Programs. diff --git a/chrome/installer/util/uninstall_metrics.cc b/chrome/installer/util/uninstall_metrics.cc index 58badf6..da8ca03 100644 --- a/chrome/installer/util/uninstall_metrics.cc +++ b/chrome/installer/util/uninstall_metrics.cc @@ -33,12 +33,12 @@ bool BuildUninstallMetricsString( iter.Advance()) { has_values = true; metrics->append(L"&"); - metrics->append(UTF8ToWide(iter.key())); + metrics->append(base::UTF8ToWide(iter.key())); metrics->append(L"="); std::string value; iter.value().GetAsString(&value); - metrics->append(UTF8ToWide(value)); + metrics->append(base::UTF8ToWide(value)); } return has_values; diff --git a/chrome/installer/util/user_experiment.cc b/chrome/installer/util/user_experiment.cc index 6a57bbe..9565b6e 100644 --- a/chrome/installer/util/user_experiment.cc +++ b/chrome/installer/util/user_experiment.cc @@ -332,16 +332,16 @@ bool CreateExperimentDetails(int flavor, ExperimentDetails* experiment) { base::string16 locale; GoogleUpdateSettings::GetLanguage(&locale); - if (locale.empty() || (locale == ASCIIToWide("en"))) - locale = ASCIIToWide("en-US"); + if (locale.empty() || (locale == base::ASCIIToWide("en"))) + locale = base::ASCIIToWide("en-US"); base::string16 brand; if (!GoogleUpdateSettings::GetBrand(&brand)) - brand = ASCIIToWide(""); // Could still be viable for catch-all rules. + brand = base::ASCIIToWide(""); // Could still be viable for catch-all rules for (int i = 0; i < arraysize(kExperiments); ++i) { if (kExperiments[i].locale != locale && - kExperiments[i].locale != ASCIIToWide("*")) + kExperiments[i].locale != base::ASCIIToWide("*")) continue; std::vector<base::string16> brand_codes; diff --git a/chrome/renderer/autofill/autofill_renderer_browsertest.cc b/chrome/renderer/autofill/autofill_renderer_browsertest.cc index f75a105..71d8829 100644 --- a/chrome/renderer/autofill/autofill_renderer_browsertest.cc +++ b/chrome/renderer/autofill/autofill_renderer_browsertest.cc @@ -13,6 +13,7 @@ #include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebInputElement.h" +using base::ASCIIToUTF16; using blink::WebDocument; using blink::WebFrame; using blink::WebInputElement; diff --git a/chrome/renderer/autofill/form_autofill_browsertest.cc b/chrome/renderer/autofill/form_autofill_browsertest.cc index ba454f1..ecb90ab 100644 --- a/chrome/renderer/autofill/form_autofill_browsertest.cc +++ b/chrome/renderer/autofill/form_autofill_browsertest.cc @@ -28,6 +28,7 @@ #include "third_party/WebKit/public/web/WebSelectElement.h" #include "third_party/WebKit/public/web/WebTextAreaElement.h" +using base::ASCIIToUTF16; using blink::WebDocument; using blink::WebElement; using blink::WebFormControlElement; diff --git a/chrome/renderer/autofill/password_generation_agent_browsertest.cc b/chrome/renderer/autofill/password_generation_agent_browsertest.cc index 6d13019..b39c06e 100644 --- a/chrome/renderer/autofill/password_generation_agent_browsertest.cc +++ b/chrome/renderer/autofill/password_generation_agent_browsertest.cc @@ -214,7 +214,7 @@ TEST_F(PasswordGenerationAgentTest, FillTest) { EXPECT_TRUE(first_password_element.value().isNull()); EXPECT_TRUE(second_password_element.value().isNull()); - base::string16 password = ASCIIToUTF16("random_password"); + base::string16 password = base::ASCIIToUTF16("random_password"); AutofillMsg_GeneratedPasswordAccepted msg(0, password); generation_manager_->OnMessageReceived(msg); diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 2052bc6..9f9777e 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -118,6 +118,7 @@ using autofill::AutofillAgent; using autofill::PasswordAutofillAgent; using autofill::PasswordGenerationAgent; +using base::ASCIIToUTF16; using content::RenderThread; using content::UserMetricsAction; using content::WebPluginInfo; diff --git a/chrome/renderer/chrome_content_renderer_client_unittest.cc b/chrome/renderer/chrome_content_renderer_client_unittest.cc index e2b70d2..33739e17 100644 --- a/chrome/renderer/chrome_content_renderer_client_unittest.cc +++ b/chrome/renderer/chrome_content_renderer_client_unittest.cc @@ -72,9 +72,9 @@ void AddContentTypeHandler(content::WebPluginInfo* info, const char* manifest_url) { content::WebPluginMimeType mime_type_info; mime_type_info.mime_type = mime_type; - mime_type_info.additional_param_names.push_back(UTF8ToUTF16("nacl")); + mime_type_info.additional_param_names.push_back(base::UTF8ToUTF16("nacl")); mime_type_info.additional_param_values.push_back( - UTF8ToUTF16(manifest_url)); + base::UTF8ToUTF16(manifest_url)); info->mime_types.push_back(mime_type_info); } } // namespace diff --git a/chrome/renderer/chrome_render_process_observer.cc b/chrome/renderer/chrome_render_process_observer.cc index ce6c1c2..60759bc 100644 --- a/chrome/renderer/chrome_render_process_observer.cc +++ b/chrome/renderer/chrome_render_process_observer.cc @@ -345,7 +345,7 @@ void ChromeRenderProcessObserver::WebKitInitialized() { // that can commit synchronously. No code should be runnable in these pages, // so it should not need to access anything nor should it allow javascript // URLs since it should never be visible to the user. - WebString native_scheme(ASCIIToUTF16(chrome::kChromeNativeScheme)); + WebString native_scheme(base::ASCIIToUTF16(chrome::kChromeNativeScheme)); WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(native_scheme); WebSecurityPolicy::registerURLSchemeAsEmptyDocument(native_scheme); WebSecurityPolicy::registerURLSchemeAsNoAccess(native_scheme); diff --git a/chrome/renderer/chrome_render_view_observer.cc b/chrome/renderer/chrome_render_view_observer.cc index d0ddb5b..47509ba 100644 --- a/chrome/renderer/chrome_render_view_observer.cc +++ b/chrome/renderer/chrome_render_view_observer.cc @@ -585,8 +585,8 @@ bool ChromeRenderViewObserver::HasRefreshMetaTag(WebFrame* frame) { if (head.isNull() || !head.hasChildNodes()) return false; - const WebString tag_name(ASCIIToUTF16("meta")); - const WebString attribute_name(ASCIIToUTF16("http-equiv")); + const WebString tag_name(base::ASCIIToUTF16("meta")); + const WebString attribute_name(base::ASCIIToUTF16("http-equiv")); WebNodeList children = head.childNodes(); for (size_t i = 0; i < children.length(); ++i) { diff --git a/chrome/renderer/extensions/console.cc b/chrome/renderer/extensions/console.cc index b2e4efc..1c3dde3 100644 --- a/chrome/renderer/extensions/console.cc +++ b/chrome/renderer/extensions/console.cc @@ -135,7 +135,7 @@ void AddMessage(content::RenderView* render_view, break; } web_view->mainFrame()->addMessageToConsole( - blink::WebConsoleMessage(target_level, UTF8ToUTF16(message))); + blink::WebConsoleMessage(target_level, base::UTF8ToUTF16(message))); } void Debug(v8::Handle<v8::Context> context, const std::string& message) { diff --git a/chrome/renderer/extensions/page_capture_custom_bindings.cc b/chrome/renderer/extensions/page_capture_custom_bindings.cc index 79e10a6..d001874 100644 --- a/chrome/renderer/extensions/page_capture_custom_bindings.cc +++ b/chrome/renderer/extensions/page_capture_custom_bindings.cc @@ -31,7 +31,7 @@ void PageCaptureCustomBindings::CreateBlob( CHECK(args.Length() == 2); CHECK(args[0]->IsString()); CHECK(args[1]->IsInt32()); - blink::WebString path(UTF8ToUTF16(*v8::String::Utf8Value(args[0]))); + blink::WebString path(base::UTF8ToUTF16(*v8::String::Utf8Value(args[0]))); blink::WebBlob blob = blink::WebBlob::createFromFile(path, args[1]->Int32Value()); args.GetReturnValue().Set(blob.toV8Value()); diff --git a/chrome/renderer/mock_printer.cc b/chrome/renderer/mock_printer.cc index b2450c3..15213e6 100644 --- a/chrome/renderer/mock_printer.cc +++ b/chrome/renderer/mock_printer.cc @@ -72,8 +72,8 @@ MockPrinter::MockPrinter() preview_request_id_(0), print_scaling_option_(blink::WebPrintScalingOptionSourceSize), display_header_footer_(false), - title_(ASCIIToUTF16("title")), - url_(ASCIIToUTF16("url")), + title_(base::ASCIIToUTF16("title")), + url_(base::ASCIIToUTF16("url")), use_invalid_settings_(false) { page_size_.SetSize(static_cast<int>(8.5 * dpi_), static_cast<int>(11.0 * dpi_)); diff --git a/chrome/renderer/net/net_error_helper.cc b/chrome/renderer/net/net_error_helper.cc index dc170ce..088b0ad 100644 --- a/chrome/renderer/net/net_error_helper.cc +++ b/chrome/renderer/net/net_error_helper.cc @@ -229,7 +229,7 @@ void NetErrorHelper::UpdateErrorPage() { std::string js = "if (window.updateForDnsProbe) " "updateForDnsProbe(" + json + ");"; base::string16 js16; - if (!UTF8ToUTF16(js.c_str(), js.length(), &js16)) { + if (!base::UTF8ToUTF16(js.c_str(), js.length(), &js16)) { NOTREACHED(); return; } diff --git a/chrome/renderer/net/prescient_networking_dispatcher.cc b/chrome/renderer/net/prescient_networking_dispatcher.cc index 08f956d..8cd4203 100644 --- a/chrome/renderer/net/prescient_networking_dispatcher.cc +++ b/chrome/renderer/net/prescient_networking_dispatcher.cc @@ -55,7 +55,7 @@ void PrescientNetworkingDispatcher::prefetchDNS( if (hostname.isEmpty()) return; - std::string hostname_utf8 = UTF16ToUTF8(hostname); + std::string hostname_utf8 = base::UTF16ToUTF8(hostname); net_predictor_.Resolve(hostname_utf8.data(), hostname_utf8.length()); } diff --git a/chrome/renderer/page_load_histograms.cc b/chrome/renderer/page_load_histograms.cc index c111883..6b408f3 100644 --- a/chrome/renderer/page_load_histograms.cc +++ b/chrome/renderer/page_load_histograms.cc @@ -147,7 +147,7 @@ bool DataReductionProxyWasUsed(WebFrame* frame) { if (!document_state->was_fetched_via_proxy()) return false; - std::string via_header(UTF16ToUTF8( + std::string via_header(base::UTF16ToUTF8( frame->dataSource()->response().httpHeaderField(kViaHeaderName))); return via_header.find(kDatReductionProxyViaValue) != std::string::npos; #endif diff --git a/chrome/renderer/pepper/pepper_flash_menu_host.cc b/chrome/renderer/pepper/pepper_flash_menu_host.cc index c322190..d24b0c1 100644 --- a/chrome/renderer/pepper/pepper_flash_menu_host.cc +++ b/chrome/renderer/pepper/pepper_flash_menu_host.cc @@ -70,7 +70,7 @@ bool ConvertMenuData(const PP_Flash_Menu* in_menu, return false; } if (in_menu->items[i].name) - item.label = UTF8ToUTF16(in_menu->items[i].name); + item.label = base::UTF8ToUTF16(in_menu->items[i].name); if (menu_id_map->size() >= kMaxMenuIdMapEntries) return false; item.action = static_cast<unsigned>(menu_id_map->size()); diff --git a/chrome/renderer/pepper/pepper_pdf_host.cc b/chrome/renderer/pepper/pepper_pdf_host.cc index dffb169..461e9f9 100644 --- a/chrome/renderer/pepper/pepper_pdf_host.cc +++ b/chrome/renderer/pepper/pepper_pdf_host.cc @@ -157,13 +157,13 @@ int32_t PepperPDFHost::OnHostMsgGetLocalizedString( PP_ResourceString string_id) { std::string rv; if (string_id == PP_RESOURCESTRING_PDFGETPASSWORD) { - rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_NEED_PASSWORD)); + rv = base::UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_NEED_PASSWORD)); } else if (string_id == PP_RESOURCESTRING_PDFLOADING) { - rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOADING)); + rv = base::UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOADING)); } else if (string_id == PP_RESOURCESTRING_PDFLOAD_FAILED) { - rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOAD_FAILED)); + rv = base::UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOAD_FAILED)); } else if (string_id == PP_RESOURCESTRING_PDFPROGRESSLOADING) { - rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PROGRESS_LOADING)); + rv = base::UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PROGRESS_LOADING)); } else { NOTREACHED(); return PP_ERROR_FAILED; diff --git a/chrome/renderer/pepper/ppb_pdf_impl.cc b/chrome/renderer/pepper/ppb_pdf_impl.cc index ad5e8d4..4b77044 100644 --- a/chrome/renderer/pepper/ppb_pdf_impl.cc +++ b/chrome/renderer/pepper/ppb_pdf_impl.cc @@ -174,13 +174,13 @@ PP_Var GetLocalizedString(PP_Instance instance_id, std::string rv; if (string_id == PP_RESOURCESTRING_PDFGETPASSWORD) { - rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_NEED_PASSWORD)); + rv = base::UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_NEED_PASSWORD)); } else if (string_id == PP_RESOURCESTRING_PDFLOADING) { - rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOADING)); + rv = base::UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOADING)); } else if (string_id == PP_RESOURCESTRING_PDFLOAD_FAILED) { - rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOAD_FAILED)); + rv = base::UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOAD_FAILED)); } else if (string_id == PP_RESOURCESTRING_PDFPROGRESSLOADING) { - rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PROGRESS_LOADING)); + rv = base::UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PROGRESS_LOADING)); } else { NOTREACHED(); } diff --git a/chrome/renderer/plugins/chrome_plugin_placeholder.cc b/chrome/renderer/plugins/chrome_plugin_placeholder.cc index 182071f..899087a 100644 --- a/chrome/renderer/plugins/chrome_plugin_placeholder.cc +++ b/chrome/renderer/plugins/chrome_plugin_placeholder.cc @@ -257,7 +257,7 @@ void ChromePluginPlaceholder::OnFinishedDownloadingPlugin() { void ChromePluginPlaceholder::OnErrorDownloadingPlugin( const std::string& error) { SetMessage(l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOAD_ERROR, - UTF8ToUTF16(error))); + base::UTF8ToUTF16(error))); } void ChromePluginPlaceholder::OnCancelledDownloadingPlugin() { diff --git a/chrome/renderer/printing/print_web_view_helper.cc b/chrome/renderer/printing/print_web_view_helper.cc index 688512e..a53c822 100644 --- a/chrome/renderer/printing/print_web_view_helper.cc +++ b/chrome/renderer/printing/print_web_view_helper.cc @@ -75,7 +75,7 @@ void ExecuteScript(blink::WebFrame* frame, std::string json; base::JSONWriter::Write(¶meters, &json); std::string script = base::StringPrintf(script_format, json.c_str()); - frame->executeScript(blink::WebString(UTF8ToUTF16(script))); + frame->executeScript(blink::WebString(base::UTF8ToUTF16(script))); } int GetDPI(const PrintMsg_Print_Params* print_params) { diff --git a/chrome/renderer/safe_browsing/phishing_classifier_browsertest.cc b/chrome/renderer/safe_browsing/phishing_classifier_browsertest.cc index 3a1779a..3277d4e 100644 --- a/chrome/renderer/safe_browsing/phishing_classifier_browsertest.cc +++ b/chrome/renderer/safe_browsing/phishing_classifier_browsertest.cc @@ -225,7 +225,7 @@ IN_PROC_BROWSER_TEST_F(PhishingClassifierTest, MAYBE_TestClassification) { EXPECT_CALL(*clock_, Now()) .WillRepeatedly(::testing::Return(base::TimeTicks::Now())); - base::string16 page_text = ASCIIToUTF16("login"); + base::string16 page_text = base::ASCIIToUTF16("login"); float phishy_score; FeatureMap features; diff --git a/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc b/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc index 9ccb8da..20a70af 100644 --- a/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc +++ b/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc @@ -39,6 +39,7 @@ #include "third_party/WebKit/public/web/WebView.h" #include "url/gurl.h" +using base::ASCIIToUTF16; using ::testing::_; using ::testing::InSequence; using ::testing::Mock; diff --git a/chrome/renderer/safe_browsing/phishing_term_feature_extractor.cc b/chrome/renderer/safe_browsing/phishing_term_feature_extractor.cc index 4e5ac67..89994df 100644 --- a/chrome/renderer/safe_browsing/phishing_term_feature_extractor.cc +++ b/chrome/renderer/safe_browsing/phishing_term_feature_extractor.cc @@ -221,7 +221,7 @@ void PhishingTermFeatureExtractor::HandleWord( return; } - std::string word_lower = UTF16ToUTF8(base::i18n::ToLower(word)); + std::string word_lower = base::UTF16ToUTF8(base::i18n::ToLower(word)); uint32 word_hash = MurmurHash3String(word_lower, murmurhash3_seed_); // Quick out if the word is not part of any term, which is the common case. diff --git a/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc b/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc index 0649de8..e2b121a 100644 --- a/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc +++ b/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc @@ -23,6 +23,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +using base::ASCIIToUTF16; using ::testing::Return; namespace safe_browsing { diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc index 8423a85..d4cafe4 100644 --- a/chrome/renderer/searchbox/searchbox_extension.cc +++ b/chrome/renderer/searchbox/searchbox_extension.cc @@ -120,7 +120,7 @@ v8::Handle<v8::Object> GenerateMostVisitedItem( base::string16 title = mv_item.title; if (title.empty()) - title = UTF8ToUTF16(mv_item.url.spec()); + title = base::UTF8ToUTF16(mv_item.url.spec()); v8::Handle<v8::Object> obj = v8::Object::New(isolate); obj->Set(v8::String::NewFromUtf8(isolate, "renderViewId"), @@ -464,7 +464,7 @@ void SearchBoxExtension::DispatchChromeIdentityCheckResult( const base::string16& identity, bool identity_match) { std::string escaped_identity = base::GetQuotedJSONString(identity); - blink::WebString script(UTF8ToUTF16(base::StringPrintf( + blink::WebString script(base::UTF8ToUTF16(base::StringPrintf( kDispatchChromeIdentityCheckResult, escaped_identity.c_str(), identity_match ? "true" : "false"))); diff --git a/chrome/renderer/searchbox/searchbox_extension_unittest.cc b/chrome/renderer/searchbox/searchbox_extension_unittest.cc index 4b3dabf..61cafc5 100644 --- a/chrome/renderer/searchbox/searchbox_extension_unittest.cc +++ b/chrome/renderer/searchbox/searchbox_extension_unittest.cc @@ -15,19 +15,19 @@ GURL ResolveURL(const GURL& current_url, TEST(SearchboxExtensionTest, ResolveURL) { EXPECT_EQ(GURL("http://www.google.com/"), - ResolveURL(GURL(""), ASCIIToUTF16("http://www.google.com"))); + ResolveURL(GURL(""), base::ASCIIToUTF16("http://www.google.com"))); EXPECT_EQ(GURL("http://news.google.com/"), ResolveURL(GURL("http://www.google.com"), - ASCIIToUTF16("http://news.google.com"))); + base::ASCIIToUTF16("http://news.google.com"))); EXPECT_EQ(GURL("http://www.google.com/hello?q=world"), ResolveURL(GURL("http://www.google.com/foo?a=b"), - ASCIIToUTF16("hello?q=world"))); + base::ASCIIToUTF16("hello?q=world"))); EXPECT_EQ(GURL("http://www.google.com:90/foo/hello?q=world"), ResolveURL(GURL("http://www.google.com:90/"), - ASCIIToUTF16("foo/hello?q=world"))); + base::ASCIIToUTF16("foo/hello?q=world"))); } } // namespace internal diff --git a/chrome/renderer/spellchecker/custom_dictionary_engine.cc b/chrome/renderer/spellchecker/custom_dictionary_engine.cc index 976ffea..edf6cdd 100644 --- a/chrome/renderer/spellchecker/custom_dictionary_engine.cc +++ b/chrome/renderer/spellchecker/custom_dictionary_engine.cc @@ -21,7 +21,7 @@ void CustomDictionaryEngine::Init(const std::set<std::string>& custom_words) { for (std::set<std::string>::const_iterator it = custom_words.begin(); it != custom_words.end(); ++it) { - dictionary_.insert(UTF8ToUTF16(*it)); + dictionary_.insert(base::UTF8ToUTF16(*it)); } } @@ -31,12 +31,12 @@ void CustomDictionaryEngine::OnCustomDictionaryChanged( for (std::vector<std::string>::const_iterator it = words_added.begin(); it != words_added.end(); ++it) { - dictionary_.insert(UTF8ToUTF16(*it)); + dictionary_.insert(base::UTF8ToUTF16(*it)); } for (std::vector<std::string>::const_iterator it = words_removed.begin(); it != words_removed.end(); ++it) { - dictionary_.erase(UTF8ToUTF16(*it)); + dictionary_.erase(base::UTF8ToUTF16(*it)); } } diff --git a/chrome/renderer/spellchecker/custom_dictionary_engine_unittest.cc b/chrome/renderer/spellchecker/custom_dictionary_engine_unittest.cc index b57b603..dc9d50e 100644 --- a/chrome/renderer/spellchecker/custom_dictionary_engine_unittest.cc +++ b/chrome/renderer/spellchecker/custom_dictionary_engine_unittest.cc @@ -15,11 +15,13 @@ TEST(CustomDictionaryTest, HandlesEmptyWordWithInvalidSubstring) { TEST(CustomDictionaryTest, Basic) { CustomDictionaryEngine engine; - EXPECT_FALSE(engine.SpellCheckWord(ASCIIToUTF16("helllo").c_str(), 0, 6)); + EXPECT_FALSE(engine.SpellCheckWord(base::ASCIIToUTF16("helllo").c_str(), + 0, 6)); std::set<std::string> custom_words; custom_words.insert("helllo"); engine.Init(custom_words); - EXPECT_TRUE(engine.SpellCheckWord(ASCIIToUTF16("helllo").c_str(), 0, 6)); + EXPECT_TRUE(engine.SpellCheckWord(base::ASCIIToUTF16("helllo").c_str(), + 0, 6)); } TEST(CustomDictionaryTest, HandlesNullCharacters) { diff --git a/chrome/renderer/spellchecker/hunspell_engine.cc b/chrome/renderer/spellchecker/hunspell_engine.cc index 7900c50..74dd292 100644 --- a/chrome/renderer/spellchecker/hunspell_engine.cc +++ b/chrome/renderer/spellchecker/hunspell_engine.cc @@ -80,7 +80,7 @@ bool HunspellEngine::CheckSpelling(const base::string16& word_to_check, // offer suggestions on them, either, there's no point in flagging them to // the user. bool word_correct = true; - std::string word_to_check_utf8(UTF16ToUTF8(word_to_check)); + std::string word_to_check_utf8(base::UTF16ToUTF8(word_to_check)); // Limit the size of checked words. if (word_to_check_utf8.length() <= kMaxCheckedLen) { @@ -98,7 +98,7 @@ bool HunspellEngine::CheckSpelling(const base::string16& word_to_check, void HunspellEngine::FillSuggestionList( const base::string16& wrong_word, std::vector<base::string16>* optional_suggestions) { - std::string wrong_word_utf8(UTF16ToUTF8(wrong_word)); + std::string wrong_word_utf8(base::UTF16ToUTF8(wrong_word)); if (wrong_word_utf8.length() > kMaxSuggestLen) return; @@ -115,7 +115,7 @@ void HunspellEngine::FillSuggestionList( // Populate the vector of WideStrings. for (int i = 0; i < number_of_suggestions; ++i) { if (i < chrome::spellcheck_common::kMaxSuggestions) - optional_suggestions->push_back(UTF8ToUTF16(suggestions[i])); + optional_suggestions->push_back(base::UTF8ToUTF16(suggestions[i])); free(suggestions[i]); } if (suggestions != NULL) diff --git a/chrome/renderer/spellchecker/spellcheck_provider_hunspell_unittest.cc b/chrome/renderer/spellchecker/spellcheck_provider_hunspell_unittest.cc index eb92ceb..a9d5f18 100644 --- a/chrome/renderer/spellchecker/spellcheck_provider_hunspell_unittest.cc +++ b/chrome/renderer/spellchecker/spellcheck_provider_hunspell_unittest.cc @@ -14,6 +14,8 @@ // Tests for Hunspell functionality in SpellcheckingProvider +using base::ASCIIToUTF16; + namespace { TEST_F(SpellCheckProviderTest, UsingHunspell) { diff --git a/chrome/renderer/spellchecker/spellcheck_provider_mac_unittest.cc b/chrome/renderer/spellchecker/spellcheck_provider_mac_unittest.cc index 5cb81f0..bab1107d 100644 --- a/chrome/renderer/spellchecker/spellcheck_provider_mac_unittest.cc +++ b/chrome/renderer/spellchecker/spellcheck_provider_mac_unittest.cc @@ -62,7 +62,7 @@ TEST_F(SpellCheckProviderMacTest, SingleRoundtripSuccess) { MessageParameters read_parameters = ReadRequestTextCheck(provider_.messages_[0]); - EXPECT_EQ(read_parameters.text, UTF8ToUTF16("hello ")); + EXPECT_EQ(read_parameters.text, base::UTF8ToUTF16("hello ")); FakeMessageArrival(&provider_, read_parameters); EXPECT_EQ(completion.completion_count_, 1U); @@ -86,11 +86,11 @@ TEST_F(SpellCheckProviderMacTest, TwoRoundtripSuccess) { MessageParameters read_parameters1 = ReadRequestTextCheck(provider_.messages_[0]); - EXPECT_EQ(read_parameters1.text, UTF8ToUTF16("hello ")); + EXPECT_EQ(read_parameters1.text, base::UTF8ToUTF16("hello ")); MessageParameters read_parameters2 = ReadRequestTextCheck(provider_.messages_[1]); - EXPECT_EQ(read_parameters2.text, UTF8ToUTF16("bye ")); + EXPECT_EQ(read_parameters2.text, base::UTF8ToUTF16("bye ")); FakeMessageArrival(&provider_, read_parameters1); EXPECT_EQ(completion1.completion_count_, 1U); diff --git a/chrome/renderer/spellchecker/spellcheck_unittest.cc b/chrome/renderer/spellchecker/spellcheck_unittest.cc index 143770e..05f0b6b 100644 --- a/chrome/renderer/spellchecker/spellcheck_unittest.cc +++ b/chrome/renderer/spellchecker/spellcheck_unittest.cc @@ -79,7 +79,7 @@ class SpellCheckTest : public testing::Test { bool CheckSpelling(const std::string& word, int tag) { return spell_check_->spellcheck_.platform_spelling_engine_->CheckSpelling( - ASCIIToUTF16(word), tag); + base::ASCIIToUTF16(word), tag); } #if !defined(OS_MACOSX) @@ -388,7 +388,7 @@ TEST_F(SpellCheckTest, SpellCheckStrings_EN_US) { int misspelling_start; int misspelling_length; bool result = spell_check()->SpellCheckWord( - WideToUTF16(kTestCases[i].input).c_str(), + base::WideToUTF16(kTestCases[i].input).c_str(), static_cast<int>(input_length), 0, &misspelling_start, @@ -439,7 +439,7 @@ TEST_F(SpellCheckTest, SpellCheckSuggestions_EN_US) { int misspelling_start; int misspelling_length; bool result = spell_check()->SpellCheckWord( - WideToUTF16(kTestCases[i].input).c_str(), + base::WideToUTF16(kTestCases[i].input).c_str(), static_cast<int>(input_length), 0, &misspelling_start, @@ -452,8 +452,8 @@ TEST_F(SpellCheckTest, SpellCheckSuggestions_EN_US) { // Check if the suggested words occur. bool suggested_word_is_present = false; for (int j = 0; j < static_cast<int>(suggestions.size()); j++) { - if (suggestions.at(j).compare(WideToUTF16(kTestCases[i].suggested_word)) - == 0) { + if (suggestions.at(j).compare( + base::WideToUTF16(kTestCases[i].suggested_word)) == 0) { suggested_word_is_present = true; break; } @@ -804,7 +804,7 @@ TEST_F(SpellCheckTest, MAYBE_SpellCheckText) { int misspelling_start = 0; int misspelling_length = 0; bool result = spell_check()->SpellCheckWord( - WideToUTF16(kTestCases[i].input).c_str(), + base::WideToUTF16(kTestCases[i].input).c_str(), static_cast<int>(input_length), 0, &misspelling_start, @@ -841,9 +841,9 @@ TEST_F(SpellCheckTest, GetAutoCorrectionWord_EN_US) { EnableAutoCorrect(true); for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) { - base::string16 misspelled_word(UTF8ToUTF16(kTestCases[i].input)); + base::string16 misspelled_word(base::UTF8ToUTF16(kTestCases[i].input)); base::string16 expected_autocorrect_word( - UTF8ToUTF16(kTestCases[i].expected_result)); + base::UTF8ToUTF16(kTestCases[i].expected_result)); base::string16 autocorrect_word = spell_check()->GetAutoCorrectionWord( misspelled_word, 0); @@ -885,7 +885,7 @@ TEST_F(SpellCheckTest, MisspelledWords) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) { ReinitializeSpellCheck(kTestCases[i].language); - base::string16 word(WideToUTF16(kTestCases[i].input)); + base::string16 word(base::WideToUTF16(kTestCases[i].input)); int word_length = static_cast<int>(word.length()); int misspelling_start = 0; int misspelling_length = 0; @@ -908,19 +908,19 @@ TEST_F(SpellCheckTest, MisspelledWords) { // Make sure SpellCheckParagraph does not crash if the input is empty. TEST_F(SpellCheckTest, SpellCheckParagraphEmptyParagraph) { std::vector<SpellCheckResult> expected; - TestSpellCheckParagraph(UTF8ToUTF16(""), expected); + TestSpellCheckParagraph(base::UTF8ToUTF16(""), expected); } // A simple test case having no misspellings. TEST_F(SpellCheckTest, SpellCheckParagraphNoMisspellings) { - const base::string16 text = UTF8ToUTF16("apple"); + const base::string16 text = base::UTF8ToUTF16("apple"); std::vector<SpellCheckResult> expected; TestSpellCheckParagraph(text, expected); } // A simple test case having one misspelling. TEST_F(SpellCheckTest, SpellCheckParagraphSingleMisspellings) { - const base::string16 text = UTF8ToUTF16("zz"); + const base::string16 text = base::UTF8ToUTF16("zz"); std::vector<SpellCheckResult> expected; expected.push_back(SpellCheckResult( SpellCheckResult::SPELLING, 0, 2)); @@ -930,7 +930,7 @@ TEST_F(SpellCheckTest, SpellCheckParagraphSingleMisspellings) { // A simple test case having multiple misspellings. TEST_F(SpellCheckTest, SpellCheckParagraphMultipleMisspellings) { - const base::string16 text = UTF8ToUTF16("zz, zz"); + const base::string16 text = base::UTF8ToUTF16("zz, zz"); std::vector<SpellCheckResult> expected; expected.push_back(SpellCheckResult( SpellCheckResult::SPELLING, 0, 2)); @@ -944,7 +944,7 @@ TEST_F(SpellCheckTest, SpellCheckParagraphMultipleMisspellings) { TEST_F(SpellCheckTest, SpellCheckParagraphLongSentence) { std::vector<SpellCheckResult> expected; // The text is taken from US constitution preamble. - const base::string16 text = UTF8ToUTF16( + const base::string16 text = base::UTF8ToUTF16( "We the people of the United States, in order to form a more perfect " "union, establish justice, insure domestic tranquility, provide for " "the common defense, promote the general welfare, and secure the " @@ -959,7 +959,7 @@ TEST_F(SpellCheckTest, SpellCheckParagraphLongSentenceMultipleMisspellings) { std::vector<SpellCheckResult> expected; // All 'the' are converted to 'hte' in US consitition preamble. - const base::string16 text = UTF8ToUTF16( + const base::string16 text = base::UTF8ToUTF16( "We hte people of hte United States, in order to form a more perfect " "union, establish justice, insure domestic tranquility, provide for " "hte common defense, promote hte general welfare, and secure hte " @@ -1000,7 +1000,7 @@ TEST_F(SpellCheckTest, RequestSpellCheckWithEmptyString) { TEST_F(SpellCheckTest, RequestSpellCheckWithoutMisspelling) { MockTextCheckingCompletion completion; - const base::string16 text = ASCIIToUTF16("hello"); + const base::string16 text = base::ASCIIToUTF16("hello"); spell_check()->RequestTextChecking(text, &completion); base::MessageLoop::current()->RunUntilIdle(); @@ -1012,7 +1012,7 @@ TEST_F(SpellCheckTest, RequestSpellCheckWithoutMisspelling) { TEST_F(SpellCheckTest, RequestSpellCheckWithSingleMisspelling) { MockTextCheckingCompletion completion; - const base::string16 text = ASCIIToUTF16("apple, zz"); + const base::string16 text = base::ASCIIToUTF16("apple, zz"); spell_check()->RequestTextChecking(text, &completion); base::MessageLoop::current()->RunUntilIdle(); @@ -1027,7 +1027,7 @@ TEST_F(SpellCheckTest, RequestSpellCheckWithSingleMisspelling) { TEST_F(SpellCheckTest, RequestSpellCheckWithMisspellings) { MockTextCheckingCompletion completion; - const base::string16 text = ASCIIToUTF16("apple, zz, orange, zz"); + const base::string16 text = base::ASCIIToUTF16("apple, zz, orange, zz"); spell_check()->RequestTextChecking(text, &completion); base::MessageLoop::current()->RunUntilIdle(); @@ -1046,9 +1046,9 @@ TEST_F(SpellCheckTest, RequestSpellCheckWithMultipleRequests) { MockTextCheckingCompletion completion[3]; const base::string16 text[3] = { - ASCIIToUTF16("what, zz"), - ASCIIToUTF16("apple, zz"), - ASCIIToUTF16("orange, zz") + base::ASCIIToUTF16("what, zz"), + base::ASCIIToUTF16("apple, zz"), + base::ASCIIToUTF16("orange, zz") }; for (int i = 0; i < 3; ++i) @@ -1070,7 +1070,7 @@ TEST_F(SpellCheckTest, RequestSpellCheckWithoutInitialization) { UninitializeSpellCheck(); MockTextCheckingCompletion completion; - const base::string16 text = ASCIIToUTF16("zz"); + const base::string16 text = base::ASCIIToUTF16("zz"); spell_check()->RequestTextChecking(text, &completion); @@ -1086,9 +1086,9 @@ TEST_F(SpellCheckTest, RequestSpellCheckMultipleTimesWithoutInitialization) { MockTextCheckingCompletion completion[3]; const base::string16 text[3] = { - ASCIIToUTF16("what, zz"), - ASCIIToUTF16("apple, zz"), - ASCIIToUTF16("orange, zz") + base::ASCIIToUTF16("what, zz"), + base::ASCIIToUTF16("apple, zz"), + base::ASCIIToUTF16("orange, zz") }; // Calls RequestTextchecking a few times. @@ -1117,7 +1117,7 @@ TEST_F(SpellCheckTest, CreateTextCheckingResults) { // Verify that the SpellCheck class keeps the spelling marker added to a // misspelled word "zz". { - base::string16 text = ASCIIToUTF16("zz"); + base::string16 text = base::ASCIIToUTF16("zz"); std::vector<SpellCheckResult> spellcheck_results; spellcheck_results.push_back(SpellCheckResult( SpellCheckResult::SPELLING, 0, 2, base::string16())); @@ -1137,7 +1137,7 @@ TEST_F(SpellCheckTest, CreateTextCheckingResults) { // Verify that the SpellCheck class replaces the spelling marker added to a // contextually-misspelled word "bean" with a grammar marker. { - base::string16 text = ASCIIToUTF16("I have bean to USA."); + base::string16 text = base::ASCIIToUTF16("I have bean to USA."); std::vector<SpellCheckResult> spellcheck_results; spellcheck_results.push_back(SpellCheckResult( SpellCheckResult::SPELLING, 7, 4, base::string16())); @@ -1197,7 +1197,7 @@ TEST_F(SpellCheckTest, EnglishWords) { int misspelling_start = 0; int misspelling_length = 0; bool result = spell_check()->SpellCheckWord( - ASCIIToUTF16(kTestCases[i].input).c_str(), + base::ASCIIToUTF16(kTestCases[i].input).c_str(), static_cast<int>(input_length), 0, &misspelling_start, @@ -1244,7 +1244,7 @@ TEST_F(SpellCheckTest, NoSuggest) { int misspelling_start = 0; int misspelling_length = 0; bool result = spell_check()->SpellCheckWord( - ASCIIToUTF16(kTestCases[i].suggestion).c_str(), + base::ASCIIToUTF16(kTestCases[i].suggestion).c_str(), static_cast<int>(suggestion_length), 0, &misspelling_start, @@ -1259,7 +1259,7 @@ TEST_F(SpellCheckTest, NoSuggest) { if (kTestCases[i].input != NULL) input_length = strlen(kTestCases[i].input); result = spell_check()->SpellCheckWord( - ASCIIToUTF16(kTestCases[i].input).c_str(), + base::ASCIIToUTF16(kTestCases[i].input).c_str(), static_cast<int>(input_length), 0, &misspelling_start, @@ -1272,8 +1272,8 @@ TEST_F(SpellCheckTest, NoSuggest) { // Check if the suggested words occur. for (int j = 0; j < static_cast<int>(suggestions.size()); j++) { for (size_t t = 0; t < test_cases_size; t++) { - int compare_result = - suggestions.at(j).compare(ASCIIToUTF16(kTestCases[t].suggestion)); + int compare_result = suggestions.at(j).compare( + base::ASCIIToUTF16(kTestCases[t].suggestion)); EXPECT_FALSE(compare_result == 0) << kTestCases[t].suggestion << " in " << kTestCases[i].locale; } @@ -1349,7 +1349,7 @@ TEST_F(SpellCheckTest, LogicalSuggestions) { int misspelling_length = 0; std::vector<base::string16> suggestions; EXPECT_FALSE(spell_check()->SpellCheckWord( - ASCIIToUTF16(kTestCases[i].misspelled).c_str(), + base::ASCIIToUTF16(kTestCases[i].misspelled).c_str(), strlen(kTestCases[i].misspelled), 0, &misspelling_start, @@ -1357,6 +1357,6 @@ TEST_F(SpellCheckTest, LogicalSuggestions) { &suggestions)); EXPECT_GE(suggestions.size(), static_cast<size_t>(1)); if (suggestions.size() > 0) - EXPECT_EQ(suggestions[0], ASCIIToUTF16(kTestCases[i].suggestion)); + EXPECT_EQ(suggestions[0], base::ASCIIToUTF16(kTestCases[i].suggestion)); } } diff --git a/chrome/renderer/spellchecker/spellcheck_worditerator.cc b/chrome/renderer/spellchecker/spellcheck_worditerator.cc index ca5c7fa..9d0e555 100644 --- a/chrome/renderer/spellchecker/spellcheck_worditerator.cc +++ b/chrome/renderer/spellchecker/spellcheck_worditerator.cc @@ -174,14 +174,14 @@ void SpellcheckCharAttribute::CreateRuleSets(const std::string& language) { "$ALetterEx ($MidLetterEx | $MidNumLetEx) $ALetterEx {200};"; const char kDisallowContraction[] = ""; - ruleset_allow_contraction_ = ASCIIToUTF16( + ruleset_allow_contraction_ = base::ASCIIToUTF16( base::StringPrintf(kRuleTemplate, aletter, aletter_extra, midletter_extra, aletter_plus, kAllowContraction)); - ruleset_disallow_contraction_ = ASCIIToUTF16( + ruleset_disallow_contraction_ = base::ASCIIToUTF16( base::StringPrintf(kRuleTemplate, aletter, aletter_extra, diff --git a/chrome/renderer/spellchecker/spellcheck_worditerator.h b/chrome/renderer/spellchecker/spellcheck_worditerator.h index 50a0ef6..3a757b9 100644 --- a/chrome/renderer/spellchecker/spellcheck_worditerator.h +++ b/chrome/renderer/spellchecker/spellcheck_worditerator.h @@ -93,7 +93,7 @@ class SpellcheckCharAttribute { // // Set up a SpellcheckWordIterator object which extracts English words, // // and retrieve them. // SpellcheckWordIterator iterator; -// base::string16 text(UTF8ToUTF16("this is a test.")); +// base::string16 text(base::UTF8ToUTF16("this is a test.")); // iterator.Initialize(&attribute, true); // iterator.SetText(text.c_str(), text_.length()); // diff --git a/chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc b/chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc index c1e5fce..a87340a 100644 --- a/chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc +++ b/chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc @@ -119,7 +119,7 @@ TEST(SpellcheckWordIteratorTest, SplitWord) { SpellcheckCharAttribute attributes; attributes.SetDefaultLanguage(kTestCases[i].language); - base::string16 input(WideToUTF16(kTestText)); + base::string16 input(base::WideToUTF16(kTestText)); SpellcheckWordIterator iterator; EXPECT_TRUE(iterator.Initialize(&attributes, kTestCases[i].allow_contraction)); @@ -127,7 +127,7 @@ TEST(SpellcheckWordIteratorTest, SplitWord) { std::vector<base::string16> expected_words; base::SplitString( - WideToUTF16(kTestCases[i].expected_words), ' ', &expected_words); + base::WideToUTF16(kTestCases[i].expected_words), ' ', &expected_words); base::string16 actual_word; int actual_start, actual_end; @@ -149,7 +149,7 @@ TEST(SpellcheckWordIteratorTest, RuleSetConsistency) { attributes.SetDefaultLanguage("en-US"); const wchar_t kTestText[] = L"\x1791\x17c1\x002e"; - base::string16 input(WideToUTF16(kTestText)); + base::string16 input(base::WideToUTF16(kTestText)); SpellcheckWordIterator iterator; EXPECT_TRUE(iterator.Initialize(&attributes, true)); @@ -214,7 +214,7 @@ TEST(SpellcheckWordIteratorTest, TreatNumbersAsWordCharacters) { SpellcheckCharAttribute attributes; attributes.SetDefaultLanguage(kTestCases[i].language); - base::string16 input_word(WideToUTF16(kTestCases[i].text)); + base::string16 input_word(base::WideToUTF16(kTestCases[i].text)); SpellcheckWordIterator iterator; EXPECT_TRUE(iterator.Initialize(&attributes, true)); EXPECT_TRUE(iterator.SetText(input_word.c_str(), input_word.length())); diff --git a/chrome/renderer/translate/translate_helper.cc b/chrome/renderer/translate/translate_helper.cc index 6613758..f276c64 100644 --- a/chrome/renderer/translate/translate_helper.cc +++ b/chrome/renderer/translate/translate_helper.cc @@ -30,6 +30,7 @@ #include "url/gurl.h" #include "v8/include/v8.h" +using base::ASCIIToUTF16; using blink::WebDocument; using blink::WebElement; using blink::WebFrame; diff --git a/chrome/renderer/translate/translate_script_browsertest.cc b/chrome/renderer/translate/translate_script_browsertest.cc index 49b9dde..9bc2410 100644 --- a/chrome/renderer/translate/translate_script_browsertest.cc +++ b/chrome/renderer/translate/translate_script_browsertest.cc @@ -85,7 +85,7 @@ class TranslateScriptBrowserTest : public ChromeRenderViewTest { } void ExecuteScript(const std::string& script) { - WebScriptSource source = WebScriptSource(ASCIIToUTF16(script)); + WebScriptSource source = WebScriptSource(base::ASCIIToUTF16(script)); GetMainFrame()->executeScript(source); } @@ -111,7 +111,7 @@ class TranslateScriptBrowserTest : public ChromeRenderViewTest { } double ExecuteScriptAndGetNumberResult(const std::string& script) { - WebScriptSource source = WebScriptSource(ASCIIToUTF16(script)); + WebScriptSource source = WebScriptSource(base::ASCIIToUTF16(script)); v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); v8::Handle<v8::Value> result = GetMainFrame()->executeScriptAndReturnValue(source); @@ -125,7 +125,7 @@ class TranslateScriptBrowserTest : public ChromeRenderViewTest { } bool ExecuteScriptAndGetBoolResult(const std::string& script) { - WebScriptSource source = WebScriptSource(ASCIIToUTF16(script)); + WebScriptSource source = WebScriptSource(base::ASCIIToUTF16(script)); v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); v8::Handle<v8::Value> result = GetMainFrame()->executeScriptAndReturnValue(source); diff --git a/chrome/renderer/web_apps_unittest.cc b/chrome/renderer/web_apps_unittest.cc index 199d55c..902e592 100644 --- a/chrome/renderer/web_apps_unittest.cc +++ b/chrome/renderer/web_apps_unittest.cc @@ -43,8 +43,8 @@ TEST(WebAppInfo, ParseIconSizes) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { bool is_any; std::vector<gfx::Size> sizes; - bool result = web_apps::ParseIconSizes(ASCIIToUTF16(data[i].input), &sizes, - &is_any); + bool result = web_apps::ParseIconSizes( + base::ASCIIToUTF16(data[i].input), &sizes, &is_any); ASSERT_EQ(result, data[i].expected_result); if (result) { ASSERT_EQ(data[i].is_any, is_any); diff --git a/chrome/service/cloud_print/cloud_print_connector.cc b/chrome/service/cloud_print/cloud_print_connector.cc index f202cf7..03687d8 100644 --- a/chrome/service/cloud_print/cloud_print_connector.cc +++ b/chrome/service/cloud_print/cloud_print_connector.cc @@ -589,7 +589,7 @@ void CloudPrintConnector::OnReceivePrinterCaps( LOG(ERROR) << "CP_CONNECTOR: Failed to get printer info" << ", printer name: " << printer_name; // This printer failed to register, notify the server of this failure. - base::string16 printer_name_utf16 = UTF8ToUTF16(printer_name); + base::string16 printer_name_utf16 = base::UTF8ToUTF16(printer_name); std::string status_message = l10n_util::GetStringFUTF8( IDS_CLOUD_PRINT_REGISTER_PRINTER_FAILED, printer_name_utf16, diff --git a/chrome/service/cloud_print/print_system_win.cc b/chrome/service/cloud_print/print_system_win.cc index 0ad8c0b..f46c2af 100644 --- a/chrome/service/cloud_print/print_system_win.cc +++ b/chrome/service/cloud_print/print_system_win.cc @@ -44,7 +44,7 @@ class PrintSystemWatcherWin : public base::win::ObjectWatcher::Delegate { LPTSTR printer_name_to_use = NULL; std::wstring printer_name_wide; if (!printer_name.empty()) { - printer_name_wide = UTF8ToWide(printer_name); + printer_name_wide = base::UTF8ToWide(printer_name); printer_name_to_use = const_cast<LPTSTR>(printer_name_wide.c_str()); } bool ret = false; @@ -223,7 +223,7 @@ bool PrintSystemWin::GetJobDetails(const std::string& printer_name, print_backend_->GetPrinterDriverInfo(printer_name)); DCHECK(job_details); printing::ScopedPrinterHandle printer_handle; - std::wstring printer_name_wide = UTF8ToWide(printer_name); + std::wstring printer_name_wide = base::UTF8ToWide(printer_name); printer_handle.OpenPrinter(printer_name_wide.c_str()); DCHECK(printer_handle.IsValid()); bool ret = false; @@ -240,8 +240,8 @@ bool PrintSystemWin::GetJobDetails(const std::string& printer_name, JOB_INFO_1 *job_info = reinterpret_cast<JOB_INFO_1 *>(job_info_buffer.get()); if (job_info->pStatus) { - WideToUTF8(job_info->pStatus, wcslen(job_info->pStatus), - &job_details->status_message); + base::WideToUTF8(job_info->pStatus, wcslen(job_info->pStatus), + &job_details->status_message); } job_details->platform_status_flags = job_info->Status; if ((job_info->Status & JOB_STATUS_COMPLETE) || diff --git a/chrome/service/cloud_print/print_system_xps_win.cc b/chrome/service/cloud_print/print_system_xps_win.cc index e15f224..5fc722d 100644 --- a/chrome/service/cloud_print/print_system_xps_win.cc +++ b/chrome/service/cloud_print/print_system_xps_win.cc @@ -77,7 +77,7 @@ HRESULT PrintTicketToDevMode(const std::string& printer_name, return hr; HPTPROVIDER provider = NULL; - hr = printing::XPSModule::OpenProvider(UTF8ToWide(printer_name), 1, + hr = printing::XPSModule::OpenProvider(base::UTF8ToWide(printer_name), 1, &provider); if (SUCCEEDED(hr)) { ULONG size = 0; @@ -166,7 +166,7 @@ class JobSpoolerWin : public PrintSystem::JobSpooler { return false; } - HDC dc = CreateDC(L"WINSPOOL", UTF8ToWide(printer_name).c_str(), + HDC dc = CreateDC(L"WINSPOOL", base::UTF8ToWide(printer_name).c_str(), NULL, pt_dev_mode.dm_); if (!dc) { NOTREACHED(); @@ -175,7 +175,7 @@ class JobSpoolerWin : public PrintSystem::JobSpooler { hr = E_FAIL; DOCINFO di = {0}; di.cbSize = sizeof(DOCINFO); - base::string16 doc_name = UTF8ToUTF16(job_title); + base::string16 doc_name = base::UTF8ToUTF16(job_title); DCHECK(printing::SimplifyDocumentTitle(doc_name) == doc_name); di.lpszDocName = doc_name.c_str(); job_id_ = StartDoc(dc, &di); @@ -360,7 +360,8 @@ class JobSpoolerWin : public PrintSystem::JobSpooler { base::win::ScopedComPtr<IXpsPrintJobStream> doc_stream; base::win::ScopedComPtr<IXpsPrintJobStream> print_ticket_stream; if (FAILED(printing::XPSPrintModule::StartXpsPrintJob( - UTF8ToWide(printer_name).c_str(), UTF8ToWide(job_title).c_str(), + base::UTF8ToWide(printer_name).c_str(), + base::UTF8ToWide(job_title).c_str(), NULL, job_progress_event_.Get(), NULL, NULL, NULL, xps_print_job_.Receive(), doc_stream.Receive(), print_ticket_stream.Receive()))) @@ -537,7 +538,7 @@ bool PrintSystemWinXPS::ValidatePrintTicket( } bool ret = false; HPTPROVIDER provider = NULL; - printing::XPSModule::OpenProvider(UTF8ToWide(printer_name.c_str()), + printing::XPSModule::OpenProvider(base::UTF8ToWide(printer_name.c_str()), 1, &provider); if (provider) { diff --git a/chrome/service/cloud_print/printer_job_handler.cc b/chrome/service/cloud_print/printer_job_handler.cc index b99c75b..33375d1 100644 --- a/chrome/service/cloud_print/printer_job_handler.cc +++ b/chrome/service/cloud_print/printer_job_handler.cc @@ -773,8 +773,8 @@ void PrinterJobHandler::DoPrint(const JobDetails& job_details, DCHECK(job_spooler_.get()); if (!job_spooler_.get()) return; - base::string16 document_name = - printing::SimplifyDocumentTitle(UTF8ToUTF16(job_details.job_title_)); + base::string16 document_name = printing::SimplifyDocumentTitle( + base::UTF8ToUTF16(job_details.job_title_)); if (document_name.empty()) { document_name = printing::SimplifyDocumentTitle( l10n_util::GetStringUTF16(IDS_DEFAULT_PRINT_DOCUMENT_TITLE)); @@ -786,7 +786,7 @@ void PrinterJobHandler::DoPrint(const JobDetails& job_details, job_details.print_data_file_path_, job_details.print_data_mime_type_, printer_name, - UTF16ToUTF8(document_name), + base::UTF16ToUTF8(document_name), job_details.tags_, this)) { OnJobSpoolFailed(); diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc index c8816ef..3facd59 100644 --- a/chrome/service/service_process.cc +++ b/chrome/service/service_process.cc @@ -110,10 +110,10 @@ void PrepareRestartOnCrashEnviroment( base::i18n::AdjustStringForLocaleDirection(&adjusted_string); dlg_strings.append(adjusted_string); dlg_strings.push_back('|'); - dlg_strings.append(ASCIIToUTF16( + dlg_strings.append(base::ASCIIToUTF16( base::i18n::IsRTL() ? env_vars::kRtlLocale : env_vars::kLtrLocale)); - env->SetVar(env_vars::kRestartInfo, UTF16ToUTF8(dlg_strings)); + env->SetVar(env_vars::kRestartInfo, base::UTF16ToUTF8(dlg_strings)); } } // namespace diff --git a/chrome/test/automation/proxy_launcher.cc b/chrome/test/automation/proxy_launcher.cc index e3565b0..92c29a8 100644 --- a/chrome/test/automation/proxy_launcher.cc +++ b/chrome/test/automation/proxy_launcher.cc @@ -482,7 +482,7 @@ bool ProxyLauncher::LaunchBrowserHelper(const LaunchState& state, const char* browser_wrapper = getenv("BROWSER_WRAPPER"); if (browser_wrapper) { #if defined(OS_WIN) - command_line.PrependWrapper(ASCIIToWide(browser_wrapper)); + command_line.PrependWrapper(base::ASCIIToWide(browser_wrapper)); #elif defined(OS_POSIX) command_line.PrependWrapper(browser_wrapper); #endif diff --git a/chrome/test/base/testing_profile_manager.cc b/chrome/test/base/testing_profile_manager.cc index d96c5eb..4bcb590 100644 --- a/chrome/test/base/testing_profile_manager.cc +++ b/chrome/test/base/testing_profile_manager.cc @@ -91,7 +91,7 @@ TestingProfile* TestingProfileManager::CreateTestingProfile( const std::string& name) { DCHECK(called_set_up_); return CreateTestingProfile(name, scoped_ptr<PrefServiceSyncable>(), - UTF8ToUTF16(name), 0, std::string(), + base::UTF8ToUTF16(name), 0, std::string(), TestingProfile::TestingFactories()); } diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc index 587ef70..c3e4847 100644 --- a/chrome/test/base/ui_test_utils.cc +++ b/chrome/test/base/ui_test_utils.cc @@ -393,7 +393,7 @@ void SendToOmniboxAndSubmit(LocationBar* location_bar, const std::string& input) { OmniboxView* omnibox = location_bar->GetOmniboxView(); omnibox->model()->OnSetFocus(false); - omnibox->SetUserText(ASCIIToUTF16(input)); + omnibox->SetUserText(base::ASCIIToUTF16(input)); location_bar->AcceptInput(); while (!omnibox->model()->autocomplete_controller()->done()) { content::WindowedNotificationObserver observer( diff --git a/chrome/test/base/web_ui_browsertest.cc b/chrome/test/base/web_ui_browsertest.cc index dbcc2f6..81f54c6 100644 --- a/chrome/test/base/web_ui_browsertest.cc +++ b/chrome/test/base/web_ui_browsertest.cc @@ -487,7 +487,7 @@ void WebUIBrowserTest::BuildJavascriptLibraries(base::string16* content) { utf8_content.append(library_content); utf8_content.append(";\n"); } - content->append(UTF8ToUTF16(utf8_content)); + content->append(base::UTF8ToUTF16(utf8_content)); } base::string16 WebUIBrowserTest::BuildRunTestJSCall( diff --git a/chrome/test/chromedriver/capabilities.cc b/chrome/test/chromedriver/capabilities.cc index adae250..3c561b6 100644 --- a/chrome/test/chromedriver/capabilities.cc +++ b/chrome/test/chromedriver/capabilities.cc @@ -309,7 +309,7 @@ void Switches::SetSwitch(const std::string& name) { void Switches::SetSwitch(const std::string& name, const std::string& value) { #if defined(OS_WIN) - SetSwitch(name, UTF8ToUTF16(value)); + SetSwitch(name, base::UTF8ToUTF16(value)); #else switch_map_[name] = value; #endif @@ -319,7 +319,7 @@ void Switches::SetSwitch(const std::string& name, const base::string16& value) { #if defined(OS_WIN) switch_map_[name] = value; #else - SetSwitch(name, UTF16ToUTF8(value)); + SetSwitch(name, base::UTF16ToUTF8(value)); #endif } @@ -361,7 +361,7 @@ bool Switches::HasSwitch(const std::string& name) const { std::string Switches::GetSwitchValue(const std::string& name) const { NativeString value = GetSwitchValueNative(name); #if defined(OS_WIN) - return UTF16ToUTF8(value); + return base::UTF16ToUTF8(value); #else return value; #endif diff --git a/chrome/test/chromedriver/chrome/zip_internal.cc b/chrome/test/chromedriver/chrome/zip_internal.cc index 0042e90..b8f6349 100644 --- a/chrome/test/chromedriver/chrome/zip_internal.cc +++ b/chrome/test/chromedriver/chrome/zip_internal.cc @@ -54,7 +54,7 @@ void* ZipOpenFunc(void *opaque, const char* filename, int mode) { creation_disposition = CREATE_ALWAYS; } - base::string16 filename16 = UTF8ToUTF16(filename); + base::string16 filename16 = base::UTF8ToUTF16(filename); if ((filename != NULL) && (desired_access != 0)) { file = CreateFile(filename16.c_str(), desired_access, share_mode, NULL, creation_disposition, flags_and_attributes, NULL); diff --git a/chrome/test/chromedriver/chrome/zip_reader.cc b/chrome/test/chromedriver/chrome/zip_reader.cc index 71d11f5..52bf815 100644 --- a/chrome/test/chromedriver/chrome/zip_reader.cc +++ b/chrome/test/chromedriver/chrome/zip_reader.cc @@ -40,8 +40,8 @@ ZipReader::EntryInfo::EntryInfo(const std::string& file_name_in_zip, // We also consider that the file name is unsafe, if it's invalid UTF-8. base::string16 file_name_utf16; - if (!UTF8ToUTF16(file_name_in_zip.data(), file_name_in_zip.size(), - &file_name_utf16)) { + if (!base::UTF8ToUTF16(file_name_in_zip.data(), file_name_in_zip.size(), + &file_name_utf16)) { is_unsafe_ = true; } diff --git a/chrome/test/chromedriver/key_converter.cc b/chrome/test/chromedriver/key_converter.cc index 57f98a4..6e40702 100644 --- a/chrome/test/chromedriver/key_converter.cc +++ b/chrome/test/chromedriver/key_converter.cc @@ -141,7 +141,7 @@ bool KeyCodeFromShorthandKey(char16 key_utf16, bool* client_should_skip) { base::string16 key_str_utf16; key_str_utf16.push_back(key_utf16); - std::string key_str_utf8 = UTF16ToUTF8(key_str_utf16); + std::string key_str_utf8 = base::UTF16ToUTF8(key_str_utf16); if (key_str_utf8.length() != 1) return false; bool should_skip = false; @@ -303,8 +303,8 @@ Status ConvertKeysToKeyEvents(const base::string16& client_keys, } } else { // Do a best effort and use the raw key we were given. - unmodified_text = UTF16ToUTF8(keys.substr(i, 1)); - modified_text = UTF16ToUTF8(keys.substr(i, 1)); + unmodified_text = base::UTF16ToUTF8(keys.substr(i, 1)); + modified_text = base::UTF16ToUTF8(keys.substr(i, 1)); } } diff --git a/chrome/test/chromedriver/key_converter_unittest.cc b/chrome/test/chromedriver/key_converter_unittest.cc index 3318ca8a..21a3c5f 100644 --- a/chrome/test/chromedriver/key_converter_unittest.cc +++ b/chrome/test/chromedriver/key_converter_unittest.cc @@ -50,7 +50,7 @@ void CheckEventsReleaseModifiers(const base::string16& keys, void CheckEventsReleaseModifiers(const std::string& keys, KeyEvent expected_events[], size_t expected_size) { - CheckEventsReleaseModifiers(UTF8ToUTF16(keys), + CheckEventsReleaseModifiers(base::UTF8ToUTF16(keys), expected_events, expected_size); } @@ -59,7 +59,7 @@ void CheckNonShiftChar(ui::KeyboardCode key_code, char character) { std::string char_string; char_string.push_back(character); std::list<KeyEvent> events; - EXPECT_EQ(kOk, ConvertKeysToKeyEvents(ASCIIToUTF16(char_string), + EXPECT_EQ(kOk, ConvertKeysToKeyEvents(base::ASCIIToUTF16(char_string), true /* release_modifiers*/, &modifiers, &events).code()); ASSERT_EQ(3u, events.size()) << "Char: " << character; @@ -79,7 +79,7 @@ void CheckShiftChar(ui::KeyboardCode key_code, char character, char lower) { std::string char_string; char_string.push_back(character); std::list<KeyEvent> events; - EXPECT_EQ(kOk, ConvertKeysToKeyEvents(ASCIIToUTF16(char_string), + EXPECT_EQ(kOk, ConvertKeysToKeyEvents(base::ASCIIToUTF16(char_string), true /* release_modifiers*/, &modifiers, &events).code()); ASSERT_EQ(5u, events.size()) << "Char: " << character; @@ -152,9 +152,10 @@ TEST(KeyConverter, WebDriverSpecialNonCharKey) { TEST(KeyConverter, FrenchKeyOnEnglishLayout) { KeyEvent event_array[] = { CreateKeyDownEvent(ui::VKEY_UNKNOWN, 0), - CreateCharEvent(WideToUTF8(L"\u00E9"), WideToUTF8(L"\u00E9"), 0), + CreateCharEvent(base::WideToUTF8(L"\u00E9"), + base::WideToUTF8(L"\u00E9"), 0), CreateKeyUpEvent(ui::VKEY_UNKNOWN, 0)}; - CheckEventsReleaseModifiers(WideToUTF16(L"\u00E9"), + CheckEventsReleaseModifiers(base::WideToUTF16(L"\u00E9"), event_array, arraysize(event_array)); } @@ -210,7 +211,7 @@ TEST(KeyConverter, UppercaseCharUsesShiftOnlyIfNecessary) { CreateKeyUpEvent(ui::VKEY_SHIFT, 0)}; base::string16 keys; keys.push_back(static_cast<char16>(0xE008U)); - keys.append(UTF8ToUTF16("aBc")); + keys.append(base::UTF8ToUTF16("aBc")); CheckEventsReleaseModifiers(keys, event_array, arraysize(event_array)); } diff --git a/chrome/test/chromedriver/keycode_text_conversion_mac.mm b/chrome/test/chromedriver/keycode_text_conversion_mac.mm index a5abaa6..6d8a2c3 100644 --- a/chrome/test/chromedriver/keycode_text_conversion_mac.mm +++ b/chrome/test/chromedriver/keycode_text_conversion_mac.mm @@ -66,7 +66,7 @@ bool ConvertKeyCodeToText( if (status == noErr && char_count == 1 && !std::iscntrl(character)) { base::string16 text16; text16.push_back(character); - *text = UTF16ToUTF8(text16); + *text = base::UTF16ToUTF8(text16); return true; } *text = std::string(); @@ -78,7 +78,7 @@ bool ConvertCharToKeyCode( std::string* error_msg) { base::string16 key_string; key_string.push_back(key); - std::string key_string_utf8 = UTF16ToUTF8(key_string); + std::string key_string_utf8 = base::UTF16ToUTF8(key_string); bool found_code = false; *error_msg = std::string(); // There doesn't seem to be a way to get a mac key code for a given unicode diff --git a/chrome/test/chromedriver/keycode_text_conversion_unittest.cc b/chrome/test/chromedriver/keycode_text_conversion_unittest.cc index b5750b7..5c95fa0 100644 --- a/chrome/test/chromedriver/keycode_text_conversion_unittest.cc +++ b/chrome/test/chromedriver/keycode_text_conversion_unittest.cc @@ -27,14 +27,14 @@ void CheckCharToKeyCode16(char16 character, ui::KeyboardCode key_code, void CheckCharToKeyCode(char character, ui::KeyboardCode key_code, int modifiers) { - CheckCharToKeyCode16(UTF8ToUTF16(std::string(1, character))[0], + CheckCharToKeyCode16(base::UTF8ToUTF16(std::string(1, character))[0], key_code, modifiers); } #if defined(OS_WIN) void CheckCharToKeyCode(wchar_t character, ui::KeyboardCode key_code, int modifiers) { - CheckCharToKeyCode16(WideToUTF16(std::wstring(1, character))[0], + CheckCharToKeyCode16(base::WideToUTF16(std::wstring(1, character))[0], key_code, modifiers); } #endif @@ -42,7 +42,7 @@ void CheckCharToKeyCode(wchar_t character, ui::KeyboardCode key_code, void CheckCantConvertChar(wchar_t character) { std::wstring character_string; character_string.push_back(character); - char16 character_utf16 = WideToUTF16(character_string)[0]; + char16 character_utf16 = base::WideToUTF16(character_string)[0]; ui::KeyboardCode actual_key_code = ui::VKEY_UNKNOWN; int actual_modifiers = 0; std::string error_msg; @@ -156,7 +156,8 @@ TEST(KeycodeTextConversionTest, MAYBE_NonEnglish) { // Regression test for chromedriver bug #405. ASSERT_TRUE(SwitchKeyboardLayout("00000419")); // russian CheckCharToKeyCode(L'\u0438', ui::VKEY_B, 0); - EXPECT_EQ(UTF16ToUTF8(L"\u0438"), ConvertKeyCodeToTextNoError(ui::VKEY_B, 0)); + EXPECT_EQ(base::UTF16ToUTF8(L"\u0438"), + ConvertKeyCodeToTextNoError(ui::VKEY_B, 0)); #elif defined(OS_MACOSX) ASSERT_TRUE(SwitchKeyboardLayout("com.apple.keylayout.German")); CheckCharToKeyCode('z', ui::VKEY_Y, 0); diff --git a/chrome/test/chromedriver/keycode_text_conversion_win.cc b/chrome/test/chromedriver/keycode_text_conversion_win.cc index 9a65778..d65919d 100644 --- a/chrome/test/chromedriver/keycode_text_conversion_win.cc +++ b/chrome/test/chromedriver/keycode_text_conversion_win.cc @@ -30,7 +30,7 @@ bool ConvertKeyCodeToText( if (code <= 0 || (code == 1 && iswcntrl(chars[0]))) *text = std::string(); else - WideToUTF8(chars, code, text); + base::WideToUTF8(chars, code, text); return true; } diff --git a/chrome/test/chromedriver/keycode_text_conversion_x.cc b/chrome/test/chromedriver/keycode_text_conversion_x.cc index fbb5888..0499203 100644 --- a/chrome/test/chromedriver/keycode_text_conversion_x.cc +++ b/chrome/test/chromedriver/keycode_text_conversion_x.cc @@ -224,7 +224,7 @@ bool ConvertKeyCodeToText( if (!character) *text = std::string(); else - *text = UTF16ToUTF8(base::string16(1, character)); + *text = base::UTF16ToUTF8(base::string16(1, character)); return true; } @@ -233,7 +233,7 @@ bool ConvertCharToKeyCode( ui::KeyboardCode* key_code, int* necessary_modifiers, std::string* error_msg) { - std::string key_string(UTF16ToUTF8(base::string16(1, key))); + std::string key_string(base::UTF16ToUTF8(base::string16(1, key))); bool found = false; ui::KeyboardCode test_code; int test_modifiers; diff --git a/chrome/test/chromedriver/test_util.cc b/chrome/test/chromedriver/test_util.cc index 14f1c74..bfa7de4 100644 --- a/chrome/test/chromedriver/test_util.cc +++ b/chrome/test/chromedriver/test_util.cc @@ -30,7 +30,7 @@ RestoreKeyboardLayoutOnDestruct::~RestoreKeyboardLayoutOnDestruct() { #if defined(OS_WIN) bool SwitchKeyboardLayout(const std::string& input_locale_identifier) { HKL layout = LoadKeyboardLayout( - UTF8ToWide(input_locale_identifier).c_str(), 0); + base::UTF8ToWide(input_locale_identifier).c_str(), 0); if (!layout) return false; return !!ActivateKeyboardLayout(layout, 0); diff --git a/chrome/test/data/webui/history_ui_browsertest.cc b/chrome/test/data/webui/history_ui_browsertest.cc index e60befc..69af912 100644 --- a/chrome/test/data/webui/history_ui_browsertest.cc +++ b/chrome/test/data/webui/history_ui_browsertest.cc @@ -40,7 +40,7 @@ void HistoryUIBrowserTest::AddPageToHistory( history_->AddPage(gurl, time, id_scope, page_id_++, GURL(), history::RedirectList(), content::PAGE_TRANSITION_LINK, history::SOURCE_BROWSED, false); - history_->SetPageTitle(gurl, UTF8ToUTF16(title)); + history_->SetPageTitle(gurl, base::UTF8ToUTF16(title)); } void HistoryUIBrowserTest::SetDeleteAllowed(bool allowed) { diff --git a/chrome/test/perf/dom_checker_uitest.cc b/chrome/test/perf/dom_checker_uitest.cc index dcd5e32..ab468b6 100644 --- a/chrome/test/perf/dom_checker_uitest.cc +++ b/chrome/test/perf/dom_checker_uitest.cc @@ -176,7 +176,7 @@ class DomCheckerTest : public UITest { if (!succeeded) return false; - std::string json = WideToUTF8(json_wide); + std::string json = base::WideToUTF8(json_wide); JSONStringValueSerializer deserializer(json); scoped_ptr<base::Value> value(deserializer.Deserialize(NULL, NULL)); diff --git a/chrome/test/perf/frame_rate/frame_rate_tests.cc b/chrome/test/perf/frame_rate/frame_rate_tests.cc index 705aaee..b1d36e4 100644 --- a/chrome/test/perf/frame_rate/frame_rate_tests.cc +++ b/chrome/test/perf/frame_rate/frame_rate_tests.cc @@ -236,7 +236,7 @@ class FrameRateTest &json)); std::map<std::string, std::string> results; - ASSERT_TRUE(JsonDictionaryToMap(WideToUTF8(json), &results)); + ASSERT_TRUE(JsonDictionaryToMap(base::WideToUTF8(json), &results)); ASSERT_TRUE(results.find("mean") != results.end()); ASSERT_TRUE(results.find("sigma") != results.end()); diff --git a/chrome/test/perf/generate_profile.cc b/chrome/test/perf/generate_profile.cc index 44c72ad..c749dfd 100644 --- a/chrome/test/perf/generate_profile.cc +++ b/chrome/test/perf/generate_profile.cc @@ -90,8 +90,8 @@ base::string16 RandomWords(int count) { // Return a random URL-looking string. GURL ConstructRandomURL() { - return GURL(ASCIIToUTF16("http://") + RandomChars(3) + ASCIIToUTF16(".com/") + - RandomChars(RandomInt(5, 20))); + return GURL(base::ASCIIToUTF16("http://") + RandomChars(3) + + base::ASCIIToUTF16(".com/") + RandomChars(RandomInt(5, 20))); } // Return a random page title-looking string. diff --git a/chrome/test/perf/indexeddb_uitest.cc b/chrome/test/perf/indexeddb_uitest.cc index ec1a42b..f6e4066 100644 --- a/chrome/test/perf/indexeddb_uitest.cc +++ b/chrome/test/perf/indexeddb_uitest.cc @@ -74,7 +74,7 @@ class IndexedDBTest : public UIPerfTest { if (!succeeded) return false; - std::string json = WideToUTF8(json_wide); + std::string json = base::WideToUTF8(json_wide); return JsonDictionaryToMap(json, results); } diff --git a/chrome/test/perf/startup_test.cc b/chrome/test/perf/startup_test.cc index 679d180..e15048e 100644 --- a/chrome/test/perf/startup_test.cc +++ b/chrome/test/perf/startup_test.cc @@ -119,11 +119,11 @@ class StartupTest : public UIPerfTest { // Read in preferences template. std::string pref_string; EXPECT_TRUE(base::ReadFileToString(pref_template_path, &pref_string)); - base::string16 format_string = ASCIIToUTF16(pref_string); + base::string16 format_string = base::ASCIIToUTF16(pref_string); // Make sure temp directory has the proper format for writing to prefs file. #if defined(OS_POSIX) - std::wstring user_data_dir_w(ASCIIToWide(user_data_dir().value())); + std::wstring user_data_dir_w(base::ASCIIToWide(user_data_dir().value())); #elif defined(OS_WIN) std::wstring user_data_dir_w(user_data_dir().value()); // In Windows, the FilePath will write '\' for the path separators; change @@ -134,7 +134,7 @@ class StartupTest : public UIPerfTest { // Rewrite prefs file. std::vector<base::string16> subst; - subst.push_back(WideToUTF16(user_data_dir_w)); + subst.push_back(base::WideToUTF16(user_data_dir_w)); const std::string prefs_string = UTF16ToASCII(ReplaceStringPlaceholders(format_string, subst, NULL)); EXPECT_TRUE(file_util::WriteFile(pref_path, prefs_string.c_str(), diff --git a/chrome/test/perf/tab_switching_test.cc b/chrome/test/perf/tab_switching_test.cc index abd2786..16e587a 100644 --- a/chrome/test/perf/tab_switching_test.cc +++ b/chrome/test/perf/tab_switching_test.cc @@ -51,7 +51,8 @@ class TabSwitchingUITest : public UIPerfTest { // Set the log file path for the browser test. scoped_ptr<base::Environment> env(base::Environment::Create()); #if defined(OS_WIN) - env->SetVar(env_vars::kLogFileName, WideToUTF8(log_file_name_.value())); + env->SetVar(env_vars::kLogFileName, + base::WideToUTF8(log_file_name_.value())); #else env->SetVar(env_vars::kLogFileName, log_file_name_.value()); #endif diff --git a/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp b/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp index 42a0f62..88615f8 100644 --- a/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp +++ b/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp @@ -553,8 +553,8 @@ std::string ProcessGeneralName(PRArenaPool* arena, break; } std::string rv(l10n_util::GetStringFUTF8(IDS_CERT_UNKNOWN_OID_INFO_FORMAT, - UTF8ToUTF16(key), - UTF8ToUTF16(value))); + base::UTF8ToUTF16(key), + base::UTF8ToUTF16(value))); rv += '\n'; return rv; } @@ -601,7 +601,7 @@ std::string ProcessSubjectKeyId(SECItem* extension_data) { } rv = l10n_util::GetStringFUTF8(IDS_CERT_KEYID_FORMAT, - ASCIIToUTF16(ProcessRawBytes(&decoded))); + base::ASCIIToUTF16(ProcessRawBytes(&decoded))); return rv; } @@ -616,21 +616,23 @@ std::string ProcessAuthKeyId(SECItem* extension_data) { if (ret->keyID.len > 0) { rv += l10n_util::GetStringFUTF8(IDS_CERT_KEYID_FORMAT, - ASCIIToUTF16(ProcessRawBytes(&ret->keyID))); + base::ASCIIToUTF16( + ProcessRawBytes(&ret->keyID))); rv += '\n'; } if (ret->authCertIssuer) { rv += l10n_util::GetStringFUTF8( IDS_CERT_ISSUER_FORMAT, - UTF8ToUTF16(ProcessGeneralNames(arena.get(), ret->authCertIssuer))); + base::UTF8ToUTF16( + ProcessGeneralNames(arena.get(), ret->authCertIssuer))); rv += '\n'; } if (ret->authCertSerialNumber.len > 0) { rv += l10n_util::GetStringFUTF8( IDS_CERT_SERIAL_NUMBER_FORMAT, - ASCIIToUTF16(ProcessRawBytes(&ret->authCertSerialNumber))); + base::ASCIIToUTF16(ProcessRawBytes(&ret->authCertSerialNumber))); rv += '\n'; } @@ -666,7 +668,7 @@ std::string ProcessUserNotice(SECItem* der_notice) { if (itemList != notice->noticeReference.noticeNumbers) rv += ", "; rv += '#'; - rv += UTF16ToUTF8(base::UintToString16(number)); + rv += base::UTF16ToUTF8(base::UintToString16(number)); } itemList++; } @@ -711,7 +713,7 @@ std::string ProcessCertificatePolicies(SECItem* extension_data) { // complicated, since we don't want to do the EV check synchronously.) if (policyInfo->policyQualifiers) { rv += l10n_util::GetStringFUTF8(IDS_CERT_MULTILINE_INFO_START_FORMAT, - UTF8ToUTF16(key)); + base::UTF8ToUTF16(key)); } else { rv += key; } @@ -726,7 +728,7 @@ std::string ProcessCertificatePolicies(SECItem* extension_data) { CERTPolicyQualifier* policyQualifier = *policyQualifiers++; rv += l10n_util::GetStringFUTF8( IDS_CERT_MULTILINE_INFO_START_FORMAT, - UTF8ToUTF16(GetOIDText(&policyQualifier->qualifierID))); + base::UTF8ToUTF16(GetOIDText(&policyQualifier->qualifierID))); switch(policyQualifier->oid) { case SEC_OID_PKIX_CPS_POINTER_QUALIFIER: rv += " "; @@ -808,7 +810,8 @@ std::string ProcessCrlDistPoints(SECItem* extension_data) { if (point->crlIssuer) { rv += l10n_util::GetStringFUTF8( IDS_CERT_ISSUER_FORMAT, - UTF8ToUTF16(ProcessGeneralNames(arena.get(), point->crlIssuer))); + base::UTF8ToUTF16( + ProcessGeneralNames(arena.get(), point->crlIssuer))); } } return rv; @@ -828,7 +831,7 @@ std::string ProcessAuthInfoAccess(SECItem* extension_data) { while (*aia != NULL) { desc = *aia++; base::string16 location_str = - UTF8ToUTF16(ProcessGeneralName(arena.get(), desc->location)); + base::UTF8ToUTF16(ProcessGeneralName(arena.get(), desc->location)); switch (SECOID_FindOIDTag(&desc->method)) { case SEC_OID_PKIX_OCSP: rv += l10n_util::GetStringFUTF8(IDS_CERT_OCSP_RESPONDER_FORMAT, @@ -840,7 +843,8 @@ std::string ProcessAuthInfoAccess(SECItem* extension_data) { break; default: rv += l10n_util::GetStringFUTF8(IDS_CERT_UNKNOWN_OID_INFO_FORMAT, - UTF8ToUTF16(GetOIDText(&desc->method)), + base::UTF8ToUTF16( + GetOIDText(&desc->method)), location_str); break; } @@ -962,16 +966,16 @@ std::string ProcessExtKeyUsage(SECItem* extension_data) { std::string oid_dump = DumpOidString(oid); std::string oid_text = GetOIDText(oid); - // If oid is one we recognize, oid_text will have a text description of the OID, - // which we display along with the oid_dump. If we don't recognize the OID, - // GetOIDText will return the same value as DumpOidString, so just display - // the OID alone. + // If oid is one we recognize, oid_text will have a text description of the + // OID, which we display along with the oid_dump. If we don't recognize the + // OID, GetOIDText will return the same value as DumpOidString, so just + // display the OID alone. if (oid_dump == oid_text) rv += oid_dump; else rv += l10n_util::GetStringFUTF8(IDS_CERT_EXT_KEY_USAGE_FORMAT, - UTF8ToUTF16(oid_text), - UTF8ToUTF16(oid_dump)); + base::UTF8ToUTF16(oid_text), + base::UTF8ToUTF16(oid_dump)); rv += '\n'; } CERT_DestroyOidSequence(extension_key_usage); @@ -1030,9 +1034,9 @@ std::string ProcessSubjectPublicKeyInfo(CERTSubjectPublicKeyInfo* spki) { rv = l10n_util::GetStringFUTF8( IDS_CERT_RSA_PUBLIC_KEY_DUMP_FORMAT, base::UintToString16(key->u.rsa.modulus.len * 8), - UTF8ToUTF16(ProcessRawBytes(&key->u.rsa.modulus)), + base::UTF8ToUTF16(ProcessRawBytes(&key->u.rsa.modulus)), base::UintToString16(key->u.rsa.publicExponent.len * 8), - UTF8ToUTF16(ProcessRawBytes(&key->u.rsa.publicExponent))); + base::UTF8ToUTF16(ProcessRawBytes(&key->u.rsa.publicExponent))); break; } default: diff --git a/chrome/tools/convert_dict/aff_reader.cc b/chrome/tools/convert_dict/aff_reader.cc index 6ef94a8..5b995f0 100644 --- a/chrome/tools/convert_dict/aff_reader.cc +++ b/chrome/tools/convert_dict/aff_reader.cc @@ -148,7 +148,7 @@ bool AffReader::EncodingToUTF8(const std::string& encoded, if (!base::CodepageToWide(encoded, encoding(), base::OnStringConversionError::FAIL, &wide_word)) return false; - *utf8 = WideToUTF8(wide_word); + *utf8 = base::WideToUTF8(wide_word); return true; } diff --git a/chrome/tools/convert_dict/convert_dict_unittest.cc b/chrome/tools/convert_dict/convert_dict_unittest.cc index 5d895d3..cbb92ac 100644 --- a/chrome/tools/convert_dict/convert_dict_unittest.cc +++ b/chrome/tools/convert_dict/convert_dict_unittest.cc @@ -101,7 +101,7 @@ void RunDictionaryTest(const char* codepage, for (size_t i = 0; i < dic_reader.words().size(); ++i) { SCOPED_TRACE(base::StringPrintf("dic_reader.words()[%" PRIuS "]: %s", i, dic_reader.words()[i].first.c_str())); - base::string16 word(UTF8ToUTF16(dic_reader.words()[i].first)); + base::string16 word(base::UTF8ToUTF16(dic_reader.words()[i].first)); EXPECT_TRUE(word_list.find(word) != word_list.end()); } @@ -152,7 +152,8 @@ TEST(ConvertDictTest, English) { std::map<base::string16, bool> word_list; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kWords); ++i) word_list.insert( - std::make_pair<base::string16, bool>(WideToUTF16(kWords[i]), true)); + std::make_pair<base::string16, bool>(base::WideToUTF16(kWords[i]), + true)); RunDictionaryTest(kCodepage, word_list); } @@ -174,7 +175,8 @@ TEST(ConvertDictTest, Russian) { std::map<base::string16, bool> word_list; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kWords); ++i) word_list.insert( - std::make_pair<base::string16, bool>(WideToUTF16(kWords[i]), true)); + std::make_pair<base::string16, bool>(base::WideToUTF16(kWords[i]), + true)); RunDictionaryTest(kCodepage, word_list); } @@ -198,7 +200,8 @@ TEST(ConvertDictTest, Hungarian) { std::map<base::string16, bool> word_list; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kWords); ++i) word_list.insert( - std::make_pair<base::string16, bool>(WideToUTF16(kWords[i]), true)); + std::make_pair<base::string16, bool>(base::WideToUTF16(kWords[i]), + true)); RunDictionaryTest(kCodepage, word_list); } diff --git a/chrome/utility/extensions/unpacker.cc b/chrome/utility/extensions/unpacker.cc index 75c3741..795e0c5e 100644 --- a/chrome/utility/extensions/unpacker.cc +++ b/chrome/utility/extensions/unpacker.cc @@ -293,10 +293,10 @@ bool Unpacker::ReadMessageCatalog(const base::FilePath& message_path) { if (error.empty()) { // If file is missing, Deserialize will fail with empty error. SetError(base::StringPrintf("%s %s", errors::kLocalesMessagesFileMissing, - UTF16ToUTF8(messages_file).c_str())); + base::UTF16ToUTF8(messages_file).c_str())); } else { SetError(base::StringPrintf("%s: %s", - UTF16ToUTF8(messages_file).c_str(), + base::UTF16ToUTF8(messages_file).c_str(), error.c_str())); } return false; @@ -320,7 +320,7 @@ bool Unpacker::ReadMessageCatalog(const base::FilePath& message_path) { } void Unpacker::SetError(const std::string &error) { - SetUTF16Error(UTF8ToUTF16(error)); + SetUTF16Error(base::UTF8ToUTF16(error)); } void Unpacker::SetUTF16Error(const base::string16& error) { diff --git a/chrome/utility/extensions/unpacker_unittest.cc b/chrome/utility/extensions/unpacker_unittest.cc index 28a2522..faf89ff 100644 --- a/chrome/utility/extensions/unpacker_unittest.cc +++ b/chrome/utility/extensions/unpacker_unittest.cc @@ -16,6 +16,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkBitmap.h" +using base::ASCIIToUTF16; + namespace extensions { namespace errors = manifest_errors; diff --git a/chrome/utility/importer/bookmark_html_reader_unittest.cc b/chrome/utility/importer/bookmark_html_reader_unittest.cc index 6bfb16f..47ae53e 100644 --- a/chrome/utility/importer/bookmark_html_reader_unittest.cc +++ b/chrome/utility/importer/bookmark_html_reader_unittest.cc @@ -16,6 +16,9 @@ #include "chrome/common/importer/imported_bookmark_entry.h" #include "testing/gtest/include/gtest/gtest.h" +using base::ASCIIToUTF16; +using base::UTF16ToWide; + namespace bookmark_html_reader { TEST(BookmarkHTMLReaderTest, ParseTests) { diff --git a/chrome/utility/importer/firefox_importer.cc b/chrome/utility/importer/firefox_importer.cc index 3c826d2..014e8d5 100644 --- a/chrome/utility/importer/firefox_importer.cc +++ b/chrome/utility/importer/firefox_importer.cc @@ -310,7 +310,7 @@ void FirefoxImporter::ImportBookmarks() { if (!item->keyword.empty() && item->url.is_valid()) { importer::URLKeywordInfo url_keyword_info; url_keyword_info.url = item->url; - url_keyword_info.keyword.assign(UTF8ToUTF16(item->keyword)); + url_keyword_info.keyword.assign(base::UTF8ToUTF16(item->keyword)); url_keyword_info.display_name = item->title; url_keywords.push_back(url_keyword_info); } diff --git a/chrome/utility/importer/firefox_importer_unittest.cc b/chrome/utility/importer/firefox_importer_unittest.cc index 50372e1..9a415d6 100644 --- a/chrome/utility/importer/firefox_importer_unittest.cc +++ b/chrome/utility/importer/firefox_importer_unittest.cc @@ -36,11 +36,11 @@ TEST(FirefoxImporterTest, MAYBE_NSS(Firefox3NSS3Decryptor)) { ASSERT_TRUE(decryptor_proxy.Setup(nss_path)); ASSERT_TRUE(decryptor_proxy.DecryptorInit(nss_path, db_path)); - EXPECT_EQ(ASCIIToUTF16("hello"), + EXPECT_EQ(base::ASCIIToUTF16("hello"), decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECKa" "jtRg4qFSHBAhv9luFkXgDJA==")); // Test UTF-16 encoding. - EXPECT_EQ(WideToUTF16(L"\x4E2D"), + EXPECT_EQ(base::WideToUTF16(L"\x4E2D"), decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECLW" "qqiccfQHWBAie74hxnULxlw==")); } diff --git a/chrome/utility/importer/ie_importer_win.cc b/chrome/utility/importer/ie_importer_win.cc index 6dbe5d8..0779fb3 100644 --- a/chrome/utility/importer/ie_importer_win.cc +++ b/chrome/utility/importer/ie_importer_win.cc @@ -290,7 +290,7 @@ GURL ReadURLFromInternetShortcut(IUniformResourceLocator* url_locator) { base::win::ScopedCoMem<wchar_t> url; // GetURL can return S_FALSE (FAILED(S_FALSE) is false) when url == NULL. return (FAILED(url_locator->GetURL(&url)) || !url) ? - GURL() : GURL(WideToUTF16(std::wstring(url))); + GURL() : GURL(base::WideToUTF16(std::wstring(url))); } // Reads the URL of the favicon of the internet shortcut. @@ -315,7 +315,7 @@ GURL ReadFaviconURLFromInternetShortcut(IUniformResourceLocator* url_locator) { if (FAILED(property_storage->ReadMultiple(1, properties, output.Receive())) || output.get().vt != VT_LPWSTR) return GURL(); - return GURL(WideToUTF16(output.get().pwszVal)); + return GURL(base::WideToUTF16(output.get().pwszVal)); } // Reads the favicon imaga data in an NTFS alternate data stream. This is where @@ -329,7 +329,7 @@ bool ReadFaviconDataFromInternetShortcut(const base::string16& file, // Reads the favicon imaga data in the Internet cache. IE6 doesn't hold the data // explicitly, but it might be found in the cache. bool ReadFaviconDataFromCache(const GURL& favicon_url, std::string* data) { - std::wstring url_wstring(UTF8ToWide(favicon_url.spec())); + std::wstring url_wstring(base::UTF8ToWide(favicon_url.spec())); DWORD info_size = 0; GetUrlCacheEntryInfoEx(url_wstring.c_str(), NULL, &info_size, NULL, NULL, NULL, 0); @@ -702,7 +702,7 @@ void IEImporter::ImportSearchEngines() { } } - std::string url(WideToUTF8(wide_url)); + std::string url(base::WideToUTF8(wide_url)); SearchEnginesMap::iterator t_iter = search_engines_map.find(url); if (t_iter == search_engines_map.end()) { // First time we see that URL. diff --git a/chrome/utility/importer/nss_decryptor.cc b/chrome/utility/importer/nss_decryptor.cc index 652fed7..6b22ae2 100644 --- a/chrome/utility/importer/nss_decryptor.cc +++ b/chrome/utility/importer/nss_decryptor.cc @@ -101,7 +101,7 @@ base::string16 NSSDecryptor::Decrypt(const std::string& crypt) const { base::Base64Decode(crypt.substr(1), &plain); } - return UTF8ToUTF16(plain); + return base::UTF8ToUTF16(plain); } // There are three versions of password files. They store saved user @@ -205,11 +205,11 @@ void NSSDecryptor::ParseSignons( // line (contains a dot). while (begin + 4 < end) { // The user name. - form.username_element = UTF8ToUTF16(lines[begin++]); + form.username_element = base::UTF8ToUTF16(lines[begin++]); form.username_value = Decrypt(lines[begin++]); // The element name has a leading '*'. if (lines[begin].at(0) == '*') { - form.password_element = UTF8ToUTF16(lines[begin++].substr(1)); + form.password_element = base::UTF8ToUTF16(lines[begin++].substr(1)); form.password_value = Decrypt(lines[begin++]); } else { // Maybe the file is bad, we skip to next block. diff --git a/chrome/utility/importer/safari_importer_unittest.mm b/chrome/utility/importer/safari_importer_unittest.mm index d7f3c65..043e186 100644 --- a/chrome/utility/importer/safari_importer_unittest.mm +++ b/chrome/utility/importer/safari_importer_unittest.mm @@ -22,6 +22,8 @@ #include "sql/connection.h" #include "testing/platform_test.h" +using base::ASCIIToUTF16; + // In order to test the Safari import functionality effectively, we store a // simulated Library directory containing dummy data files in the same // structure as ~/Library in the Chrome test data directory. @@ -57,7 +59,7 @@ TEST_F(SafariImporterTest, HistoryImport) { ImporterURLRow& it1 = history_items[0]; EXPECT_EQ(it1.url, GURL("http://www.firsthistoryitem.com/")); - EXPECT_EQ(it1.title, UTF8ToUTF16("First History Item Title")); + EXPECT_EQ(it1.title, base::UTF8ToUTF16("First History Item Title")); EXPECT_EQ(it1.visit_count, 1); EXPECT_EQ(it1.hidden, 0); EXPECT_EQ(it1.typed_count, 0); @@ -68,7 +70,7 @@ TEST_F(SafariImporterTest, HistoryImport) { std::string second_item_title("http://www.secondhistoryitem.com/"); EXPECT_EQ(it2.url, GURL(second_item_title)); // The second item lacks a title so we expect the URL to be substituted. - EXPECT_EQ(UTF16ToUTF8(it2.title), second_item_title.c_str()); + EXPECT_EQ(base::UTF16ToUTF8(it2.title), second_item_title.c_str()); EXPECT_EQ(it2.visit_count, 55); EXPECT_EQ(it2.hidden, 0); EXPECT_EQ(it2.typed_count, 0); diff --git a/chrome/utility/media_galleries/itunes_library_parser.cc b/chrome/utility/media_galleries/itunes_library_parser.cc index aef27f7..21fa825 100644 --- a/chrome/utility/media_galleries/itunes_library_parser.cc +++ b/chrome/utility/media_galleries/itunes_library_parser.cc @@ -79,7 +79,7 @@ bool GetTrackInfoFromDict(XmlReader* reader, TrackInfo* result) { #else base::string16 location16(decoded_location.data(), decoded_location.length()); - std::string location = "/" + UTF16ToUTF8(location16); + std::string location = "/" + base::UTF16ToUTF8(location16); #endif result->location = base::FilePath(location); found_location = true; |