root/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuItemDelegate.java

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. isIncognito
  2. isIncognitoSupported
  3. canLoadOriginalImage
  4. startDownload
  5. onOpenInNewTab
  6. onOpenInNewIncognitoTab
  7. onOpenImageUrl
  8. onOpenImageInNewTab
  9. onSaveToClipboard
  10. onSaveImageToClipboard
  11. onSearchByImageInNewTab

// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.contextmenu;

import org.chromium.chrome.browser.Tab;
import org.chromium.content_public.Referrer;

/**
 * A delegate responsible for taking actions based on context menu selections.
 */
public interface ChromeContextMenuItemDelegate {
    /**
     * @return Whether or not this context menu is being shown for an incognito {@link ContentView}.
     */
    boolean isIncognito();

    /**
     * @return Whether or not the current application can show incognito tabs.
     */
    boolean isIncognitoSupported();

    /**
     * @return Whether or not the context menu should give the user the chance to show the original
     *         image.
     */
    boolean canLoadOriginalImage();

    /**
     * Called when the context menu is trying to start a download.
     * @param isLink Whether or not the download is a link (as opposed to an image/video).
     * @return       Whether or not a download should actually be started.
     */
    boolean startDownload(boolean isLink);

    /**
     * Called when the {@code url} should be opened in a new tab with the same incognito state as
     * the current {@link Tab}.
     * @param url The URL to open.
     */
    void onOpenInNewTab(String url, Referrer referrer);

    /**
     * Called when the {@code url} should be opened in a new incognito tab.
     * @param url The URL to open.
     */
    void onOpenInNewIncognitoTab(String url);

    /**
     * Called when the {@code url} is of an image and should be opened in the same tab.
     * @param url The image URL to open.
     */
    void onOpenImageUrl(String url, Referrer referrer);

    /**
     * Called when the {@code url} is of an image and should be opened in a new tab.
     * @param url The image URL to open.
     */
    void onOpenImageInNewTab(String url, Referrer referrer);

    /**
     * Called when the {@code text} should be saved to the clipboard.
     * @param text  The text to save to the clipboard.
     * @param isUrl Whether or not the text is a URL.
     */
    void onSaveToClipboard(String text, boolean isUrl);

    /**
     * Called when the {@code url} is of an image and a link to the image should be saved to the
     * clipboard.
     * @param url The image URL.
     */
    void onSaveImageToClipboard(String url);

    /**
     * Called when a search by image should be performed in a new tab.
     */
    void onSearchByImageInNewTab();
}

/* [<][>][^][v][top][bottom][index][help] */