1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 package org.chromium.chrome.browser.contextmenu;
7 import org.chromium.chrome.browser.Tab;
8 import org.chromium.content.browser.ContentViewCore;
9 import org.chromium.content_public.common.Referrer;
12 * A delegate responsible for taking actions based on context menu selections.
14 public interface ChromeContextMenuItemDelegate {
16 * @return Whether or not this context menu is being shown for an incognito
17 * {@link ContentViewCore}.
19 boolean isIncognito();
22 * @return Whether or not the current application can show incognito tabs.
24 boolean isIncognitoSupported();
27 * @return Whether or not the context menu should give the user the chance to show the original
30 boolean canLoadOriginalImage();
33 * Called when the context menu is trying to start a download.
34 * @param url Url of the download item.
35 * @param isLink Whether or not the download is a link (as opposed to an image/video).
36 * @return Whether or not a download should actually be started.
38 boolean startDownload(String url, boolean isLink);
41 * Called when the {@code url} should be opened in a new tab with the same incognito state as
42 * the current {@link Tab}.
43 * @param url The URL to open.
45 void onOpenInNewTab(String url, Referrer referrer);
48 * Called when the {@code url} should be opened in a new incognito tab.
49 * @param url The URL to open.
51 void onOpenInNewIncognitoTab(String url);
54 * Called when the {@code url} is of an image and should be opened in the same tab.
55 * @param url The image URL to open.
57 void onOpenImageUrl(String url, Referrer referrer);
60 * Called when the {@code url} is of an image and should be opened in a new tab.
61 * @param url The image URL to open.
63 void onOpenImageInNewTab(String url, Referrer referrer);
66 * Called when the {@code text} should be saved to the clipboard.
67 * @param text The text to save to the clipboard.
68 * @param isUrl Whether or not the text is a URL.
70 void onSaveToClipboard(String text, boolean isUrl);
73 * Called when the {@code url} is of an image and a link to the image should be saved to the
75 * @param url The image URL.
77 void onSaveImageToClipboard(String url);
80 * Called when a search by image should be performed in a new tab.
82 void onSearchByImageInNewTab();