Index: chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuUi.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuUi.java b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuUi.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9cd8cc6a00f463660e20c74234e6e9fd98603a3d |
--- /dev/null |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuUi.java |
@@ -0,0 +1,40 @@ |
+// Copyright 2017 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 android.app.Activity; |
+import android.util.Pair; |
+ |
+import java.util.List; |
+ |
+/** |
+ * A representation of the ContextMenu UI. Given a list of items it should populate and display a |
+ * context menu. |
+ */ |
+public interface ContextMenuUi { |
+ /** |
+ * Shows the Context Menu in Chrome. |
+ * @param activity Used to inflate the context menu. |
+ * @param params The current parameters for the the context menu. |
+ * @param items The list of items that need to be displayed in the context menu items. This is |
+ * taken from the return value of {@link ContextMenuPopulator#buildContextMenu( |
+ * ContextMenu, Context, ContextMenuParams)}. |
+ */ |
+ void displayMenu(Activity activity, ContextMenuParams params, |
+ List<Pair<Integer, List<ContextMenuItems>>> items); |
+ |
+ /** |
+ * When the item is clicked, this will dispatch the listener. This should generally be put |
+ * into the constructor of the class that implements this interface. This way the UI has a way |
+ * of returning actions that are used. |
+ */ |
+ interface OnMenuClickedListener { |
+ /** |
+ * When an item is clicked in the UI this will dispatch the menuId that was clicked. |
+ * @param menuId The menu id from ids.xml. |
+ */ |
+ void onItemClicked(int menuId); |
+ } |
+} |