Bug 1203011 - Restricted profiles: Hide 'Remove' context menu item from Top Sites list. r=ally
authorSebastian Kaspari <s.kaspari@gmail.com>
Wed, 16 Sep 2015 12:35:48 +0200
changeset 295852 9df83a75732217b4a48b0e54f7283e35741441e2
parent 295851 bb283bb54d56b03d16805823fc351ddd2ce26157
child 295853 815dc4143c96fa676e774a2551affe9d9063c28c
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersally
bugs1203011
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1203011 - Restricted profiles: Hide 'Remove' context menu item from Top Sites list. r=ally
mobile/android/base/home/TopSitesPanel.java
--- a/mobile/android/base/home/TopSitesPanel.java
+++ b/mobile/android/base/home/TopSitesPanel.java
@@ -337,16 +337,21 @@ public class TopSitesPanel extends HomeF
         if (menuInfo == null) {
             return;
         }
 
         if (!(menuInfo instanceof TopSitesGridContextMenuInfo)) {
             // Long pressed item was not a Top Sites GridView item. Superclass
             // can handle this.
             super.onCreateContextMenu(menu, view, menuInfo);
+
+            if (!RestrictedProfiles.isAllowed(view.getContext(), Restriction.DISALLOW_CLEAR_HISTORY)) {
+                menu.findItem(R.id.home_remove).setVisible(false);
+            }
+
             return;
         }
 
         final Context context = view.getContext();
 
         // Long pressed item was a Top Sites GridView item, handle it.
         MenuInflater inflater = new MenuInflater(context);
         inflater.inflate(R.menu.home_contextmenu, menu);