OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.contextmenu; | 5 package org.chromium.chrome.browser.contextmenu; |
6 | 6 |
7 import android.content.Context; | 7 import android.app.Activity; |
8 import android.util.Pair; | 8 import android.util.Pair; |
9 | 9 |
10 import org.chromium.base.Callback; | 10 import org.chromium.base.Callback; |
11 | 11 |
12 import java.util.List; | 12 import java.util.List; |
13 | 13 |
14 /** | 14 /** |
15 * A representation of the ContextMenu UI. Given a list of items it should popul
ate and display a | 15 * A representation of the ContextMenu UI. Given a list of items it should popul
ate and display a |
16 * context menu. | 16 * context menu. |
17 */ | 17 */ |
18 public interface ContextMenuUi { | 18 public interface ContextMenuUi { |
19 /** | 19 /** |
20 * Shows the Context Menu in Chrome. | 20 * Shows the Context Menu in Chrome. |
21 * @param context Used to inflate the context menu. | 21 * @param activity Used to inflate the context menu. |
22 * @param params The current parameters for the the context menu. | 22 * @param params The current parameters for the the context menu. |
23 * @param items The list of items that need to be displayed in the context m
enu items. This is | 23 * @param items The list of items that need to be displayed in the context m
enu items. This is |
24 * taken from the return value of {@link ContextMenuPopulator#b
uildContextMenu( | 24 * taken from the return value of {@link ContextMenuPopulator#b
uildContextMenu( |
25 * ContextMenu, Context, ContextMenuParams)}. | 25 * ContextMenu, Context, ContextMenuParams)}. |
26 * @param onItemClicked When the user has pressed an item the menuId associa
ted with the item | 26 * @param onItemClicked When the user has pressed an item the menuId associa
ted with the item |
27 * is sent back through {@link Callback#onResult(Object
)}. The ids that | 27 * is sent back through {@link Callback#onResult(Object
)}. The ids that |
28 * could be called are in ids.xml. | 28 * could be called are in ids.xml. |
29 * @param onMenuShown After the menu is displayed this method should be call
ed to present a | 29 * @param onMenuShown After the menu is displayed this method should be call
ed to present a |
30 * full menu. | 30 * full menu. |
31 * @param onMenuClosed When the menu is closed, this method is called to do
any possible final | 31 * @param onMenuClosed When the menu is closed, this method is called to do
any possible final |
32 * clean up. | 32 * clean up. |
33 */ | 33 */ |
34 void displayMenu(Context context, ContextMenuParams params, | 34 void displayMenu(Activity activity, ContextMenuParams params, |
35 List<Pair<Integer, List<ContextMenuItem>>> items, Callback<Integer>
onItemClicked, | 35 List<Pair<Integer, List<ContextMenuItem>>> items, Callback<Integer>
onItemClicked, |
36 Runnable onMenuShown, Runnable onMenuClosed); | 36 Runnable onMenuShown, Runnable onMenuClosed); |
37 } | 37 } |
OLD | NEW |