fix link context menus

    http://b/issue?id=3351385
    http://b/issue?id=3352255

    remove bookmark/share link option
    change open in new tab text based on open in background setting

Change-Id: I3930d085339a7f829d8ef4f1afc879b4df743f24
diff --git a/res/menu/browsercontext.xml b/res/menu/browsercontext.xml
index f5361d5..a8ae5c8 100644
--- a/res/menu/browsercontext.xml
+++ b/res/menu/browsercontext.xml
@@ -40,12 +40,8 @@
             android:title="@string/contextmenu_openlink"/>
         <item android:id="@+id/open_newtab_context_menu_id"
             android:title="@string/contextmenu_openlink_newwindow"/>
-        <item android:id="@+id/bookmark_context_menu_id"
-            android:title="@string/contextmenu_bookmark_thislink"/>
         <item android:id="@+id/save_link_context_menu_id"
             android:title="@string/contextmenu_savelink"/>
-        <item android:id="@+id/share_link_context_menu_id"
-            android:title="@string/contextmenu_sharelink"/>
         <item android:id="@+id/copy_link_context_menu_id"
             android:title="@string/contextmenu_copylink"/>
     </group>
diff --git a/res/values-xlarge/strings.xml b/res/values-xlarge/strings.xml
index 8dcabe2..ee20dfa 100644
--- a/res/values-xlarge/strings.xml
+++ b/res/values-xlarge/strings.xml
@@ -25,6 +25,9 @@
     <!-- Context Menu item to open the currently selected link in a new
          window. [CHAR LIMIT=30] -->
     <string name="contextmenu_openlink_newwindow">Open in new tab</string>
+    <!-- Context Menu item to open the currently selected link in a new
+         background window. [CHAR LIMIT=50] -->
+    <string name="contextmenu_openlink_newwindow_background">Open in new background tab</string>
     <!-- Context menu item to open every bookmark in a folder in new tabs [CHAR LIMIT=50] -->
     <string name="open_all_in_new_window">Open all in new tabs</string>
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 09bd56d..5452b63 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -248,15 +248,12 @@
     <!-- Context Menu item to open the currently selected link in a new
             window. -->
     <string name="contextmenu_openlink_newwindow">Open in new window</string>
-    <!-- Context Menu item to create a bookmark for the url of the currently
-            selected link. -->
-    <string name="contextmenu_bookmark_thislink">Bookmark link</string>
+    <!-- Context Menu item to open the currently selected link in a new
+         background window. [CHAR LIMIT=50] -->
+    <string name="contextmenu_openlink_newwindow_background">Open in new background window</string>
     <!-- Context Menu item to save the webpage referred to by this link to the
             SD card (external storage) -->
     <string name="contextmenu_savelink">Save link</string>
-    <!-- Context Menu item to send the url of the selected link to someone else,
-            via Gmail or another app -->
-    <string name="contextmenu_sharelink">Share link</string>
     <!-- Context Menu item -->
     <string name="contextmenu_copy">Copy</string>
     <!-- Context Menu item to copy the url of the selected link to the
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index b79acab..fe19927 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -461,18 +461,6 @@
                                     parent.addChildTab(newTab);
                                 }
                                 break;
-                            case R.id.bookmark_context_menu_id:
-                                Intent intent = new Intent(mActivity,
-                                        AddBookmarkPage.class);
-                                intent.putExtra(BrowserContract.Bookmarks.URL, url);
-                                intent.putExtra(BrowserContract.Bookmarks.TITLE,
-                                        title);
-                                mActivity.startActivity(intent);
-                                break;
-                            case R.id.share_link_context_menu_id:
-                                sharePage(mActivity, title, url, null,
-                                        null);
-                                break;
                             case R.id.copy_link_context_menu_id:
                                 copy(url);
                                 break;
@@ -1309,6 +1297,10 @@
                 boolean showNewTab = mTabControl.canCreateNewTab();
                 MenuItem newTabItem
                         = menu.findItem(R.id.open_newtab_context_menu_id);
+                newTabItem.setTitle(
+                        BrowserSettings.getInstance().openInBackground()
+                        ? R.string.contextmenu_openlink_newwindow_background
+                        : R.string.contextmenu_openlink_newwindow);
                 newTabItem.setVisible(showNewTab);
                 if (showNewTab) {
                     if (WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE == type) {
@@ -1343,15 +1335,6 @@
                                 });
                     }
                 }
-                menu.findItem(R.id.bookmark_context_menu_id).setVisible(
-                        Bookmarks.urlHasAcceptableScheme(extra));
-                PackageManager pm = mActivity.getPackageManager();
-                Intent send = new Intent(Intent.ACTION_SEND);
-                send.setType("text/plain");
-                ResolveInfo ri = pm.resolveActivity(send,
-                        PackageManager.MATCH_DEFAULT_ONLY);
-                menu.findItem(R.id.share_link_context_menu_id)
-                        .setVisible(ri != null);
                 if (type == WebView.HitTestResult.SRC_ANCHOR_TYPE) {
                     break;
                 }
@@ -1650,9 +1633,7 @@
                 break;
             // -- Browser context menu
             case R.id.open_context_menu_id:
-            case R.id.bookmark_context_menu_id:
             case R.id.save_link_context_menu_id:
-            case R.id.share_link_context_menu_id:
             case R.id.copy_link_context_menu_id:
                 final WebView webView = getCurrentTopWebView();
                 if (null == webView) {