Bug 1381359 - Hide AS Pin Site item from classic Top Sites context menu r=sebastian draft
authorGrigory Kruglov <gkruglov@mozilla.com>
Fri, 11 Aug 2017 16:56:07 -0400
changeset 645075 2ce0b502184da545c91d518bcda5c17b5f571597
parent 645074 80ff3f300e05f38f96c385b03d1973a966a2bd35
child 725807 9579eabe2fb01e67a0e2ad8b72c684208a70b6a4
push id73650
push userbmo:gkruglov@mozilla.com
push dateFri, 11 Aug 2017 21:01:43 +0000
reviewerssebastian
bugs1381359
milestone57.0a1
Bug 1381359 - Hide AS Pin Site item from classic Top Sites context menu r=sebastian Our home panel context menu is shared by classic top sites, history and bookmark panels. For acitivty stream, we've added a new context menu, and a new type of pins. However, old context menu is still used for history and bookmarks. New style of pins allows for items to be pinned from those panels to activity stream. This requires having both "classic" pin buttons for old Top Sites panel, as well as the new AS Pin button. However, initial implementation forgot to disable the new AS Pin button for the classic Top Sites panel context menu. This caused two "pin site" menu items to appear, and the AS one would crash the browser if it's interacted with. We'll be unifying context menus at some point, and removing the old Top Sites code, and so this simple patch should be sufficient. MozReview-Commit-ID: 3cxVTv6QP8L
mobile/android/base/java/org/mozilla/gecko/home/TopSitesPanel.java
--- a/mobile/android/base/java/org/mozilla/gecko/home/TopSitesPanel.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/TopSitesPanel.java
@@ -357,16 +357,19 @@ public class TopSitesPanel extends HomeF
             menu.findItem(R.id.home_share).setVisible(false);
         }
 
         if (!Restrictions.isAllowed(context, Restrictable.PRIVATE_BROWSING)) {
             menu.findItem(R.id.home_open_private_tab).setVisible(false);
         }
         final boolean distSetAsHomepage = GeckoSharedPrefs.forProfile(view.getContext()).getBoolean(GeckoPreferences.PREFS_SET_AS_HOMEPAGE, false);
         menu.findItem(R.id.home_set_as_homepage).setVisible(distSetAsHomepage);
+
+        // Hide the AS-specific "pin" item. It doesn't work on classic Top Sites. Bug 1381359.
+        menu.findItem(R.id.home_as_pin).setVisible(false);
     }
 
     @Override
     public boolean onContextItemSelected(MenuItem item) {
         if (super.onContextItemSelected(item)) {
             // HomeFragment was able to handle to selected item.
             return true;
         }