зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1064177 - Part 2: Don't show Synced Tabs home panel in Guest Mode. r=wesj
We hard-code a number of default panel configuration options here, so let's add another. I don't care to migrate serialized Guest profile Home Panel configurations forward. I don't expect there are any: no Home Panel configuration is written to SharedPreferences until the user edits the default configuration in Settings > Customize > Home, and I expect ~0 folks to have taken these steps while in Guest Mode. While I was here, I updated the other uses of GeckoProfile.inGuestMode to guard Sync related things that I found. --HG-- extra : rebase_source : 995a70fb19abbd1958e84f2517bd864ffdf75584
This commit is contained in:
Родитель
f54014e6bc
Коммит
71f49f64a1
|
@ -15,6 +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.home.HomeConfig.HomeConfigBackend;
|
||||
import org.mozilla.gecko.home.HomeConfig.OnReloadListener;
|
||||
import org.mozilla.gecko.home.HomeConfig.PanelConfig;
|
||||
|
@ -81,18 +82,29 @@ class HomeConfigPrefsBackend implements HomeConfigBackend {
|
|||
|
||||
final PanelConfig historyEntry = createBuiltinPanelConfig(mContext, PanelType.HISTORY);
|
||||
final PanelConfig recentTabsEntry = createBuiltinPanelConfig(mContext, PanelType.RECENT_TABS);
|
||||
final PanelConfig remoteTabsEntry = createBuiltinPanelConfig(mContext, PanelType.REMOTE_TABS);
|
||||
|
||||
// We disable Synced Tabs for guest mode profiles.
|
||||
final PanelConfig remoteTabsEntry;
|
||||
if (RestrictedProfiles.isAllowed(RestrictedProfiles.Restriction.DISALLOW_MODIFY_ACCOUNTS)) {
|
||||
remoteTabsEntry = createBuiltinPanelConfig(mContext, PanelType.REMOTE_TABS);
|
||||
} else {
|
||||
remoteTabsEntry = null;
|
||||
}
|
||||
|
||||
// On tablets, we go [...|History|Recent Tabs|Synced Tabs].
|
||||
// On phones, we go [Synced Tabs|Recent Tabs|History|...].
|
||||
if (HardwareUtils.isTablet()) {
|
||||
panelConfigs.add(historyEntry);
|
||||
panelConfigs.add(recentTabsEntry);
|
||||
panelConfigs.add(remoteTabsEntry);
|
||||
if (remoteTabsEntry != null) {
|
||||
panelConfigs.add(remoteTabsEntry);
|
||||
}
|
||||
} else {
|
||||
panelConfigs.add(0, historyEntry);
|
||||
panelConfigs.add(0, recentTabsEntry);
|
||||
panelConfigs.add(0, remoteTabsEntry);
|
||||
if (remoteTabsEntry != null) {
|
||||
panelConfigs.add(0, remoteTabsEntry);
|
||||
}
|
||||
}
|
||||
|
||||
return new State(panelConfigs, true);
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.mozilla.gecko.LocaleManager;
|
|||
import org.mozilla.gecko.NewTabletUI;
|
||||
import org.mozilla.gecko.PrefsHelper;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.RestrictedProfiles;
|
||||
import org.mozilla.gecko.Telemetry;
|
||||
import org.mozilla.gecko.TelemetryContract;
|
||||
import org.mozilla.gecko.TelemetryContract.Method;
|
||||
|
@ -717,7 +718,8 @@ OnSharedPreferenceChangeListener
|
|||
CharSequence selectedEntry = listPref.getEntry();
|
||||
listPref.setSummary(selectedEntry);
|
||||
continue;
|
||||
} else if (PREFS_SYNC.equals(key) && GeckoProfile.get(this).inGuestMode()) {
|
||||
} else if (PREFS_SYNC.equals(key) &&
|
||||
!RestrictedProfiles.isAllowed(RestrictedProfiles.Restriction.DISALLOW_MODIFY_ACCOUNTS)) {
|
||||
// Don't show sync prefs while in guest mode.
|
||||
preferences.removePreference(pref);
|
||||
i--;
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.mozilla.gecko.LightweightTheme;
|
|||
import org.mozilla.gecko.LightweightThemeDrawable;
|
||||
import org.mozilla.gecko.NewTabletUI;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.RestrictedProfiles;
|
||||
import org.mozilla.gecko.Telemetry;
|
||||
import org.mozilla.gecko.TelemetryContract;
|
||||
import org.mozilla.gecko.animation.PropertyAnimator;
|
||||
|
@ -173,7 +174,7 @@ public class TabsPanel extends LinearLayout
|
|||
mTabWidget.addTab(R.drawable.tabs_normal, R.string.tabs_normal);
|
||||
mTabWidget.addTab(R.drawable.tabs_private, R.string.tabs_private);
|
||||
|
||||
if (!GeckoProfile.get(mContext).inGuestMode()) {
|
||||
if (RestrictedProfiles.isAllowed(RestrictedProfiles.Restriction.DISALLOW_MODIFY_ACCOUNTS)) {
|
||||
// The initial icon is not the animated icon, because on Android
|
||||
// 4.4.2, the animation starts immediately (and can start at other
|
||||
// unpredictable times). See Bug 1015974.
|
||||
|
|
Загрузка…
Ссылка в новой задаче