#include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
#include <stddef.h>
#include <algorithm>
#include <memory>
#include <set>
#include <utility>
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "base/no_destructor.h"
#include "base/observer_list.h"
#include "base/strings/escape.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/system/sys_info.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/accessibility/accessibility_state_utils.h"
#include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/apps/app_service/app_launch_params.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/apps/app_service/browser_app_launcher.h"
#include "chrome/browser/apps/platform_apps/app_load_service.h"
#include "chrome/browser/ash/crosapi/browser_util.h"
#include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
#include "chrome/browser/autofill/personal_data_manager_factory.h"
#include "chrome/browser/browser_features.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/companion/core/features.h"
#include "chrome/browser/companion/core/utils.h"
#include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/download/download_stats.h"
#include "chrome/browser/language/language_model_manager_factory.h"
#include "chrome/browser/media/router/media_router_feature.h"
#include "chrome/browser/navigation_predictor/navigation_predictor_features.h"
#include "chrome/browser/navigation_predictor/navigation_predictor_keyed_service.h"
#include "chrome/browser/navigation_predictor/navigation_predictor_keyed_service_factory.h"
#include "chrome/browser/password_manager/chrome_password_manager_client.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/predictors/loading_predictor.h"
#include "chrome/browser/predictors/loading_predictor_factory.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/preloading/preloading_prefs.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_attributes_entry.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
#include "chrome/browser/profiles/profile_io_data.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_window.h"
#include "chrome/browser/renderer_context_menu/accessibility_labels_menu_observer.h"
#include "chrome/browser/renderer_context_menu/context_menu_content_type_factory.h"
#include "chrome/browser/renderer_context_menu/link_to_text_menu_observer.h"
#include "chrome/browser/renderer_context_menu/spelling_menu_observer.h"
#include "chrome/browser/search/search.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/send_tab_to_self/send_tab_to_self_util.h"
#include "chrome/browser/sharing/click_to_call/click_to_call_context_menu_observer.h"
#include "chrome/browser/sharing/click_to_call/click_to_call_metrics.h"
#include "chrome/browser/sharing/click_to_call/click_to_call_utils.h"
#include "chrome/browser/sharing_hub/sharing_hub_features.h"
#include "chrome/browser/spellchecker/spellcheck_service.h"
#include "chrome/browser/supervised_user/supervised_user_service_factory.h"
#include "chrome/browser/sync/send_tab_to_self_sync_service_factory.h"
#include "chrome/browser/translate/chrome_translate_client.h"
#include "chrome/browser/translate/translate_service.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_navigator_params.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/browser_window/public/browser_window_features.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "chrome/browser/ui/exclusive_access/keyboard_lock_controller.h"
#include "chrome/browser/ui/lens/lens_overlay_controller.h"
#include "chrome/browser/ui/lens/lens_overlay_entry_point_controller.h"
#include "chrome/browser/ui/lens/lens_overlay_invocation_source.h"
#include "chrome/browser/ui/passwords/ui_utils.h"
#include "chrome/browser/ui/profiles/profile_colors_util.h"
#include "chrome/browser/ui/qrcode_generator/qrcode_generator_bubble_controller.h"
#include "chrome/browser/ui/send_tab_to_self/send_tab_to_self_bubble.h"
#include "chrome/browser/ui/side_search/side_search_utils.h"
#include "chrome/browser/ui/tab_contents/core_tab_helper.h"
#include "chrome/browser/ui/tabs/public/tab_features.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/translate/partial_translate_bubble_model.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/views/side_panel/companion/companion_tab_helper.h"
#include "chrome/browser/ui/views/side_panel/companion/companion_utils.h"
#include "chrome/browser/ui/views/side_panel/read_anything/read_anything_side_panel_controller_utils.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "chrome/browser/ui/webui/history/foreign_session_handler.h"
#include "chrome/browser/user_education/user_education_service.h"
#include "chrome/browser/web_applications/mojom/user_display_mode.mojom.h"
#include "chrome/browser/web_applications/web_app_helpers.h"
#include "chrome/browser/web_applications/web_app_icon_manager.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/browser/web_applications/web_app_registrar.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_render_frame.mojom.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/content_restriction.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/branded_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/autofill/content/browser/content_autofill_client.h"
#include "components/autofill/core/browser/ui/suggestion_hiding_reason.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/password_generation_util.h"
#include "components/autofill/core/common/unique_ids.h"
#include "components/compose/buildflags.h"
#include "components/compose/core/browser/compose_features.h"
#include "components/custom_handlers/protocol_handler.h"
#include "components/download/public/common/download_url_parameters.h"
#include "components/google/core/common/google_util.h"
#include "components/guest_view/browser/guest_view_base.h"
#include "components/language/core/browser/language_model_manager.h"
#include "components/lens/lens_constants.h"
#include "components/lens/lens_features.h"
#include "components/lens/lens_metadata.mojom.h"
#include "components/lens/lens_metrics.h"
#include "components/live_caption/caption_util.h"
#include "components/live_caption/pref_names.h"
#include "components/media_router/browser/media_router_dialog_controller.h"
#include "components/media_router/browser/media_router_metrics.h"
#include "components/omnibox/browser/autocomplete_classifier.h"
#include "components/omnibox/browser/autocomplete_match.h"
#include "components/password_manager/content/browser/content_password_manager_driver.h"
#include "components/password_manager/core/browser/features/password_features.h"
#include "components/password_manager/core/browser/password_manager_metrics_util.h"
#include "components/password_manager/core/browser/password_manager_util.h"
#include "components/pdf/common/pdf_util.h"
#include "components/policy/content/policy_blocklist_service.h"
#include "components/policy/core/common/policy_pref_names.h"
#include "components/prefs/pref_member.h"
#include "components/prefs/pref_service.h"
#include "components/search_engines/search_engines_pref_names.h"
#include "components/search_engines/template_url.h"
#include "components/search_engines/template_url_service.h"
#include "components/send_tab_to_self/metrics_util.h"
#include "components/services/app_service/public/cpp/app_launch_util.h"
#include "components/sharing_message/features.h"
#include "components/spellcheck/browser/pref_names.h"
#include "components/spellcheck/browser/spellcheck_host_metrics.h"
#include "components/spellcheck/common/spellcheck_common.h"
#include "components/spellcheck/spellcheck_buildflags.h"
#include "components/strings/grit/components_strings.h"
#include "components/supervised_user/core/browser/supervised_user_preferences.h"
#include "components/supervised_user/core/browser/supervised_user_service.h"
#include "components/supervised_user/core/browser/supervised_user_url_filter.h"
#include "components/translate/core/browser/translate_download_manager.h"
#include "components/translate/core/browser/translate_manager.h"
#include "components/translate/core/browser/translate_prefs.h"
#include "components/translate/core/common/translate_util.h"
#include "components/url_formatter/url_formatter.h"
#include "components/user_notes/user_notes_features.h"
#include "components/user_prefs/user_prefs.h"
#include "components/vector_icons/vector_icons.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/download_manager.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/picture_in_picture_window_controller.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/ssl_status.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/referrer.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/url_utils.h"
#include "extensions/buildflags/buildflags.h"
#include "media/base/media_switches.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "net/base/network_anonymization_key.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "pdf/buildflags.h"
#include "ppapi/buildflags/buildflags.h"
#include "printing/buildflags/buildflags.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/context_menu_data/context_menu_data.h"
#include "third_party/blink/public/common/context_menu_data/edit_flags.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/loader/network_utils.h"
#include "third_party/blink/public/mojom/context_menu/context_menu.mojom.h"
#include "third_party/blink/public/mojom/frame/frame.mojom.h"
#include "third_party/blink/public/mojom/frame/media_player_action.mojom.h"
#include "third_party/blink/public/public_buildflags.h"
#include "third_party/metrics_proto/omnibox_input_type.pb.h"
#include "ui/accessibility/accessibility_features.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/scoped_clipboard_writer.h"
#include "ui/base/data_transfer_policy/data_transfer_endpoint.h"
#include "ui/base/emoji/emoji_panel_helper.h"
#include "ui/base/interaction/element_identifier.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/image_model.h"
#include "ui/base/window_open_disposition_utils.h"
#include "ui/gfx/favicon_size.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/text_elider.h"
#include "ui/strings/grit/ui_strings.h"
#include "url/origin.h"
#if BUILDFLAG(USE_RENDERER_SPELLCHECKER)
#include "chrome/browser/renderer_context_menu/spelling_options_submenu_observer.h"
#endif
#if BUILDFLAG(ENABLE_COMPOSE)
#include "chrome/browser/compose/chrome_compose_client.h"
#include "components/compose/core/browser/compose_manager.h"
#include "components/compose/core/browser/compose_metrics.h"
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/devtools_util.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/common/extensions/api/url_handlers/url_handlers_parser.h"
#include "extensions/browser/extension_host.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/browser/view_type_utils.h"
#include "extensions/common/extension.h"
#endif
#if BUILDFLAG(ENABLE_PDF)
#include "chrome/browser/pdf/pdf_extension_util.h"
#include "components/pdf/browser/pdf_frame_util.h"
#include "components/pdf/common/constants.h"
#include "pdf/pdf_features.h"
#endif
#if BUILDFLAG(ENABLE_PLUGINS)
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
#endif
#if BUILDFLAG(ENABLE_PRINTING)
#include "chrome/browser/printing/print_view_manager_common.h"
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
#include "chrome/browser/printing/print_preview_context_menu_observer.h"
#include "chrome/browser/printing/print_preview_dialog_controller.h"
#endif
#endif
#if BUILDFLAG(ENABLE_LENS_DESKTOP_GOOGLE_BRANDED_FEATURES)
#include "chrome/browser/lens/region_search/lens_region_search_controller.h"
#include "chrome/browser/ui/views/lens/lens_side_panel_helper.h"
#include "chrome/grit/theme_resources.h"
#include "ui/base/resource/resource_bundle.h"
#endif
#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "ui/base/menu_source_utils.h"
#endif
#if BUILDFLAG(IS_CHROMEOS)
#include "chrome/browser/chromeos/arc/open_with_menu.h"
#include "chrome/browser/chromeos/arc/start_smart_selection_action_menu.h"
#include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager.h"
#include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager_factory.h"
#include "chrome/browser/renderer_context_menu/read_write_card_observer.h"
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/ui/clipboard_history/clipboard_history_submenu_model.h"
#include "chromeos/ui/clipboard_history/clipboard_history_util.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_features.h"
#include "ash/public/cpp/clipboard_history_controller.h"
#include "ash/webui/settings/public/constants/routes.mojom.h"
#include "ash/webui/system_apps/public/system_web_app_type.h"
#include "chrome/browser/ash/arc/arc_util.h"
#include "chrome/browser/ash/arc/intent_helper/arc_intent_helper_mojo_ash.h"
#include "chrome/browser/ash/input_method/editor_mediator.h"
#include "chrome/browser/ash/system_web_apps/types/system_web_app_delegate.h"
#include "chrome/browser/ash/url_handler/url_handler.h"
#include "chrome/browser/ui/ash/system_web_apps/system_web_app_ui_utils.h"
#include "chrome/browser/ui/settings_window_manager_chromeos.h"
#include "chrome/browser/ui/webui/ash/system_web_dialog_delegate.h"
#include "chromeos/crosapi/mojom/clipboard_history.mojom.h"
#include "ui/aura/window.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chrome/browser/lacros/arc/arc_intent_helper_mojo_lacros.h"
#include "chromeos/crosapi/mojom/clipboard_history.mojom.h"
#include "chromeos/lacros/lacros_service.h"
#include "ui/aura/window.h"
#endif
#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/ui/toasts/api/toast_id.h"
#include "chrome/browser/ui/toasts/toast_controller.h"
#include "chrome/browser/ui/toasts/toast_features.h"
#endif
UserMetricsAction;
ContextMenuData;
ContextMenuDataEditFlags;
ContextMenuDataMediaType;
BrowserContext;
ChildProcessSecurityPolicy;
DownloadManager;
NavigationEntry;
OpenURLParams;
RenderFrameHost;
RenderViewHost;
SSLStatus;
WebContents;
DownloadUrlParameters;
ContextMenuMatcher;
Extension;
MenuItem;
MenuManager;
namespace {
constexpr char kOpenLinkAsProfileHistogram[] = …;
base::OnceCallback<void(RenderViewContextMenu*)>* GetMenuShownCallback() { … }
enum class UmaEnumIdLookupType { … };
enum class OpenLinkAs { … };
const std::map<int, int>& GetIdcToUmaMap(UmaEnumIdLookupType type) { … }
int GetUmaValueMax(UmaEnumIdLookupType type) { … }
int CollapseCommandsForUMA(int id) { … }
int FindUMAEnumValueForCommand(int id, UmaEnumIdLookupType type) { … }
bool IsCommandForOpenLink(int id) { … }
PrefService* GetPrefs(content::BrowserContext* context) { … }
bool ExtensionPatternMatch(const extensions::URLPatternSet& patterns,
const GURL& url) { … }
content::Referrer CreateReferrer(const GURL& url,
const content::ContextMenuParams& params) { … }
content::WebContents* GetWebContentsToUse(
content::RenderFrameHost* render_frame_host) { … }
bool g_custom_id_ranges_initialized = …;
#if !BUILDFLAG(IS_CHROMEOS_ASH)
void AddAvatarToLastMenuItem(const gfx::Image& icon,
ui::SimpleMenuModel* menu) { … }
#endif
void OnBrowserCreated(const GURL& link_url,
url::Origin initiator_origin,
Browser* browser) { … }
bool DoesFormControlTypeSupportEmoji(
blink::mojom::FormControlType form_control_type) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
std::optional<ash::SystemWebAppType> GetLinkSystemAppType(Profile* profile,
const GURL& url) {
std::optional<webapps::AppId> link_app_id =
web_app::FindInstalledAppWithUrlInScope(profile, url);
if (!link_app_id) {
return std::nullopt;
}
return ash::GetSystemWebAppTypeForAppId(profile, *link_app_id);
}
#endif
#if BUILDFLAG(IS_CHROMEOS)
int GetClipboardHistoryStringId() {
return chromeos::features::IsClipboardHistoryRefreshEnabled()
? IDS_CONTEXT_MENU_PASTE_FROM_CLIPBOARD
: IDS_CONTEXT_MENU_SHOW_CLIPBOARD_HISTORY_MENU;
}
int GetClipboardHistoryCommandId() {
return chromeos::features::IsClipboardHistoryRefreshEnabled()
? IDC_CONTENT_PASTE_FROM_CLIPBOARD
: IDC_CONTENT_CLIPBOARD_HISTORY_MENU;
}
bool IsCaptivePortalProfile(Profile* profile) {
return chromeos::features::IsCaptivePortalPopupWindowEnabled() &&
profile->IsOffTheRecord() &&
profile->GetOTRProfileID().IsCaptivePortal();
}
#endif
bool IsFrameInPdfViewer(content::RenderFrameHost* rfh) { … }
Browser* FindNormalBrowser(const Profile* profile) { … }
#if BUILDFLAG(ENABLE_PDF)
bool MaybePdfViewerHandlesSave(RenderFrameHost* frame_host) { … }
#endif
bool IsLensOptionEnteredThroughKeyboard(int event_flags) { … }
}
bool RenderViewContextMenu::IsDevToolsURL(const GURL& url) { … }
void RenderViewContextMenu::AddSpellCheckServiceItem(ui::SimpleMenuModel* menu,
bool is_checked) { … }
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(RenderViewContextMenu,
kExitFullscreenMenuItem);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(RenderViewContextMenu, kComposeMenuItem);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(RenderViewContextMenu, kRegionSearchItem);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(RenderViewContextMenu,
kSearchForImageItem);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(RenderViewContextMenu,
kSearchForVideoFrameItem);
RenderViewContextMenu::RenderViewContextMenu(
content::RenderFrameHost& render_frame_host,
const content::ContextMenuParams& params)
: … { … }
RenderViewContextMenu::~RenderViewContextMenu() = default;
#if BUILDFLAG(ENABLE_EXTENSIONS)
bool RenderViewContextMenu::ExtensionContextAndPatternMatch(
const content::ContextMenuParams& params,
const MenuItem::ContextList& contexts,
const extensions::URLPatternSet& target_url_patterns) { … }
bool RenderViewContextMenu::MenuItemMatchesParams(
const content::ContextMenuParams& params,
const extensions::MenuItem* item) { … }
void RenderViewContextMenu::AppendAllExtensionItems() { … }
void RenderViewContextMenu::AppendCurrentExtensionItems() { … }
#endif
std::u16string RenderViewContextMenu::FormatURLForClipboard(const GURL& url) { … }
void RenderViewContextMenu::WriteURLToClipboard(const GURL& url) { … }
void RenderViewContextMenu::IssuePreconnectionToUrl(
const std::string& anonymization_key_url,
const std::string& preconnect_url) { … }
bool RenderViewContextMenu::IsInProgressiveWebApp() const { … }
void RenderViewContextMenu::InitMenu() { … }
Profile* RenderViewContextMenu::GetProfile() const { … }
int RenderViewContextMenu::GetSearchForImageIdc() const { … }
int RenderViewContextMenu::GetTranslateImageIdc() const { … }
int RenderViewContextMenu::GetRegionSearchIdc() const { … }
int RenderViewContextMenu::GetSearchForVideoFrameIdc() const { … }
const TemplateURL* RenderViewContextMenu::GetImageSearchProvider() const { … }
std::u16string RenderViewContextMenu::GetImageSearchProviderName(
const TemplateURL* provider) const { … }
void RenderViewContextMenu::RecordUsedItem(int id) { … }
void RenderViewContextMenu::RecordShownItem(int id, bool is_submenu) { … }
bool RenderViewContextMenu::IsHTML5Fullscreen() const { … }
bool RenderViewContextMenu::IsPressAndHoldEscRequiredToExitFullscreen() const { … }
#if BUILDFLAG(ENABLE_PLUGINS)
void RenderViewContextMenu::HandleAuthorizeAllPlugins() { … }
#endif
void RenderViewContextMenu::AppendPrintPreviewItems() { … }
const Extension* RenderViewContextMenu::GetExtension() const { … }
std::u16string RenderViewContextMenu::GetTargetLanguageDisplayName(
bool is_full_page_translation) const { … }
#if BUILDFLAG(ENABLE_COMPOSE)
ChromeComposeClient* RenderViewContextMenu::GetChromeComposeClient() const { … }
#endif
void RenderViewContextMenu::AppendDeveloperItems() { … }
void RenderViewContextMenu::AppendDevtoolsForUnpackedExtensions() { … }
void RenderViewContextMenu::AppendLinkItems() { … }
void RenderViewContextMenu::AppendOpenWithLinkItems() { … }
void RenderViewContextMenu::AppendReadWriteCardItems() { … }
void RenderViewContextMenu::AppendSmartSelectionActionItems() { … }
void RenderViewContextMenu::AppendOpenInWebAppLinkItems() { … }
void RenderViewContextMenu::AppendImageItems() { … }
void RenderViewContextMenu::AppendSearchWebForImageItems() { … }
void RenderViewContextMenu::AppendAudioItems() { … }
void RenderViewContextMenu::AppendCanvasItems() { … }
void RenderViewContextMenu::AppendVideoItems() { … }
void RenderViewContextMenu::AppendMediaItems() { … }
void RenderViewContextMenu::AppendPluginItems() { … }
void RenderViewContextMenu::AppendPageItems() { … }
void RenderViewContextMenu::AppendExitFullscreenItem() { … }
void RenderViewContextMenu::AppendCopyItem() { … }
void RenderViewContextMenu::AppendLinkToTextItems() { … }
void RenderViewContextMenu::AppendPrintItem() { … }
void RenderViewContextMenu::AppendPartialTranslateItem() { … }
void RenderViewContextMenu::AppendTranslateItem() { … }
void RenderViewContextMenu::AppendMediaRouterItem() { … }
void RenderViewContextMenu::AppendReadingModeItem() { … }
void RenderViewContextMenu::AppendRotationItems() { … }
void RenderViewContextMenu::AppendSearchProvider() { … }
void RenderViewContextMenu::AppendSpellingAndSearchSuggestionItems() { … }
void RenderViewContextMenu::AppendOtherEditableItems() { … }
void RenderViewContextMenu::AppendLanguageSettings() { … }
void RenderViewContextMenu::AppendSpellingSuggestionItems() { … }
bool RenderViewContextMenu::AppendAccessibilityLabelsItems() { … }
void RenderViewContextMenu::AppendProtocolHandlerSubMenu() { … }
void RenderViewContextMenu::AppendPasswordItems() { … }
void RenderViewContextMenu::AppendSharingItems() { … }
void RenderViewContextMenu::AppendClickToCallItem() { … }
void RenderViewContextMenu::AppendRegionSearchItem() { … }
void RenderViewContextMenu::AppendLiveCaptionItem() { … }
bool RenderViewContextMenu::IsCommandIdEnabled(int id) const { … }
bool RenderViewContextMenu::IsCommandIdChecked(int id) const { … }
bool RenderViewContextMenu::IsCommandIdVisible(int id) const { … }
void RenderViewContextMenu::OpenURLWithExtraHeaders(
const GURL& url,
const GURL& referring_url,
const url::Origin& initiator,
WindowOpenDisposition disposition,
ui::PageTransition transition,
const std::string& extra_headers,
bool started_from_context_menu) { … }
void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { … }
void RenderViewContextMenu::AddSpellCheckServiceItem(bool is_checked) { … }
void RenderViewContextMenu::AddAccessibilityLabelsServiceItem(bool is_checked) { … }
void RenderViewContextMenu::RegisterMenuShownCallbackForTesting(
base::OnceCallback<void(RenderViewContextMenu*)> cb) { … }
void RenderViewContextMenu::RegisterExecutePluginActionCallbackForTesting(
ExecutePluginActionCallback cb) { … }
custom_handlers::ProtocolHandlerRegistry::ProtocolHandlerList
RenderViewContextMenu::GetHandlersForLinkUrl() { … }
void RenderViewContextMenu::OnProtocolHandlerRegistryChanged() { … }
void RenderViewContextMenu::NotifyMenuShown() { … }
std::u16string RenderViewContextMenu::PrintableSelectionText() { … }
void RenderViewContextMenu::EscapeAmpersands(std::u16string* text) { … }
#if BUILDFLAG(IS_CHROMEOS)
const policy::DlpRulesManager* RenderViewContextMenu::GetDlpRulesManager()
const {
return policy::DlpRulesManagerFactory::GetForPrimaryProfile();
}
#endif
bool RenderViewContextMenu::IsSaveAsItemAllowedByPolicy(
const GURL& item_url) const { … }
bool RenderViewContextMenu::IsSaveAsItemAllowedByUntrustedNetworkStatus()
const { … }
bool RenderViewContextMenu::IsReloadEnabled() const { … }
bool RenderViewContextMenu::IsViewSourceEnabled() const { … }
bool RenderViewContextMenu::IsDevCommandEnabled(int id) const { … }
bool RenderViewContextMenu::IsTranslateEnabled() const { … }
bool RenderViewContextMenu::IsSaveLinkAsEnabled() const { … }
bool RenderViewContextMenu::IsSaveImageAsEnabled() const { … }
bool RenderViewContextMenu::IsSaveAsEnabled() const { … }
bool RenderViewContextMenu::IsSavePageEnabled() const { … }
bool RenderViewContextMenu::IsPasteEnabled() const { … }
bool RenderViewContextMenu::IsOpenLinkAllowedByDlp(const GURL& link_url) const { … }
bool RenderViewContextMenu::IsPasteAndMatchStyleEnabled() const { … }
bool RenderViewContextMenu::IsPrintPreviewEnabled() const { … }
bool RenderViewContextMenu::IsQRCodeGeneratorEnabled() const { … }
bool RenderViewContextMenu::IsRegionSearchEnabled() const { … }
bool RenderViewContextMenu::IsVideoFrameItemEnabled(int id) const { … }
bool RenderViewContextMenu::AppendQRCodeGeneratorItem(bool for_image,
bool draw_icon,
bool add_separator) { … }
void RenderViewContextMenu::AppendSendTabToSelfItem(bool add_separator) { … }
std::unique_ptr<ui::DataTransferEndpoint>
RenderViewContextMenu::CreateDataEndpoint(bool notify_if_restricted) const { … }
bool RenderViewContextMenu::IsRouteMediaEnabled() const { … }
bool RenderViewContextMenu::IsOpenLinkOTREnabled() const { … }
void RenderViewContextMenu::ExecOpenWebApp() { … }
void RenderViewContextMenu::ExecOpenLinkPreview() { … }
void RenderViewContextMenu::ExecProtocolHandler(int event_flags,
int handler_index) { … }
void RenderViewContextMenu::ExecOpenLinkInProfile(int profile_index) { … }
#if BUILDFLAG(ENABLE_COMPOSE)
void RenderViewContextMenu::ExecOpenCompose() { … }
#endif
void RenderViewContextMenu::ExecOpenInReadAnything() { … }
void RenderViewContextMenu::ExecInspectElement() { … }
void RenderViewContextMenu::ExecInspectBackgroundPage() { … }
void RenderViewContextMenu::CheckSupervisedUserURLFilterAndSaveLinkAs() { … }
void RenderViewContextMenu::OnSupervisedUserURLFilterChecked(
supervised_user::FilteringBehavior filtering_behavior,
supervised_user::FilteringBehaviorReason reason,
bool uncertain) { … }
void RenderViewContextMenu::ExecSaveLinkAs() { … }
void RenderViewContextMenu::ExecSaveAs() { … }
void RenderViewContextMenu::ExecExitFullscreen() { … }
void RenderViewContextMenu::ExecCopyLinkText() { … }
void RenderViewContextMenu::ExecCopyImageAt() { … }
void RenderViewContextMenu::ExecSearchLensForImage(int event_flags,
bool is_image_translate) { … }
void RenderViewContextMenu::OpenLensOverlayWithPreselectedRegion(
mojo::AssociatedRemote<chrome::mojom::ChromeRenderFrame>
chrome_render_frame,
const gfx::Rect& tab_bounds,
const gfx::Rect& view_bounds,
float device_scale_factor,
const SkBitmap& region_bitmap,
const gfx::Rect& region_bounds) { … }
void RenderViewContextMenu::ExecRegionSearch(
int event_flags,
bool is_google_default_search_provider) { … }
void RenderViewContextMenu::ExecSearchWebForImage(bool is_image_translate) { … }
void RenderViewContextMenu::ExecSearchWebInCompanionSidePanel(const GURL& url) { … }
void RenderViewContextMenu::ExecSearchWebInSidePanel(const GURL& url) { … }
void RenderViewContextMenu::ExecLoadImage() { … }
void RenderViewContextMenu::ExecLoop() { … }
void RenderViewContextMenu::ExecControls() { … }
void RenderViewContextMenu::ExecSaveVideoFrameAs() { … }
void RenderViewContextMenu::ExecCopyVideoFrame() { … }
void RenderViewContextMenu::ExecSearchForVideoFrame(int event_flags) { … }
void RenderViewContextMenu::ExecLiveCaption() { … }
void RenderViewContextMenu::ExecRotateCW() { … }
void RenderViewContextMenu::ExecRotateCCW() { … }
void RenderViewContextMenu::ExecReloadPackagedApp() { … }
void RenderViewContextMenu::ExecRestartPackagedApp() { … }
void RenderViewContextMenu::ExecPrint() { … }
void RenderViewContextMenu::ExecRouteMedia() { … }
void RenderViewContextMenu::ExecTranslate() { … }
void RenderViewContextMenu::ExecPartialTranslate() { … }
void RenderViewContextMenu::ExecLanguageSettings(int event_flags) { … }
void RenderViewContextMenu::ExecProtocolHandlerSettings(int event_flags) { … }
void RenderViewContextMenu::ExecPictureInPicture() { … }
void RenderViewContextMenu::MediaPlayerAction(
const blink::mojom::MediaPlayerAction& action) { … }
void RenderViewContextMenu::SearchForVideoFrame(
int event_flags,
const SkBitmap& bitmap,
const gfx::Rect& region_bounds) { … }
void RenderViewContextMenu::PluginActionAt(
const gfx::Point& location,
blink::mojom::PluginActionType plugin_action) { … }
Browser* RenderViewContextMenu::GetBrowser() const { … }
bool RenderViewContextMenu::CanTranslate(bool menu_logging) { … }
bool RenderViewContextMenu::CanPartiallyTranslateTargetLanguage() { … }
void RenderViewContextMenu::MaybePrepareForLensQuery() { … }
#if BUILDFLAG(IS_CHROMEOS)
void RenderViewContextMenu::ShowClipboardHistoryMenu(int event_flags) {
auto* const host_native_view =
GetRenderFrameHost() ? GetRenderFrameHost()->GetNativeView() : nullptr;
if (!host_native_view) {
return;
}
gfx::Point anchor_point_in_screen =
host_native_view->GetBoundsInScreen().origin();
anchor_point_in_screen.Offset(params_.x, params_.y);
const ui::MenuSourceType source_type = ui::GetMenuSourceType(event_flags);
#if BUILDFLAG(IS_CHROMEOS_ASH)
ash::ClipboardHistoryController::Get()->ShowMenu(
gfx::Rect(anchor_point_in_screen, gfx::Size()), source_type,
crosapi::mojom::ClipboardHistoryControllerShowSource::
kRenderViewContextMenu);
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
if (auto* service = chromeos::LacrosService::Get();
service && service->IsAvailable<crosapi::mojom::ClipboardHistory>()) {
service->GetRemote<crosapi::mojom::ClipboardHistory>()->ShowClipboard(
gfx::Rect(anchor_point_in_screen, gfx::Size()), source_type,
crosapi::mojom::ClipboardHistoryControllerShowSource::
kRenderViewContextMenu);
}
#endif
}
#endif