Commit f660c935 authored by dtrainor's avatar dtrainor Committed by Commit bot

[Android] Handle a null java side of CVC in context menu

We might have a native ContentViewCore but not a java side.  Don't
attempt to show the context menu if this is the case.

BUG=410599

Review URL: https://codereview.chromium.org/610913004

Cr-Commit-Position: refs/heads/master@{#297318}
parent af0ddd52
...@@ -41,12 +41,18 @@ void ContextMenuHelper::ShowContextMenu( ...@@ -41,12 +41,18 @@ void ContextMenuHelper::ShowContextMenu(
if (!content_view_core) if (!content_view_core)
return; return;
base::android::ScopedJavaLocalRef<jobject> jcontent_view_core(
content_view_core->GetJavaObject());
if (jcontent_view_core.is_null())
return;
JNIEnv* env = base::android::AttachCurrentThread(); JNIEnv* env = base::android::AttachCurrentThread();
context_menu_params_ = params; context_menu_params_ = params;
Java_ContextMenuHelper_showContextMenu( Java_ContextMenuHelper_showContextMenu(
env, env,
java_obj_.obj(), java_obj_.obj(),
content_view_core->GetJavaObject().obj(), jcontent_view_core.obj(),
ContextMenuHelper::CreateJavaContextMenuParams(params).obj()); ContextMenuHelper::CreateJavaContextMenuParams(params).obj());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment