Bug 1189336 - (Part 1) Rename RestrictedProfiles to Restrictions. r=ally

RestrictedProfiles: The name of the class can be confusing because it handles
guest profiles and restricted profiles. We might even query it from a normal
profile.
This commit is contained in:
Sebastian Kaspari 2015-11-11 12:29:07 +01:00
parent e601ca814e
commit 745dffd4ae
20 changed files with 70 additions and 77 deletions

View File

@ -83,7 +83,7 @@ public class AccountsHelper implements NativeEventListener {
@Override
public void handleMessage(String event, NativeJSObject message, final EventCallback callback) {
if (!RestrictedProfiles.isAllowed(mContext, Restriction.DISALLOW_MODIFY_ACCOUNTS)) {
if (!Restrictions.isAllowed(mContext, Restriction.DISALLOW_MODIFY_ACCOUNTS)) {
// We register for messages in all contexts; we drop, with a log and an error to JavaScript,
// when the profile is restricted. It's better to return errors than silently ignore messages.
Log.e(LOGTAG, "Profile is not allowed to modify accounts! Ignoring event: " + event);

View File

@ -1793,7 +1793,7 @@ public class BrowserApp extends GeckoApp
}
}
if (AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED && RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_LOCATION_SERVICE)) {
if (AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED && Restrictions.isAllowed(this, Restriction.DISALLOW_LOCATION_SERVICE)) {
// Start (this acts as ping if started already) the stumbler lib; if the stumbler has queued data it will upload it.
// Stumbler operates on its own thread, and startup impact is further minimized by delaying work (such as upload) a few seconds.
// Avoid any potential startup CPU/thread contention by delaying the pref broadcast.
@ -2497,7 +2497,7 @@ public class BrowserApp extends GeckoApp
});
// Don't show the banner in guest mode.
if (!RestrictedProfiles.isUserRestricted()) {
if (!Restrictions.isUserRestricted()) {
final ViewStub homeBannerStub = (ViewStub) findViewById(R.id.home_banner_stub);
final HomeBanner homeBanner = (HomeBanner) homeBannerStub.inflate();
mHomePager.setBanner(homeBanner);
@ -3084,11 +3084,11 @@ public class BrowserApp extends GeckoApp
}
// Disable share menuitem for about:, chrome:, file:, and resource: URIs
final boolean shareVisible = RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_SHARE);
final boolean shareVisible = Restrictions.isAllowed(this, Restriction.DISALLOW_SHARE);
share.setVisible(shareVisible);
final boolean shareEnabled = StringUtils.isShareableUrl(url) && shareVisible;
share.setEnabled(shareEnabled);
MenuUtils.safeSetEnabled(aMenu, R.id.downloads, RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_DOWNLOADS));
MenuUtils.safeSetEnabled(aMenu, R.id.downloads, Restrictions.isAllowed(this, Restriction.DISALLOW_DOWNLOADS));
// NOTE: Use MenuUtils.safeSetEnabled because some actions might
// be on the BrowserToolbar context menu.
@ -3151,7 +3151,7 @@ public class BrowserApp extends GeckoApp
}
}
final boolean privateTabVisible = RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_PRIVATE_BROWSING);
final boolean privateTabVisible = Restrictions.isAllowed(this, Restriction.DISALLOW_PRIVATE_BROWSING);
MenuUtils.safeSetVisible(aMenu, R.id.new_private_tab, privateTabVisible);
// Disable PDF generation (save and print) for about:home and xul pages.
@ -3173,11 +3173,11 @@ public class BrowserApp extends GeckoApp
enterGuestMode.setVisible(true);
}
if (!RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_GUEST_BROWSING)) {
if (!Restrictions.isAllowed(this, Restriction.DISALLOW_GUEST_BROWSING)) {
MenuUtils.safeSetVisible(aMenu, R.id.new_guest_session, false);
}
if (!RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_INSTALL_EXTENSION)) {
if (!Restrictions.isAllowed(this, Restriction.DISALLOW_INSTALL_EXTENSION)) {
MenuUtils.safeSetVisible(aMenu, R.id.addons, false);
}
@ -3796,7 +3796,7 @@ public class BrowserApp extends GeckoApp
if (inGuestMode) {
return StartupAction.GUEST;
}
if (RestrictedProfiles.isRestrictedProfile(this)) {
if (Restrictions.isRestrictedProfile(this)) {
return StartupAction.RESTRICTED;
}
return (passedURL == null ? StartupAction.NORMAL : StartupAction.URL);

View File

@ -2081,7 +2081,7 @@ public abstract class GeckoApp
}
});
RestrictedProfiles.update(this);
Restrictions.update(this);
}
@Override

View File

@ -22,7 +22,7 @@ import android.os.UserManager;
import android.util.Log;
@RobocopTarget
public class RestrictedProfiles {
public class Restrictions {
private static final String LOGTAG = "GeckoRestrictedProfiles";
private static RestrictionConfiguration configuration;

View File

@ -6,7 +6,6 @@
package org.mozilla.gecko.db;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.InputStream;
import java.lang.IllegalAccessException;
import java.lang.NoSuchFieldException;
@ -25,22 +24,19 @@ import org.json.JSONException;
import org.json.JSONObject;
import org.mozilla.gecko.AboutPages;
import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.R;
import org.mozilla.gecko.db.BrowserContract.Bookmarks;
import org.mozilla.gecko.db.BrowserContract.Combined;
import org.mozilla.gecko.db.BrowserContract.ExpirePriority;
import org.mozilla.gecko.db.BrowserContract.Favicons;
import org.mozilla.gecko.db.BrowserContract.History;
import org.mozilla.gecko.db.BrowserContract.ReadingListItems;
import org.mozilla.gecko.db.BrowserContract.SearchHistory;
import org.mozilla.gecko.db.BrowserContract.SyncColumns;
import org.mozilla.gecko.db.BrowserContract.Thumbnails;
import org.mozilla.gecko.distribution.Distribution;
import org.mozilla.gecko.favicons.decoders.FaviconDecoder;
import org.mozilla.gecko.favicons.decoders.LoadFaviconResult;
import org.mozilla.gecko.gfx.BitmapUtils;
import org.mozilla.gecko.RestrictedProfiles;
import org.mozilla.gecko.Restrictions;
import org.mozilla.gecko.sync.Utils;
import org.mozilla.gecko.util.GeckoJarReader;
import org.mozilla.gecko.util.StringUtils;
@ -225,7 +221,7 @@ public class LocalBrowserDB implements BrowserDB {
}
try {
if (RestrictedProfiles.isRestrictedProfile(context)) {
if (Restrictions.isRestrictedProfile(context)) {
// matching on variable name from strings.xml.in
final String addons = "bookmarkdefaults_title_addons";
final String regularSumo = "bookmarkdefaults_title_support";
@ -233,7 +229,7 @@ public class LocalBrowserDB implements BrowserDB {
continue;
}
}
if (!RestrictedProfiles.isRestrictedProfile(context)) {
if (!Restrictions.isRestrictedProfile(context)) {
// if we're not in kidfox, skip the kidfox specific bookmark(s)
if (name.startsWith("bookmarkdefaults_title_restricted")) {
continue;

View File

@ -40,8 +40,7 @@ import org.mozilla.gecko.GeckoProfile;
import org.mozilla.gecko.Locales;
import org.mozilla.gecko.R;
import org.mozilla.gecko.distribution.Distribution;
import org.mozilla.gecko.db.BrowserContract;
import org.mozilla.gecko.RestrictedProfiles;
import org.mozilla.gecko.Restrictions;
import org.mozilla.gecko.preferences.GeckoPreferences;
import org.mozilla.gecko.util.RawResource;
import org.mozilla.gecko.util.ThreadUtils;
@ -512,7 +511,7 @@ public class SuggestedSites {
continue;
}
final boolean restrictedProfile = RestrictedProfiles.isRestrictedProfile(context);
final boolean restrictedProfile = Restrictions.isRestrictedProfile(context);
if (restrictedProfile == site.restricted) {
final RowBuilder row = cursor.newRow();

View File

@ -18,7 +18,7 @@ import com.nineoldandroids.animation.AnimatorSet;
import com.nineoldandroids.animation.ObjectAnimator;
import com.nineoldandroids.view.ViewHelper;
import org.mozilla.gecko.RestrictedProfiles;
import org.mozilla.gecko.Restrictions;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.animation.TransitionsTracker;
@ -64,7 +64,7 @@ public class FirstrunPager extends ViewPager {
public void load(Context appContext, FragmentManager fm, final FirstrunPane.OnFinishListener onFinishListener) {
final List<FirstrunPagerConfig.FirstrunPanelConfig> panels;
if (RestrictedProfiles.isUserRestricted(context)) {
if (Restrictions.isUserRestricted(context)) {
panels = FirstrunPagerConfig.getRestricted();
} else {
panels = FirstrunPagerConfig.getDefault(appContext);

View File

@ -18,9 +18,8 @@ import org.mozilla.gecko.EventDispatcher;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent;
import org.mozilla.gecko.GeckoProfile;
import org.mozilla.gecko.GeckoScreenOrientation;
import org.mozilla.gecko.R;
import org.mozilla.gecko.RestrictedProfiles;
import org.mozilla.gecko.Restrictions;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.db.BrowserContract.Combined;
@ -35,7 +34,6 @@ import android.app.AlertDialog;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Configuration;
import android.database.Cursor;
import android.graphics.Typeface;
import android.os.Bundle;
@ -226,7 +224,7 @@ public class HistoryPanel extends HomeFragment {
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, view, menuInfo);
if (!RestrictedProfiles.isAllowed(getActivity(), Restriction.DISALLOW_CLEAR_HISTORY)) {
if (!Restrictions.isAllowed(getActivity(), Restriction.DISALLOW_CLEAR_HISTORY)) {
menu.findItem(R.id.home_remove).setVisible(false);
}
}
@ -293,7 +291,7 @@ public class HistoryPanel extends HomeFragment {
private void updateUiFromCursor(Cursor c) {
if (c != null && c.getCount() > 0) {
if (RestrictedProfiles.isAllowed(getActivity(), Restriction.DISALLOW_CLEAR_HISTORY)) {
if (Restrictions.isAllowed(getActivity(), Restriction.DISALLOW_CLEAR_HISTORY)) {
mClearHistoryButton.setVisibility(View.VISIBLE);
}
return;
@ -324,7 +322,7 @@ public class HistoryPanel extends HomeFragment {
emptyHint.setVisibility(View.VISIBLE);
}
if (!RestrictedProfiles.isAllowed(getActivity(), Restriction.DISALLOW_PRIVATE_BROWSING)) {
if (!Restrictions.isAllowed(getActivity(), Restriction.DISALLOW_PRIVATE_BROWSING)) {
emptyHint.setVisibility(View.GONE);
}

View File

@ -15,7 +15,7 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.mozilla.gecko.GeckoSharedPrefs;
import org.mozilla.gecko.RestrictedProfiles;
import org.mozilla.gecko.Restrictions;
import org.mozilla.gecko.home.HomeConfig.HomeConfigBackend;
import org.mozilla.gecko.home.HomeConfig.OnReloadListener;
import org.mozilla.gecko.home.HomeConfig.PanelConfig;
@ -77,7 +77,7 @@ class HomeConfigPrefsBackend implements HomeConfigBackend {
panelConfigs.add(createBuiltinPanelConfig(mContext, PanelType.HISTORY));
// We disable Synced Tabs for guest mode / restricted profiles.
if (RestrictedProfiles.isAllowed(mContext, Restriction.DISALLOW_MODIFY_ACCOUNTS)) {
if (Restrictions.isAllowed(mContext, Restriction.DISALLOW_MODIFY_ACCOUNTS)) {
panelConfigs.add(createBuiltinPanelConfig(mContext, PanelType.REMOTE_TABS));
}

View File

@ -13,7 +13,7 @@ import org.mozilla.gecko.GeckoEvent;
import org.mozilla.gecko.GeckoProfile;
import org.mozilla.gecko.R;
import org.mozilla.gecko.ReaderModeUtils;
import org.mozilla.gecko.RestrictedProfiles;
import org.mozilla.gecko.Restrictions;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.db.BrowserDB;
@ -153,7 +153,7 @@ public abstract class HomeFragment extends Fragment {
menu.findItem(R.id.home_share).setVisible(false);
}
if (!RestrictedProfiles.isAllowed(view.getContext(), Restriction.DISALLOW_PRIVATE_BROWSING)) {
if (!Restrictions.isAllowed(view.getContext(), Restriction.DISALLOW_PRIVATE_BROWSING)) {
menu.findItem(R.id.home_open_private_tab).setVisible(false);
}

View File

@ -18,7 +18,7 @@ import java.util.Map;
import org.mozilla.gecko.GeckoProfile;
import org.mozilla.gecko.Locales;
import org.mozilla.gecko.R;
import org.mozilla.gecko.RestrictedProfiles;
import org.mozilla.gecko.Restrictions;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.Telemetry;
@ -343,7 +343,7 @@ public class TopSitesPanel extends HomeFragment {
// can handle this.
super.onCreateContextMenu(menu, view, menuInfo);
if (!RestrictedProfiles.isAllowed(view.getContext(), Restriction.DISALLOW_CLEAR_HISTORY)) {
if (!Restrictions.isAllowed(view.getContext(), Restriction.DISALLOW_CLEAR_HISTORY)) {
menu.findItem(R.id.home_remove).setVisible(false);
}
@ -359,7 +359,7 @@ public class TopSitesPanel extends HomeFragment {
// Hide unused menu items.
menu.findItem(R.id.home_edit_bookmark).setVisible(false);
menu.findItem(R.id.home_remove).setVisible(RestrictedProfiles.isAllowed(context, Restriction.DISALLOW_CLEAR_HISTORY));
menu.findItem(R.id.home_remove).setVisible(Restrictions.isAllowed(context, Restriction.DISALLOW_CLEAR_HISTORY));
TopSitesGridContextMenuInfo info = (TopSitesGridContextMenuInfo) menuInfo;
menu.setHeaderTitle(info.getDisplayTitle());
@ -381,7 +381,7 @@ public class TopSitesPanel extends HomeFragment {
menu.findItem(R.id.home_share).setVisible(false);
}
if (!RestrictedProfiles.isAllowed(context, Restriction.DISALLOW_PRIVATE_BROWSING)) {
if (!Restrictions.isAllowed(context, Restriction.DISALLOW_PRIVATE_BROWSING)) {
menu.findItem(R.id.home_open_private_tab).setVisible(false);
}

View File

@ -478,7 +478,7 @@ gbjar.sources += [
'RemoteClientsDialogFragment.java',
'RemoteTabsExpandableListAdapter.java',
'Restarter.java',
'RestrictedProfiles.java',
'Restrictions.java',
'restrictions/DefaultConfiguration.java',
'restrictions/GuestProfileConfiguration.java',
'restrictions/RestrictedProfileConfiguration.java',

View File

@ -8,7 +8,7 @@ package org.mozilla.gecko.preferences;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.R;
import org.mozilla.gecko.util.ThreadUtils;
import org.mozilla.gecko.RestrictedProfiles;
import org.mozilla.gecko.Restrictions;
import org.mozilla.gecko.restrictions.Restriction;
import java.util.Set;
@ -28,7 +28,7 @@ class AndroidImportPreference extends MultiPrefMultiChoicePreference {
public static class Handler implements GeckoPreferences.PrefHandler {
public boolean setupPref(Context context, Preference pref) {
// Feature disabled on devices running Android M+ (Bug 1183559)
return Versions.preM && RestrictedProfiles.isAllowed(context, Restriction.DISALLOW_IMPORT_SETTINGS);
return Versions.preM && Restrictions.isAllowed(context, Restriction.DISALLOW_IMPORT_SETTINGS);
}
public void onChange(Context context, Preference pref, Object newValue) { }

View File

@ -23,7 +23,7 @@ import org.mozilla.gecko.LocaleManager;
import org.mozilla.gecko.Locales;
import org.mozilla.gecko.PrefsHelper;
import org.mozilla.gecko.R;
import org.mozilla.gecko.RestrictedProfiles;
import org.mozilla.gecko.Restrictions;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.TelemetryContract.Method;
@ -463,7 +463,7 @@ OnSharedPreferenceChangeListener
while (iterator.hasNext()) {
Header header = iterator.next();
if (header.id == R.id.pref_header_advanced && !RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_ADVANCED_SETTINGS)) {
if (header.id == R.id.pref_header_advanced && !Restrictions.isAllowed(this, Restriction.DISALLOW_ADVANCED_SETTINGS)) {
iterator.remove();
}
}
@ -678,7 +678,7 @@ OnSharedPreferenceChangeListener
continue;
}
} else if (PREFS_SCREEN_ADVANCED.equals(key) &&
!RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_ADVANCED_SETTINGS)) {
!Restrictions.isAllowed(this, Restriction.DISALLOW_ADVANCED_SETTINGS)) {
preferences.removePreference(pref);
i--;
continue;
@ -694,7 +694,7 @@ OnSharedPreferenceChangeListener
}
} else if (PREFS_OPEN_URLS_IN_PRIVATE.equals(key)) {
// Remove UI for opening external links in private browsing on non-Nightly builds.
if (!AppConstants.NIGHTLY_BUILD || !RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_PRIVATE_BROWSING)) {
if (!AppConstants.NIGHTLY_BUILD || !Restrictions.isAllowed(this, Restriction.DISALLOW_PRIVATE_BROWSING)) {
preferences.removePreference(pref);
i--;
continue;
@ -734,19 +734,19 @@ OnSharedPreferenceChangeListener
}
} else if (PREFS_GEO_REPORTING.equals(key) ||
PREFS_GEO_LEARN_MORE.equals(key)) {
if (!AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED || !RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_LOCATION_SERVICE)) {
if (!AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED || !Restrictions.isAllowed(this, Restriction.DISALLOW_LOCATION_SERVICE)) {
preferences.removePreference(pref);
i--;
continue;
}
} else if (PREFS_DEVTOOLS_REMOTE_USB_ENABLED.equals(key)) {
if (!RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_REMOTE_DEBUGGING)) {
if (!Restrictions.isAllowed(this, Restriction.DISALLOW_REMOTE_DEBUGGING)) {
preferences.removePreference(pref);
i--;
continue;
}
} else if (PREFS_DEVTOOLS_REMOTE_WIFI_ENABLED.equals(key)) {
if (!RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_REMOTE_DEBUGGING)) {
if (!Restrictions.isAllowed(this, Restriction.DISALLOW_REMOTE_DEBUGGING)) {
preferences.removePreference(pref);
i--;
continue;
@ -759,7 +759,7 @@ OnSharedPreferenceChangeListener
}
} else if (PREFS_DEVTOOLS_REMOTE_LINK.equals(key)) {
// Remove the "Learn more" link if remote debugging is disabled
if (!RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_REMOTE_DEBUGGING)) {
if (!Restrictions.isAllowed(this, Restriction.DISALLOW_REMOTE_DEBUGGING)) {
preferences.removePreference(pref);
i--;
continue;
@ -776,7 +776,7 @@ OnSharedPreferenceChangeListener
continue;
} else if (PREFS_SYNC.equals(key)) {
// Don't show sync prefs while in guest mode.
if (!RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_MODIFY_ACCOUNTS)) {
if (!Restrictions.isAllowed(this, Restriction.DISALLOW_MODIFY_ACCOUNTS)) {
preferences.removePreference(pref);
i--;
continue;
@ -819,19 +819,19 @@ OnSharedPreferenceChangeListener
continue;
}
} else if (PREFS_TRACKING_PROTECTION_PRIVATE_BROWSING.equals(key)) {
if (!RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_PRIVATE_BROWSING)) {
if (!Restrictions.isAllowed(this, Restriction.DISALLOW_PRIVATE_BROWSING)) {
preferences.removePreference(pref);
i--;
continue;
}
} else if (PREFS_TRACKING_PROTECTION_LEARN_MORE.equals(key)) {
if (!RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_PRIVATE_BROWSING)) {
if (!Restrictions.isAllowed(this, Restriction.DISALLOW_PRIVATE_BROWSING)) {
preferences.removePreference(pref);
i--;
continue;
}
} else if (PREFS_MP_ENABLED.equals(key)) {
if (!RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_MASTER_PASSWORD)) {
if (!Restrictions.isAllowed(this, Restriction.DISALLOW_MASTER_PASSWORD)) {
preferences.removePreference(pref);
i--;
continue;
@ -843,7 +843,7 @@ OnSharedPreferenceChangeListener
continue;
}
} else if (PREFS_CLEAR_PRIVATE_DATA.equals(key) || PREFS_CLEAR_PRIVATE_DATA_EXIT.equals(key)) {
if (!RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_CLEAR_HISTORY)) {
if (!Restrictions.isAllowed(this, Restriction.DISALLOW_CLEAR_HISTORY)) {
preferences.removePreference(pref);
i--;
continue;

View File

@ -6,7 +6,7 @@
package org.mozilla.gecko.restrictions;
/**
* Interface for classes that RestrictedProfiles will delegate to for making decisions.
* Interface for classes that Restrictions will delegate to for making decisions.
*/
public interface RestrictionConfiguration {
/**

View File

@ -9,7 +9,7 @@ import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.GeckoApp;
import org.mozilla.gecko.GeckoApplication;
import org.mozilla.gecko.R;
import org.mozilla.gecko.RestrictedProfiles;
import org.mozilla.gecko.Restrictions;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.animation.PropertyAnimator;
@ -144,7 +144,7 @@ public class TabsPanel extends LinearLayout
(ThemedImageButton) mTabWidget.addTab(R.drawable.tabs_private, R.string.tabs_private);
privateTabsPanel.setPrivateMode(true);
if (!RestrictedProfiles.isAllowed(mContext, Restriction.DISALLOW_PRIVATE_BROWSING)) {
if (!Restrictions.isAllowed(mContext, Restriction.DISALLOW_PRIVATE_BROWSING)) {
mTabWidget.setVisibility(View.GONE);
}
@ -173,7 +173,7 @@ public class TabsPanel extends LinearLayout
// Each panel has a "+" shortcut button, so don't show it for that panel.
menu.findItem(R.id.new_tab).setVisible(mCurrentPanel != Panel.NORMAL_TABS);
menu.findItem(R.id.new_private_tab).setVisible(mCurrentPanel != Panel.PRIVATE_TABS
&& RestrictedProfiles.isAllowed(mContext, Restriction.DISALLOW_PRIVATE_BROWSING));
&& Restrictions.isAllowed(mContext, Restriction.DISALLOW_PRIVATE_BROWSING));
// Only show "Clear * tabs" for current panel.
menu.findItem(R.id.close_all_tabs).setVisible(mCurrentPanel == Panel.NORMAL_TABS);

View File

@ -6,7 +6,7 @@ package org.mozilla.gecko.tests;
import static org.mozilla.gecko.tests.helpers.AssertionHelper.fAssertTrue;
import org.mozilla.gecko.RestrictedProfiles;
import org.mozilla.gecko.Restrictions;
import org.mozilla.gecko.restrictions.Restriction;
import org.mozilla.gecko.tests.helpers.GeckoHelper;
@ -17,7 +17,7 @@ public class testRestrictions extends UITest {
// No restrictions should be enforced when using a normal profile
for (Restriction restriction : Restriction.values()) {
fAssertTrue(String.format("Restriction %s is not enforced", restriction.name),
RestrictedProfiles.isAllowed(getActivity(), restriction)
Restrictions.isAllowed(getActivity(), restriction)
);
}
}

View File

@ -14,7 +14,7 @@ nsParentalControlsService::nsParentalControlsService() :
mEnabled(false)
{
if (mozilla::jni::IsAvailable()) {
mEnabled = mozilla::widget::RestrictedProfiles::IsUserRestricted();
mEnabled = mozilla::widget::Restrictions::IsUserRestricted();
}
}
@ -92,7 +92,7 @@ nsParentalControlsService::IsAllowed(int16_t aAction,
NS_ENSURE_SUCCESS(rv, rv);
}
*_retval = mozilla::widget::RestrictedProfiles::IsAllowed(aAction,
*_retval = mozilla::widget::Restrictions::IsAllowed(aAction,
NS_ConvertUTF8toUTF16(url));
return rv;
}

View File

@ -1116,20 +1116,20 @@ constexpr char PrefsHelper::GetPrefsById_t::signature[];
constexpr char PrefsHelper::RemovePrefsObserver_t::name[];
constexpr char PrefsHelper::RemovePrefsObserver_t::signature[];
constexpr char RestrictedProfiles::name[];
constexpr char Restrictions::name[];
constexpr char RestrictedProfiles::IsAllowed_t::name[];
constexpr char RestrictedProfiles::IsAllowed_t::signature[];
constexpr char Restrictions::IsAllowed_t::name[];
constexpr char Restrictions::IsAllowed_t::signature[];
auto RestrictedProfiles::IsAllowed(int32_t a0, mozilla::jni::String::Param a1) -> bool
auto Restrictions::IsAllowed(int32_t a0, mozilla::jni::String::Param a1) -> bool
{
return mozilla::jni::Method<IsAllowed_t>::Call(nullptr, nullptr, a0, a1);
}
constexpr char RestrictedProfiles::IsUserRestricted_t::name[];
constexpr char RestrictedProfiles::IsUserRestricted_t::signature[];
constexpr char Restrictions::IsUserRestricted_t::name[];
constexpr char Restrictions::IsUserRestricted_t::signature[];
auto RestrictedProfiles::IsUserRestricted() -> bool
auto Restrictions::IsUserRestricted() -> bool
{
return mozilla::jni::Method<IsUserRestricted_t>::Call(nullptr, nullptr);
}

View File

@ -3044,23 +3044,23 @@ public:
template<class Impl> class Natives;
};
class RestrictedProfiles : public mozilla::jni::Class<RestrictedProfiles>
class Restrictions : public mozilla::jni::Class<Restrictions>
{
public:
typedef mozilla::jni::Ref<RestrictedProfiles> Ref;
typedef mozilla::jni::LocalRef<RestrictedProfiles> LocalRef;
typedef mozilla::jni::GlobalRef<RestrictedProfiles> GlobalRef;
typedef const mozilla::jni::Param<RestrictedProfiles>& Param;
typedef mozilla::jni::Ref<Restrictions> Ref;
typedef mozilla::jni::LocalRef<Restrictions> LocalRef;
typedef mozilla::jni::GlobalRef<Restrictions> GlobalRef;
typedef const mozilla::jni::Param<Restrictions>& Param;
static constexpr char name[] =
"org/mozilla/gecko/RestrictedProfiles";
"org/mozilla/gecko/Restrictions";
protected:
RestrictedProfiles(jobject instance) : Class(instance) {}
Restrictions(jobject instance) : Class(instance) {}
public:
struct IsAllowed_t {
typedef RestrictedProfiles Owner;
typedef Restrictions Owner;
typedef bool ReturnType;
typedef bool SetterType;
typedef mozilla::jni::Args<
@ -3079,7 +3079,7 @@ public:
public:
struct IsUserRestricted_t {
typedef RestrictedProfiles Owner;
typedef Restrictions Owner;
typedef bool ReturnType;
typedef bool SetterType;
typedef mozilla::jni::Args<> Args;