From ad65a3ee540552ecca50ebbf9382f1a4c718d383 Mon Sep 17 00:00:00 2001 From: "avi@chromium.org" Date: Wed, 25 Dec 2013 18:18:01 +0000 Subject: Update uses of UTF conversions in courgette/, device/, extensions/, google_apis/, gpu/, ipc/, media/, net/ to use the base:: namespace. BUG=330556 TEST=no change TBR=ben@chromium.org Review URL: https://codereview.chromium.org/112963005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242496 0039d316-1c4b-4281-b951-d872f2087c98 --- courgette/encoded_program.cc | 3 +- device/bluetooth/bluetooth_chromeos_unittest.cc | 6 ++-- device/bluetooth/bluetooth_device.cc | 4 +-- device/bluetooth/test/mock_bluetooth_device.cc | 2 +- extensions/browser/admin_policy.cc | 6 ++-- extensions/browser/management_policy_unittest.cc | 14 +++++----- extensions/browser/test_management_policy.cc | 4 +-- extensions/common/error_utils.cc | 6 ++-- extensions/common/extension.cc | 32 +++++++++++----------- extensions/common/manifest_handler_unittest.cc | 2 +- .../common/manifest_handlers/background_info.cc | 3 +- extensions/common/manifest_handlers/csp_info.cc | 6 ++-- .../common/manifest_handlers/incognito_info.cc | 4 +-- .../common/manifest_handlers/kiosk_mode_info.cc | 7 +++-- .../manifest_handlers/offline_enabled_info.cc | 2 +- .../common/manifest_handlers/requirements_info.cc | 4 +-- .../manifest_handlers/sandboxed_page_info.cc | 6 ++-- .../common/manifest_handlers/shared_module_info.cc | 10 +++---- extensions/common/permissions/permissions_data.cc | 2 +- .../permissions/permissions_data_unittest.cc | 1 + extensions/common/stack_frame_unittest.cc | 8 +++--- google_apis/drive/gdata_wapi_parser.cc | 2 +- google_apis/gaia/oauth2_mint_token_flow.cc | 2 +- .../gaia/oauth2_mint_token_flow_unittest.cc | 10 +++---- gpu/config/gpu_dx_diagnostics_win.cc | 6 ++-- ipc/ipc_channel_win.cc | 4 +-- ipc/ipc_message_utils.cc | 4 +-- media/audio/win/audio_device_listener_win.cc | 2 +- .../win/audio_device_listener_win_unittest.cc | 2 +- media/audio/win/audio_low_latency_input_win.cc | 4 +-- media/audio/win/core_audio_util_win.cc | 18 ++++++------ media/audio/win/core_audio_util_win_unittest.cc | 2 +- media/audio/win/device_enumeration_win.cc | 11 ++++---- media/midi/midi_manager_win.cc | 4 +-- net/base/escape.cc | 8 ++++-- net/base/escape_unittest.cc | 22 +++++++-------- net/base/keygen_handler_win.cc | 2 +- net/base/mime_util.cc | 3 +- net/base/mime_util_unittest.cc | 4 +-- net/base/net_util.cc | 27 +++++++++--------- net/base/net_util_unittest.cc | 7 +++-- net/base/net_util_win.cc | 2 +- net/base/network_time_notifier.cc | 3 +- net/base/platform_mime_util_win.cc | 5 ++-- net/cert/cert_verify_proc_win.cc | 2 +- net/cert/nss_cert_database_unittest.cc | 2 ++ net/cert/x509_cert_types_mac.cc | 6 ++-- net/cert/x509_cert_types_win.cc | 2 +- net/dns/dns_config_service_win.cc | 2 +- net/dns/host_resolver_impl.cc | 2 +- net/ftp/ftp_auth_cache_unittest.cc | 1 + net/ftp/ftp_directory_listing_parser.cc | 2 +- net/ftp/ftp_directory_listing_parser_ls.cc | 5 ++-- net/ftp/ftp_directory_listing_parser_netware.cc | 4 ++- ...tp_directory_listing_parser_netware_unittest.cc | 4 +-- net/ftp/ftp_directory_listing_parser_unittest.cc | 2 +- net/ftp/ftp_directory_listing_parser_unittest.h | 4 +-- net/ftp/ftp_directory_listing_parser_vms.cc | 8 +++--- .../ftp_directory_listing_parser_vms_unittest.cc | 2 ++ net/ftp/ftp_network_transaction.cc | 10 +++---- net/ftp/ftp_network_transaction_unittest.cc | 8 +++--- net/ftp/ftp_util.cc | 1 + net/ftp/ftp_util_unittest.cc | 3 ++ net/http/http_auth_cache_unittest.cc | 2 ++ net/http/http_auth_controller_unittest.cc | 2 +- net/http/http_auth_handler_basic.cc | 4 +-- net/http/http_auth_handler_basic_unittest.cc | 4 +-- net/http/http_auth_handler_digest.cc | 8 +++--- net/http/http_auth_handler_digest_unittest.cc | 7 +++-- net/http/http_auth_handler_ntlm_portable.cc | 6 ++-- net/http/http_auth_handler_unittest.cc | 3 +- net/http/http_content_disposition.cc | 4 +-- net/http/http_content_disposition_unittest.cc | 4 +-- net/http/http_network_transaction_unittest.cc | 2 ++ .../http_pipelined_network_transaction_unittest.cc | 3 +- net/http/http_proxy_client_socket_pool_unittest.cc | 4 +-- net/http/url_security_manager_win.cc | 2 +- net/proxy/mock_proxy_script_fetcher.cc | 2 +- .../multi_threaded_proxy_resolver_unittest.cc | 2 ++ net/proxy/proxy_resolver_script_data.cc | 2 +- net/proxy/proxy_resolver_v8.cc | 14 +++++----- net/proxy/proxy_resolver_v8_unittest.cc | 4 +-- net/proxy/proxy_resolver_winhttp.cc | 9 +++--- net/proxy/proxy_script_decider.cc | 3 +- net/proxy/proxy_script_decider_unittest.cc | 8 +++--- net/proxy/proxy_script_fetcher_impl_unittest.cc | 2 ++ net/proxy/proxy_service_unittest.cc | 2 ++ net/socket/ssl_client_socket_pool_unittest.cc | 4 +-- net/socket_stream/socket_stream_unittest.cc | 2 ++ net/spdy/spdy_network_transaction_unittest.cc | 3 +- net/spdy/spdy_proxy_client_socket_unittest.cc | 4 +-- net/test/python_utils.cc | 2 +- .../spawned_test_server/local_test_server_win.cc | 2 +- net/tools/get_server_time/get_server_time.cc | 2 ++ net/tools/testserver/run_testserver.cc | 3 +- net/url_request/url_request.cc | 2 +- net/url_request/url_request_file_dir_job.cc | 2 +- net/url_request/url_request_ftp_job_unittest.cc | 2 ++ net/url_request/url_request_unittest.cc | 1 + 99 files changed, 269 insertions(+), 219 deletions(-) diff --git a/courgette/encoded_program.cc b/courgette/encoded_program.cc index 8d45d72..8fb8c69 100644 --- a/courgette/encoded_program.cc +++ b/courgette/encoded_program.cc @@ -300,7 +300,8 @@ static FieldSelect GetFieldSelect() { std::string s; env->GetVar("A_FIELDS", &s); if (!s.empty()) { - return static_cast(wcstoul(ASCIIToWide(s).c_str(), 0, 0)); + return static_cast( + wcstoul(base::ASCIIToWide(s).c_str(), 0, 0)); } #endif return static_cast(~0); diff --git a/device/bluetooth/bluetooth_chromeos_unittest.cc b/device/bluetooth/bluetooth_chromeos_unittest.cc index dea1322..efc0b36 100644 --- a/device/bluetooth/bluetooth_chromeos_unittest.cc +++ b/device/bluetooth/bluetooth_chromeos_unittest.cc @@ -749,7 +749,7 @@ TEST_F(BluetoothChromeOSTest, DeviceProperties) { devices[0]->GetAddress()); // Verify the other device properties. - EXPECT_EQ(UTF8ToUTF16(FakeBluetoothDeviceClient::kPairedDeviceName), + EXPECT_EQ(base::UTF8ToUTF16(FakeBluetoothDeviceClient::kPairedDeviceName), devices[0]->GetName()); EXPECT_EQ(BluetoothDevice::DEVICE_COMPUTER, devices[0]->GetDeviceType()); EXPECT_TRUE(devices[0]->IsPaired()); @@ -805,7 +805,7 @@ TEST_F(BluetoothChromeOSTest, DeviceNameChanged) { ASSERT_EQ(1U, devices.size()); ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress, devices[0]->GetAddress()); - ASSERT_EQ(UTF8ToUTF16(FakeBluetoothDeviceClient::kPairedDeviceName), + ASSERT_EQ(base::UTF8ToUTF16(FakeBluetoothDeviceClient::kPairedDeviceName), devices[0]->GetName()); // Install an observer; expect the DeviceChanged method to be called when @@ -823,7 +823,7 @@ TEST_F(BluetoothChromeOSTest, DeviceNameChanged) { EXPECT_EQ(1, observer.device_changed_count_); EXPECT_EQ(devices[0], observer.last_device_); - EXPECT_EQ(UTF8ToUTF16(new_name), devices[0]->GetName()); + EXPECT_EQ(base::UTF8ToUTF16(new_name), devices[0]->GetName()); } TEST_F(BluetoothChromeOSTest, DeviceUuidsChanged) { diff --git a/device/bluetooth/bluetooth_device.cc b/device/bluetooth/bluetooth_device.cc index d9ba2134..7c100ec 100644 --- a/device/bluetooth/bluetooth_device.cc +++ b/device/bluetooth/bluetooth_device.cc @@ -27,14 +27,14 @@ BluetoothDevice::~BluetoothDevice() { base::string16 BluetoothDevice::GetName() const { std::string name = GetDeviceName(); if (!name.empty()) { - return UTF8ToUTF16(name); + return base::UTF8ToUTF16(name); } else { return GetAddressWithLocalizedDeviceTypeName(); } } base::string16 BluetoothDevice::GetAddressWithLocalizedDeviceTypeName() const { - base::string16 address_utf16 = UTF8ToUTF16(GetAddress()); + base::string16 address_utf16 = base::UTF8ToUTF16(GetAddress()); BluetoothDevice::DeviceType device_type = GetDeviceType(); switch (device_type) { case DEVICE_COMPUTER: diff --git a/device/bluetooth/test/mock_bluetooth_device.cc b/device/bluetooth/test/mock_bluetooth_device.cc index b4c6cfe..c1fe56f 100644 --- a/device/bluetooth/test/mock_bluetooth_device.cc +++ b/device/bluetooth/test/mock_bluetooth_device.cc @@ -33,7 +33,7 @@ MockBluetoothDevice::MockBluetoothDevice(MockBluetoothAdapter* adapter, ON_CALL(*this, IsConnecting()) .WillByDefault(testing::Return(false)); ON_CALL(*this, GetName()) - .WillByDefault(testing::Return(UTF8ToUTF16(name_))); + .WillByDefault(testing::Return(base::UTF8ToUTF16(name_))); ON_CALL(*this, ExpectingPinCode()) .WillByDefault(testing::Return(false)); ON_CALL(*this, ExpectingPasskey()) diff --git a/extensions/browser/admin_policy.cc b/extensions/browser/admin_policy.cc index 0513eb9..d961da1 100644 --- a/extensions/browser/admin_policy.cc +++ b/extensions/browser/admin_policy.cc @@ -25,7 +25,7 @@ bool ManagementPolicyImpl(const extensions::Extension* extension, if (error) { *error = l10n_util::GetStringFUTF16( IDS_EXTENSION_CANT_MODIFY_POLICY_REQUIRED, - UTF8ToUTF16(extension->name())); + base::UTF8ToUTF16(extension->name())); } return !modifiable_value; } @@ -35,8 +35,8 @@ bool ReturnLoadError(const extensions::Extension* extension, if (error) { *error = l10n_util::GetStringFUTF16( IDS_EXTENSION_CANT_INSTALL_POLICY_BLOCKED, - UTF8ToUTF16(extension->name()), - UTF8ToUTF16(extension->id())); + base::UTF8ToUTF16(extension->name()), + base::UTF8ToUTF16(extension->id())); } return false; } diff --git a/extensions/browser/management_policy_unittest.cc b/extensions/browser/management_policy_unittest.cc index 20658f1..52373c1 100644 --- a/extensions/browser/management_policy_unittest.cc +++ b/extensions/browser/management_policy_unittest.cc @@ -180,14 +180,14 @@ TEST_F(ManagementPolicyTest, MustRemainDisabled) { TEST_F(ManagementPolicyTest, ErrorHandling) { // The error parameter should be unchanged if no restriction was found. std::string original_error = "Ceci est en effet une erreur."; - base::string16 original_error16 = UTF8ToUTF16(original_error); + base::string16 original_error16 = base::UTF8ToUTF16(original_error); base::string16 error = original_error16; EXPECT_TRUE(policy_.UserMayLoad(NULL, &error)); - EXPECT_EQ(original_error, UTF16ToUTF8(error)); + EXPECT_EQ(original_error, base::UTF16ToUTF8(error)); EXPECT_TRUE(policy_.UserMayModifySettings(NULL, &error)); - EXPECT_EQ(original_error, UTF16ToUTF8(error)); + EXPECT_EQ(original_error, base::UTF16ToUTF8(error)); EXPECT_FALSE(policy_.MustRemainEnabled(NULL, &error)); - EXPECT_EQ(original_error, UTF16ToUTF8(error)); + EXPECT_EQ(original_error, base::UTF16ToUTF8(error)); // Ensure no crashes if no error message was requested. EXPECT_TRUE(policy_.UserMayLoad(NULL, NULL)); @@ -201,11 +201,11 @@ TEST_F(ManagementPolicyTest, ErrorHandling) { // Make sure returned error is correct. error = original_error16; EXPECT_FALSE(policy_.UserMayLoad(NULL, &error)); - EXPECT_EQ(UTF8ToUTF16(TestProvider::expected_error()), error); + EXPECT_EQ(base::UTF8ToUTF16(TestProvider::expected_error()), error); error = original_error16; EXPECT_FALSE(policy_.UserMayModifySettings(NULL, &error)); - EXPECT_EQ(UTF8ToUTF16(TestProvider::expected_error()), error); + EXPECT_EQ(base::UTF8ToUTF16(TestProvider::expected_error()), error); error = original_error16; EXPECT_TRUE(policy_.MustRemainEnabled(NULL, &error)); - EXPECT_EQ(UTF8ToUTF16(TestProvider::expected_error()), error); + EXPECT_EQ(base::UTF8ToUTF16(TestProvider::expected_error()), error); } diff --git a/extensions/browser/test_management_policy.cc b/extensions/browser/test_management_policy.cc index 5c78efe..77ec191 100644 --- a/extensions/browser/test_management_policy.cc +++ b/extensions/browser/test_management_policy.cc @@ -14,13 +14,13 @@ TestManagementPolicyProvider::TestManagementPolicyProvider() must_remain_enabled_(false), must_remain_disabled_(false), disable_reason_(Extension::DISABLE_NONE) { - error_message_ = UTF8ToUTF16(expected_error()); + error_message_ = base::UTF8ToUTF16(expected_error()); } TestManagementPolicyProvider::TestManagementPolicyProvider( int prohibited_actions) { SetProhibitedActions(prohibited_actions); - error_message_ = UTF8ToUTF16(expected_error()); + error_message_ = base::UTF8ToUTF16(expected_error()); } void TestManagementPolicyProvider::SetProhibitedActions( diff --git a/extensions/common/error_utils.cc b/extensions/common/error_utils.cc index c44e216..4c40e20 100644 --- a/extensions/common/error_utils.cc +++ b/extensions/common/error_utils.cc @@ -40,7 +40,7 @@ base::string16 ErrorUtils::FormatErrorMessageUTF16(const std::string& format, const std::string& s1) { std::string ret_val = format; ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1); - return UTF8ToUTF16(ret_val); + return base::UTF8ToUTF16(ret_val); } base::string16 ErrorUtils::FormatErrorMessageUTF16(const std::string& format, @@ -49,7 +49,7 @@ base::string16 ErrorUtils::FormatErrorMessageUTF16(const std::string& format, std::string ret_val = format; ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1); ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s2); - return UTF8ToUTF16(ret_val); + return base::UTF8ToUTF16(ret_val); } base::string16 ErrorUtils::FormatErrorMessageUTF16(const std::string& format, @@ -60,7 +60,7 @@ base::string16 ErrorUtils::FormatErrorMessageUTF16(const std::string& format, ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1); ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s2); ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s3); - return UTF8ToUTF16(ret_val); + return base::UTF8ToUTF16(ret_val); } } // namespace diff --git a/extensions/common/extension.cc b/extensions/common/extension.cc index 2bab533..ceb6a79 100644 --- a/extensions/common/extension.cc +++ b/extensions/common/extension.cc @@ -117,7 +117,7 @@ scoped_refptr Extension::Create(const base::FilePath& path, location, scoped_ptr(value.DeepCopy()))); if (!InitExtensionID(manifest.get(), path, explicit_id, flags, &error)) { - *utf8_error = UTF16ToUTF8(error); + *utf8_error = base::UTF16ToUTF8(error); return NULL; } @@ -130,7 +130,7 @@ scoped_refptr Extension::Create(const base::FilePath& path, extension->install_warnings_.swap(install_warnings); if (!extension->InitFromValue(flags, &error)) { - *utf8_error = UTF16ToUTF8(error); + *utf8_error = base::UTF16ToUTF8(error); return NULL; } @@ -479,7 +479,7 @@ bool Extension::InitExtensionID(extensions::Manifest* manifest, std::string public_key_bytes; if (!manifest->GetString(keys::kPublicKey, &public_key) || !ParsePEMKeyBytes(public_key, &public_key_bytes)) { - *error = ASCIIToUTF16(errors::kInvalidKey); + *error = base::ASCIIToUTF16(errors::kInvalidKey); return false; } std::string extension_id = id_util::GenerateId(public_key_bytes); @@ -488,7 +488,7 @@ bool Extension::InitExtensionID(extensions::Manifest* manifest, } if (creation_flags & REQUIRE_KEY) { - *error = ASCIIToUTF16(errors::kInvalidKey); + *error = base::ASCIIToUTF16(errors::kInvalidKey); return false; } else { // If there is a path, we generate the ID from it. This is useful for @@ -575,24 +575,24 @@ bool Extension::LoadRequiredFeatures(base::string16* error) { bool Extension::LoadName(base::string16* error) { base::string16 localized_name; if (!manifest_->GetString(keys::kName, &localized_name)) { - *error = ASCIIToUTF16(errors::kInvalidName); + *error = base::ASCIIToUTF16(errors::kInvalidName); return false; } - non_localized_name_ = UTF16ToUTF8(localized_name); + non_localized_name_ = base::UTF16ToUTF8(localized_name); base::i18n::AdjustStringForLocaleDirection(&localized_name); - name_ = UTF16ToUTF8(localized_name); + name_ = base::UTF16ToUTF8(localized_name); return true; } bool Extension::LoadVersion(base::string16* error) { std::string version_str; if (!manifest_->GetString(keys::kVersion, &version_str)) { - *error = ASCIIToUTF16(errors::kInvalidVersion); + *error = base::ASCIIToUTF16(errors::kInvalidVersion); return false; } version_.reset(new base::Version(version_str)); if (!version_->IsValid() || version_->components().size() > 4) { - *error = ASCIIToUTF16(errors::kInvalidVersion); + *error = base::ASCIIToUTF16(errors::kInvalidVersion); return false; } return true; @@ -605,13 +605,13 @@ bool Extension::LoadAppFeatures(base::string16* error) { } if (manifest_->HasKey(keys::kDisplayInLauncher) && !manifest_->GetBoolean(keys::kDisplayInLauncher, &display_in_launcher_)) { - *error = ASCIIToUTF16(errors::kInvalidDisplayInLauncher); + *error = base::ASCIIToUTF16(errors::kInvalidDisplayInLauncher); return false; } if (manifest_->HasKey(keys::kDisplayInNewTabPage)) { if (!manifest_->GetBoolean(keys::kDisplayInNewTabPage, &display_in_new_tab_page_)) { - *error = ASCIIToUTF16(errors::kInvalidDisplayInNewTabPage); + *error = base::ASCIIToUTF16(errors::kInvalidDisplayInNewTabPage); return false; } } else { @@ -632,7 +632,7 @@ bool Extension::LoadExtent(const char* key, const base::ListValue* pattern_list = NULL; if (!temp_pattern_value->GetAsList(&pattern_list)) { - *error = ASCIIToUTF16(list_error); + *error = base::ASCIIToUTF16(list_error); return false; } @@ -707,7 +707,7 @@ bool Extension::LoadSharedFeatures(base::string16* error) { bool Extension::LoadDescription(base::string16* error) { if (manifest_->HasKey(keys::kDescription) && !manifest_->GetString(keys::kDescription, &description_)) { - *error = ASCIIToUTF16(errors::kInvalidDescription); + *error = base::ASCIIToUTF16(errors::kInvalidDescription); return false; } return true; @@ -720,7 +720,7 @@ bool Extension::LoadManifestVersion(base::string16* error) { int manifest_version = 1; if (!manifest_->GetInteger(keys::kManifestVersion, &manifest_version) || manifest_version < 1) { - *error = ASCIIToUTF16(errors::kInvalidManifestVersion); + *error = base::ASCIIToUTF16(errors::kInvalidManifestVersion); return false; } } @@ -746,12 +746,12 @@ bool Extension::LoadShortName(base::string16* error) { base::string16 localized_short_name; if (!manifest_->GetString(keys::kShortName, &localized_short_name) || localized_short_name.empty()) { - *error = ASCIIToUTF16(errors::kInvalidShortName); + *error = base::ASCIIToUTF16(errors::kInvalidShortName); return false; } base::i18n::AdjustStringForLocaleDirection(&localized_short_name); - short_name_ = UTF16ToUTF8(localized_short_name); + short_name_ = base::UTF16ToUTF8(localized_short_name); } else { short_name_ = name_; } diff --git a/extensions/common/manifest_handler_unittest.cc b/extensions/common/manifest_handler_unittest.cc index 8eb9fec..1da6b40 100644 --- a/extensions/common/manifest_handler_unittest.cc +++ b/extensions/common/manifest_handler_unittest.cc @@ -112,7 +112,7 @@ class ManifestHandlerTest : public testing::Test { : TestManifestHandler(name, keys, prereqs, watcher) { } virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE { - *error = ASCIIToUTF16(name_); + *error = base::ASCIIToUTF16(name_); return false; } }; diff --git a/extensions/common/manifest_handlers/background_info.cc b/extensions/common/manifest_handlers/background_info.cc index 66a18e5..c7aee90 100644 --- a/extensions/common/manifest_handlers/background_info.cc +++ b/extensions/common/manifest_handlers/background_info.cc @@ -20,6 +20,7 @@ #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +using base::ASCIIToUTF16; using base::DictionaryValue; namespace extensions { @@ -275,7 +276,7 @@ bool BackgroundManifestHandler::Validate( extension->GetResource(background_scripts[i]).GetFilePath())) { *error = l10n_util::GetStringFUTF8( IDS_EXTENSION_LOAD_BACKGROUND_SCRIPT_FAILED, - UTF8ToUTF16(background_scripts[i])); + base::UTF8ToUTF16(background_scripts[i])); return false; } } diff --git a/extensions/common/manifest_handlers/csp_info.cc b/extensions/common/manifest_handlers/csp_info.cc index 842a640..2fd74fb 100644 --- a/extensions/common/manifest_handlers/csp_info.cc +++ b/extensions/common/manifest_handlers/csp_info.cc @@ -97,17 +97,17 @@ bool CSPHandler::Parse(Extension* extension, base::string16* error) { std::string content_security_policy; if (!extension->manifest()->GetString(key, &content_security_policy)) { - *error = ASCIIToUTF16(errors::kInvalidContentSecurityPolicy); + *error = base::ASCIIToUTF16(errors::kInvalidContentSecurityPolicy); return false; } if (!ContentSecurityPolicyIsLegal(content_security_policy)) { - *error = ASCIIToUTF16(errors::kInvalidContentSecurityPolicy); + *error = base::ASCIIToUTF16(errors::kInvalidContentSecurityPolicy); return false; } if (extension->manifest_version() >= 2 && !ContentSecurityPolicyIsSecure(content_security_policy, extension->GetType())) { - *error = ASCIIToUTF16(errors::kInsecureContentSecurityPolicy); + *error = base::ASCIIToUTF16(errors::kInsecureContentSecurityPolicy); return false; } diff --git a/extensions/common/manifest_handlers/incognito_info.cc b/extensions/common/manifest_handlers/incognito_info.cc index a56ac6b..02c3b28 100644 --- a/extensions/common/manifest_handlers/incognito_info.cc +++ b/extensions/common/manifest_handlers/incognito_info.cc @@ -48,7 +48,7 @@ bool IncognitoHandler::Parse(Extension* extension, base::string16* error) { bool split_mode = false; std::string incognito_string; if (!extension->manifest()->GetString(keys::kIncognito, &incognito_string)) { - *error = ASCIIToUTF16(manifest_errors::kInvalidIncognitoBehavior); + *error = base::ASCIIToUTF16(manifest_errors::kInvalidIncognitoBehavior); return false; } @@ -57,7 +57,7 @@ bool IncognitoHandler::Parse(Extension* extension, base::string16* error) { else if (incognito_string != manifest_values::kIncognitoSpanning) { // If incognito_string == kIncognitoSpanning, it is valid and // split_mode remains false. - *error = ASCIIToUTF16(manifest_errors::kInvalidIncognitoBehavior); + *error = base::ASCIIToUTF16(manifest_errors::kInvalidIncognitoBehavior); return false; } diff --git a/extensions/common/manifest_handlers/kiosk_mode_info.cc b/extensions/common/manifest_handlers/kiosk_mode_info.cc index 41b0c8c..f5d36af 100644 --- a/extensions/common/manifest_handlers/kiosk_mode_info.cc +++ b/extensions/common/manifest_handlers/kiosk_mode_info.cc @@ -52,19 +52,20 @@ bool KioskModeHandler::Parse(Extension* extension, base::string16* error) { bool kiosk_enabled = false; if (manifest->HasKey(keys::kKioskEnabled) && !manifest->GetBoolean(keys::kKioskEnabled, &kiosk_enabled)) { - *error = ASCIIToUTF16(manifest_errors::kInvalidKioskEnabled); + *error = base::ASCIIToUTF16(manifest_errors::kInvalidKioskEnabled); return false; } bool kiosk_only = false; if (manifest->HasKey(keys::kKioskOnly) && !manifest->GetBoolean(keys::kKioskOnly, &kiosk_only)) { - *error = ASCIIToUTF16(manifest_errors::kInvalidKioskOnly); + *error = base::ASCIIToUTF16(manifest_errors::kInvalidKioskOnly); return false; } if (kiosk_only && !kiosk_enabled) { - *error = ASCIIToUTF16(manifest_errors::kInvalidKioskOnlyButNotEnabled); + *error = base::ASCIIToUTF16( + manifest_errors::kInvalidKioskOnlyButNotEnabled); return false; } diff --git a/extensions/common/manifest_handlers/offline_enabled_info.cc b/extensions/common/manifest_handlers/offline_enabled_info.cc index 7d6bdc9..1d1f8b1 100644 --- a/extensions/common/manifest_handlers/offline_enabled_info.cc +++ b/extensions/common/manifest_handlers/offline_enabled_info.cc @@ -49,7 +49,7 @@ bool OfflineEnabledHandler::Parse(Extension* extension, base::string16* error) { if (!extension->manifest()->GetBoolean(keys::kOfflineEnabled, &offline_enabled)) { - *error = ASCIIToUTF16(manifest_errors::kInvalidOfflineEnabled); + *error = base::ASCIIToUTF16(manifest_errors::kInvalidOfflineEnabled); return false; } diff --git a/extensions/common/manifest_handlers/requirements_info.cc b/extensions/common/manifest_handlers/requirements_info.cc index 7838e82..a775324 100644 --- a/extensions/common/manifest_handlers/requirements_info.cc +++ b/extensions/common/manifest_handlers/requirements_info.cc @@ -72,7 +72,7 @@ bool RequirementsHandler::Parse(Extension* extension, base::string16* error) { const base::DictionaryValue* requirements_value = NULL; if (!extension->manifest()->GetDictionary(keys::kRequirements, &requirements_value)) { - *error = ASCIIToUTF16(errors::kInvalidRequirements); + *error = base::ASCIIToUTF16(errors::kInvalidRequirements); return false; } @@ -129,7 +129,7 @@ bool RequirementsHandler::Parse(Extension* extension, base::string16* error) { } } } else { - *error = ASCIIToUTF16(errors::kInvalidRequirements); + *error = base::ASCIIToUTF16(errors::kInvalidRequirements); return false; } } diff --git a/extensions/common/manifest_handlers/sandboxed_page_info.cc b/extensions/common/manifest_handlers/sandboxed_page_info.cc index d430a8a..2471e93 100644 --- a/extensions/common/manifest_handlers/sandboxed_page_info.cc +++ b/extensions/common/manifest_handlers/sandboxed_page_info.cc @@ -66,7 +66,7 @@ bool SandboxedPageHandler::Parse(Extension* extension, base::string16* error) { const base::ListValue* list_value = NULL; if (!extension->manifest()->GetList(keys::kSandboxedPages, &list_value)) { - *error = ASCIIToUTF16(errors::kInvalidSandboxedPagesList); + *error = base::ASCIIToUTF16(errors::kInvalidSandboxedPagesList); return false; } @@ -93,7 +93,7 @@ bool SandboxedPageHandler::Parse(Extension* extension, base::string16* error) { if (!extension->manifest()->GetString( keys::kSandboxedPagesCSP, &sandboxed_info->content_security_policy)) { - *error = ASCIIToUTF16(errors::kInvalidSandboxedPagesCSP); + *error = base::ASCIIToUTF16(errors::kInvalidSandboxedPagesCSP); return false; } @@ -101,7 +101,7 @@ bool SandboxedPageHandler::Parse(Extension* extension, base::string16* error) { sandboxed_info->content_security_policy) || !csp_validator::ContentSecurityPolicyIsSandboxed( sandboxed_info->content_security_policy, extension->GetType())) { - *error = ASCIIToUTF16(errors::kInvalidSandboxedPagesCSP); + *error = base::ASCIIToUTF16(errors::kInvalidSandboxedPagesCSP); return false; } } else { diff --git a/extensions/common/manifest_handlers/shared_module_info.cc b/extensions/common/manifest_handlers/shared_module_info.cc index 0586719..0c01f75 100644 --- a/extensions/common/manifest_handlers/shared_module_info.cc +++ b/extensions/common/manifest_handlers/shared_module_info.cc @@ -113,19 +113,19 @@ bool SharedModuleInfo::Parse(const Extension* extension, return true; if (has_import && has_export) { - *error = ASCIIToUTF16(errors::kInvalidImportAndExport); + *error = base::ASCIIToUTF16(errors::kInvalidImportAndExport); return false; } if (has_export) { const base::DictionaryValue* export_value = NULL; if (!extension->manifest()->GetDictionary(keys::kExport, &export_value)) { - *error = ASCIIToUTF16(errors::kInvalidExport); + *error = base::ASCIIToUTF16(errors::kInvalidExport); return false; } const base::ListValue* resources_list = NULL; if (!export_value->GetList(keys::kResources, &resources_list)) { - *error = ASCIIToUTF16(errors::kInvalidExportResources); + *error = base::ASCIIToUTF16(errors::kInvalidExportResources); return false; } for (size_t i = 0; i < resources_list->GetSize(); ++i) { @@ -149,13 +149,13 @@ bool SharedModuleInfo::Parse(const Extension* extension, if (has_import) { const base::ListValue* import_list = NULL; if (!extension->manifest()->GetList(keys::kImport, &import_list)) { - *error = ASCIIToUTF16(errors::kInvalidImport); + *error = base::ASCIIToUTF16(errors::kInvalidImport); return false; } for (size_t i = 0; i < import_list->GetSize(); ++i) { const base::DictionaryValue* import_entry = NULL; if (!import_list->GetDictionary(i, &import_entry)) { - *error = ASCIIToUTF16(errors::kInvalidImport); + *error = base::ASCIIToUTF16(errors::kInvalidImport); return false; } std::string extension_id; diff --git a/extensions/common/permissions/permissions_data.cc b/extensions/common/permissions/permissions_data.cc index 3e6e85f..07e8c9e 100644 --- a/extensions/common/permissions/permissions_data.cc +++ b/extensions/common/permissions/permissions_data.cc @@ -152,7 +152,7 @@ bool ParseHelper(Extension* extension, if (iter->id() == APIPermission::kExperimental) { if (!CanSpecifyExperimentalPermission(extension)) { - *error = ASCIIToUTF16(errors::kExperimentalFlagRequired); + *error = base::ASCIIToUTF16(errors::kExperimentalFlagRequired); return false; } } diff --git a/extensions/common/permissions/permissions_data_unittest.cc b/extensions/common/permissions/permissions_data_unittest.cc index c2914e5..294d106 100644 --- a/extensions/common/permissions/permissions_data_unittest.cc +++ b/extensions/common/permissions/permissions_data_unittest.cc @@ -24,6 +24,7 @@ #include "extensions/common/url_pattern_set.h" #include "testing/gtest/include/gtest/gtest.h" +using base::UTF16ToUTF8; using content::SocketPermissionRequest; using extension_test_util::LoadManifest; using extension_test_util::LoadManifestUnchecked; diff --git a/extensions/common/stack_frame_unittest.cc b/extensions/common/stack_frame_unittest.cc index 7dad047..ddd92ae 100644 --- a/extensions/common/stack_frame_unittest.cc +++ b/extensions/common/stack_frame_unittest.cc @@ -21,18 +21,18 @@ void AssertStackFrameValid(const std::string& text, size_t column, const std::string& source, const std::string& function) { - base::string16 utf16_text = UTF8ToUTF16(text); + base::string16 utf16_text = base::UTF8ToUTF16(text); scoped_ptr frame = StackFrame::CreateFromText(utf16_text); ASSERT_TRUE(frame.get()) << "Failed to create frame from '" << text << "'"; EXPECT_EQ(line, frame->line_number()); EXPECT_EQ(column, frame->column_number()); - EXPECT_EQ(UTF8ToUTF16(source), frame->source()); - EXPECT_EQ(UTF8ToUTF16(function), frame->function()); + EXPECT_EQ(base::UTF8ToUTF16(source), frame->source()); + EXPECT_EQ(base::UTF8ToUTF16(function), frame->function()); } void AssertStackFrameInvalid(const std::string& text) { - base::string16 utf16_text = UTF8ToUTF16(text); + base::string16 utf16_text = base::UTF8ToUTF16(text); scoped_ptr frame = StackFrame::CreateFromText(utf16_text); ASSERT_FALSE(frame.get()) << "Errantly created frame from '" << text << "'"; } diff --git a/google_apis/drive/gdata_wapi_parser.cc b/google_apis/drive/gdata_wapi_parser.cc index 82f9d43..1951c17 100644 --- a/google_apis/drive/gdata_wapi_parser.cc +++ b/google_apis/drive/gdata_wapi_parser.cc @@ -539,7 +539,7 @@ std::string ResourceEntry::GetHostedDocumentExtension() const { int ResourceEntry::ClassifyEntryKindByFileExtension( const base::FilePath& file_path) { #if defined(OS_WIN) - std::string file_extension = WideToUTF8(file_path.Extension()); + std::string file_extension = base::WideToUTF8(file_path.Extension()); #else std::string file_extension = file_path.Extension(); #endif diff --git a/google_apis/gaia/oauth2_mint_token_flow.cc b/google_apis/gaia/oauth2_mint_token_flow.cc index 94cacde..437574d 100644 --- a/google_apis/gaia/oauth2_mint_token_flow.cc +++ b/google_apis/gaia/oauth2_mint_token_flow.cc @@ -268,7 +268,7 @@ bool OAuth2MintTokenFlow::ParseIssueAdviceResponse( TrimWhitespace(entry.description, TRIM_ALL, &entry.description); static const base::string16 detail_separators = - ASCIIToUTF16(kDetailSeparators); + base::ASCIIToUTF16(kDetailSeparators); Tokenize(detail, detail_separators, &entry.details); for (size_t i = 0; i < entry.details.size(); i++) TrimWhitespace(entry.details[i], TRIM_ALL, &entry.details[i]); diff --git a/google_apis/gaia/oauth2_mint_token_flow_unittest.cc b/google_apis/gaia/oauth2_mint_token_flow_unittest.cc index 8632f56..8fd359f 100644 --- a/google_apis/gaia/oauth2_mint_token_flow_unittest.cc +++ b/google_apis/gaia/oauth2_mint_token_flow_unittest.cc @@ -111,13 +111,13 @@ std::vector CreateTestScopes() { static IssueAdviceInfo CreateIssueAdvice() { IssueAdviceInfo ia; IssueAdviceInfoEntry e1; - e1.description = ASCIIToUTF16("Manage your calendars"); - e1.details.push_back(ASCIIToUTF16("View and manage your calendars")); + e1.description = base::ASCIIToUTF16("Manage your calendars"); + e1.details.push_back(base::ASCIIToUTF16("View and manage your calendars")); ia.push_back(e1); IssueAdviceInfoEntry e2; - e2.description = ASCIIToUTF16("Manage your documents"); - e2.details.push_back(ASCIIToUTF16("View your documents")); - e2.details.push_back(ASCIIToUTF16("Upload new documents")); + e2.description = base::ASCIIToUTF16("Manage your documents"); + e2.details.push_back(base::ASCIIToUTF16("View your documents")); + e2.details.push_back(base::ASCIIToUTF16("Upload new documents")); ia.push_back(e2); return ia; } diff --git a/gpu/config/gpu_dx_diagnostics_win.cc b/gpu/config/gpu_dx_diagnostics_win.cc index 023e351..0c09ded 100644 --- a/gpu/config/gpu_dx_diagnostics_win.cc +++ b/gpu/config/gpu_dx_diagnostics_win.cc @@ -36,7 +36,7 @@ void RecurseDiagnosticTree(DxDiagNode* output, WCHAR prop_name16[256]; hr = container->EnumPropNames(i, prop_name16, arraysize(prop_name16)); if (SUCCEEDED(hr)) { - std::string prop_name8 = WideToUTF8(prop_name16); + std::string prop_name8 = base::WideToUTF8(prop_name16); hr = container->GetProp(prop_name16, &variant); if (SUCCEEDED(hr)) { @@ -51,7 +51,7 @@ void RecurseDiagnosticTree(DxDiagNode* output, output->values[prop_name8] = variant.boolVal ? "true" : "false"; break; case VT_BSTR: - output->values[prop_name8] = WideToUTF8(variant.bstrVal); + output->values[prop_name8] = base::WideToUTF8(variant.bstrVal); break; default: break; @@ -74,7 +74,7 @@ void RecurseDiagnosticTree(DxDiagNode* output, child_name16, arraysize(child_name16)); if (SUCCEEDED(hr)) { - std::string child_name8 = WideToUTF8(child_name16); + std::string child_name8 = base::WideToUTF8(child_name16); DxDiagNode* output_child = &output->children[child_name8]; IDxDiagContainer* child_container = NULL; diff --git a/ipc/ipc_channel_win.cc b/ipc/ipc_channel_win.cc index 802a0a2..418e8cb 100644 --- a/ipc/ipc_channel_win.cc +++ b/ipc/ipc_channel_win.cc @@ -192,13 +192,13 @@ const base::string16 Channel::ChannelImpl::PipeName( if (index != std::string::npos) { if (secret) // Retrieve the secret if asked for. base::StringToInt(channel_id.substr(index + 1), secret); - return ASCIIToWide(name.append(channel_id.substr(0, index - 1))); + return base::ASCIIToWide(name.append(channel_id.substr(0, index - 1))); } // This case is here to support predictable named pipes in tests. if (secret) *secret = 0; - return ASCIIToWide(name.append(channel_id)); + return base::ASCIIToWide(name.append(channel_id)); } bool Channel::ChannelImpl::CreatePipe(const IPC::ChannelHandle &channel_handle, diff --git a/ipc/ipc_message_utils.cc b/ipc/ipc_message_utils.cc index 0390648..b652443 100644 --- a/ipc/ipc_message_utils.cc +++ b/ipc/ipc_message_utils.cc @@ -340,12 +340,12 @@ void ParamTraits::Log(const param_type& p, std::string* l) { } void ParamTraits::Log(const param_type& p, std::string* l) { - l->append(WideToUTF8(p)); + l->append(base::WideToUTF8(p)); } #if !defined(WCHAR_T_IS_UTF16) void ParamTraits::Log(const param_type& p, std::string* l) { - l->append(UTF16ToUTF8(p)); + l->append(base::UTF16ToUTF8(p)); } #endif diff --git a/media/audio/win/audio_device_listener_win.cc b/media/audio/win/audio_device_listener_win.cc index adbc9a8..17f7730 100644 --- a/media/audio/win/audio_device_listener_win.cc +++ b/media/audio/win/audio_device_listener_win.cc @@ -133,7 +133,7 @@ STDMETHODIMP AudioDeviceListenerWin::OnDefaultDeviceChanged( // If no device is now available, |new_default_device_id| will be NULL. std::string new_device_id; if (new_default_device_id) - new_device_id = WideToUTF8(new_default_device_id); + new_device_id = base::WideToUTF8(new_default_device_id); VLOG(1) << "OnDefaultDeviceChanged() " << "new_default_device: " diff --git a/media/audio/win/audio_device_listener_win_unittest.cc b/media/audio/win/audio_device_listener_win_unittest.cc index 3076fff..14b70a8 100644 --- a/media/audio/win/audio_device_listener_win_unittest.cc +++ b/media/audio/win/audio_device_listener_win_unittest.cc @@ -47,7 +47,7 @@ class AudioDeviceListenerWinTest : public testing::Test { bool SimulateDefaultOutputDeviceChange(const char* new_device_id) { return output_device_listener_->OnDefaultDeviceChanged( static_cast(eConsole), static_cast(eRender), - ASCIIToWide(new_device_id).c_str()) == S_OK; + base::ASCIIToWide(new_device_id).c_str()) == S_OK; } void SetOutputDeviceId(std::string new_device_id) { diff --git a/media/audio/win/audio_low_latency_input_win.cc b/media/audio/win/audio_low_latency_input_win.cc index 8227908..7fde232 100644 --- a/media/audio/win/audio_low_latency_input_win.cc +++ b/media/audio/win/audio_low_latency_input_win.cc @@ -282,7 +282,7 @@ HRESULT WASAPIAudioInputStream::GetMixFormat(const std::string& device_id, } else { // Retrieve a capture endpoint device that is specified by an endpoint // device-identification string. - hr = enumerator->GetDevice(UTF8ToUTF16(device_id).c_str(), + hr = enumerator->GetDevice(base::UTF8ToUTF16(device_id).c_str(), endpoint_device.Receive()); } if (FAILED(hr)) @@ -478,7 +478,7 @@ HRESULT WASAPIAudioInputStream::SetCaptureDevice() { } else { // Retrieve a capture endpoint device that is specified by an endpoint // device-identification string. - hr = enumerator->GetDevice(UTF8ToUTF16(device_id_).c_str(), + hr = enumerator->GetDevice(base::UTF8ToUTF16(device_id_).c_str(), endpoint_device_.Receive()); } diff --git a/media/audio/win/core_audio_util_win.cc b/media/audio/win/core_audio_util_win.cc index 790b2b1..7d3bee7 100644 --- a/media/audio/win/core_audio_util_win.cc +++ b/media/audio/win/core_audio_util_win.cc @@ -146,7 +146,7 @@ static std::string GetDeviceID(IMMDevice* device) { ScopedCoMem device_id_com; std::string device_id; if (SUCCEEDED(device->GetId(&device_id_com))) - WideToUTF8(device_id_com, wcslen(device_id_com), &device_id); + base::WideToUTF8(device_id_com, wcslen(device_id_com), &device_id); return device_id; } @@ -288,8 +288,8 @@ ScopedComPtr CoreAudioUtil::CreateDevice( // Retrieve an audio device specified by an endpoint device-identification // string. - HRESULT hr = device_enumerator->GetDevice(UTF8ToUTF16(device_id).c_str(), - endpoint_device.Receive()); + HRESULT hr = device_enumerator->GetDevice( + base::UTF8ToUTF16(device_id).c_str(), endpoint_device.Receive()); DVLOG_IF(1, FAILED(hr)) << "IMMDeviceEnumerator::GetDevice: " << std::hex << hr; return endpoint_device; @@ -316,9 +316,9 @@ HRESULT CoreAudioUtil::GetDeviceName(IMMDevice* device, AudioDeviceName* name) { if (FAILED(hr)) return hr; if (friendly_name.get().vt == VT_LPWSTR && friendly_name.get().pwszVal) { - WideToUTF8(friendly_name.get().pwszVal, - wcslen(friendly_name.get().pwszVal), - &device_name.device_name); + base::WideToUTF8(friendly_name.get().pwszVal, + wcslen(friendly_name.get().pwszVal), + &device_name.device_name); } *name = device_name; @@ -367,9 +367,9 @@ std::string CoreAudioUtil::GetAudioControllerID(IMMDevice* device, } std::string controller_id; - WideToUTF8(instance_id.get().pwszVal, - wcslen(instance_id.get().pwszVal), - &controller_id); + base::WideToUTF8(instance_id.get().pwszVal, + wcslen(instance_id.get().pwszVal), + &controller_id); return controller_id; } diff --git a/media/audio/win/core_audio_util_win_unittest.cc b/media/audio/win/core_audio_util_win_unittest.cc index e9ed0c4..f18878c 100644 --- a/media/audio/win/core_audio_util_win_unittest.cc +++ b/media/audio/win/core_audio_util_win_unittest.cc @@ -504,7 +504,7 @@ TEST_F(CoreAudioUtilWinTest, GetMatchingOutputDeviceID) { base::win::ScopedCoMem wide_id; device->GetId(&wide_id); std::string id; - WideToUTF8(wide_id, wcslen(wide_id), &id); + base::WideToUTF8(wide_id, wcslen(wide_id), &id); found_a_pair = !CoreAudioUtil::GetMatchingOutputDeviceID(id).empty(); } diff --git a/media/audio/win/device_enumeration_win.cc b/media/audio/win/device_enumeration_win.cc index aa66afb..1beddbb 100644 --- a/media/audio/win/device_enumeration_win.cc +++ b/media/audio/win/device_enumeration_win.cc @@ -68,7 +68,8 @@ static bool GetDeviceNamesWinImpl(EDataFlow data_flow, // Store the unique name. ScopedCoMem endpoint_device_id; audio_device->GetId(&endpoint_device_id); - device.unique_id = WideToUTF8(static_cast(endpoint_device_id)); + device.unique_id = + base::WideToUTF8(static_cast(endpoint_device_id)); // Retrieve user-friendly name of endpoint device. // Example: "Microphone (Realtek High Definition Audio)". @@ -82,7 +83,7 @@ static bool GetDeviceNamesWinImpl(EDataFlow data_flow, // Store the user-friendly name. if (SUCCEEDED(hr) && friendly_name.get().vt == VT_LPWSTR && friendly_name.get().pwszVal) { - device.device_name = WideToUTF8(friendly_name.get().pwszVal); + device.device_name = base::WideToUTF8(friendly_name.get().pwszVal); } } @@ -124,7 +125,7 @@ static bool GetDeviceNamesWinXPImpl(AudioDeviceNames* device_names) { // Store the user-friendly name. Max length is MAXPNAMELEN(=32) // characters and the name cane be truncated on XP. // Example: "Microphone (Realtek High Defini". - device.device_name = WideToUTF8(capabilities.szPname); + device.device_name = base::WideToUTF8(capabilities.szPname); // Store the "unique" name (we use same as friendly name on Windows XP). device.unique_id = device.device_name; @@ -181,7 +182,7 @@ std::string ConvertToWinXPInputDeviceId(const std::string& device_id) { if (result != MMSYSERR_NOERROR) continue; - std::string utf8_id = WideToUTF8(static_cast(id)); + std::string utf8_id = base::WideToUTF8(static_cast(id)); // Check whether the endpoint ID string of this waveIn device matches that // of the audio endpoint device. if (device_id == utf8_id) @@ -195,7 +196,7 @@ std::string ConvertToWinXPInputDeviceId(const std::string& device_id) { result = waveInGetDevCaps(i, &capabilities, sizeof(capabilities)); if (result == MMSYSERR_NOERROR) - return WideToUTF8(capabilities.szPname); + return base::WideToUTF8(capabilities.szPname); } return std::string(); diff --git a/media/midi/midi_manager_win.cc b/media/midi/midi_manager_win.cc index dabbf25..460dcfe 100644 --- a/media/midi/midi_manager_win.cc +++ b/media/midi/midi_manager_win.cc @@ -39,7 +39,7 @@ std::string GetInErrorMessage(MMRESULT result) { << " midiInGetErrorText error: " << get_result; return std::string(); } - return WideToUTF8(text); + return base::WideToUTF8(text); } std::string GetOutErrorMessage(MMRESULT result) { @@ -51,7 +51,7 @@ std::string GetOutErrorMessage(MMRESULT result) { << " midiOutGetErrorText error: " << get_result; return std::string(); } - return WideToUTF8(text); + return base::WideToUTF8(text); } class MIDIHDRDeleter { diff --git a/net/base/escape.cc b/net/base/escape.cc index d1b592c..134a986 100644 --- a/net/base/escape.cc +++ b/net/base/escape.cc @@ -337,7 +337,7 @@ base::string16 UnescapeForHTML(const base::string16& input) { { "'", '\''}, }; - if (input.find(ASCIIToUTF16("&")) == std::string::npos) + if (input.find(base::ASCIIToUTF16("&")) == std::string::npos) return input; base::string16 ampersand_chars[ARRAYSIZE_UNSAFE(kEscapeToChars)]; @@ -348,8 +348,10 @@ base::string16 UnescapeForHTML(const base::string16& input) { // Potential ampersand encode char. size_t index = iter - text.begin(); for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kEscapeToChars); i++) { - if (ampersand_chars[i].empty()) - ampersand_chars[i] = ASCIIToUTF16(kEscapeToChars[i].ampersand_code); + if (ampersand_chars[i].empty()) { + ampersand_chars[i] = + base::ASCIIToUTF16(kEscapeToChars[i].ampersand_code); + } if (text.find(ampersand_chars[i], index) == index) { text.replace(iter, iter + ampersand_chars[i].length(), 1, kEscapeToChars[i].replacement); diff --git a/net/base/escape_unittest.cc b/net/base/escape_unittest.cc index e7e435c..90c246a 100644 --- a/net/base/escape_unittest.cc +++ b/net/base/escape_unittest.cc @@ -250,28 +250,28 @@ TEST(EscapeTest, UnescapeURLComponent) { }; for (size_t i = 0; i < arraysize(unescape_cases); i++) { - base::string16 str(WideToUTF16(unescape_cases[i].input)); - EXPECT_EQ(WideToUTF16(unescape_cases[i].output), + base::string16 str(base::WideToUTF16(unescape_cases[i].input)); + EXPECT_EQ(base::WideToUTF16(unescape_cases[i].output), UnescapeURLComponent(str, unescape_cases[i].rules)); } // Test the NULL character unescaping (which wouldn't work above since those // are just char pointers). - base::string16 input(WideToUTF16(L"Null")); + base::string16 input(base::WideToUTF16(L"Null")); input.push_back(0); // Also have a NULL in the input. - input.append(WideToUTF16(L"%00%39Test")); + input.append(base::WideToUTF16(L"%00%39Test")); // When we're unescaping NULLs - base::string16 expected(WideToUTF16(L"Null")); + base::string16 expected(base::WideToUTF16(L"Null")); expected.push_back(0); expected.push_back(0); - expected.append(ASCIIToUTF16("9Test")); + expected.append(base::ASCIIToUTF16("9Test")); EXPECT_EQ(expected, UnescapeURLComponent(input, UnescapeRule::CONTROL_CHARS)); // When we're not unescaping NULLs. - expected = WideToUTF16(L"Null"); + expected = base::WideToUTF16(L"Null"); expected.push_back(0); - expected.append(WideToUTF16(L"%009Test")); + expected.append(base::WideToUTF16(L"%009Test")); EXPECT_EQ(expected, UnescapeURLComponent(input, UnescapeRule::NORMAL)); } @@ -331,7 +331,7 @@ TEST(EscapeTest, UnescapeAndDecodeUTF8URLComponent) { // TODO: Need to test unescape_spaces and unescape_percent. base::string16 decoded = UnescapeAndDecodeUTF8URLComponent( unescape_cases[i].input, UnescapeRule::NORMAL, NULL); - EXPECT_EQ(WideToUTF16(unescape_cases[i].decoded), decoded); + EXPECT_EQ(base::WideToUTF16(unescape_cases[i].decoded), decoded); } } @@ -387,8 +387,8 @@ TEST(EscapeTest, UnescapeForHTML) { { "& &", "& &" }, }; for (size_t i = 0; i < arraysize(tests); ++i) { - base::string16 result = UnescapeForHTML(ASCIIToUTF16(tests[i].input)); - EXPECT_EQ(ASCIIToUTF16(tests[i].expected_output), result); + base::string16 result = UnescapeForHTML(base::ASCIIToUTF16(tests[i].input)); + EXPECT_EQ(base::ASCIIToUTF16(tests[i].expected_output), result); } } diff --git a/net/base/keygen_handler_win.cc b/net/base/keygen_handler_win.cc index 59d90e8..59dc69d 100644 --- a/net/base/keygen_handler_win.cc +++ b/net/base/keygen_handler_win.cc @@ -64,7 +64,7 @@ bool GetSubjectPublicKeyInfo(HCRYPTPROV prov, std::vector* output) { bool GetSignedPublicKeyAndChallenge(HCRYPTPROV prov, const std::string& challenge, std::string* output) { - std::wstring wide_challenge = ASCIIToWide(challenge); + std::wstring wide_challenge = base::ASCIIToWide(challenge); std::vector spki; if (!GetSubjectPublicKeyInfo(prov, &spki)) diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc index 5ad50b0..51a970b 100644 --- a/net/base/mime_util.cc +++ b/net/base/mime_util.cc @@ -876,7 +876,8 @@ void GetExtensionsFromHardCodedMappings( &this_extensions); for (size_t j = 0; j < this_extensions.size(); ++j) { #if defined(OS_WIN) - base::FilePath::StringType extension(UTF8ToWide(this_extensions[j])); + base::FilePath::StringType extension( + base::UTF8ToWide(this_extensions[j])); #else base::FilePath::StringType extension(this_extensions[j]); #endif diff --git a/net/base/mime_util_unittest.cc b/net/base/mime_util_unittest.cc index ddd34da..bf6bed9 100644 --- a/net/base/mime_util_unittest.cc +++ b/net/base/mime_util_unittest.cc @@ -196,7 +196,7 @@ TEST(MimeUtilTest, TestIsMimeType) { std::string nonAscii("application/nonutf8"); EXPECT_TRUE(IsMimeType(nonAscii)); #if defined(OS_WIN) - nonAscii.append(WideToUTF8(std::wstring(L"\u2603"))); + nonAscii.append(base::WideToUTF8(std::wstring(L"\u2603"))); #else nonAscii.append("\u2603"); // unicode snowman #endif @@ -278,7 +278,7 @@ TEST(MimeUtilTest, TestGetExtensionsForMimeType) { bool found = false; for (size_t j = 0; !found && j < extensions.size(); ++j) { #if defined(OS_WIN) - if (extensions[j] == UTF8ToWide(tests[i].contained_result)) + if (extensions[j] == base::UTF8ToWide(tests[i].contained_result)) found = true; #else if (extensions[j] == tests[i].contained_result) diff --git a/net/base/net_util.cc b/net/base/net_util.cc index 1f69ee7..f26169a 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -634,7 +634,7 @@ base::string16 FormatViewSourceUrl(const GURL& url, base::OffsetAdjuster adjuster(&offsets_into_underlying_url); adjuster.Add(base::OffsetAdjuster::Adjustment(0, kViewSourceLength, 0)); } - base::string16 result(ASCIIToUTF16(kViewSource) + + base::string16 result(base::ASCIIToUTF16(kViewSource) + FormatUrlWithOffsets(GURL(url_str.substr(kViewSourceLength)), languages, format_types, unescape_rules, new_parsed, prefix_end, &offsets_into_underlying_url)); @@ -810,9 +810,9 @@ std::string GetFileNameFromURL(const GURL& url, referrer_charset.c_str(), base::OnStringConversionError::FAIL, &utf16_output)) { - decoded_filename = UTF16ToUTF8(utf16_output); + decoded_filename = base::UTF16ToUTF8(utf16_output); } else { - decoded_filename = WideToUTF8( + decoded_filename = base::WideToUTF8( base::SysNativeMBToWide(unescaped_url_filename)); } } @@ -857,7 +857,7 @@ bool IsReservedName(const base::FilePath::StringType& filename) { "lpt5", "lpt6", "lpt7", "lpt8", "lpt9", "clock$" }; #if defined(OS_WIN) - std::string filename_lower = StringToLowerASCII(WideToUTF8(filename)); + std::string filename_lower = StringToLowerASCII(base::WideToUTF8(filename)); #elif defined(OS_POSIX) std::string filename_lower = StringToLowerASCII(filename); #endif @@ -945,11 +945,12 @@ void EnsureSafeExtension(const std::string& mime_type, bool FilePathToString16(const base::FilePath& path, base::string16* converted) { #if defined(OS_WIN) - return WideToUTF16(path.value().c_str(), path.value().size(), converted); + return base::WideToUTF16( + path.value().c_str(), path.value().size(), converted); #elif defined(OS_POSIX) std::string component8 = path.AsUTF8Unsafe(); return !component8.empty() && - UTF8ToUTF16(component8.c_str(), component8.size(), converted); + base::UTF8ToUTF16(component8.c_str(), component8.size(), converted); #endif } @@ -1152,7 +1153,7 @@ std::string GetDirectoryListingEntry(const base::string16& name, base::EscapeJSONString(name, true, &result); result.append(","); if (raw_bytes.empty()) { - base::EscapeJSONString(EscapePath(UTF16ToUTF8(name)), true, &result); + base::EscapeJSONString(EscapePath(base::UTF16ToUTF8(name)), true, &result); } else { base::EscapeJSONString(EscapePath(raw_bytes), true, &result); } @@ -1183,13 +1184,13 @@ std::string GetDirectoryListingEntry(const base::string16& name, } base::string16 StripWWW(const base::string16& text) { - const base::string16 www(ASCIIToUTF16("www.")); + const base::string16 www(base::ASCIIToUTF16("www.")); return StartsWith(text, www, true) ? text.substr(www.length()) : text; } base::string16 StripWWWFromHost(const GURL& url) { DCHECK(url.is_valid()); - return StripWWW(ASCIIToUTF16(url.host())); + return StripWWW(base::ASCIIToUTF16(url.host())); } bool IsSafePortablePathComponent(const base::FilePath& component) { @@ -1292,8 +1293,8 @@ base::string16 GetSuggestedFilename(const GURL& url, base::FilePath::StringType result_str, default_name_str; #if defined(OS_WIN) replace_trailing = true; - result_str = UTF8ToUTF16(filename); - default_name_str = UTF8ToUTF16(default_name); + result_str = base::UTF8ToUTF16(filename); + default_name_str = base::UTF8ToUTF16(default_name); #else result_str = filename; default_name_str = default_name; @@ -1337,7 +1338,7 @@ base::FilePath GenerateFileName(const GURL& url, base::FilePath generated_name(file_name); #else base::FilePath generated_name( - base::SysWideToNativeMB(UTF16ToWide(file_name))); + base::SysWideToNativeMB(base::UTF16ToWide(file_name))); #endif #if defined(OS_CHROMEOS) @@ -1835,7 +1836,7 @@ base::string16 FormatUrlWithOffsets( // If we need to strip out http do it after the fact. This way we don't need // to worry about how offset_for_adjustment is interpreted. - if (omit_http && StartsWith(url_string, ASCIIToUTF16(kHTTP), true)) { + if (omit_http && StartsWith(url_string, base::ASCIIToUTF16(kHTTP), true)) { const size_t kHTTPSize = arraysize(kHTTP) - 1; url_string = url_string.substr(kHTTPSize); if (offsets_for_adjustment && !offsets_for_adjustment->empty()) { diff --git a/net/base/net_util_unittest.cc b/net/base/net_util_unittest.cc index 5d5137a..7e4c77e 100644 --- a/net/base/net_util_unittest.cc +++ b/net/base/net_util_unittest.cc @@ -30,6 +30,9 @@ #include #endif // OS_WIN +using base::ASCIIToUTF16; +using base::WideToUTF16; + namespace net { namespace { @@ -493,7 +496,7 @@ std::string DumpIPNumber(const IPAddressNumber& v) { } void RunGenerateFileNameTestCase(const GenerateFilenameCase* test_case) { - std::string default_filename(WideToUTF8(test_case->default_filename)); + std::string default_filename(base::WideToUTF8(test_case->default_filename)); base::FilePath file_path = GenerateFileName( GURL(test_case->url), test_case->content_disp_header, test_case->referrer_charset, test_case->suggested_filename, @@ -3344,7 +3347,7 @@ TEST(NetUtilTest, GetNetworkList) { EXPECT_EQ(luid_to_guid(&luid, &guid), NO_ERROR); LPOLESTR name; StringFromCLSID(guid, &name); - EXPECT_STREQ(UTF8ToWide(it->name).c_str(), name); + EXPECT_STREQ(base::UTF8ToWide(it->name).c_str(), name); CoTaskMemFree(name); continue; } else { diff --git a/net/base/net_util_win.cc b/net/base/net_util_win.cc index b15337b..2100286 100644 --- a/net/base/net_util_win.cc +++ b/net/base/net_util_win.cc @@ -127,7 +127,7 @@ bool FileURLToFilePath(const GURL& url, base::FilePath* file_path) { file_path_str = base::SysNativeMBToWide(path); return !file_path_str.empty(); } - file_path_str.assign(UTF8ToWide(path)); + file_path_str.assign(base::UTF8ToWide(path)); // We used to try too hard and see if |path| made up entirely of // the 1st 256 characters in the Unicode was a zero-extended UTF-16. diff --git a/net/base/network_time_notifier.cc b/net/base/network_time_notifier.cc index 6dd0d3d..d21b4ba 100644 --- a/net/base/network_time_notifier.cc +++ b/net/base/network_time_notifier.cc @@ -41,7 +41,8 @@ void NetworkTimeNotifier::UpdateNetworkTime(const base::Time& network_time, const base::TimeTicks& post_time) { DCHECK(thread_checker_.CalledOnValidThread()); DVLOG(1) << "Network time updating to " - << UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(network_time)); + << base::UTF16ToUTF8( + base::TimeFormatFriendlyDateAndTime(network_time)); // Update network time on every request to limit dependency on ticks lag. // TODO(mad): Find a heuristic to avoid augmenting the // network_time_uncertainty_ too much by a particularly long latency. diff --git a/net/base/platform_mime_util_win.cc b/net/base/platform_mime_util_win.cc index 421ddba..fcac48f 100644 --- a/net/base/platform_mime_util_win.cc +++ b/net/base/platform_mime_util_win.cc @@ -19,7 +19,7 @@ bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( base::win::RegKey(HKEY_CLASSES_ROOT, key.c_str(), KEY_READ).ReadValue( L"Content Type", &value); if (!value.empty()) { - *result = WideToUTF8(value); + *result = base::WideToUTF8(value); return true; } return false; @@ -27,7 +27,8 @@ bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( bool PlatformMimeUtil::GetPreferredExtensionForMimeType( const std::string& mime_type, base::FilePath::StringType* ext) const { - std::wstring key(L"MIME\\Database\\Content Type\\" + UTF8ToWide(mime_type)); + std::wstring key( + L"MIME\\Database\\Content Type\\" + base::UTF8ToWide(mime_type)); if (base::win::RegKey(HKEY_CLASSES_ROOT, key.c_str(), KEY_READ).ReadValue( L"Extension", ext) != ERROR_SUCCESS) { return false; diff --git a/net/cert/cert_verify_proc_win.cc b/net/cert/cert_verify_proc_win.cc index 29885ea..0639b3d 100644 --- a/net/cert/cert_verify_proc_win.cc +++ b/net/cert/cert_verify_proc_win.cc @@ -722,7 +722,7 @@ int CertVerifyProcWin::VerifyInternal( if (CertSubjectCommonNameHasNull(cert_handle)) verify_result->cert_status |= CERT_STATUS_INVALID; - std::wstring wstr_hostname = ASCIIToWide(hostname); + std::wstring wstr_hostname = base::ASCIIToWide(hostname); SSL_EXTRA_CERT_CHAIN_POLICY_PARA extra_policy_para; memset(&extra_policy_para, 0, sizeof(extra_policy_para)); diff --git a/net/cert/nss_cert_database_unittest.cc b/net/cert/nss_cert_database_unittest.cc index 4ad1192..f6958cf 100644 --- a/net/cert/nss_cert_database_unittest.cc +++ b/net/cert/nss_cert_database_unittest.cc @@ -37,6 +37,8 @@ #define CERTDB_TERMINAL_RECORD CERTDB_VALID_PEER #endif +using base::ASCIIToUTF16; + namespace net { class CertDatabaseNSSTest : public testing::Test { diff --git a/net/cert/x509_cert_types_mac.cc b/net/cert/x509_cert_types_mac.cc index 6439c7f..2e4f28c 100644 --- a/net/cert/x509_cert_types_mac.cc +++ b/net/cert/x509_cert_types_mac.cc @@ -116,7 +116,7 @@ std::string Latin1DataToUTF8String(CSSM_DATA data) { if (!CodepageToUTF16(DataToString(data), base::kCodepageLatin1, base::OnStringConversionError::FAIL, &utf16)) return ""; - return UTF16ToUTF8(utf16); + return base::UTF16ToUTF8(utf16); } // Converts big-endian UTF-16 to UTF-8 in a std::string. @@ -125,7 +125,7 @@ bool UTF16BigEndianToUTF8(base::char16* chars, size_t length, std::string* out_string) { for (size_t i = 0; i < length; i++) chars[i] = EndianU16_BtoN(chars[i]); - return UTF16ToUTF8(chars, length, out_string); + return base::UTF16ToUTF8(chars, length, out_string); } // Converts big-endian UTF-32 to UTF-8 in a std::string. @@ -135,7 +135,7 @@ bool UTF32BigEndianToUTF8(char32* chars, size_t length, for (size_t i = 0; i < length; ++i) chars[i] = EndianS32_BtoN(chars[i]); #if defined(WCHAR_T_IS_UTF32) - return WideToUTF8(reinterpret_cast(chars), + return base::WideToUTF8(reinterpret_cast(chars), length, out_string); #else #error This code doesn't handle 16-bit wchar_t. diff --git a/net/cert/x509_cert_types_win.cc b/net/cert/x509_cert_types_win.cc index d99362c..8d9a25a 100644 --- a/net/cert/x509_cert_types_win.cc +++ b/net/cert/x509_cert_types_win.cc @@ -54,7 +54,7 @@ bool GetAttributeValue(PCERT_RDN_ATTR attribute, if (chars_written <= 1) return false; wide_name.resize(chars_written - 1); - *value = WideToUTF8(wide_name); + *value = base::WideToUTF8(wide_name); return true; } diff --git a/net/dns/dns_config_service_win.cc b/net/dns/dns_config_service_win.cc index fe97b74..15ae222 100644 --- a/net/dns/dns_config_service_win.cc +++ b/net/dns/dns_config_service_win.cc @@ -153,7 +153,7 @@ bool ParseDomainASCII(const base::string16& widestr, std::string* domain) { // |punycode_output| should now be ASCII; convert it to a std::string. // (We could use UTF16ToASCII() instead, but that requires an extra string // copy. Since ASCII is a subset of UTF8 the following is equivalent). - bool success = UTF16ToUTF8(punycode.data(), punycode.length(), domain); + bool success = base::UTF16ToUTF8(punycode.data(), punycode.length(), domain); DCHECK(success); DCHECK(IsStringASCII(*domain)); return success && !domain->empty(); diff --git a/net/dns/host_resolver_impl.cc b/net/dns/host_resolver_impl.cc index 57ab3d6..f90df04 100644 --- a/net/dns/host_resolver_impl.cc +++ b/net/dns/host_resolver_impl.cc @@ -307,7 +307,7 @@ base::Value* NetLogProcTaskFailedCallback(uint32 attempt_number, (LPWSTR)&error_string, 0, // Buffer size. 0); // Arguments (unused). - dict->SetString("os_error_string", WideToUTF8(error_string)); + dict->SetString("os_error_string", base::WideToUTF8(error_string)); LocalFree(error_string); #endif } diff --git a/net/ftp/ftp_auth_cache_unittest.cc b/net/ftp/ftp_auth_cache_unittest.cc index 153d08b..bd47b64 100644 --- a/net/ftp/ftp_auth_cache_unittest.cc +++ b/net/ftp/ftp_auth_cache_unittest.cc @@ -11,6 +11,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" +using base::ASCIIToUTF16; using net::FtpAuthCache; namespace { diff --git a/net/ftp/ftp_directory_listing_parser.cc b/net/ftp/ftp_directory_listing_parser.cc index 03b77bb..d19e4a2 100644 --- a/net/ftp/ftp_directory_listing_parser.cc +++ b/net/ftp/ftp_directory_listing_parser.cc @@ -110,7 +110,7 @@ int DecodeAndParse(const std::string& text, &converted_text)) { for (size_t j = 0; j < arraysize(kNewlineSeparators); j++) { int rv = ParseListing(converted_text, - ASCIIToUTF16(kNewlineSeparators[j]), + base::ASCIIToUTF16(kNewlineSeparators[j]), encodings[i], current_time, entries, diff --git a/net/ftp/ftp_directory_listing_parser_ls.cc b/net/ftp/ftp_directory_listing_parser_ls.cc index 41e29b6..27174a6 100644 --- a/net/ftp/ftp_directory_listing_parser_ls.cc +++ b/net/ftp/ftp_directory_listing_parser_ls.cc @@ -167,7 +167,7 @@ bool ParseFtpDirectoryListingLs( // All those messages have in common is the string ".:", // where "." means the current directory, and ":" separates it // from the rest of the message, which may be empty. - if (lines[i].find(ASCIIToUTF16(".:")) != base::string16::npos) + if (lines[i].find(base::ASCIIToUTF16(".:")) != base::string16::npos) continue; return false; @@ -216,7 +216,8 @@ bool ParseFtpDirectoryListingLs( column_offset + 1); if (entry.type == FtpDirectoryListingEntry::SYMLINK) { - base::string16::size_type pos = entry.name.rfind(ASCIIToUTF16(" -> ")); + base::string16::size_type pos = + entry.name.rfind(base::ASCIIToUTF16(" -> ")); // We don't require the " -> " to be present. Some FTP servers don't send // the symlink target, possibly for security reasons. diff --git a/net/ftp/ftp_directory_listing_parser_netware.cc b/net/ftp/ftp_directory_listing_parser_netware.cc index 2306513..cc20856 100644 --- a/net/ftp/ftp_directory_listing_parser_netware.cc +++ b/net/ftp/ftp_directory_listing_parser_netware.cc @@ -39,8 +39,10 @@ bool ParseFtpDirectoryListingNetware( const std::vector& lines, const base::Time& current_time, std::vector* entries) { - if (!lines.empty() && !StartsWith(lines[0], ASCIIToUTF16("total "), true)) + if (!lines.empty() && + !StartsWith(lines[0], base::ASCIIToUTF16("total "), true)) { return false; + } for (size_t i = 1U; i < lines.size(); i++) { if (lines[i].empty()) diff --git a/net/ftp/ftp_directory_listing_parser_netware_unittest.cc b/net/ftp/ftp_directory_listing_parser_netware_unittest.cc index 4863713..102552c 100644 --- a/net/ftp/ftp_directory_listing_parser_netware_unittest.cc +++ b/net/ftp/ftp_directory_listing_parser_netware_unittest.cc @@ -36,7 +36,7 @@ TEST_F(FtpDirectoryListingParserNetwareTest, Good) { GetSingleLineTestCase(good_cases[i].input)); // The parser requires a "total n" line before accepting regular input. - lines.insert(lines.begin(), ASCIIToUTF16("total 1")); + lines.insert(lines.begin(), base::ASCIIToUTF16("total 1")); std::vector entries; EXPECT_TRUE(ParseFtpDirectoryListingNetware(lines, @@ -63,7 +63,7 @@ TEST_F(FtpDirectoryListingParserNetwareTest, Bad) { std::vector lines(GetSingleLineTestCase(bad_cases[i])); // The parser requires a "total n" line before accepting regular input. - lines.insert(lines.begin(), ASCIIToUTF16("total 1")); + lines.insert(lines.begin(), base::ASCIIToUTF16("total 1")); std::vector entries; EXPECT_FALSE(ParseFtpDirectoryListingNetware(lines, diff --git a/net/ftp/ftp_directory_listing_parser_unittest.cc b/net/ftp/ftp_directory_listing_parser_unittest.cc index f27007a..145b90c 100644 --- a/net/ftp/ftp_directory_listing_parser_unittest.cc +++ b/net/ftp/ftp_directory_listing_parser_unittest.cc @@ -91,7 +91,7 @@ TEST_P(FtpDirectoryListingParserTest, Parse) { ADD_FAILURE() << "invalid gold test data: " << type; } - EXPECT_EQ(UTF8ToUTF16(name), entry.name); + EXPECT_EQ(base::UTF8ToUTF16(name), entry.name); EXPECT_EQ(size, entry.size); base::Time::Exploded time_exploded; diff --git a/net/ftp/ftp_directory_listing_parser_unittest.h b/net/ftp/ftp_directory_listing_parser_unittest.h index 9ac42d8..22c2cf9 100644 --- a/net/ftp/ftp_directory_listing_parser_unittest.h +++ b/net/ftp/ftp_directory_listing_parser_unittest.h @@ -32,7 +32,7 @@ class FtpDirectoryListingParserTest : public testing::Test { std::vector GetSingleLineTestCase(const std::string& text) { std::vector lines; - lines.push_back(UTF8ToUTF16(text)); + lines.push_back(base::UTF8ToUTF16(text)); return lines; } @@ -43,7 +43,7 @@ class FtpDirectoryListingParserTest : public testing::Test { FtpDirectoryListingEntry entry = entries[0]; EXPECT_EQ(test_case.type, entry.type); - EXPECT_EQ(UTF8ToUTF16(test_case.filename), entry.name); + EXPECT_EQ(base::UTF8ToUTF16(test_case.filename), entry.name); EXPECT_EQ(test_case.size, entry.size); base::Time::Exploded time_exploded; diff --git a/net/ftp/ftp_directory_listing_parser_vms.cc b/net/ftp/ftp_directory_listing_parser_vms.cc index 4b44d73..9d9defd 100644 --- a/net/ftp/ftp_directory_listing_parser_vms.cc +++ b/net/ftp/ftp_directory_listing_parser_vms.cc @@ -54,7 +54,7 @@ bool ParseVmsFilename(const base::string16& raw_filename, } bool ParseVmsFilesize(const base::string16& input, int64* size) { - if (ContainsOnlyChars(input, ASCIIToUTF16("*"))) { + if (ContainsOnlyChars(input, base::ASCIIToUTF16("*"))) { // Response consisting of asterisks means unknown size. *size = -1; return true; @@ -141,7 +141,7 @@ bool LooksLikeVMSError(const base::string16& text) { }; for (size_t i = 0; i < arraysize(kPermissionDeniedMessages); i++) { - if (text.find(ASCIIToUTF16(kPermissionDeniedMessages[i])) != + if (text.find(base::ASCIIToUTF16(kPermissionDeniedMessages[i])) != base::string16::npos) return true; } @@ -210,7 +210,7 @@ bool ParseFtpDirectoryListingVms( if (lines[i].empty()) continue; - if (StartsWith(lines[i], ASCIIToUTF16("Total of "), true)) { + if (StartsWith(lines[i], base::ASCIIToUTF16("Total of "), true)) { // After the "total" line, all following lines must be empty. for (size_t j = i + 1; j < lines.size(); j++) if (!lines[j].empty()) @@ -248,7 +248,7 @@ bool ParseFtpDirectoryListingVms( // Join the current and next line and split them into columns. base::SplitString( - CollapseWhitespace(lines[i - 1] + ASCIIToUTF16(" ") + lines[i], + CollapseWhitespace(lines[i - 1] + base::ASCIIToUTF16(" ") + lines[i], false), ' ', &columns); diff --git a/net/ftp/ftp_directory_listing_parser_vms_unittest.cc b/net/ftp/ftp_directory_listing_parser_vms_unittest.cc index 3690f7e..cef86c0 100644 --- a/net/ftp/ftp_directory_listing_parser_vms_unittest.cc +++ b/net/ftp/ftp_directory_listing_parser_vms_unittest.cc @@ -11,6 +11,8 @@ #include "base/strings/utf_string_conversions.h" #include "net/ftp/ftp_directory_listing_parser_vms.h" +using base::ASCIIToUTF16; + namespace net { namespace { diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc index 23a0432..3455fc6 100644 --- a/net/ftp/ftp_network_transaction.cc +++ b/net/ftp/ftp_network_transaction.cc @@ -256,8 +256,8 @@ int FtpNetworkTransaction::Start(const FtpRequestInfo* request_info, GetIdentityFromURL(request_->url, &username, &password); credentials_.Set(username, password); } else { - credentials_.Set(ASCIIToUTF16("anonymous"), - ASCIIToUTF16("chrome@example.com")); + credentials_.Set(base::ASCIIToUTF16("anonymous"), + base::ASCIIToUTF16("chrome@example.com")); } DetectTypecode(); @@ -706,7 +706,7 @@ int FtpNetworkTransaction::DoCtrlReadComplete(int result) { // connection when anonymous login is not permitted. For more details // see http://crbug.com/25023. if (command_sent_ == COMMAND_USER && - credentials_.username() == ASCIIToUTF16("anonymous")) { + credentials_.username() == base::ASCIIToUTF16("anonymous")) { response_.needs_auth = true; } return Stop(ERR_EMPTY_RESPONSE); @@ -753,7 +753,7 @@ int FtpNetworkTransaction::DoCtrlWriteComplete(int result) { // USER Command. int FtpNetworkTransaction::DoCtrlWriteUSER() { - std::string command = "USER " + UTF16ToUTF8(credentials_.username()); + std::string command = "USER " + base::UTF16ToUTF8(credentials_.username()); if (!IsValidFTPCommandString(command)) return Stop(ERR_MALFORMED_IDENTITY); @@ -784,7 +784,7 @@ int FtpNetworkTransaction::ProcessResponseUSER( // PASS command. int FtpNetworkTransaction::DoCtrlWritePASS() { - std::string command = "PASS " + UTF16ToUTF8(credentials_.password()); + std::string command = "PASS " + base::UTF16ToUTF8(credentials_.password()); if (!IsValidFTPCommandString(command)) return Stop(ERR_MALFORMED_IDENTITY); diff --git a/net/ftp/ftp_network_transaction_unittest.cc b/net/ftp/ftp_network_transaction_unittest.cc index a244cc5..537ce14 100644 --- a/net/ftp/ftp_network_transaction_unittest.cc +++ b/net/ftp/ftp_network_transaction_unittest.cc @@ -1311,8 +1311,8 @@ TEST_P(FtpNetworkTransactionTest, EvilRestartUser) { ASSERT_EQ(ERR_IO_PENDING, transaction_.RestartWithAuth( AuthCredentials( - ASCIIToUTF16("foo\nownz0red"), - ASCIIToUTF16("innocent")), + base::ASCIIToUTF16("foo\nownz0red"), + base::ASCIIToUTF16("innocent")), callback_.callback())); EXPECT_EQ(ERR_MALFORMED_IDENTITY, callback_.WaitForResult()); } @@ -1346,8 +1346,8 @@ TEST_P(FtpNetworkTransactionTest, EvilRestartPassword) { mock_socket_factory_.AddSocketDataProvider(&ctrl_socket2); ASSERT_EQ(ERR_IO_PENDING, transaction_.RestartWithAuth( - AuthCredentials(ASCIIToUTF16("innocent"), - ASCIIToUTF16("foo\nownz0red")), + AuthCredentials(base::ASCIIToUTF16("innocent"), + base::ASCIIToUTF16("foo\nownz0red")), callback_.callback())); EXPECT_EQ(ERR_MALFORMED_IDENTITY, callback_.WaitForResult()); } diff --git a/net/ftp/ftp_util.cc b/net/ftp/ftp_util.cc index e639c46..8ff0f60 100644 --- a/net/ftp/ftp_util.cc +++ b/net/ftp/ftp_util.cc @@ -22,6 +22,7 @@ #include "third_party/icu/source/i18n/unicode/datefmt.h" #include "third_party/icu/source/i18n/unicode/dtfmtsym.h" +using base::ASCIIToUTF16; using base::StringPiece16; // For examples of Unix<->VMS path conversions, see the unit test file. On VMS diff --git a/net/ftp/ftp_util_unittest.cc b/net/ftp/ftp_util_unittest.cc index 2aab7f4..5851e88 100644 --- a/net/ftp/ftp_util_unittest.cc +++ b/net/ftp/ftp_util_unittest.cc @@ -12,6 +12,9 @@ #include "base/time/time.h" #include "testing/gtest/include/gtest/gtest.h" +using base::ASCIIToUTF16; +using base::UTF8ToUTF16; + namespace { TEST(FtpUtilTest, UnixFilePathToVMS) { diff --git a/net/http/http_auth_cache_unittest.cc b/net/http/http_auth_cache_unittest.cc index a4ea1c6..565e1a7 100644 --- a/net/http/http_auth_cache_unittest.cc +++ b/net/http/http_auth_cache_unittest.cc @@ -13,6 +13,8 @@ #include "net/http/http_auth_handler.h" #include "testing/gtest/include/gtest/gtest.h" +using base::ASCIIToUTF16; + namespace net { namespace { diff --git a/net/http/http_auth_controller_unittest.cc b/net/http/http_auth_controller_unittest.cc index 2a18369..210f1e4 100644 --- a/net/http/http_auth_controller_unittest.cc +++ b/net/http/http_auth_controller_unittest.cc @@ -224,7 +224,7 @@ TEST(HttpAuthControllerTest, NoExplicitCredentialsAllowed) { ASSERT_EQ(OK, controller->HandleAuthChallenge(headers, false, false, dummy_log)); ASSERT_TRUE(controller->HaveAuthHandler()); - controller->ResetAuth(AuthCredentials(ASCIIToUTF16("Hello"), + controller->ResetAuth(AuthCredentials(base::ASCIIToUTF16("Hello"), base::string16())); EXPECT_TRUE(controller->HaveAuth()); EXPECT_TRUE(controller->IsAuthSchemeDisabled(HttpAuth::AUTH_SCHEME_MOCK)); diff --git a/net/http/http_auth_handler_basic.cc b/net/http/http_auth_handler_basic.cc index e445c93..daab5a7 100644 --- a/net/http/http_auth_handler_basic.cc +++ b/net/http/http_auth_handler_basic.cc @@ -91,8 +91,8 @@ int HttpAuthHandlerBasic::GenerateAuthTokenImpl( DCHECK(credentials); // TODO(eroman): is this the right encoding of username/password? std::string base64_username_password; - base::Base64Encode(UTF16ToUTF8(credentials->username()) + ":" + - UTF16ToUTF8(credentials->password()), + base::Base64Encode(base::UTF16ToUTF8(credentials->username()) + ":" + + base::UTF16ToUTF8(credentials->password()), &base64_username_password); *auth_token = "Basic " + base64_username_password; return OK; diff --git a/net/http/http_auth_handler_basic_unittest.cc b/net/http/http_auth_handler_basic_unittest.cc index 5e05b76..075afa2 100644 --- a/net/http/http_auth_handler_basic_unittest.cc +++ b/net/http/http_auth_handler_basic_unittest.cc @@ -36,8 +36,8 @@ TEST(HttpAuthHandlerBasicTest, GenerateAuthToken) { scoped_ptr basic; EXPECT_EQ(OK, factory.CreateAuthHandlerFromString( challenge, HttpAuth::AUTH_SERVER, origin, BoundNetLog(), &basic)); - AuthCredentials credentials(ASCIIToUTF16(tests[i].username), - ASCIIToUTF16(tests[i].password)); + AuthCredentials credentials(base::ASCIIToUTF16(tests[i].username), + base::ASCIIToUTF16(tests[i].password)); HttpRequestInfo request_info; std::string auth_token; int rv = basic->GenerateAuthToken(&credentials, &request_info, diff --git a/net/http/http_auth_handler_digest.cc b/net/http/http_auth_handler_digest.cc index a8e301a..e0a1ef6 100644 --- a/net/http/http_auth_handler_digest.cc +++ b/net/http/http_auth_handler_digest.cc @@ -322,9 +322,9 @@ std::string HttpAuthHandlerDigest::AssembleResponseDigest( const std::string& nc) const { // ha1 = MD5(A1) // TODO(eroman): is this the right encoding? - std::string ha1 = base::MD5String(UTF16ToUTF8(credentials.username()) + ":" + - original_realm_ + ":" + - UTF16ToUTF8(credentials.password())); + std::string ha1 = base::MD5String(base::UTF16ToUTF8(credentials.username()) + + ":" + original_realm_ + ":" + + base::UTF16ToUTF8(credentials.password())); if (algorithm_ == HttpAuthHandlerDigest::ALGORITHM_MD5_SESS) ha1 = base::MD5String(ha1 + ":" + nonce_ + ":" + cnonce); @@ -352,7 +352,7 @@ std::string HttpAuthHandlerDigest::AssembleCredentials( // TODO(eroman): is this the right encoding? std::string authorization = (std::string("Digest username=") + HttpUtil::Quote( - UTF16ToUTF8(credentials.username()))); + base::UTF16ToUTF8(credentials.username()))); authorization += ", realm=" + HttpUtil::Quote(original_realm_); authorization += ", nonce=" + HttpUtil::Quote(nonce_); authorization += ", uri=" + HttpUtil::Quote(path); diff --git a/net/http/http_auth_handler_digest_unittest.cc b/net/http/http_auth_handler_digest_unittest.cc index dee44eb..aa5176e 100644 --- a/net/http/http_auth_handler_digest_unittest.cc +++ b/net/http/http_auth_handler_digest_unittest.cc @@ -67,7 +67,8 @@ bool RespondToChallenge(HttpAuth::Target target, TestCompletionCallback callback; scoped_ptr request(new HttpRequestInfo()); request->url = GURL(request_url); - AuthCredentials credentials(ASCIIToUTF16("foo"), ASCIIToUTF16("bar")); + AuthCredentials credentials(base::ASCIIToUTF16("foo"), + base::ASCIIToUTF16("bar")); int rv_generate = handler->GenerateAuthToken( &credentials, request.get(), callback.callback(), token); if (rv_generate != OK) { @@ -530,8 +531,8 @@ TEST(HttpAuthHandlerDigestTest, AssembleCredentials) { digest->AssembleCredentials(tests[i].req_method, tests[i].req_path, AuthCredentials( - ASCIIToUTF16(tests[i].username), - ASCIIToUTF16(tests[i].password)), + base::ASCIIToUTF16(tests[i].username), + base::ASCIIToUTF16(tests[i].password)), tests[i].cnonce, tests[i].nonce_count); diff --git a/net/http/http_auth_handler_ntlm_portable.cc b/net/http/http_auth_handler_ntlm_portable.cc index d1fbf23..9faa85f 100644 --- a/net/http/http_auth_handler_ntlm_portable.cc +++ b/net/http/http_auth_handler_ntlm_portable.cc @@ -257,7 +257,7 @@ static void LM_Hash(const base::string16& password, uint8* hash) { // Convert password to OEM character set. We'll just use the native // filesystem charset. - std::string passbuf = base::SysWideToNativeMB(UTF16ToWide(password)); + std::string passbuf = base::SysWideToNativeMB(base::UTF16ToWide(password)); StringToUpperASCII(&passbuf); passbuf.resize(14, '\0'); @@ -487,7 +487,7 @@ static int GenerateType3Msg(const base::string16& domain, domain_len = domain.length() * 2; #endif } else { - oem_domain_buf = base::SysWideToNativeMB(UTF16ToWide(domain)); + oem_domain_buf = base::SysWideToNativeMB(base::UTF16ToWide(domain)); domain_ptr = oem_domain_buf.data(); domain_len = oem_domain_buf.length(); } @@ -507,7 +507,7 @@ static int GenerateType3Msg(const base::string16& domain, user_len = username.length() * 2; #endif } else { - oem_user_buf = base::SysWideToNativeMB(UTF16ToWide(username)); + oem_user_buf = base::SysWideToNativeMB(base::UTF16ToWide(username)); user_ptr = oem_user_buf.data(); user_len = oem_user_buf.length(); } diff --git a/net/http/http_auth_handler_unittest.cc b/net/http/http_auth_handler_unittest.cc index f8928fc..2476332 100644 --- a/net/http/http_auth_handler_unittest.cc +++ b/net/http/http_auth_handler_unittest.cc @@ -19,7 +19,8 @@ namespace net { TEST(HttpAuthHandlerTest, NetLog) { GURL origin("http://www.example.com"); std::string challenge = "Mock asdf"; - AuthCredentials credentials(ASCIIToUTF16("user"), ASCIIToUTF16("pass")); + AuthCredentials credentials(base::ASCIIToUTF16("user"), + base::ASCIIToUTF16("pass")); std::string auth_token; HttpRequestInfo request; diff --git a/net/http/http_content_disposition.cc b/net/http/http_content_disposition.cc index 3dbf234..68412cf 100644 --- a/net/http/http_content_disposition.cc +++ b/net/http/http_content_disposition.cc @@ -113,9 +113,9 @@ bool DecodeWord(const std::string& encoded_word, base::CodepageToUTF16(encoded_word, referrer_charset.c_str(), base::OnStringConversionError::FAIL, &utf16_output)) { - *output = UTF16ToUTF8(utf16_output); + *output = base::UTF16ToUTF8(utf16_output); } else { - *output = WideToUTF8(base::SysNativeMBToWide(encoded_word)); + *output = base::WideToUTF8(base::SysNativeMBToWide(encoded_word)); } } diff --git a/net/http/http_content_disposition_unittest.cc b/net/http/http_content_disposition_unittest.cc index 62d9577..43fef9d 100644 --- a/net/http/http_content_disposition_unittest.cc +++ b/net/http/http_content_disposition_unittest.cc @@ -198,7 +198,7 @@ TEST(HttpContentDispositionTest, Filename) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { HttpContentDisposition header(tests[i].header, tests[i].referrer_charset); EXPECT_EQ(tests[i].expected, - UTF8ToWide(header.filename())) + base::UTF8ToWide(header.filename())) << "Failed on input: " << tests[i].header; } } @@ -507,7 +507,7 @@ TEST(HttpContentDispositionTest, tc2231) { HttpContentDisposition header(tests[i].header, std::string()); EXPECT_EQ(tests[i].expected_type, header.type()) << "Failed on input: " << tests[i].header; - EXPECT_EQ(tests[i].expected_filename, UTF8ToWide(header.filename())) + EXPECT_EQ(tests[i].expected_filename, base::UTF8ToWide(header.filename())) << "Failed on input: " << tests[i].header; } } diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index a0d622a..0f37ed2 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -69,6 +69,8 @@ #include "testing/platform_test.h" #include "url/gurl.h" +using base::ASCIIToUTF16; + //----------------------------------------------------------------------------- namespace { diff --git a/net/http/http_pipelined_network_transaction_unittest.cc b/net/http/http_pipelined_network_transaction_unittest.cc index 80b74fd..f5f3922 100644 --- a/net/http/http_pipelined_network_transaction_unittest.cc +++ b/net/http/http_pipelined_network_transaction_unittest.cc @@ -603,7 +603,8 @@ TEST_F(HttpPipelinedNetworkTransactionTest, BasicHttpAuthentication) { BoundNetLog())); EXPECT_EQ(OK, callback_.WaitForResult()); - AuthCredentials credentials(ASCIIToUTF16("user"), ASCIIToUTF16("pass")); + AuthCredentials credentials(base::ASCIIToUTF16("user"), + base::ASCIIToUTF16("pass")); EXPECT_EQ(OK, transaction.RestartWithAuth(credentials, callback_.callback())); ExpectResponse("one.html", transaction, SYNCHRONOUS); diff --git a/net/http/http_proxy_client_socket_pool_unittest.cc b/net/http/http_proxy_client_socket_pool_unittest.cc index a70fe6a..9f3a652 100644 --- a/net/http/http_proxy_client_socket_pool_unittest.cc +++ b/net/http/http_proxy_client_socket_pool_unittest.cc @@ -100,8 +100,8 @@ class HttpProxyClientSocketPoolTest } void AddAuthToCache() { - const base::string16 kFoo(ASCIIToUTF16("foo")); - const base::string16 kBar(ASCIIToUTF16("bar")); + const base::string16 kFoo(base::ASCIIToUTF16("foo")); + const base::string16 kBar(base::ASCIIToUTF16("bar")); GURL proxy_url(GetParam().proxy_type == HTTP ? (std::string("http://") + kHttpProxyHost) : (std::string("https://") + kHttpsProxyHost)); diff --git a/net/http/url_security_manager_win.cc b/net/http/url_security_manager_win.cc index cb3c66e..4e2d938 100644 --- a/net/http/url_security_manager_win.cc +++ b/net/http/url_security_manager_win.cc @@ -53,7 +53,7 @@ bool URLSecurityManagerWin::CanUseDefaultCredentials( if (!const_cast(this)->EnsureSystemSecurityManager()) return false; - std::wstring url_w = ASCIIToWide(auth_origin.spec()); + std::wstring url_w = base::ASCIIToWide(auth_origin.spec()); DWORD policy = 0; HRESULT hr; hr = security_manager_->ProcessUrlAction(url_w.c_str(), diff --git a/net/proxy/mock_proxy_script_fetcher.cc b/net/proxy/mock_proxy_script_fetcher.cc index 5d66e6c..7604b5b 100644 --- a/net/proxy/mock_proxy_script_fetcher.cc +++ b/net/proxy/mock_proxy_script_fetcher.cc @@ -38,7 +38,7 @@ int MockProxyScriptFetcher::Fetch(const GURL& url, base::string16* text, void MockProxyScriptFetcher::NotifyFetchCompletion( int result, const std::string& ascii_text) { DCHECK(has_pending_request()); - *pending_request_text_ = ASCIIToUTF16(ascii_text); + *pending_request_text_ = base::ASCIIToUTF16(ascii_text); CompletionCallback callback = pending_request_callback_; pending_request_callback_.Reset(); callback.Run(result); diff --git a/net/proxy/multi_threaded_proxy_resolver_unittest.cc b/net/proxy/multi_threaded_proxy_resolver_unittest.cc index 79c0acc..824bdce 100644 --- a/net/proxy/multi_threaded_proxy_resolver_unittest.cc +++ b/net/proxy/multi_threaded_proxy_resolver_unittest.cc @@ -19,6 +19,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" +using base::ASCIIToUTF16; + namespace net { namespace { diff --git a/net/proxy/proxy_resolver_script_data.cc b/net/proxy/proxy_resolver_script_data.cc index 7ee07a5..8c4fd31 100644 --- a/net/proxy/proxy_resolver_script_data.cc +++ b/net/proxy/proxy_resolver_script_data.cc @@ -14,7 +14,7 @@ scoped_refptr ProxyResolverScriptData::FromUTF8( const std::string& utf8) { return new ProxyResolverScriptData(TYPE_SCRIPT_CONTENTS, GURL(), - UTF8ToUTF16(utf8)); + base::UTF8ToUTF16(utf8)); } // static diff --git a/net/proxy/proxy_resolver_v8.cc b/net/proxy/proxy_resolver_v8.cc index 3de1c7a..4571c4e 100644 --- a/net/proxy/proxy_resolver_v8.cc +++ b/net/proxy/proxy_resolver_v8.cc @@ -233,7 +233,7 @@ bool GetHostnameArgument(const v8::FunctionCallbackInfo& args, // |punycode_output| should now be ASCII; convert it to a std::string. // (We could use UTF16ToASCII() instead, but that requires an extra string // copy. Since ASCII is a subset of UTF8 the following is equivalent). - bool success = UTF16ToUTF8(punycode_output.data(), + bool success = base::UTF16ToUTF8(punycode_output.data(), punycode_output.length(), hostname); DCHECK(success); @@ -372,7 +372,7 @@ class ProxyResolverV8::Context { v8::Local function; if (!GetFindProxyForURL(&function)) { js_bindings()->OnError( - -1, ASCIIToUTF16("FindProxyForURL() is undefined.")); + -1, base::ASCIIToUTF16("FindProxyForURL() is undefined.")); return ERR_PAC_SCRIPT_FAILED; } @@ -392,7 +392,7 @@ class ProxyResolverV8::Context { if (!ret->IsString()) { js_bindings()->OnError( - -1, ASCIIToUTF16("FindProxyForURL() did not return a string.")); + -1, base::ASCIIToUTF16("FindProxyForURL() did not return a string.")); return ERR_PAC_SCRIPT_FAILED; } @@ -404,8 +404,8 @@ class ProxyResolverV8::Context { // converting them to ASCII punycode. // crbug.com/47234 base::string16 error_message = - ASCIIToUTF16("FindProxyForURL() returned a non-ASCII string " - "(crbug.com/47234): ") + ret_str; + base::ASCIIToUTF16("FindProxyForURL() returned a non-ASCII string " + "(crbug.com/47234): ") + ret_str; js_bindings()->OnError(-1, error_message); return ERR_PAC_SCRIPT_FAILED; } @@ -496,7 +496,7 @@ class ProxyResolverV8::Context { v8::Local function; if (!GetFindProxyForURL(&function)) { js_bindings()->OnError( - -1, ASCIIToUTF16("FindProxyForURL() is undefined.")); + -1, base::ASCIIToUTF16("FindProxyForURL() is undefined.")); return ERR_PAC_SCRIPT_FAILED; } @@ -564,7 +564,7 @@ class ProxyResolverV8::Context { // disregard any arguments beyond the first. base::string16 message; if (args.Length() == 0) { - message = ASCIIToUTF16("undefined"); + message = base::ASCIIToUTF16("undefined"); } else { if (!V8ObjectToUTF16String(args[0], &message, args.GetIsolate())) return; // toString() threw an exception. diff --git a/net/proxy/proxy_resolver_v8_unittest.cc b/net/proxy/proxy_resolver_v8_unittest.cc index 7ff9770..cd8b428 100644 --- a/net/proxy/proxy_resolver_v8_unittest.cc +++ b/net/proxy/proxy_resolver_v8_unittest.cc @@ -28,7 +28,7 @@ class MockJSBindings : public ProxyResolverV8::JSBindings { virtual void Alert(const base::string16& message) OVERRIDE { VLOG(1) << "PAC-alert: " << message; // Helpful when debugging. - alerts.push_back(UTF16ToUTF8(message)); + alerts.push_back(base::UTF16ToUTF8(message)); } virtual bool ResolveDns(const std::string& host, @@ -70,7 +70,7 @@ class MockJSBindings : public ProxyResolverV8::JSBindings { // Helpful when debugging. VLOG(1) << "PAC-error: [" << line_number << "] " << message; - errors.push_back(UTF16ToUTF8(message)); + errors.push_back(base::UTF16ToUTF8(message)); errors_line_number.push_back(line_number); } diff --git a/net/proxy/proxy_resolver_winhttp.cc b/net/proxy/proxy_resolver_winhttp.cc index 3273787..116b33c 100644 --- a/net/proxy/proxy_resolver_winhttp.cc +++ b/net/proxy/proxy_resolver_winhttp.cc @@ -54,7 +54,7 @@ int ProxyResolverWinHttp::GetProxyForURL(const GURL& query_url, WINHTTP_AUTOPROXY_OPTIONS options = {0}; options.fAutoLogonIfChallenged = FALSE; options.dwFlags = WINHTTP_AUTOPROXY_CONFIG_URL; - std::wstring pac_url_wide = ASCIIToWide(pac_url_.spec()); + std::wstring pac_url_wide = base::ASCIIToWide(pac_url_.spec()); options.lpszAutoConfigUrl = pac_url_wide.c_str(); WINHTTP_PROXY_INFO info = {0}; @@ -65,13 +65,14 @@ int ProxyResolverWinHttp::GetProxyForURL(const GURL& query_url, // Otherwise, we fail over to trying it with a value of true. This way we // get good performance in the case where WinHTTP uses an out-of-process // resolver. This is important for Vista and Win2k3. - BOOL ok = WinHttpGetProxyForUrl( - session_handle_, ASCIIToWide(query_url.spec()).c_str(), &options, &info); + BOOL ok = WinHttpGetProxyForUrl(session_handle_, + base::ASCIIToWide(query_url.spec()).c_str(), + &options, &info); if (!ok) { if (ERROR_WINHTTP_LOGIN_FAILURE == GetLastError()) { options.fAutoLogonIfChallenged = TRUE; ok = WinHttpGetProxyForUrl( - session_handle_, ASCIIToWide(query_url.spec()).c_str(), + session_handle_, base::ASCIIToWide(query_url.spec()).c_str(), &options, &info); } if (!ok) { diff --git a/net/proxy/proxy_script_decider.cc b/net/proxy/proxy_script_decider.cc index 3e606a6..939f7af 100644 --- a/net/proxy/proxy_script_decider.cc +++ b/net/proxy/proxy_script_decider.cc @@ -30,7 +30,8 @@ bool LooksLikePacScript(const base::string16& script) { // file not containing the string is not likely to be a PAC script. // // An exact test would have to load the script in a javascript evaluator. - return script.find(ASCIIToUTF16("FindProxyForURL")) != base::string16::npos; + return script.find(base::ASCIIToUTF16("FindProxyForURL")) != + base::string16::npos; } } diff --git a/net/proxy/proxy_script_decider_unittest.cc b/net/proxy/proxy_script_decider_unittest.cc index 9912b3a..c50b31e 100644 --- a/net/proxy/proxy_script_decider_unittest.cc +++ b/net/proxy/proxy_script_decider_unittest.cc @@ -44,9 +44,9 @@ class Rules { base::string16 text() const { if (is_valid_script) - return UTF8ToUTF16(url.spec() + "!FindProxyForURL"); + return base::UTF8ToUTF16(url.spec() + "!FindProxyForURL"); if (fetch_error == OK) - return UTF8ToUTF16(url.spec() + "!invalid-script"); + return base::UTF8ToUTF16(url.spec() + "!invalid-script"); return base::string16(); } @@ -675,7 +675,7 @@ TEST(ProxyScriptDeciderTest, AutodetectDhcpSuccess) { Rules rules; RuleBasedProxyScriptFetcher fetcher(&rules); SynchronousSuccessDhcpFetcher dhcp_fetcher( - WideToUTF16(L"http://bingo/!FindProxyForURL")); + base::WideToUTF16(L"http://bingo/!FindProxyForURL")); ProxyConfig config; config.set_auto_detect(true); @@ -698,7 +698,7 @@ TEST(ProxyScriptDeciderTest, AutodetectDhcpFailParse) { Rules rules; RuleBasedProxyScriptFetcher fetcher(&rules); SynchronousSuccessDhcpFetcher dhcp_fetcher( - WideToUTF16(L"http://bingo/!invalid-script")); + base::WideToUTF16(L"http://bingo/!invalid-script")); ProxyConfig config; config.set_auto_detect(true); diff --git a/net/proxy/proxy_script_fetcher_impl_unittest.cc b/net/proxy/proxy_script_fetcher_impl_unittest.cc index 9c1ca98..152dbf9 100644 --- a/net/proxy/proxy_script_fetcher_impl_unittest.cc +++ b/net/proxy/proxy_script_fetcher_impl_unittest.cc @@ -30,6 +30,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" +using base::ASCIIToUTF16; + namespace net { // TODO(eroman): diff --git a/net/proxy/proxy_service_unittest.cc b/net/proxy/proxy_service_unittest.cc index c8551b0..bad5afd 100644 --- a/net/proxy/proxy_service_unittest.cc +++ b/net/proxy/proxy_service_unittest.cc @@ -23,6 +23,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" +using base::ASCIIToUTF16; + // TODO(eroman): Write a test which exercises // ProxyService::SuspendAllPendingRequests(). namespace net { diff --git a/net/socket/ssl_client_socket_pool_unittest.cc b/net/socket/ssl_client_socket_pool_unittest.cc index 92ad51a..b652279 100644 --- a/net/socket/ssl_client_socket_pool_unittest.cc +++ b/net/socket/ssl_client_socket_pool_unittest.cc @@ -166,8 +166,8 @@ class SSLClientSocketPoolTest } void AddAuthToCache() { - const base::string16 kFoo(ASCIIToUTF16("foo")); - const base::string16 kBar(ASCIIToUTF16("bar")); + const base::string16 kFoo(base::ASCIIToUTF16("foo")); + const base::string16 kBar(base::ASCIIToUTF16("bar")); session_->http_auth_cache()->Add(GURL("http://proxy:443/"), "MyRealm1", HttpAuth::AUTH_SCHEME_BASIC, diff --git a/net/socket_stream/socket_stream_unittest.cc b/net/socket_stream/socket_stream_unittest.cc index cbf5594..4a6a9e2 100644 --- a/net/socket_stream/socket_stream_unittest.cc +++ b/net/socket_stream/socket_stream_unittest.cc @@ -23,6 +23,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" +using base::ASCIIToUTF16; + namespace net { namespace { diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc index bf9fbce..93ba028 100644 --- a/net/spdy/spdy_network_transaction_unittest.cc +++ b/net/spdy/spdy_network_transaction_unittest.cc @@ -5005,7 +5005,8 @@ TEST_P(SpdyNetworkTransactionTest, SpdyBasicAuth) { EXPECT_EQ("MyRealm", auth_challenge->realm); // Restart with a username/password. - AuthCredentials credentials(ASCIIToUTF16("foo"), ASCIIToUTF16("bar")); + AuthCredentials credentials(base::ASCIIToUTF16("foo"), + base::ASCIIToUTF16("bar")); TestCompletionCallback callback_restart; const int rv_restart = trans->RestartWithAuth( credentials, callback_restart.callback()); diff --git a/net/spdy/spdy_proxy_client_socket_unittest.cc b/net/spdy/spdy_proxy_client_socket_unittest.cc index c2b1ac0..18fef79 100644 --- a/net/spdy/spdy_proxy_client_socket_unittest.cc +++ b/net/spdy/spdy_proxy_client_socket_unittest.cc @@ -93,8 +93,8 @@ class SpdyProxyClientSocketTest int num_reads); void AddAuthToCache() { - const base::string16 kFoo(ASCIIToUTF16("foo")); - const base::string16 kBar(ASCIIToUTF16("bar")); + const base::string16 kFoo(base::ASCIIToUTF16("foo")); + const base::string16 kBar(base::ASCIIToUTF16("bar")); session_->http_auth_cache()->Add(GURL(kProxyUrl), "MyRealm1", HttpAuth::AUTH_SCHEME_BASIC, diff --git a/net/test/python_utils.cc b/net/test/python_utils.cc index e249a27..a67b2c1 100644 --- a/net/test/python_utils.cc +++ b/net/test/python_utils.cc @@ -21,7 +21,7 @@ void AppendToPythonPath(const base::FilePath& dir) { std::string old_path; std::string dir_path; #if defined(OS_WIN) - dir_path = WideToUTF8(dir.value()); + dir_path = base::WideToUTF8(dir.value()); #elif defined(OS_POSIX) dir_path = dir.value(); #endif diff --git a/net/test/spawned_test_server/local_test_server_win.cc b/net/test/spawned_test_server/local_test_server_win.cc index db06742..cadebe9 100644 --- a/net/test/spawned_test_server/local_test_server_win.cc +++ b/net/test/spawned_test_server/local_test_server_win.cc @@ -122,7 +122,7 @@ ScopedPath::ScopedPath(const base::FilePath& path_to_add) if (!new_value.empty()) new_value += ";"; - new_value += WideToUTF8(path_to_add.value()); + new_value += base::WideToUTF8(path_to_add.value()); path_modified_ = environment_->SetVar("PATH", new_value); } diff --git a/net/tools/get_server_time/get_server_time.cc b/net/tools/get_server_time/get_server_time.cc index 19a2010..f7c33f5 100644 --- a/net/tools/get_server_time/get_server_time.cc +++ b/net/tools/get_server_time/get_server_time.cc @@ -48,6 +48,8 @@ #include "net/proxy/proxy_config_service_fixed.h" #endif +using base::UTF16ToUTF8; + namespace { // base::TimeTicks::Now() is documented to have a resolution of diff --git a/net/tools/testserver/run_testserver.cc b/net/tools/testserver/run_testserver.cc index acf4177..342209ce 100644 --- a/net/tools/testserver/run_testserver.cc +++ b/net/tools/testserver/run_testserver.cc @@ -113,7 +113,8 @@ int main(int argc, const char* argv[]) { if (!base::DirectoryExists(test_server->document_root())) { printf("Error: invalid doc root: \"%s\" does not exist!\n", - UTF16ToUTF8(test_server->document_root().LossyDisplayName()).c_str()); + base::UTF16ToUTF8( + test_server->document_root().LossyDisplayName()).c_str()); return -1; } diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index f9dec87..ce26730 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc @@ -353,7 +353,7 @@ LoadStateWithParam URLRequest::GetLoadState() const { if (calling_delegate_ || !blocked_by_.empty()) { return LoadStateWithParam( LOAD_STATE_WAITING_FOR_DELEGATE, - use_blocked_by_as_load_param_ ? UTF8ToUTF16(blocked_by_) : + use_blocked_by_as_load_param_ ? base::UTF8ToUTF16(blocked_by_) : base::string16()); } return LoadStateWithParam(job_.get() ? job_->GetLoadState() : LOAD_STATE_IDLE, diff --git a/net/url_request/url_request_file_dir_job.cc b/net/url_request/url_request_file_dir_job.cc index d98da02..da586f3 100644 --- a/net/url_request/url_request_file_dir_job.cc +++ b/net/url_request/url_request_file_dir_job.cc @@ -108,7 +108,7 @@ void URLRequestFileDirJob::OnListFile( // On Linux, the file system encoding is not defined, but we assume that // SysNativeMBToWide takes care of it at least for now. We can try something // more sophisticated if necessary later. - const base::string16& title = WideToUTF16( + const base::string16& title = base::WideToUTF16( base::SysNativeMBToWide(dir_path_.value())); #endif data_.append(GetDirectoryListingHeader(title)); diff --git a/net/url_request/url_request_ftp_job_unittest.cc b/net/url_request/url_request_ftp_job_unittest.cc index 4bc6675..50eeb36 100644 --- a/net/url_request/url_request_ftp_job_unittest.cc +++ b/net/url_request/url_request_ftp_job_unittest.cc @@ -23,6 +23,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" +using base::ASCIIToUTF16; + namespace net { class FtpTestURLRequestContext : public TestURLRequestContext { diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index a7af568..c1220ad 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -82,6 +82,7 @@ #include "base/win/windows_version.h" #endif +using base::ASCIIToUTF16; using base::Time; namespace net { -- cgit v1.1