Skip to content

Commit

Permalink
For mozilla-mobile#3326 - Remove open image in tab from context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
ekager committed Jun 11, 2019
1 parent 4d82c29 commit 1846a0c
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import mozilla.appservices.places.BookmarkRoot
import mozilla.components.browser.session.Session
import mozilla.components.browser.session.SessionManager
import mozilla.components.feature.app.links.AppLinksFeature
import mozilla.components.feature.contextmenu.ContextMenuCandidate
import mozilla.components.feature.contextmenu.ContextMenuFeature
import mozilla.components.feature.downloads.DownloadsFeature
import mozilla.components.feature.intent.IntentProcessor
Expand Down Expand Up @@ -206,7 +205,7 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
feature = ContextMenuFeature(
requireFragmentManager(),
sessionManager,
ContextMenuCandidate.defaultCandidates(
FenixContextMenuCandidate.defaultCandidates(
requireContext(),
requireComponents.useCases.tabsUseCases,
view,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package org.mozilla.fenix.browser

import android.content.Context
import android.view.View
import mozilla.components.feature.contextmenu.ContextMenuCandidate
import mozilla.components.feature.contextmenu.DefaultSnackbarDelegate
import mozilla.components.feature.tabs.TabsUseCases


class FenixContextMenuCandidate {
companion object {
/**
* Returns the default list of context menu candidates.
*
* We are removing open image in new tab temporarily see https://github.com/mozilla-mobile/fenix/issues/2312
*/
fun defaultCandidates(
context: Context,
tabsUseCases: TabsUseCases,
snackBarParentView: View,
snackbarDelegate: ContextMenuCandidate.SnackbarDelegate = DefaultSnackbarDelegate()
): List<ContextMenuCandidate> = listOf(
ContextMenuCandidate.createOpenInNewTabCandidate(
context,
tabsUseCases,
snackBarParentView,
snackbarDelegate
),
ContextMenuCandidate.createOpenInPrivateTabCandidate(
context,
tabsUseCases,
snackBarParentView,
snackbarDelegate
),
ContextMenuCandidate.createCopyLinkCandidate(context, snackBarParentView, snackbarDelegate),
ContextMenuCandidate.createShareLinkCandidate(context),
ContextMenuCandidate.createSaveImageCandidate(context),
ContextMenuCandidate.createCopyImageLocationCandidate(context, snackBarParentView, snackbarDelegate)
)
}
}

0 comments on commit 1846a0c

Please sign in to comment.