Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1010)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuUi.java

Issue 2747453002: Split context menu display and population/handling (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698