Skip to content

Commit

Permalink
[translate] Stop checking Google Translate Extension
Browse files Browse the repository at this point in the history
  • Loading branch information
atuchin-m committed Sep 19, 2022
1 parent f494ac2 commit 55cbd88
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 29 deletions.
4 changes: 0 additions & 4 deletions browser/translate/brave_translate_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,4 @@ bool IsTranslateExtensionEnabled(content::BrowserContext* context) {
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
}

bool IsInternalTranslationEnabled(content::BrowserContext* context) {
return !IsTranslateExtensionEnabled(context) && IsBraveTranslateGoAvailable();
}

} // namespace translate
2 changes: 0 additions & 2 deletions browser/translate/brave_translate_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ namespace translate {

bool IsTranslateExtensionEnabled(content::BrowserContext* context);

bool IsInternalTranslationEnabled(content::BrowserContext* context);

} // namespace translate

#endif // BRAVE_BROWSER_TRANSLATE_BRAVE_TRANSLATE_UTILS_H_
2 changes: 0 additions & 2 deletions browser/ui/views/frame/brave_browser_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,9 @@ ShowTranslateBubbleResult BraveBrowserView::ShowTranslateBubble(
translate::TranslateErrors::Type error_type,
bool is_user_gesture) {
#if BUILDFLAG(ENABLE_BRAVE_TRANSLATE_GO)
if (translate::IsInternalTranslationEnabled(GetProfile())) {
return BrowserView::ShowTranslateBubble(web_contents, step, source_language,
target_language, error_type,
is_user_gesture);
}
#endif // BUILDFLAG(ENABLE_BRAVE_TRANSLATE_GO)
return ShowTranslateBubbleResult::BROWSER_WINDOW_NOT_VALID;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "brave/browser/renderer_context_menu/brave_spelling_options_submenu_observer.h"
#include "brave/components/ipfs/buildflags/buildflags.h"
#include "brave/components/tor/buildflags/buildflags.h"
#include "brave/components/translate/core/common/buildflags.h"
#include "brave/grit/brave_theme_resources.h"
#include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h"
#include "chrome/browser/ui/browser_list.h"
Expand All @@ -37,10 +36,6 @@
#include "brave/components/ipfs/ipfs_utils.h"
#endif

#if BUILDFLAG(ENABLE_BRAVE_TRANSLATE_GO)
#include "brave/browser/translate/brave_translate_utils.h"
#endif

// Our .h file creates a masquerade for RenderViewContextMenu. Switch
// back to the Chromium one for the Chromium implementation.
#undef RenderViewContextMenu
Expand Down Expand Up @@ -404,20 +399,4 @@ void BraveRenderViewContextMenu::InitMenu() {
#if BUILDFLAG(ENABLE_IPFS)
BuildIPFSMenu();
#endif

#if BUILDFLAG(ENABLE_BRAVE_TRANSLATE_GO)
const bool remove_translate =
!translate::IsInternalTranslationEnabled(GetProfile());
#else
const bool remove_translate = true;
#endif // BUILDFLAG(ENABLE_BRAVE_TRANSLATE_GO)

// Only show the translate item when go-translate is enabled.
// This removes menu item, but keeps the duplicated separator. The duplicated
// separator is removed in |BraveRenderViewContextMenuViews::Show|
if (remove_translate) {
index = menu_model_.GetIndexOfCommandId(IDC_CONTENT_CONTEXT_TRANSLATE);
if (index.has_value())
menu_model_.RemoveItemAt(index.value());
}
}

0 comments on commit 55cbd88

Please sign in to comment.