diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-25 00:53:42 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-25 00:53:42 +0000 |
commit | c91b9d414c56955f3ca405fd66c6f567fc16d9fc (patch) | |
tree | 293205b4a78c5ce8571edcb4ae26e1b9880d8e51 /chrome/renderer | |
parent | 036a5f386e1204a861f3b24201bd0f89d359f29c (diff) | |
download | chromium_src-c91b9d414c56955f3ca405fd66c6f567fc16d9fc.zip chromium_src-c91b9d414c56955f3ca405fd66c6f567fc16d9fc.tar.gz chromium_src-c91b9d414c56955f3ca405fd66c6f567fc16d9fc.tar.bz2 |
Update uses of UTF conversions in chrome/installer, chrome/renderer, chrome/service, chrome/test, chrome/third_party, chrome/tools, chrome/utility to use the base:: namespace.
BUG=330556
TEST=no change
TBR=ben@chromium.org
Review URL: https://codereview.chromium.org/119103004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242472 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
36 files changed, 99 insertions, 89 deletions
diff --git a/chrome/renderer/autofill/autofill_renderer_browsertest.cc b/chrome/renderer/autofill/autofill_renderer_browsertest.cc index f75a105..71d8829 100644 --- a/chrome/renderer/autofill/autofill_renderer_browsertest.cc +++ b/chrome/renderer/autofill/autofill_renderer_browsertest.cc @@ -13,6 +13,7 @@ #include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebInputElement.h" +using base::ASCIIToUTF16; using blink::WebDocument; using blink::WebFrame; using blink::WebInputElement; diff --git a/chrome/renderer/autofill/form_autofill_browsertest.cc b/chrome/renderer/autofill/form_autofill_browsertest.cc index ba454f1..ecb90ab 100644 --- a/chrome/renderer/autofill/form_autofill_browsertest.cc +++ b/chrome/renderer/autofill/form_autofill_browsertest.cc @@ -28,6 +28,7 @@ #include "third_party/WebKit/public/web/WebSelectElement.h" #include "third_party/WebKit/public/web/WebTextAreaElement.h" +using base::ASCIIToUTF16; using blink::WebDocument; using blink::WebElement; using blink::WebFormControlElement; diff --git a/chrome/renderer/autofill/password_generation_agent_browsertest.cc b/chrome/renderer/autofill/password_generation_agent_browsertest.cc index 6d13019..b39c06e 100644 --- a/chrome/renderer/autofill/password_generation_agent_browsertest.cc +++ b/chrome/renderer/autofill/password_generation_agent_browsertest.cc @@ -214,7 +214,7 @@ TEST_F(PasswordGenerationAgentTest, FillTest) { EXPECT_TRUE(first_password_element.value().isNull()); EXPECT_TRUE(second_password_element.value().isNull()); - base::string16 password = ASCIIToUTF16("random_password"); + base::string16 password = base::ASCIIToUTF16("random_password"); AutofillMsg_GeneratedPasswordAccepted msg(0, password); generation_manager_->OnMessageReceived(msg); diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 2052bc6..9f9777e 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -118,6 +118,7 @@ using autofill::AutofillAgent; using autofill::PasswordAutofillAgent; using autofill::PasswordGenerationAgent; +using base::ASCIIToUTF16; using content::RenderThread; using content::UserMetricsAction; using content::WebPluginInfo; diff --git a/chrome/renderer/chrome_content_renderer_client_unittest.cc b/chrome/renderer/chrome_content_renderer_client_unittest.cc index e2b70d2..33739e17 100644 --- a/chrome/renderer/chrome_content_renderer_client_unittest.cc +++ b/chrome/renderer/chrome_content_renderer_client_unittest.cc @@ -72,9 +72,9 @@ void AddContentTypeHandler(content::WebPluginInfo* info, const char* manifest_url) { content::WebPluginMimeType mime_type_info; mime_type_info.mime_type = mime_type; - mime_type_info.additional_param_names.push_back(UTF8ToUTF16("nacl")); + mime_type_info.additional_param_names.push_back(base::UTF8ToUTF16("nacl")); mime_type_info.additional_param_values.push_back( - UTF8ToUTF16(manifest_url)); + base::UTF8ToUTF16(manifest_url)); info->mime_types.push_back(mime_type_info); } } // namespace diff --git a/chrome/renderer/chrome_render_process_observer.cc b/chrome/renderer/chrome_render_process_observer.cc index ce6c1c2..60759bc 100644 --- a/chrome/renderer/chrome_render_process_observer.cc +++ b/chrome/renderer/chrome_render_process_observer.cc @@ -345,7 +345,7 @@ void ChromeRenderProcessObserver::WebKitInitialized() { // that can commit synchronously. No code should be runnable in these pages, // so it should not need to access anything nor should it allow javascript // URLs since it should never be visible to the user. - WebString native_scheme(ASCIIToUTF16(chrome::kChromeNativeScheme)); + WebString native_scheme(base::ASCIIToUTF16(chrome::kChromeNativeScheme)); WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(native_scheme); WebSecurityPolicy::registerURLSchemeAsEmptyDocument(native_scheme); WebSecurityPolicy::registerURLSchemeAsNoAccess(native_scheme); diff --git a/chrome/renderer/chrome_render_view_observer.cc b/chrome/renderer/chrome_render_view_observer.cc index d0ddb5b..47509ba 100644 --- a/chrome/renderer/chrome_render_view_observer.cc +++ b/chrome/renderer/chrome_render_view_observer.cc @@ -585,8 +585,8 @@ bool ChromeRenderViewObserver::HasRefreshMetaTag(WebFrame* frame) { if (head.isNull() || !head.hasChildNodes()) return false; - const WebString tag_name(ASCIIToUTF16("meta")); - const WebString attribute_name(ASCIIToUTF16("http-equiv")); + const WebString tag_name(base::ASCIIToUTF16("meta")); + const WebString attribute_name(base::ASCIIToUTF16("http-equiv")); WebNodeList children = head.childNodes(); for (size_t i = 0; i < children.length(); ++i) { diff --git a/chrome/renderer/extensions/console.cc b/chrome/renderer/extensions/console.cc index b2e4efc..1c3dde3 100644 --- a/chrome/renderer/extensions/console.cc +++ b/chrome/renderer/extensions/console.cc @@ -135,7 +135,7 @@ void AddMessage(content::RenderView* render_view, break; } web_view->mainFrame()->addMessageToConsole( - blink::WebConsoleMessage(target_level, UTF8ToUTF16(message))); + blink::WebConsoleMessage(target_level, base::UTF8ToUTF16(message))); } void Debug(v8::Handle<v8::Context> context, const std::string& message) { diff --git a/chrome/renderer/extensions/page_capture_custom_bindings.cc b/chrome/renderer/extensions/page_capture_custom_bindings.cc index 79e10a6..d001874 100644 --- a/chrome/renderer/extensions/page_capture_custom_bindings.cc +++ b/chrome/renderer/extensions/page_capture_custom_bindings.cc @@ -31,7 +31,7 @@ void PageCaptureCustomBindings::CreateBlob( CHECK(args.Length() == 2); CHECK(args[0]->IsString()); CHECK(args[1]->IsInt32()); - blink::WebString path(UTF8ToUTF16(*v8::String::Utf8Value(args[0]))); + blink::WebString path(base::UTF8ToUTF16(*v8::String::Utf8Value(args[0]))); blink::WebBlob blob = blink::WebBlob::createFromFile(path, args[1]->Int32Value()); args.GetReturnValue().Set(blob.toV8Value()); diff --git a/chrome/renderer/mock_printer.cc b/chrome/renderer/mock_printer.cc index b2450c3..15213e6 100644 --- a/chrome/renderer/mock_printer.cc +++ b/chrome/renderer/mock_printer.cc @@ -72,8 +72,8 @@ MockPrinter::MockPrinter() preview_request_id_(0), print_scaling_option_(blink::WebPrintScalingOptionSourceSize), display_header_footer_(false), - title_(ASCIIToUTF16("title")), - url_(ASCIIToUTF16("url")), + title_(base::ASCIIToUTF16("title")), + url_(base::ASCIIToUTF16("url")), use_invalid_settings_(false) { page_size_.SetSize(static_cast<int>(8.5 * dpi_), static_cast<int>(11.0 * dpi_)); diff --git a/chrome/renderer/net/net_error_helper.cc b/chrome/renderer/net/net_error_helper.cc index dc170ce..088b0ad 100644 --- a/chrome/renderer/net/net_error_helper.cc +++ b/chrome/renderer/net/net_error_helper.cc @@ -229,7 +229,7 @@ void NetErrorHelper::UpdateErrorPage() { std::string js = "if (window.updateForDnsProbe) " "updateForDnsProbe(" + json + ");"; base::string16 js16; - if (!UTF8ToUTF16(js.c_str(), js.length(), &js16)) { + if (!base::UTF8ToUTF16(js.c_str(), js.length(), &js16)) { NOTREACHED(); return; } diff --git a/chrome/renderer/net/prescient_networking_dispatcher.cc b/chrome/renderer/net/prescient_networking_dispatcher.cc index 08f956d..8cd4203 100644 --- a/chrome/renderer/net/prescient_networking_dispatcher.cc +++ b/chrome/renderer/net/prescient_networking_dispatcher.cc @@ -55,7 +55,7 @@ void PrescientNetworkingDispatcher::prefetchDNS( if (hostname.isEmpty()) return; - std::string hostname_utf8 = UTF16ToUTF8(hostname); + std::string hostname_utf8 = base::UTF16ToUTF8(hostname); net_predictor_.Resolve(hostname_utf8.data(), hostname_utf8.length()); } diff --git a/chrome/renderer/page_load_histograms.cc b/chrome/renderer/page_load_histograms.cc index c111883..6b408f3 100644 --- a/chrome/renderer/page_load_histograms.cc +++ b/chrome/renderer/page_load_histograms.cc @@ -147,7 +147,7 @@ bool DataReductionProxyWasUsed(WebFrame* frame) { if (!document_state->was_fetched_via_proxy()) return false; - std::string via_header(UTF16ToUTF8( + std::string via_header(base::UTF16ToUTF8( frame->dataSource()->response().httpHeaderField(kViaHeaderName))); return via_header.find(kDatReductionProxyViaValue) != std::string::npos; #endif diff --git a/chrome/renderer/pepper/pepper_flash_menu_host.cc b/chrome/renderer/pepper/pepper_flash_menu_host.cc index c322190..d24b0c1 100644 --- a/chrome/renderer/pepper/pepper_flash_menu_host.cc +++ b/chrome/renderer/pepper/pepper_flash_menu_host.cc @@ -70,7 +70,7 @@ bool ConvertMenuData(const PP_Flash_Menu* in_menu, return false; } if (in_menu->items[i].name) - item.label = UTF8ToUTF16(in_menu->items[i].name); + item.label = base::UTF8ToUTF16(in_menu->items[i].name); if (menu_id_map->size() >= kMaxMenuIdMapEntries) return false; item.action = static_cast<unsigned>(menu_id_map->size()); diff --git a/chrome/renderer/pepper/pepper_pdf_host.cc b/chrome/renderer/pepper/pepper_pdf_host.cc index dffb169..461e9f9 100644 --- a/chrome/renderer/pepper/pepper_pdf_host.cc +++ b/chrome/renderer/pepper/pepper_pdf_host.cc @@ -157,13 +157,13 @@ int32_t PepperPDFHost::OnHostMsgGetLocalizedString( PP_ResourceString string_id) { std::string rv; if (string_id == PP_RESOURCESTRING_PDFGETPASSWORD) { - rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_NEED_PASSWORD)); + rv = base::UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_NEED_PASSWORD)); } else if (string_id == PP_RESOURCESTRING_PDFLOADING) { - rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOADING)); + rv = base::UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOADING)); } else if (string_id == PP_RESOURCESTRING_PDFLOAD_FAILED) { - rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOAD_FAILED)); + rv = base::UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOAD_FAILED)); } else if (string_id == PP_RESOURCESTRING_PDFPROGRESSLOADING) { - rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PROGRESS_LOADING)); + rv = base::UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PROGRESS_LOADING)); } else { NOTREACHED(); return PP_ERROR_FAILED; diff --git a/chrome/renderer/pepper/ppb_pdf_impl.cc b/chrome/renderer/pepper/ppb_pdf_impl.cc index ad5e8d4..4b77044 100644 --- a/chrome/renderer/pepper/ppb_pdf_impl.cc +++ b/chrome/renderer/pepper/ppb_pdf_impl.cc @@ -174,13 +174,13 @@ PP_Var GetLocalizedString(PP_Instance instance_id, std::string rv; if (string_id == PP_RESOURCESTRING_PDFGETPASSWORD) { - rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_NEED_PASSWORD)); + rv = base::UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_NEED_PASSWORD)); } else if (string_id == PP_RESOURCESTRING_PDFLOADING) { - rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOADING)); + rv = base::UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOADING)); } else if (string_id == PP_RESOURCESTRING_PDFLOAD_FAILED) { - rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOAD_FAILED)); + rv = base::UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PAGE_LOAD_FAILED)); } else if (string_id == PP_RESOURCESTRING_PDFPROGRESSLOADING) { - rv = UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PROGRESS_LOADING)); + rv = base::UTF16ToUTF8(l10n_util::GetStringUTF16(IDS_PDF_PROGRESS_LOADING)); } else { NOTREACHED(); } diff --git a/chrome/renderer/plugins/chrome_plugin_placeholder.cc b/chrome/renderer/plugins/chrome_plugin_placeholder.cc index 182071f..899087a 100644 --- a/chrome/renderer/plugins/chrome_plugin_placeholder.cc +++ b/chrome/renderer/plugins/chrome_plugin_placeholder.cc @@ -257,7 +257,7 @@ void ChromePluginPlaceholder::OnFinishedDownloadingPlugin() { void ChromePluginPlaceholder::OnErrorDownloadingPlugin( const std::string& error) { SetMessage(l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOAD_ERROR, - UTF8ToUTF16(error))); + base::UTF8ToUTF16(error))); } void ChromePluginPlaceholder::OnCancelledDownloadingPlugin() { diff --git a/chrome/renderer/printing/print_web_view_helper.cc b/chrome/renderer/printing/print_web_view_helper.cc index 688512e..a53c822 100644 --- a/chrome/renderer/printing/print_web_view_helper.cc +++ b/chrome/renderer/printing/print_web_view_helper.cc @@ -75,7 +75,7 @@ void ExecuteScript(blink::WebFrame* frame, std::string json; base::JSONWriter::Write(¶meters, &json); std::string script = base::StringPrintf(script_format, json.c_str()); - frame->executeScript(blink::WebString(UTF8ToUTF16(script))); + frame->executeScript(blink::WebString(base::UTF8ToUTF16(script))); } int GetDPI(const PrintMsg_Print_Params* print_params) { diff --git a/chrome/renderer/safe_browsing/phishing_classifier_browsertest.cc b/chrome/renderer/safe_browsing/phishing_classifier_browsertest.cc index 3a1779a..3277d4e 100644 --- a/chrome/renderer/safe_browsing/phishing_classifier_browsertest.cc +++ b/chrome/renderer/safe_browsing/phishing_classifier_browsertest.cc @@ -225,7 +225,7 @@ IN_PROC_BROWSER_TEST_F(PhishingClassifierTest, MAYBE_TestClassification) { EXPECT_CALL(*clock_, Now()) .WillRepeatedly(::testing::Return(base::TimeTicks::Now())); - base::string16 page_text = ASCIIToUTF16("login"); + base::string16 page_text = base::ASCIIToUTF16("login"); float phishy_score; FeatureMap features; diff --git a/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc b/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc index 9ccb8da..20a70af 100644 --- a/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc +++ b/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc @@ -39,6 +39,7 @@ #include "third_party/WebKit/public/web/WebView.h" #include "url/gurl.h" +using base::ASCIIToUTF16; using ::testing::_; using ::testing::InSequence; using ::testing::Mock; diff --git a/chrome/renderer/safe_browsing/phishing_term_feature_extractor.cc b/chrome/renderer/safe_browsing/phishing_term_feature_extractor.cc index 4e5ac67..89994df 100644 --- a/chrome/renderer/safe_browsing/phishing_term_feature_extractor.cc +++ b/chrome/renderer/safe_browsing/phishing_term_feature_extractor.cc @@ -221,7 +221,7 @@ void PhishingTermFeatureExtractor::HandleWord( return; } - std::string word_lower = UTF16ToUTF8(base::i18n::ToLower(word)); + std::string word_lower = base::UTF16ToUTF8(base::i18n::ToLower(word)); uint32 word_hash = MurmurHash3String(word_lower, murmurhash3_seed_); // Quick out if the word is not part of any term, which is the common case. diff --git a/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc b/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc index 0649de8..e2b121a 100644 --- a/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc +++ b/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc @@ -23,6 +23,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +using base::ASCIIToUTF16; using ::testing::Return; namespace safe_browsing { diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc index 8423a85..d4cafe4 100644 --- a/chrome/renderer/searchbox/searchbox_extension.cc +++ b/chrome/renderer/searchbox/searchbox_extension.cc @@ -120,7 +120,7 @@ v8::Handle<v8::Object> GenerateMostVisitedItem( base::string16 title = mv_item.title; if (title.empty()) - title = UTF8ToUTF16(mv_item.url.spec()); + title = base::UTF8ToUTF16(mv_item.url.spec()); v8::Handle<v8::Object> obj = v8::Object::New(isolate); obj->Set(v8::String::NewFromUtf8(isolate, "renderViewId"), @@ -464,7 +464,7 @@ void SearchBoxExtension::DispatchChromeIdentityCheckResult( const base::string16& identity, bool identity_match) { std::string escaped_identity = base::GetQuotedJSONString(identity); - blink::WebString script(UTF8ToUTF16(base::StringPrintf( + blink::WebString script(base::UTF8ToUTF16(base::StringPrintf( kDispatchChromeIdentityCheckResult, escaped_identity.c_str(), identity_match ? "true" : "false"))); diff --git a/chrome/renderer/searchbox/searchbox_extension_unittest.cc b/chrome/renderer/searchbox/searchbox_extension_unittest.cc index 4b3dabf..61cafc5 100644 --- a/chrome/renderer/searchbox/searchbox_extension_unittest.cc +++ b/chrome/renderer/searchbox/searchbox_extension_unittest.cc @@ -15,19 +15,19 @@ GURL ResolveURL(const GURL& current_url, TEST(SearchboxExtensionTest, ResolveURL) { EXPECT_EQ(GURL("http://www.google.com/"), - ResolveURL(GURL(""), ASCIIToUTF16("http://www.google.com"))); + ResolveURL(GURL(""), base::ASCIIToUTF16("http://www.google.com"))); EXPECT_EQ(GURL("http://news.google.com/"), ResolveURL(GURL("http://www.google.com"), - ASCIIToUTF16("http://news.google.com"))); + base::ASCIIToUTF16("http://news.google.com"))); EXPECT_EQ(GURL("http://www.google.com/hello?q=world"), ResolveURL(GURL("http://www.google.com/foo?a=b"), - ASCIIToUTF16("hello?q=world"))); + base::ASCIIToUTF16("hello?q=world"))); EXPECT_EQ(GURL("http://www.google.com:90/foo/hello?q=world"), ResolveURL(GURL("http://www.google.com:90/"), - ASCIIToUTF16("foo/hello?q=world"))); + base::ASCIIToUTF16("foo/hello?q=world"))); } } // namespace internal diff --git a/chrome/renderer/spellchecker/custom_dictionary_engine.cc b/chrome/renderer/spellchecker/custom_dictionary_engine.cc index 976ffea..edf6cdd 100644 --- a/chrome/renderer/spellchecker/custom_dictionary_engine.cc +++ b/chrome/renderer/spellchecker/custom_dictionary_engine.cc @@ -21,7 +21,7 @@ void CustomDictionaryEngine::Init(const std::set<std::string>& custom_words) { for (std::set<std::string>::const_iterator it = custom_words.begin(); it != custom_words.end(); ++it) { - dictionary_.insert(UTF8ToUTF16(*it)); + dictionary_.insert(base::UTF8ToUTF16(*it)); } } @@ -31,12 +31,12 @@ void CustomDictionaryEngine::OnCustomDictionaryChanged( for (std::vector<std::string>::const_iterator it = words_added.begin(); it != words_added.end(); ++it) { - dictionary_.insert(UTF8ToUTF16(*it)); + dictionary_.insert(base::UTF8ToUTF16(*it)); } for (std::vector<std::string>::const_iterator it = words_removed.begin(); it != words_removed.end(); ++it) { - dictionary_.erase(UTF8ToUTF16(*it)); + dictionary_.erase(base::UTF8ToUTF16(*it)); } } diff --git a/chrome/renderer/spellchecker/custom_dictionary_engine_unittest.cc b/chrome/renderer/spellchecker/custom_dictionary_engine_unittest.cc index b57b603..dc9d50e 100644 --- a/chrome/renderer/spellchecker/custom_dictionary_engine_unittest.cc +++ b/chrome/renderer/spellchecker/custom_dictionary_engine_unittest.cc @@ -15,11 +15,13 @@ TEST(CustomDictionaryTest, HandlesEmptyWordWithInvalidSubstring) { TEST(CustomDictionaryTest, Basic) { CustomDictionaryEngine engine; - EXPECT_FALSE(engine.SpellCheckWord(ASCIIToUTF16("helllo").c_str(), 0, 6)); + EXPECT_FALSE(engine.SpellCheckWord(base::ASCIIToUTF16("helllo").c_str(), + 0, 6)); std::set<std::string> custom_words; custom_words.insert("helllo"); engine.Init(custom_words); - EXPECT_TRUE(engine.SpellCheckWord(ASCIIToUTF16("helllo").c_str(), 0, 6)); + EXPECT_TRUE(engine.SpellCheckWord(base::ASCIIToUTF16("helllo").c_str(), + 0, 6)); } TEST(CustomDictionaryTest, HandlesNullCharacters) { diff --git a/chrome/renderer/spellchecker/hunspell_engine.cc b/chrome/renderer/spellchecker/hunspell_engine.cc index 7900c50..74dd292 100644 --- a/chrome/renderer/spellchecker/hunspell_engine.cc +++ b/chrome/renderer/spellchecker/hunspell_engine.cc @@ -80,7 +80,7 @@ bool HunspellEngine::CheckSpelling(const base::string16& word_to_check, // offer suggestions on them, either, there's no point in flagging them to // the user. bool word_correct = true; - std::string word_to_check_utf8(UTF16ToUTF8(word_to_check)); + std::string word_to_check_utf8(base::UTF16ToUTF8(word_to_check)); // Limit the size of checked words. if (word_to_check_utf8.length() <= kMaxCheckedLen) { @@ -98,7 +98,7 @@ bool HunspellEngine::CheckSpelling(const base::string16& word_to_check, void HunspellEngine::FillSuggestionList( const base::string16& wrong_word, std::vector<base::string16>* optional_suggestions) { - std::string wrong_word_utf8(UTF16ToUTF8(wrong_word)); + std::string wrong_word_utf8(base::UTF16ToUTF8(wrong_word)); if (wrong_word_utf8.length() > kMaxSuggestLen) return; @@ -115,7 +115,7 @@ void HunspellEngine::FillSuggestionList( // Populate the vector of WideStrings. for (int i = 0; i < number_of_suggestions; ++i) { if (i < chrome::spellcheck_common::kMaxSuggestions) - optional_suggestions->push_back(UTF8ToUTF16(suggestions[i])); + optional_suggestions->push_back(base::UTF8ToUTF16(suggestions[i])); free(suggestions[i]); } if (suggestions != NULL) diff --git a/chrome/renderer/spellchecker/spellcheck_provider_hunspell_unittest.cc b/chrome/renderer/spellchecker/spellcheck_provider_hunspell_unittest.cc index eb92ceb..a9d5f18 100644 --- a/chrome/renderer/spellchecker/spellcheck_provider_hunspell_unittest.cc +++ b/chrome/renderer/spellchecker/spellcheck_provider_hunspell_unittest.cc @@ -14,6 +14,8 @@ // Tests for Hunspell functionality in SpellcheckingProvider +using base::ASCIIToUTF16; + namespace { TEST_F(SpellCheckProviderTest, UsingHunspell) { diff --git a/chrome/renderer/spellchecker/spellcheck_provider_mac_unittest.cc b/chrome/renderer/spellchecker/spellcheck_provider_mac_unittest.cc index 5cb81f0..bab1107d 100644 --- a/chrome/renderer/spellchecker/spellcheck_provider_mac_unittest.cc +++ b/chrome/renderer/spellchecker/spellcheck_provider_mac_unittest.cc @@ -62,7 +62,7 @@ TEST_F(SpellCheckProviderMacTest, SingleRoundtripSuccess) { MessageParameters read_parameters = ReadRequestTextCheck(provider_.messages_[0]); - EXPECT_EQ(read_parameters.text, UTF8ToUTF16("hello ")); + EXPECT_EQ(read_parameters.text, base::UTF8ToUTF16("hello ")); FakeMessageArrival(&provider_, read_parameters); EXPECT_EQ(completion.completion_count_, 1U); @@ -86,11 +86,11 @@ TEST_F(SpellCheckProviderMacTest, TwoRoundtripSuccess) { MessageParameters read_parameters1 = ReadRequestTextCheck(provider_.messages_[0]); - EXPECT_EQ(read_parameters1.text, UTF8ToUTF16("hello ")); + EXPECT_EQ(read_parameters1.text, base::UTF8ToUTF16("hello ")); MessageParameters read_parameters2 = ReadRequestTextCheck(provider_.messages_[1]); - EXPECT_EQ(read_parameters2.text, UTF8ToUTF16("bye ")); + EXPECT_EQ(read_parameters2.text, base::UTF8ToUTF16("bye ")); FakeMessageArrival(&provider_, read_parameters1); EXPECT_EQ(completion1.completion_count_, 1U); diff --git a/chrome/renderer/spellchecker/spellcheck_unittest.cc b/chrome/renderer/spellchecker/spellcheck_unittest.cc index 143770e..05f0b6b 100644 --- a/chrome/renderer/spellchecker/spellcheck_unittest.cc +++ b/chrome/renderer/spellchecker/spellcheck_unittest.cc @@ -79,7 +79,7 @@ class SpellCheckTest : public testing::Test { bool CheckSpelling(const std::string& word, int tag) { return spell_check_->spellcheck_.platform_spelling_engine_->CheckSpelling( - ASCIIToUTF16(word), tag); + base::ASCIIToUTF16(word), tag); } #if !defined(OS_MACOSX) @@ -388,7 +388,7 @@ TEST_F(SpellCheckTest, SpellCheckStrings_EN_US) { int misspelling_start; int misspelling_length; bool result = spell_check()->SpellCheckWord( - WideToUTF16(kTestCases[i].input).c_str(), + base::WideToUTF16(kTestCases[i].input).c_str(), static_cast<int>(input_length), 0, &misspelling_start, @@ -439,7 +439,7 @@ TEST_F(SpellCheckTest, SpellCheckSuggestions_EN_US) { int misspelling_start; int misspelling_length; bool result = spell_check()->SpellCheckWord( - WideToUTF16(kTestCases[i].input).c_str(), + base::WideToUTF16(kTestCases[i].input).c_str(), static_cast<int>(input_length), 0, &misspelling_start, @@ -452,8 +452,8 @@ TEST_F(SpellCheckTest, SpellCheckSuggestions_EN_US) { // Check if the suggested words occur. bool suggested_word_is_present = false; for (int j = 0; j < static_cast<int>(suggestions.size()); j++) { - if (suggestions.at(j).compare(WideToUTF16(kTestCases[i].suggested_word)) - == 0) { + if (suggestions.at(j).compare( + base::WideToUTF16(kTestCases[i].suggested_word)) == 0) { suggested_word_is_present = true; break; } @@ -804,7 +804,7 @@ TEST_F(SpellCheckTest, MAYBE_SpellCheckText) { int misspelling_start = 0; int misspelling_length = 0; bool result = spell_check()->SpellCheckWord( - WideToUTF16(kTestCases[i].input).c_str(), + base::WideToUTF16(kTestCases[i].input).c_str(), static_cast<int>(input_length), 0, &misspelling_start, @@ -841,9 +841,9 @@ TEST_F(SpellCheckTest, GetAutoCorrectionWord_EN_US) { EnableAutoCorrect(true); for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) { - base::string16 misspelled_word(UTF8ToUTF16(kTestCases[i].input)); + base::string16 misspelled_word(base::UTF8ToUTF16(kTestCases[i].input)); base::string16 expected_autocorrect_word( - UTF8ToUTF16(kTestCases[i].expected_result)); + base::UTF8ToUTF16(kTestCases[i].expected_result)); base::string16 autocorrect_word = spell_check()->GetAutoCorrectionWord( misspelled_word, 0); @@ -885,7 +885,7 @@ TEST_F(SpellCheckTest, MisspelledWords) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) { ReinitializeSpellCheck(kTestCases[i].language); - base::string16 word(WideToUTF16(kTestCases[i].input)); + base::string16 word(base::WideToUTF16(kTestCases[i].input)); int word_length = static_cast<int>(word.length()); int misspelling_start = 0; int misspelling_length = 0; @@ -908,19 +908,19 @@ TEST_F(SpellCheckTest, MisspelledWords) { // Make sure SpellCheckParagraph does not crash if the input is empty. TEST_F(SpellCheckTest, SpellCheckParagraphEmptyParagraph) { std::vector<SpellCheckResult> expected; - TestSpellCheckParagraph(UTF8ToUTF16(""), expected); + TestSpellCheckParagraph(base::UTF8ToUTF16(""), expected); } // A simple test case having no misspellings. TEST_F(SpellCheckTest, SpellCheckParagraphNoMisspellings) { - const base::string16 text = UTF8ToUTF16("apple"); + const base::string16 text = base::UTF8ToUTF16("apple"); std::vector<SpellCheckResult> expected; TestSpellCheckParagraph(text, expected); } // A simple test case having one misspelling. TEST_F(SpellCheckTest, SpellCheckParagraphSingleMisspellings) { - const base::string16 text = UTF8ToUTF16("zz"); + const base::string16 text = base::UTF8ToUTF16("zz"); std::vector<SpellCheckResult> expected; expected.push_back(SpellCheckResult( SpellCheckResult::SPELLING, 0, 2)); @@ -930,7 +930,7 @@ TEST_F(SpellCheckTest, SpellCheckParagraphSingleMisspellings) { // A simple test case having multiple misspellings. TEST_F(SpellCheckTest, SpellCheckParagraphMultipleMisspellings) { - const base::string16 text = UTF8ToUTF16("zz, zz"); + const base::string16 text = base::UTF8ToUTF16("zz, zz"); std::vector<SpellCheckResult> expected; expected.push_back(SpellCheckResult( SpellCheckResult::SPELLING, 0, 2)); @@ -944,7 +944,7 @@ TEST_F(SpellCheckTest, SpellCheckParagraphMultipleMisspellings) { TEST_F(SpellCheckTest, SpellCheckParagraphLongSentence) { std::vector<SpellCheckResult> expected; // The text is taken from US constitution preamble. - const base::string16 text = UTF8ToUTF16( + const base::string16 text = base::UTF8ToUTF16( "We the people of the United States, in order to form a more perfect " "union, establish justice, insure domestic tranquility, provide for " "the common defense, promote the general welfare, and secure the " @@ -959,7 +959,7 @@ TEST_F(SpellCheckTest, SpellCheckParagraphLongSentenceMultipleMisspellings) { std::vector<SpellCheckResult> expected; // All 'the' are converted to 'hte' in US consitition preamble. - const base::string16 text = UTF8ToUTF16( + const base::string16 text = base::UTF8ToUTF16( "We hte people of hte United States, in order to form a more perfect " "union, establish justice, insure domestic tranquility, provide for " "hte common defense, promote hte general welfare, and secure hte " @@ -1000,7 +1000,7 @@ TEST_F(SpellCheckTest, RequestSpellCheckWithEmptyString) { TEST_F(SpellCheckTest, RequestSpellCheckWithoutMisspelling) { MockTextCheckingCompletion completion; - const base::string16 text = ASCIIToUTF16("hello"); + const base::string16 text = base::ASCIIToUTF16("hello"); spell_check()->RequestTextChecking(text, &completion); base::MessageLoop::current()->RunUntilIdle(); @@ -1012,7 +1012,7 @@ TEST_F(SpellCheckTest, RequestSpellCheckWithoutMisspelling) { TEST_F(SpellCheckTest, RequestSpellCheckWithSingleMisspelling) { MockTextCheckingCompletion completion; - const base::string16 text = ASCIIToUTF16("apple, zz"); + const base::string16 text = base::ASCIIToUTF16("apple, zz"); spell_check()->RequestTextChecking(text, &completion); base::MessageLoop::current()->RunUntilIdle(); @@ -1027,7 +1027,7 @@ TEST_F(SpellCheckTest, RequestSpellCheckWithSingleMisspelling) { TEST_F(SpellCheckTest, RequestSpellCheckWithMisspellings) { MockTextCheckingCompletion completion; - const base::string16 text = ASCIIToUTF16("apple, zz, orange, zz"); + const base::string16 text = base::ASCIIToUTF16("apple, zz, orange, zz"); spell_check()->RequestTextChecking(text, &completion); base::MessageLoop::current()->RunUntilIdle(); @@ -1046,9 +1046,9 @@ TEST_F(SpellCheckTest, RequestSpellCheckWithMultipleRequests) { MockTextCheckingCompletion completion[3]; const base::string16 text[3] = { - ASCIIToUTF16("what, zz"), - ASCIIToUTF16("apple, zz"), - ASCIIToUTF16("orange, zz") + base::ASCIIToUTF16("what, zz"), + base::ASCIIToUTF16("apple, zz"), + base::ASCIIToUTF16("orange, zz") }; for (int i = 0; i < 3; ++i) @@ -1070,7 +1070,7 @@ TEST_F(SpellCheckTest, RequestSpellCheckWithoutInitialization) { UninitializeSpellCheck(); MockTextCheckingCompletion completion; - const base::string16 text = ASCIIToUTF16("zz"); + const base::string16 text = base::ASCIIToUTF16("zz"); spell_check()->RequestTextChecking(text, &completion); @@ -1086,9 +1086,9 @@ TEST_F(SpellCheckTest, RequestSpellCheckMultipleTimesWithoutInitialization) { MockTextCheckingCompletion completion[3]; const base::string16 text[3] = { - ASCIIToUTF16("what, zz"), - ASCIIToUTF16("apple, zz"), - ASCIIToUTF16("orange, zz") + base::ASCIIToUTF16("what, zz"), + base::ASCIIToUTF16("apple, zz"), + base::ASCIIToUTF16("orange, zz") }; // Calls RequestTextchecking a few times. @@ -1117,7 +1117,7 @@ TEST_F(SpellCheckTest, CreateTextCheckingResults) { // Verify that the SpellCheck class keeps the spelling marker added to a // misspelled word "zz". { - base::string16 text = ASCIIToUTF16("zz"); + base::string16 text = base::ASCIIToUTF16("zz"); std::vector<SpellCheckResult> spellcheck_results; spellcheck_results.push_back(SpellCheckResult( SpellCheckResult::SPELLING, 0, 2, base::string16())); @@ -1137,7 +1137,7 @@ TEST_F(SpellCheckTest, CreateTextCheckingResults) { // Verify that the SpellCheck class replaces the spelling marker added to a // contextually-misspelled word "bean" with a grammar marker. { - base::string16 text = ASCIIToUTF16("I have bean to USA."); + base::string16 text = base::ASCIIToUTF16("I have bean to USA."); std::vector<SpellCheckResult> spellcheck_results; spellcheck_results.push_back(SpellCheckResult( SpellCheckResult::SPELLING, 7, 4, base::string16())); @@ -1197,7 +1197,7 @@ TEST_F(SpellCheckTest, EnglishWords) { int misspelling_start = 0; int misspelling_length = 0; bool result = spell_check()->SpellCheckWord( - ASCIIToUTF16(kTestCases[i].input).c_str(), + base::ASCIIToUTF16(kTestCases[i].input).c_str(), static_cast<int>(input_length), 0, &misspelling_start, @@ -1244,7 +1244,7 @@ TEST_F(SpellCheckTest, NoSuggest) { int misspelling_start = 0; int misspelling_length = 0; bool result = spell_check()->SpellCheckWord( - ASCIIToUTF16(kTestCases[i].suggestion).c_str(), + base::ASCIIToUTF16(kTestCases[i].suggestion).c_str(), static_cast<int>(suggestion_length), 0, &misspelling_start, @@ -1259,7 +1259,7 @@ TEST_F(SpellCheckTest, NoSuggest) { if (kTestCases[i].input != NULL) input_length = strlen(kTestCases[i].input); result = spell_check()->SpellCheckWord( - ASCIIToUTF16(kTestCases[i].input).c_str(), + base::ASCIIToUTF16(kTestCases[i].input).c_str(), static_cast<int>(input_length), 0, &misspelling_start, @@ -1272,8 +1272,8 @@ TEST_F(SpellCheckTest, NoSuggest) { // Check if the suggested words occur. for (int j = 0; j < static_cast<int>(suggestions.size()); j++) { for (size_t t = 0; t < test_cases_size; t++) { - int compare_result = - suggestions.at(j).compare(ASCIIToUTF16(kTestCases[t].suggestion)); + int compare_result = suggestions.at(j).compare( + base::ASCIIToUTF16(kTestCases[t].suggestion)); EXPECT_FALSE(compare_result == 0) << kTestCases[t].suggestion << " in " << kTestCases[i].locale; } @@ -1349,7 +1349,7 @@ TEST_F(SpellCheckTest, LogicalSuggestions) { int misspelling_length = 0; std::vector<base::string16> suggestions; EXPECT_FALSE(spell_check()->SpellCheckWord( - ASCIIToUTF16(kTestCases[i].misspelled).c_str(), + base::ASCIIToUTF16(kTestCases[i].misspelled).c_str(), strlen(kTestCases[i].misspelled), 0, &misspelling_start, @@ -1357,6 +1357,6 @@ TEST_F(SpellCheckTest, LogicalSuggestions) { &suggestions)); EXPECT_GE(suggestions.size(), static_cast<size_t>(1)); if (suggestions.size() > 0) - EXPECT_EQ(suggestions[0], ASCIIToUTF16(kTestCases[i].suggestion)); + EXPECT_EQ(suggestions[0], base::ASCIIToUTF16(kTestCases[i].suggestion)); } } diff --git a/chrome/renderer/spellchecker/spellcheck_worditerator.cc b/chrome/renderer/spellchecker/spellcheck_worditerator.cc index ca5c7fa..9d0e555 100644 --- a/chrome/renderer/spellchecker/spellcheck_worditerator.cc +++ b/chrome/renderer/spellchecker/spellcheck_worditerator.cc @@ -174,14 +174,14 @@ void SpellcheckCharAttribute::CreateRuleSets(const std::string& language) { "$ALetterEx ($MidLetterEx | $MidNumLetEx) $ALetterEx {200};"; const char kDisallowContraction[] = ""; - ruleset_allow_contraction_ = ASCIIToUTF16( + ruleset_allow_contraction_ = base::ASCIIToUTF16( base::StringPrintf(kRuleTemplate, aletter, aletter_extra, midletter_extra, aletter_plus, kAllowContraction)); - ruleset_disallow_contraction_ = ASCIIToUTF16( + ruleset_disallow_contraction_ = base::ASCIIToUTF16( base::StringPrintf(kRuleTemplate, aletter, aletter_extra, diff --git a/chrome/renderer/spellchecker/spellcheck_worditerator.h b/chrome/renderer/spellchecker/spellcheck_worditerator.h index 50a0ef6..3a757b9 100644 --- a/chrome/renderer/spellchecker/spellcheck_worditerator.h +++ b/chrome/renderer/spellchecker/spellcheck_worditerator.h @@ -93,7 +93,7 @@ class SpellcheckCharAttribute { // // Set up a SpellcheckWordIterator object which extracts English words, // // and retrieve them. // SpellcheckWordIterator iterator; -// base::string16 text(UTF8ToUTF16("this is a test.")); +// base::string16 text(base::UTF8ToUTF16("this is a test.")); // iterator.Initialize(&attribute, true); // iterator.SetText(text.c_str(), text_.length()); // diff --git a/chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc b/chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc index c1e5fce..a87340a 100644 --- a/chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc +++ b/chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc @@ -119,7 +119,7 @@ TEST(SpellcheckWordIteratorTest, SplitWord) { SpellcheckCharAttribute attributes; attributes.SetDefaultLanguage(kTestCases[i].language); - base::string16 input(WideToUTF16(kTestText)); + base::string16 input(base::WideToUTF16(kTestText)); SpellcheckWordIterator iterator; EXPECT_TRUE(iterator.Initialize(&attributes, kTestCases[i].allow_contraction)); @@ -127,7 +127,7 @@ TEST(SpellcheckWordIteratorTest, SplitWord) { std::vector<base::string16> expected_words; base::SplitString( - WideToUTF16(kTestCases[i].expected_words), ' ', &expected_words); + base::WideToUTF16(kTestCases[i].expected_words), ' ', &expected_words); base::string16 actual_word; int actual_start, actual_end; @@ -149,7 +149,7 @@ TEST(SpellcheckWordIteratorTest, RuleSetConsistency) { attributes.SetDefaultLanguage("en-US"); const wchar_t kTestText[] = L"\x1791\x17c1\x002e"; - base::string16 input(WideToUTF16(kTestText)); + base::string16 input(base::WideToUTF16(kTestText)); SpellcheckWordIterator iterator; EXPECT_TRUE(iterator.Initialize(&attributes, true)); @@ -214,7 +214,7 @@ TEST(SpellcheckWordIteratorTest, TreatNumbersAsWordCharacters) { SpellcheckCharAttribute attributes; attributes.SetDefaultLanguage(kTestCases[i].language); - base::string16 input_word(WideToUTF16(kTestCases[i].text)); + base::string16 input_word(base::WideToUTF16(kTestCases[i].text)); SpellcheckWordIterator iterator; EXPECT_TRUE(iterator.Initialize(&attributes, true)); EXPECT_TRUE(iterator.SetText(input_word.c_str(), input_word.length())); diff --git a/chrome/renderer/translate/translate_helper.cc b/chrome/renderer/translate/translate_helper.cc index 6613758..f276c64 100644 --- a/chrome/renderer/translate/translate_helper.cc +++ b/chrome/renderer/translate/translate_helper.cc @@ -30,6 +30,7 @@ #include "url/gurl.h" #include "v8/include/v8.h" +using base::ASCIIToUTF16; using blink::WebDocument; using blink::WebElement; using blink::WebFrame; diff --git a/chrome/renderer/translate/translate_script_browsertest.cc b/chrome/renderer/translate/translate_script_browsertest.cc index 49b9dde..9bc2410 100644 --- a/chrome/renderer/translate/translate_script_browsertest.cc +++ b/chrome/renderer/translate/translate_script_browsertest.cc @@ -85,7 +85,7 @@ class TranslateScriptBrowserTest : public ChromeRenderViewTest { } void ExecuteScript(const std::string& script) { - WebScriptSource source = WebScriptSource(ASCIIToUTF16(script)); + WebScriptSource source = WebScriptSource(base::ASCIIToUTF16(script)); GetMainFrame()->executeScript(source); } @@ -111,7 +111,7 @@ class TranslateScriptBrowserTest : public ChromeRenderViewTest { } double ExecuteScriptAndGetNumberResult(const std::string& script) { - WebScriptSource source = WebScriptSource(ASCIIToUTF16(script)); + WebScriptSource source = WebScriptSource(base::ASCIIToUTF16(script)); v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); v8::Handle<v8::Value> result = GetMainFrame()->executeScriptAndReturnValue(source); @@ -125,7 +125,7 @@ class TranslateScriptBrowserTest : public ChromeRenderViewTest { } bool ExecuteScriptAndGetBoolResult(const std::string& script) { - WebScriptSource source = WebScriptSource(ASCIIToUTF16(script)); + WebScriptSource source = WebScriptSource(base::ASCIIToUTF16(script)); v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); v8::Handle<v8::Value> result = GetMainFrame()->executeScriptAndReturnValue(source); diff --git a/chrome/renderer/web_apps_unittest.cc b/chrome/renderer/web_apps_unittest.cc index 199d55c..902e592 100644 --- a/chrome/renderer/web_apps_unittest.cc +++ b/chrome/renderer/web_apps_unittest.cc @@ -43,8 +43,8 @@ TEST(WebAppInfo, ParseIconSizes) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { bool is_any; std::vector<gfx::Size> sizes; - bool result = web_apps::ParseIconSizes(ASCIIToUTF16(data[i].input), &sizes, - &is_any); + bool result = web_apps::ParseIconSizes( + base::ASCIIToUTF16(data[i].input), &sizes, &is_any); ASSERT_EQ(result, data[i].expected_result); if (result) { ASSERT_EQ(data[i].is_any, is_any); |