Index: chrome/browser/renderer_context_menu/render_view_context_menu.cc |
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc |
index 12d8b73bfaac298950148f7d0035574c6a38f829..e30e5643b3ec1e61734cfde8e7b974f2385f49ae 100644 |
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc |
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc |
@@ -1175,8 +1175,13 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const { |
case IDC_CONTENT_CONTEXT_TRANSLATE: { |
ChromeTranslateClient* chrome_translate_client = |
ChromeTranslateClient::FromWebContents(embedder_web_contents_); |
- if (!chrome_translate_client) |
+ // If no |chrome_translate_client| attached with this WebContents or we're |
+ // viewing in a MimeHandlerViewGuest translate will be disabled. |
+ if (!chrome_translate_client || |
+ !!extensions::MimeHandlerViewGuest::FromWebContents( |
+ source_web_contents_)) { |
return false; |
+ } |
std::string original_lang = |
chrome_translate_client->GetLanguageState().original_language(); |
std::string target_lang = g_browser_process->GetApplicationLocale(); |