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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwWebContentsViewDelegate.java

Issue 11471040: [Android WebView] Convert context menu callback to long press (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comments. Ready for review/submit. Created 8 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: android_webview/java/src/org/chromium/android_webview/AwWebContentsViewDelegate.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwWebContentsViewDelegate.java b/android_webview/java/src/org/chromium/android_webview/AwWebContentsViewDelegate.java
new file mode 100644
index 0000000000000000000000000000000000000000..2081a0bff192b4098b08adc2c9ee9435dce7dafd
--- /dev/null
+++ b/android_webview/java/src/org/chromium/android_webview/AwWebContentsViewDelegate.java
@@ -0,0 +1,36 @@
+// Copyright (c) 2012 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.android_webview;
+
+import android.view.ViewGroup;
+
+import org.chromium.base.CalledByNative;
+import org.chromium.base.JNINamespace;
+
+/**
+ * Java counter-part of AwWebContentsViewDelegate. Used only for handling
+ * context menu callback currently.
joth 2012/12/11 01:22:11 nit: delete second sentence. (too easy to go out o
boliu 2012/12/11 02:25:33 Done.
+ */
+@JNINamespace("android_webview")
+public class AwWebContentsViewDelegate {
+ private int mNativeAwWebContentsViewDelegate;
+ private ViewGroup mContainerView;
+
+ // Package private. Called by AwContents.
+ AwWebContentsViewDelegate(int nativeAwWebContentsViewDelegate,
+ ViewGroup containerView) {
+ mNativeAwWebContentsViewDelegate = nativeAwWebContentsViewDelegate;
+ mContainerView = containerView;
+ }
+
+ @CalledByNative
+ private void onShowContextMenu() {
+ // Context menu callback in Chromium is triggered by WebKit on an
+ // unhandled GestureLongPress event. Convert the context menu callback
+ // back into a long click event for Android WebView since the view
+ // system may choose to handle the gesture.
+ mContainerView.performLongClick();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698