diff --git a/java/com/android/mailcommon/WebViewContextMenu.java b/java/com/android/mailcommon/WebViewContextMenu.java
index 06e0d0d..0de87d6 100644
--- a/java/com/android/mailcommon/WebViewContextMenu.java
+++ b/java/com/android/mailcommon/WebViewContextMenu.java
@@ -18,7 +18,6 @@
 package com.android.mailcommon;
 
 import android.app.Activity;
-import android.content.ActivityNotFoundException;
 import android.content.ClipData;
 import android.content.ClipboardManager;
 import android.content.Context;
@@ -26,8 +25,6 @@
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.net.Uri;
-import android.os.Handler;
-import android.os.Message;
 import android.provider.ContactsContract;
 import android.view.ContextMenu;
 import android.view.ContextMenu.ContextMenuInfo;
@@ -56,20 +53,9 @@
  * <li>res/values/webview_context_menu_strings.xml</li>
  * </ul>
  */
-public abstract class WebViewContextMenu implements OnCreateContextMenuListener {
+public abstract class WebViewContextMenu implements OnCreateContextMenuListener,
+        MenuItem.OnMenuItemClickListener {
 
-    // Message flag meaning that we are grabbing the url.
-    private static final int FOCUS_NODE_HREF = 1;
-    // Message flag meaning that the url is to be used for the title header.
-    private static final int HEADER_FLAG     = Integer.MIN_VALUE;
-    private static final int EXECUTE_FALSE   = Integer.MIN_VALUE;
-    // Flag telling us whether we should perform the action (open/copy) as
-    // soon as we receive the title message, and if so, which action to take.
-    private int mExecute = EXECUTE_FALSE;
-
-    // Title for the context menu.  Store a pointer so we can access its
-    // title when the user selects an option.
-    private TextView mTitleView = null;
     private Activity mActivity;
 
     protected static enum MenuType {
@@ -97,36 +83,6 @@
         this.mActivity = host;
     }
 
-    /**
-     * Used to send UI work back to the UI thread
-     */
-    private final Handler mHandler = new Handler() {
-        @Override
-        public void handleMessage(Message msg) {
-            switch (msg.what) {
-                case FOCUS_NODE_HREF:
-                    String url = (String) msg.getData().get("url");
-                    if (url == null || url.length() == 0) {
-                        break;
-                    }
-                    switch (msg.arg1) {
-                        case HEADER_FLAG:
-                            if (EXECUTE_FALSE == mExecute) {
-                                mTitleView.setText(url);
-                                break;
-                            }
-                            msg.arg1 = mExecute;
-                            onContextItemSelectedInternal(msg.arg1, url);
-                            break;
-                        default:
-                    }
-                    break;
-                default:
-                    super.handleMessage(msg);
-            }
-        }
-    };
-
     // For our copy menu items.
     private class Copy implements MenuItem.OnMenuItemClickListener {
         private final CharSequence mText;
@@ -135,12 +91,28 @@
             mText = text;
         }
 
+        @Override
         public boolean onMenuItemClick(MenuItem item) {
             copy(mText);
             return true;
         }
     }
 
+    // For our share menu items.
+    private class Share implements MenuItem.OnMenuItemClickListener {
+        private final String mUri;
+
+        public Share(String text) {
+            mUri = text;
+        }
+
+        @Override
+        public boolean onMenuItemClick(MenuItem item) {
+            shareLink(mUri);
+            return true;
+        }
+    }
+
     private boolean showShareLinkMenuItem() {
         PackageManager pm = mActivity.getPackageManager();
         Intent send = new Intent(Intent.ACTION_SEND);
@@ -196,6 +168,14 @@
         // 1251210 is fixed.
         inflater.inflate(getMenuResourceId(), menu);
 
+        // Initially make set the menu item handler this WebViewContextMenu, which will default to
+        // calling the non-abstract subclass's implementation.
+        for (int i = 0; i < menu.size(); i++) {
+            final MenuItem menuItem = menu.getItem(i);
+            menuItem.setOnMenuItemClickListener(this);
+        }
+
+
         // Show the correct menu group
         String extra = result.getExtra();
         menu.setGroupVisible(getMenuGroupResId(MenuGroupType.PHONE_GROUP),
@@ -222,22 +202,31 @@
 
                 menu.setHeaderTitle(decodedPhoneExtra);
                 // Dial
-                menu.findItem(getMenuResIdForMenuType(MenuType.DIAL_MENU)).setIntent(
-                        new Intent(Intent.ACTION_VIEW, Uri
-                                .parse(WebView.SCHEME_TEL + extra)));
+                final MenuItem dialMenuItem =
+                        menu.findItem(getMenuResIdForMenuType(MenuType.DIAL_MENU));
+                // remove the on click listener
+                dialMenuItem.setOnMenuItemClickListener(null);
+                dialMenuItem.setIntent(new Intent(Intent.ACTION_VIEW,
+                        Uri.parse(WebView.SCHEME_TEL + extra)));
 
                 // Send SMS
-                menu.findItem(getMenuResIdForMenuType(MenuType.SMS_MENU)).setIntent(
-                        new Intent(Intent.ACTION_SENDTO, Uri
-                                .parse("smsto:" + extra)));
+                final MenuItem sendSmsMenuItem =
+                        menu.findItem(getMenuResIdForMenuType(MenuType.SMS_MENU));
+                // remove the on click listener
+                sendSmsMenuItem.setOnMenuItemClickListener(null);
+                sendSmsMenuItem.setIntent(new Intent(Intent.ACTION_SENDTO,
+                        Uri.parse("smsto:" + extra)));
 
                 // Add to contacts
-                Intent addIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
+                final Intent addIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
                 addIntent.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE);
 
                 addIntent.putExtra(ContactsContract.Intents.Insert.PHONE, decodedPhoneExtra);
-                menu.findItem(getMenuResIdForMenuType(MenuType.ADD_CONTACT_MENU)).
-                        setIntent(addIntent);
+                final MenuItem addToContactsMenuItem =
+                        menu.findItem(getMenuResIdForMenuType(MenuType.ADD_CONTACT_MENU));
+                // remove the on click listener
+                addToContactsMenuItem.setOnMenuItemClickListener(null);
+                addToContactsMenuItem.setIntent(addIntent);
 
                 // Copy
                 menu.findItem(getMenuResIdForMenuType(MenuType.COPY_PHONE_MENU)).
@@ -262,78 +251,54 @@
                 catch (UnsupportedEncodingException ignore) {
                     // Should never happen; default charset is UTF-8
                 }
-                menu.findItem(getMenuResIdForMenuType(MenuType.MAP_MENU)).setIntent(
-                        new Intent(Intent.ACTION_VIEW, Uri
-                                .parse(WebView.SCHEME_GEO + geoExtra)));
+                final MenuItem viewMapMenuItem =
+                        menu.findItem(getMenuResIdForMenuType(MenuType.MAP_MENU));
+                // remove the on click listener
+                viewMapMenuItem.setOnMenuItemClickListener(null);
+                viewMapMenuItem.setIntent(new Intent(Intent.ACTION_VIEW,
+                        Uri.parse(WebView.SCHEME_GEO + geoExtra)));
                 menu.findItem(getMenuResIdForMenuType(MenuType.COPY_GEO_MENU)).
                         setOnMenuItemClickListener(new Copy(extra));
                 break;
 
             case WebView.HitTestResult.SRC_ANCHOR_TYPE:
             case WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE:
-                mTitleView = (TextView) LayoutInflater.from(mActivity)
-                        .inflate(getTitleViewLayoutResId(MenuType.SHARE_LINK_MENU), null);
-                menu.setHeaderView(mTitleView);
-
-                menu.findItem(getMenuResIdForMenuType(MenuType.SHARE_LINK_MENU)).setVisible(
-                        showShareLinkMenuItem());
                 // FIXME: Make this look like the normal menu header
                 // We cannot use the normal menu header because we need to
                 // edit the ContextMenu after it has been created.
-                Message headerMessage = mHandler.obtainMessage(
-                        FOCUS_NODE_HREF, HEADER_FLAG, 0);
-                webview.requestFocusNodeHref(headerMessage);
+                final TextView titleView = (TextView) LayoutInflater.from(mActivity)
+                        .inflate(getTitleViewLayoutResId(MenuType.SHARE_LINK_MENU), null);
+                menu.setHeaderView(titleView);
+
+                menu.findItem(getMenuResIdForMenuType(MenuType.SHARE_LINK_MENU)).setVisible(
+                        showShareLinkMenuItem());
+
+                // The documentation for WebView indicates that if the HitTestResult is
+                // SRC_ANCHOR_TYPE or the url would be specified in the extra.  We don't need to
+                // call requestFocusNodeHref().  If we wanted to handle UNKNOWN HitTestResults, we
+                // would.  With this knowledge, we can just set the title
+                titleView.setText(extra);
+
+                menu.findItem(getMenuResIdForMenuType(MenuType.COPY_LINK_MENU)).
+                        setOnMenuItemClickListener(new Copy(extra));
+
+                final MenuItem openLinkMenuItem =
+                        menu.findItem(getMenuResIdForMenuType(MenuType.OPEN_MENU));
+                // remove the on click listener
+                openLinkMenuItem.setOnMenuItemClickListener(null);
+                openLinkMenuItem.setIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(extra)));
+
+                menu.findItem(getMenuResIdForMenuType(MenuType.SHARE_LINK_MENU)).
+                        setOnMenuItemClickListener(new Share(extra));
                 break;
             default:
                 break;
         }
     }
 
-    public boolean onContextItemSelected(MenuItem item) {
-        int id = item.getItemId();
-        final MenuType menuType = getMenuTypeFromResId(id);
-        switch(menuType) {
-            case OPEN_MENU:
-            case COPY_LINK_MENU:
-            case SHARE_LINK_MENU:
-                String text = mTitleView.getText().toString();
-                // If we have not already received the title, make note that
-                // when we get it we should immediately perform the open or
-                // copy.
-                if (null == text || text.length() == 0) {
-                    mExecute = id;
-                } else {
-                    onContextItemSelectedInternal(id, text);
-                }
-                return true;
-            default:
-                return false;
-        }
-    }
-
-    // This is only to be used from the context menu.
-    private void onContextItemSelectedInternal(int id, String url) {
-        mTitleView = null;
-        mExecute = EXECUTE_FALSE;
-        final MenuType menuType = getMenuTypeFromResId(id);
-        switch (menuType) {
-            case OPEN_MENU:
-                Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
-                try {
-                    mActivity.startActivity(i);
-                } catch (ActivityNotFoundException ex) {
-                    // ignore the error
-                }
-                break;
-            case COPY_LINK_MENU:
-                copy(url);
-                break;
-            case SHARE_LINK_MENU:
-                shareLink(url);
-                break;
-            default:
-                break;
-        }
+    @Override
+    public boolean onMenuItemClick(MenuItem item) {
+        return onMenuItemSelected(item);
     }
 
     /**
@@ -375,4 +340,10 @@
      * Returns the resource id for the web view context menu
      */
     abstract protected int getMenuResourceId();
+
+
+    /**
+     * Called when a menu item is not handled by the context menu.
+     */
+    abstract protected boolean onMenuItemSelected(MenuItem menuItem);
 }
diff --git a/res/menu/webview_context_menu.xml b/res/menu/webview_context_menu.xml
index 82dbb00..f48ae39 100644
--- a/res/menu/webview_context_menu.xml
+++ b/res/menu/webview_context_menu.xml
@@ -48,6 +48,8 @@
             android:title="@string/contextmenu_copylink"/>
         <item android:id="@+id/share_link_context_menu_id"
             android:title="@string/contextmenu_sharelink"/>
+    </group>
+    <group android:id="@+id/HELP_FEEDBACK_GROUP">
         <item android:id="@+id/help_info_menu_item"
             android:icon="@android:drawable/ic_menu_help"
             android:title="@string/contextmenu_help" />
