android-components / mozilla.components.feature.contextmenu / ContextMenuCandidate

# ContextMenuCandidate

`data class ContextMenuCandidate` (source)

A candidate for an item to be displayed in the context menu.

### Constructors

<init> | `ContextMenuCandidate(id: String, label: String, showFor: (Session, HitResult) -> Boolean, action: (Session, HitResult) -> Unit)` A candidate for an item to be displayed in the context menu.

### Properties

action | `val action: (Session, HitResult) -> Unit` The action to be invoked once the user selects this item.
id | `val id: String` A unique ID that will be used to uniquely identify the candidate that the user selected.
label | `val label: String` The label that will be displayed in the context menu
showFor | `val showFor: (Session, HitResult) -> Boolean` If this lambda returns true for a given Session and HitResult then it will be displayed in the context menu.

### Companion Object Functions

createCopyImageLocationCandidate | `fun createCopyImageLocationCandidate(context: Context, snackBarParentView: View): ContextMenuCandidate` Context Menu item: "Copy Image Location".
createCopyLinkCandidate | `fun createCopyLinkCandidate(context: Context, snackBarParentView: View): ContextMenuCandidate` Context Menu item: "Copy Link".
createOpenImageInNewTabCandidate | `fun createOpenImageInNewTabCandidate(context: Context, tabsUseCases: TabsUseCases, snackBarParentView: View): ContextMenuCandidate` Context Menu item: "Open Image in New Tab".
createOpenInNewTabCandidate | `fun createOpenInNewTabCandidate(context: Context, tabsUseCases: TabsUseCases, snackBarParentView: View): ContextMenuCandidate` Context Menu item: "Open Link in New Tab".
createOpenInPrivateTabCandidate | `fun createOpenInPrivateTabCandidate(context: Context, tabsUseCases: TabsUseCases, snackBarParentView: View): ContextMenuCandidate` Context Menu item: "Open Link in Private Tab".
createSaveImageCandidate | `fun createSaveImageCandidate(context: Context): ContextMenuCandidate` Context Menu item: "Save image".
createShareLinkCandidate | `fun createShareLinkCandidate(context: Context): ContextMenuCandidate` Context Menu item: "Share Link".
defaultCandidates | `fun defaultCandidates(context: Context, tabsUseCases: TabsUseCases, snackBarParentView: View): List<ContextMenuCandidate>` Returns the default list of context menu candidates.