Commit ee93710e authored by Darren Shen's avatar Darren Shen Committed by Commit Bot

[emoji] Remove emoji option from Mojo apps.

Currently right-clicking on input fields in Mojo apps will bring up
an emoji option. Clicking it would crash the app. This is because we
assume that an emoji callback function always exists, but actually this
is not true for Mojo apps because they are in a different process.

This patch adds a null check for the emoji callback so that we don't
show the emoji option when we don't have a callback.

Bug: 887649
Change-Id: Iaccb0d9f890187f5c405888babefde7d3f33abe0
Reviewed-on: https://chromium-review.googlesource.com/c/1393584
Commit-Queue: Darren Shen <shend@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619868}
parent 05ab1c1c
......@@ -548,6 +548,26 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest,
EXPECT_FALSE(menu.IsItemPresent(IDC_CONTENT_CONTEXT_EMOJI));
}
// Only Chrome OS supports emoji panel callbacks.
#if defined(OS_CHROMEOS)
IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest,
ContextMenuForEmojiPanel_NoCallback) {
// Reset the emoji callback.
ui::SetShowEmojiKeyboardCallback(base::RepeatingClosure());
content::ContextMenuParams params;
params.is_editable = true;
TestRenderViewContextMenu menu(
browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame(),
params);
menu.Init();
// If there's no callback, the emoji context menu should not be present.
EXPECT_FALSE(menu.IsItemPresent(IDC_CONTENT_CONTEXT_EMOJI));
}
#endif // defined(OS_CHROMEOS)
IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, CopyLinkTextMouse) {
std::unique_ptr<TestRenderViewContextMenu> menu = CreateContextMenu(
GURL("http://www.google.com/"), GURL("http://www.google.com/"),
......
......@@ -19,7 +19,9 @@ base::RepeatingClosure& GetShowEmojiKeyboardCallback() {
} // namespace
bool IsEmojiPanelSupported() {
return true;
// TODO(https://crbug.com/887649): Emoji callback is null in Mojo apps because
// they are in a different process. Fix it and remove the null check.
return !GetShowEmojiKeyboardCallback().is_null();
}
void ShowEmojiPanel() {
......
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