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

Unified Diff: chrome/browser/renderer_context_menu/render_view_context_menu.cc

Issue 1374583003: Unnecessary 'translate to English' option is displayed in context menu in PDF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698