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

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

Issue 73173002: Add ContextMenu support upstream for Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years 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/ContextMenuPopulatorWrapper.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuPopulatorWrapper.java b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuPopulatorWrapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..00051137d24655c8d0841b8bd76a37c4856a4816
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuPopulatorWrapper.java
@@ -0,0 +1,40 @@
+// 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 android.content.Context;
+import android.view.ContextMenu;
+
+/**
+ * A simple wrapper around a {@link ContextMenuPopulator} to handle delegating calls to another
+ * populator while allowing overriding of specific methods.
+ */
+public class ContextMenuPopulatorWrapper implements ContextMenuPopulator {
+ private final ContextMenuPopulator mPopulator;
+
+ /**
+ * Constructs an instance of a {@link ContextMenuPopulator} and delegate calls to
+ * {@code populator}.
+ * @param populator The {@link ContextMenuPopulator} to delegate calls to.
+ */
+ public ContextMenuPopulatorWrapper(ContextMenuPopulator populator) {
+ mPopulator = populator;
+ }
+
+ @Override
+ public boolean shouldShowContextMenu(ContextMenuParams params) {
+ return mPopulator.shouldShowContextMenu(params);
+ }
+
+ @Override
+ public void buildContextMenu(ContextMenu menu, Context context, ContextMenuParams params) {
+ mPopulator.buildContextMenu(menu, context, params);
+ }
+
+ @Override
+ public boolean onItemSelected(ContextMenuHelper helper, ContextMenuParams params, int itemId) {
+ return mPopulator.onItemSelected(helper, params, itemId);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698