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(); |
+ } |
+} |