Index: content/browser/android/content_view_core_impl.cc |
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc |
index 80fe628dd022781a85a0bd56fe22b32d2d270490..78c151291b980d3d098000cc16ed8cb03d4361ba 100644 |
--- a/content/browser/android/content_view_core_impl.cc |
+++ b/content/browser/android/content_view_core_impl.cc |
@@ -1472,14 +1472,26 @@ void JavaScriptResultCallback(const ScopedJavaGlobalRef<jobject>& callback, |
void ContentViewCoreImpl::EvaluateJavaScript(JNIEnv* env, |
jobject obj, |
jstring script, |
- jobject callback) { |
- RenderViewHost* host = web_contents_->GetRenderViewHost(); |
- DCHECK(host); |
+ jobject callback, |
+ jboolean start_renderer) { |
+ RenderViewHost* rvh = |
+ static_cast<RenderViewHost*>(web_contents_->GetRenderViewHost()); |
+ DCHECK(rvh); |
+ |
+ WebContentsImpl* web_contents_impl = |
+ static_cast<WebContentsImpl*>(web_contents_); |
joth
2013/08/20 05:00:44
just use web_contents_ -- it's already of type We
michaelbai
2013/08/20 19:15:20
Done.
|
+ if (start_renderer && !rvh->IsRenderViewLive()) { |
+ if (!web_contents_impl->CreateRenderView(rvh, MSG_ROUTING_NONE, -1)) { |
joth
2013/08/20 05:00:44
this looks kind of complex, and the change in WebC
michaelbai
2013/08/20 19:15:20
Tried, it didn't work, it seemed that a swapped ou
|
+ LOG(ERROR) << |
+ "Falied to create RenderView in EvaluateJavaScript"; |
+ return; |
+ } |
+ } |
if (!callback) { |
// No callback requested. |
- host->ExecuteJavascriptInWebFrame(string16(), // frame_xpath |
- ConvertJavaStringToUTF16(env, script)); |
+ rvh->ExecuteJavascriptInWebFrame(string16(), // frame_xpath |
+ ConvertJavaStringToUTF16(env, script)); |
return; |
} |
@@ -1490,7 +1502,7 @@ void ContentViewCoreImpl::EvaluateJavaScript(JNIEnv* env, |
content::RenderViewHost::JavascriptResultCallback c_callback = |
base::Bind(&JavaScriptResultCallback, j_callback); |
- host->ExecuteJavascriptInWebFrameCallbackResult( |
+ rvh->ExecuteJavascriptInWebFrameCallbackResult( |
string16(), // frame_xpath |
ConvertJavaStringToUTF16(env, script), |
c_callback); |