Skip to content

Commit dd46eab

Browse files
committed
fix(leo): Remove incognito and tor options from the context menu on leo page
1 parent e343529 commit dd46eab

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

chromium_src/chrome/browser/renderer_context_menu/render_view_context_menu.cc

+10-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "brave/browser/ui/browser_dialogs.h"
2323
#include "brave/browser/ui/tabs/features.h"
2424
#include "brave/components/ai_rewriter/common/buildflags/buildflags.h"
25+
#include "brave/components/constants/webui_url_constants.h"
2526
#include "brave/components/tor/buildflags/buildflags.h"
2627
#include "brave/grit/brave_theme_resources.h"
2728
#include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h"
@@ -778,7 +779,7 @@ void BraveRenderViewContextMenu::InitMenu() {
778779
// Add Open Link with Tor
779780
if (!TorProfileServiceFactory::IsTorDisabled(GetProfile()) &&
780781
content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_LINK) &&
781-
!params_.link_url.is_empty()) {
782+
!params_.link_url.is_empty() && !params_.link_url.spec().starts_with(kAIChatUIURL)) {
782783
const Browser* browser = GetBrowser();
783784
const bool is_app = browser && browser->is_type_app();
784785

@@ -792,6 +793,14 @@ void BraveRenderViewContextMenu::InitMenu() {
792793
: IDS_CONTENT_CONTEXT_OPENLINKTOR);
793794
}
794795
#endif
796+
797+
if (params_.link_url.spec().starts_with(kAIChatUIURL) && GetProfile()->
798+
GetPrefs()->GetBoolean(ai_chat::prefs::kBraveAIChatContextMenuEnabled)) {
799+
index = menu_model_->.GetIndexOfCommandId(IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD);
800+
DCHECK(index);
801+
menu_model_.RemoveItemAt(index.value());
802+
}
803+
795804
if (!params_.link_url.is_empty() && params_.link_url.SchemeIsHTTPOrHTTPS()) {
796805
std::optional<size_t> link_index =
797806
menu_model_.GetIndexOfCommandId(IDC_CONTENT_CONTEXT_COPYLINKLOCATION);

0 commit comments

Comments
 (0)