diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-14 21:11:46 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-14 21:11:46 +0000 |
commit | 74f778ee567a5e18ae6766416711b92fc6e7f39a (patch) | |
tree | c2da3cc66ebb5285d8ff3f210ebdb446eb61837f /content/renderer | |
parent | a80aea7ebc002065d8f24c54673c72cb61d47b07 (diff) | |
download | chromium_src-74f778ee567a5e18ae6766416711b92fc6e7f39a.zip chromium_src-74f778ee567a5e18ae6766416711b92fc6e7f39a.tar.gz chromium_src-74f778ee567a5e18ae6766416711b92fc6e7f39a.tar.bz2 |
Move UTF16ToASCII, remove WideToASCII.
This removes WideToASCII and changes all callers to use UTF16ToASCII instead.
Moves UTF16ToASCII from base/strings/string_util.h to base/strings/utf_string_conversions.h and into the base namespace.
Convert a few related string_util functions to take a StringPiece16 instead of a string16. Remove IsStringASCII(std::wstring) which was unused.
Updates callers' includes and namespace usage accordingly.
TBR=sky
Review URL: https://codereview.chromium.org/176843022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257200 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
10 files changed, 24 insertions, 17 deletions
diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc index 9a87ecfd..65387b8 100644 --- a/content/renderer/media/android/webmediaplayer_android.cc +++ b/content/renderer/media/android/webmediaplayer_android.cc @@ -14,6 +14,7 @@ #include "base/message_loop/message_loop.h" #include "base/metrics/histogram.h" #include "base/strings/string_number_conversions.h" +#include "base/strings/utf_string_conversions.h" #include "cc/layers/video_layer.h" #include "content/public/common/content_client.h" #include "content/public/renderer/render_frame.h" @@ -1100,7 +1101,7 @@ const gfx::RectF WebMediaPlayerAndroid::GetBoundaryRectangle() { // Convert a WebString to ASCII, falling back on an empty string in the case // of a non-ASCII string. static std::string ToASCIIOrEmpty(const blink::WebString& string) { - return IsStringASCII(string) ? UTF16ToASCII(string) : std::string(); + return IsStringASCII(string) ? base::UTF16ToASCII(string) : std::string(); } // Helper functions to report media EME related stats to UMA. They follow the diff --git a/content/renderer/media/webcontentdecryptionmodule_impl.cc b/content/renderer/media/webcontentdecryptionmodule_impl.cc index 7b2131b..8a4cf47 100644 --- a/content/renderer/media/webcontentdecryptionmodule_impl.cc +++ b/content/renderer/media/webcontentdecryptionmodule_impl.cc @@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/logging.h" #include "base/strings/string_util.h" +#include "base/strings/utf_string_conversions.h" #include "content/renderer/media/cdm_session_adapter.h" #include "content/renderer/media/webcontentdecryptionmodulesession_impl.h" #include "media/base/media_keys.h" @@ -39,7 +40,7 @@ WebContentDecryptionModuleImpl* WebContentDecryptionModuleImpl::Create( base::Bind(&PepperCdmWrapperImpl::Create, static_cast<blink::WebFrame*>(NULL)), #endif - UTF16ToASCII(key_system))) { + base::UTF16ToASCII(key_system))) { return NULL; } diff --git a/content/renderer/media/webcontentdecryptionmodulesession_impl.cc b/content/renderer/media/webcontentdecryptionmodulesession_impl.cc index f46e247..14fa798 100644 --- a/content/renderer/media/webcontentdecryptionmodulesession_impl.cc +++ b/content/renderer/media/webcontentdecryptionmodulesession_impl.cc @@ -7,6 +7,7 @@ #include "base/callback_helpers.h" #include "base/logging.h" #include "base/strings/string_util.h" +#include "base/strings/utf_string_conversions.h" #include "content/renderer/media/cdm_session_adapter.h" #include "third_party/WebKit/public/platform/WebURL.h" @@ -42,7 +43,7 @@ void WebContentDecryptionModuleSessionImpl::initializeNewSession( } adapter_->InitializeNewSession( - session_id_, UTF16ToASCII(mime_type), init_data, init_data_length); + session_id_, base::UTF16ToASCII(mime_type), init_data, init_data_length); } void WebContentDecryptionModuleSessionImpl::update(const uint8* response, diff --git a/content/renderer/media/webmediaplayer_impl.cc b/content/renderer/media/webmediaplayer_impl.cc index 2fa0032..9399476 100644 --- a/content/renderer/media/webmediaplayer_impl.cc +++ b/content/renderer/media/webmediaplayer_impl.cc @@ -19,6 +19,7 @@ #include "base/message_loop/message_loop_proxy.h" #include "base/metrics/histogram.h" #include "base/strings/string_number_conversions.h" +#include "base/strings/utf_string_conversions.h" #include "base/synchronization/waitable_event.h" #include "cc/layers/video_layer.h" #include "content/public/common/content_switches.h" @@ -747,7 +748,7 @@ static void ReportMediaKeyExceptionToUMA(const std::string& method, // Convert a WebString to ASCII, falling back on an empty string in the case // of a non-ASCII string. static std::string ToASCIIOrEmpty(const blink::WebString& string) { - return IsStringASCII(string) ? UTF16ToASCII(string) : std::string(); + return IsStringASCII(string) ? base::UTF16ToASCII(string) : std::string(); } WebMediaPlayer::MediaKeyException diff --git a/content/renderer/npapi/webplugin_impl.cc b/content/renderer/npapi/webplugin_impl.cc index 5e53960..f9caddc 100644 --- a/content/renderer/npapi/webplugin_impl.cc +++ b/content/renderer/npapi/webplugin_impl.cc @@ -544,7 +544,7 @@ WebPluginImpl::WebPluginImpl( first_geometry_update_(true), ignore_response_error_(false), file_path_(file_path), - mime_type_(UTF16ToASCII(params.mimeType)), + mime_type_(base::UTF16ToASCII(params.mimeType)), weak_factory_(this), loader_client_(this) { DCHECK_EQ(params.attributeNames.size(), params.attributeValues.size()); diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc index 98dc41e..1e8f7ab 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.cc +++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc @@ -1363,7 +1363,7 @@ bool PepperPluginInstanceImpl::StartFind(const base::string16& search_text, return PP_ToBool( plugin_find_interface_->StartFind( pp_instance(), - base::UTF16ToUTF8(search_text.c_str()).c_str(), + base::UTF16ToUTF8(search_text).c_str(), PP_FromBool(case_sensitive))); } diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index e065232..1365a38 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -1034,7 +1034,7 @@ blink::WebPlugin* RenderFrameImpl::createPlugin( return plugin; } - if (UTF16ToASCII(params.mimeType) == kBrowserPluginMimeType) { + if (base::UTF16ToASCII(params.mimeType) == kBrowserPluginMimeType) { return render_view_->GetBrowserPluginManager()->CreateBrowserPlugin( render_view_.get(), frame); } diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc index c668b47..c669ac8 100644 --- a/content/renderer/render_view_browsertest.cc +++ b/content/renderer/render_view_browsertest.cc @@ -2128,7 +2128,8 @@ TEST_F(SuppressErrorPageTest, MAYBE_Suppresses) { // An error occurred. view()->main_render_frame()->didFailProvisionalLoad(web_frame, error); const int kMaxOutputCharacters = 22; - EXPECT_EQ("", UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); + EXPECT_EQ("", + base::UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); } #if defined(OS_ANDROID) @@ -2158,7 +2159,7 @@ TEST_F(SuppressErrorPageTest, MAYBE_DoesNotSuppress) { ProcessPendingMessages(); const int kMaxOutputCharacters = 22; EXPECT_EQ("A suffusion of yellow.", - UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); + base::UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); } // Tests if IME API's candidatewindow* events sent from browser are handled diff --git a/content/renderer/render_view_browsertest_mac.mm b/content/renderer/render_view_browsertest_mac.mm index f0959e0..93174c8 100644 --- a/content/renderer/render_view_browsertest_mac.mm +++ b/content/renderer/render_view_browsertest_mac.mm @@ -4,6 +4,7 @@ #include "base/strings/string16.h" #include "base/strings/string_util.h" +#include "base/strings/utf_string_conversions.h" #include "content/public/browser/native_web_keyboard_event.h" #include "content/public/test/render_view_test.h" #include "content/renderer/render_view_impl.h" @@ -103,7 +104,7 @@ TEST_F(RenderViewTest, MacTestCmdUp) { ProcessPendingMessages(); ExecuteJavaScript("scroll.textContent = window.pageYOffset"); output = GetMainFrame()->contentAsText(kMaxOutputCharacters); - EXPECT_EQ(kArrowDownScrollDown, UTF16ToASCII(output)); + EXPECT_EQ(kArrowDownScrollDown, base::UTF16ToASCII(output)); const char* kArrowUpScrollUp = "38,false,false,true,false\n0\np1"; view->OnSetEditCommandsForNextKeyEvent( @@ -112,7 +113,7 @@ TEST_F(RenderViewTest, MacTestCmdUp) { ProcessPendingMessages(); ExecuteJavaScript("scroll.textContent = window.pageYOffset"); output = GetMainFrame()->contentAsText(kMaxOutputCharacters); - EXPECT_EQ(kArrowUpScrollUp, UTF16ToASCII(output)); + EXPECT_EQ(kArrowUpScrollUp, base::UTF16ToASCII(output)); // Now let javascript eat the key events -- no scrolling should happen. // Set a scroll position slightly down the page to ensure that it does not @@ -126,7 +127,7 @@ TEST_F(RenderViewTest, MacTestCmdUp) { ProcessPendingMessages(); ExecuteJavaScript("scroll.textContent = window.pageYOffset"); output = GetMainFrame()->contentAsText(kMaxOutputCharacters); - EXPECT_EQ(kArrowDownNoScroll, UTF16ToASCII(output)); + EXPECT_EQ(kArrowDownNoScroll, base::UTF16ToASCII(output)); const char* kArrowUpNoScroll = "38,false,false,true,false\n100\np1"; view->OnSetEditCommandsForNextKeyEvent( @@ -135,7 +136,7 @@ TEST_F(RenderViewTest, MacTestCmdUp) { ProcessPendingMessages(); ExecuteJavaScript("scroll.textContent = window.pageYOffset"); output = GetMainFrame()->contentAsText(kMaxOutputCharacters); - EXPECT_EQ(kArrowUpNoScroll, UTF16ToASCII(output)); + EXPECT_EQ(kArrowUpNoScroll, base::UTF16ToASCII(output)); } } // namespace content diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc index c4b54dc..ce81e56 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.cc +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc @@ -409,7 +409,7 @@ RendererWebKitPlatformSupportImpl::MimeRegistry::supportsMediaMIMEType( return IsNotSupported; std::string key_system_ascii = - GetUnprefixedKeySystemName(UTF16ToASCII(key_system)); + GetUnprefixedKeySystemName(base::UTF16ToASCII(key_system)); std::vector<std::string> strict_codecs; bool strip_suffix = !net::IsStrictMediaMimeType(mime_type_ascii); net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, strip_suffix); @@ -475,14 +475,15 @@ RendererWebKitPlatformSupportImpl::MimeRegistry::supportsEncryptedMediaMIMEType( if (key_system.isEmpty()) return false; - const std::string mime_type_ascii = UTF16ToASCII(mime_type); + const std::string mime_type_ascii = base::UTF16ToASCII(mime_type); std::vector<std::string> codec_vector; bool strip_suffix = !net::IsStrictMediaMimeType(mime_type_ascii); - net::ParseCodecString(UTF16ToASCII(codecs), &codec_vector, strip_suffix); + net::ParseCodecString(base::UTF16ToASCII(codecs), &codec_vector, + strip_suffix); return IsSupportedKeySystemWithMediaMimeType( - mime_type_ascii, codec_vector, UTF16ToASCII(key_system)); + mime_type_ascii, codec_vector, base::UTF16ToASCII(key_system)); } WebString |