Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Unified Diff: components/translate/content/renderer/translate_helper.cc

Issue 2657613004: Use explicit WebString conversions in translate code (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/translate/translate_script_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/translate/content/renderer/translate_helper.cc
diff --git a/components/translate/content/renderer/translate_helper.cc b/components/translate/content/renderer/translate_helper.cc
index dbe7950344eedf7c981d74e56aa793c450c521ec..a2f67079db0bf8a422adace428eb2a5ca46982aa 100644
--- a/components/translate/content/renderer/translate_helper.cc
+++ b/components/translate/content/renderer/translate_helper.cc
@@ -30,7 +30,6 @@
#include "url/gurl.h"
#include "v8/include/v8.h"
-using base::ASCIIToUTF16;
using blink::WebDocument;
using blink::WebLocalFrame;
using blink::WebScriptSource;
@@ -189,7 +188,7 @@ void TranslateHelper::ExecuteScript(const std::string& script) {
if (!main_frame)
return;
- WebScriptSource source = WebScriptSource(ASCIIToUTF16(script));
+ WebScriptSource source = WebScriptSource(WebString::fromASCII(script));
main_frame->executeScriptInIsolatedWorld(world_id_, &source, 1);
}
@@ -201,7 +200,7 @@ bool TranslateHelper::ExecuteScriptAndGetBoolResult(const std::string& script,
v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
WebVector<v8::Local<v8::Value> > results;
- WebScriptSource source = WebScriptSource(ASCIIToUTF16(script));
+ WebScriptSource source = WebScriptSource(WebString::fromASCII(script));
main_frame->executeScriptInIsolatedWorld(world_id_, &source, 1, &results);
if (results.size() != 1 || results[0].IsEmpty() || !results[0]->IsBoolean()) {
NOTREACHED();
@@ -219,7 +218,7 @@ std::string TranslateHelper::ExecuteScriptAndGetStringResult(
v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
WebVector<v8::Local<v8::Value> > results;
- WebScriptSource source = WebScriptSource(ASCIIToUTF16(script));
+ WebScriptSource source = WebScriptSource(WebString::fromASCII(script));
main_frame->executeScriptInIsolatedWorld(world_id_, &source, 1, &results);
if (results.size() != 1 || results[0].IsEmpty() || !results[0]->IsString()) {
NOTREACHED();
@@ -241,7 +240,7 @@ double TranslateHelper::ExecuteScriptAndGetDoubleResult(
v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
WebVector<v8::Local<v8::Value> > results;
- WebScriptSource source = WebScriptSource(ASCIIToUTF16(script));
+ WebScriptSource source = WebScriptSource(WebString::fromASCII(script));
main_frame->executeScriptInIsolatedWorld(world_id_, &source, 1, &results);
if (results.size() != 1 || results[0].IsEmpty() || !results[0]->IsNumber()) {
NOTREACHED();
« no previous file with comments | « chrome/renderer/translate/translate_script_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698