Bug 933428 - Remove "Share" and "Add to Home Screen" from about:home context menus. r=sriram, a=lsblakk
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Mon, 04 Nov 2013 14:38:59 -0800
changeset 167379 187487847908e206df27bede829162428a0e112c
parent 167378 11b4854b7cdf9c92fc75a2c979ec7962a57f2b4f
child 167380 890695773e5658b90187439706b170d07e8349ce
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssriram, lsblakk
bugs933428
milestone27.0a2
Bug 933428 - Remove "Share" and "Add to Home Screen" from about:home context menus. r=sriram, a=lsblakk
mobile/android/base/home/HomeFragment.java
mobile/android/base/resources/menu/home_contextmenu.xml
--- a/mobile/android/base/home/HomeFragment.java
+++ b/mobile/android/base/home/HomeFragment.java
@@ -1,17 +1,16 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.home;
 
 import org.mozilla.gecko.EditBookmarkDialog;
-import org.mozilla.gecko.favicons.Favicons;
 import org.mozilla.gecko.GeckoAppShell;
 import org.mozilla.gecko.GeckoEvent;
 import org.mozilla.gecko.GeckoProfile;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.ReaderModeUtils;
 import org.mozilla.gecko.Tabs;
 import org.mozilla.gecko.db.BrowserContract.Combined;
 import org.mozilla.gecko.db.BrowserDB;
@@ -36,19 +35,16 @@ import android.widget.Toast;
 /**
  * HomeFragment is an empty fragment that can be added to the HomePager.
  * Subclasses can add their own views. 
  */
 abstract class HomeFragment extends Fragment {
     // Log Tag.
     private static final String LOGTAG="GeckoHomeFragment";
 
-    // Share MIME type.
-    private static final String SHARE_MIME_TYPE = "text/plain";
-
     // Whether the fragment can load its content or not
     // This is used to defer data loading until the editing
     // mode animation ends.
     private boolean mCanLoadHint;
 
     // Whether the fragment has loaded its content
     private boolean mIsLoaded;
 
@@ -90,18 +86,16 @@ abstract class HomeFragment extends Frag
             menu.findItem(R.id.home_edit_bookmark).setVisible(false);
         }
 
         // Hide the "Remove" menuitem if this item doesn't have a bookmark or history ID.
         if (info.bookmarkId < 0 && info.historyId < 0) {
             menu.findItem(R.id.home_remove).setVisible(false);
         }
 
-        menu.findItem(R.id.home_share).setVisible(!GeckoProfile.get(getActivity()).inGuestMode());
-
         final boolean canOpenInReader = (info.display == Combined.DISPLAY_READER);
         menu.findItem(R.id.home_open_in_reader).setVisible(canOpenInReader);
     }
 
     @Override
     public boolean onContextItemSelected(MenuItem item) {
         // onContextItemSelected() is first dispatched to the activity and
         // then dispatched to its fragments. Since fragments cannot "override"
@@ -112,35 +106,16 @@ abstract class HomeFragment extends Frag
         if (menuInfo == null || !(menuInfo instanceof HomeContextMenuInfo)) {
             return false;
         }
 
         final HomeContextMenuInfo info = (HomeContextMenuInfo) menuInfo;
         final Context context = getActivity().getApplicationContext();
 
         final int itemId = item.getItemId();
-        if (itemId == R.id.home_share) {
-            if (info.url == null) {
-                Log.e(LOGTAG, "Can't share because URL is null");
-            } else {
-                GeckoAppShell.openUriExternal(info.url, SHARE_MIME_TYPE, "", "",
-                                              Intent.ACTION_SEND, info.getDisplayTitle());
-            }
-        }
-
-        if (itemId == R.id.home_add_to_launcher) {
-            if (info.url == null) {
-                Log.e(LOGTAG, "Can't add to home screen because URL is null");
-                return false;
-            }
-
-            // Fetch the largest cacheable icon size.
-            Favicons.getLargestFaviconForPage(info.url, new GeckoAppShell.CreateShortcutFaviconLoadedListener(info.url, info.getDisplayTitle()));
-            return true;
-        }
 
         if (itemId == R.id.home_open_private_tab || itemId == R.id.home_open_new_tab) {
             if (info.url == null) {
                 Log.e(LOGTAG, "Can't open in new tab because URL is null");
                 return false;
             }
 
             int flags = Tabs.LOADURL_NEW_TAB | Tabs.LOADURL_BACKGROUND;
--- a/mobile/android/base/resources/menu/home_contextmenu.xml
+++ b/mobile/android/base/resources/menu/home_contextmenu.xml
@@ -9,21 +9,15 @@
           android:title="@string/contextmenu_open_new_tab"/>
 
     <item android:id="@+id/home_open_private_tab"
           android:title="@string/contextmenu_open_private_tab"/>
 
     <item android:id="@+id/home_open_in_reader"
           android:title="@string/contextmenu_open_in_reader"/>
 
-    <item android:id="@+id/home_share"
-          android:title="@string/contextmenu_share"/>
-
     <item android:id="@+id/home_edit_bookmark"
           android:title="@string/contextmenu_edit_bookmark"/>
 
     <item android:id="@+id/home_remove"
           android:title="@string/contextmenu_remove"/>
 
-    <item android:id="@+id/home_add_to_launcher"
-          android:title="@string/contextmenu_add_to_launcher"/>
-
 </menu>