mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-24 05:44:10 +00:00
Bug 866229 - Use metro enabled pref. r=rstrong
This commit is contained in:
parent
87026bbe43
commit
7ae6b830df
@ -2,6 +2,9 @@
|
||||
# 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/.
|
||||
|
||||
// Services = object with smart getters for common XPCOM services
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var gAppUpdater;
|
||||
var AboutPanelUI = {
|
||||
get _aboutVersionLabel() {
|
||||
@ -162,11 +165,21 @@ appUpdater.prototype =
|
||||
|
||||
// true when updating is enabled.
|
||||
get updateEnabled() {
|
||||
let updatesEnabled = true;
|
||||
try {
|
||||
return Services.prefs.getBoolPref("app.update.enabled");
|
||||
updatesEnabled = Services.prefs.getBoolPref("app.update.metro.enabled");
|
||||
}
|
||||
catch (e) { }
|
||||
return true; // Firefox default is true
|
||||
if (!updatesEnabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
updatesEnabled = Services.prefs.getBoolPref("app.update.enabled")
|
||||
}
|
||||
catch (e) { }
|
||||
|
||||
return updatesEnabled;
|
||||
},
|
||||
|
||||
// true when updating in background is enabled.
|
||||
|
@ -32,6 +32,7 @@ const PREF_APP_UPDATE_CERT_ERRORS = "app.update.cert.errors";
|
||||
const PREF_APP_UPDATE_CERT_MAXERRORS = "app.update.cert.maxErrors";
|
||||
const PREF_APP_UPDATE_CERT_REQUIREBUILTIN = "app.update.cert.requireBuiltIn";
|
||||
const PREF_APP_UPDATE_ENABLED = "app.update.enabled";
|
||||
const PREF_APP_UPDATE_METRO_ENABLED = "app.update.metro.enabled";
|
||||
const PREF_APP_UPDATE_IDLETIME = "app.update.idletime";
|
||||
const PREF_APP_UPDATE_INCOMPATIBLE_MODE = "app.update.incompatible.mode";
|
||||
const PREF_APP_UPDATE_INTERVAL = "app.update.interval";
|
||||
@ -642,6 +643,25 @@ XPCOMUtils.defineLazyGetter(this, "gCanStageUpdates", function aus_gCanStageUpda
|
||||
return true;
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gMetroUpdatesEnabled", function aus_gMetroUpdatesEnabled() {
|
||||
#ifdef XP_WIN
|
||||
#ifdef MOZ_METRO
|
||||
let metroUtils = Cc["@mozilla.org/windows-metroutils;1"].
|
||||
createInstance(Ci.nsIWinMetroUtils);
|
||||
if (metroUtils && metroUtils.immersive) {
|
||||
let metroUpdate = getPref("getBoolPref", PREF_APP_UPDATE_METRO_ENABLED, true);
|
||||
if (!metroUpdate) {
|
||||
LOG("gMetroUpdatesEnabled - unable to automatically check for metro" +
|
||||
" updates, disabled by pref");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gCanCheckForUpdates", function aus_gCanCheckForUpdates() {
|
||||
// If the administrator has locked the app update functionality
|
||||
// OFF - this is not just a user setting, so disable the manual
|
||||
@ -653,6 +673,10 @@ XPCOMUtils.defineLazyGetter(this, "gCanCheckForUpdates", function aus_gCanCheckF
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!gMetroUpdatesEnabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we don't know the binary platform we're updating, we can't update.
|
||||
if (!gABI) {
|
||||
LOG("gCanCheckForUpdates - unable to check for updates, unknown ABI");
|
||||
@ -2395,6 +2419,10 @@ UpdateService.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gMetroUpdatesEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gCanApplyUpdates) {
|
||||
LOG("UpdateService:_selectAndInstallUpdate - the user is unable to " +
|
||||
"apply updates... prompting");
|
||||
@ -3364,6 +3392,10 @@ Checker.prototype = {
|
||||
*/
|
||||
_enabled: true,
|
||||
get enabled() {
|
||||
if (!gMetroUpdatesEnabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return getPref("getBoolPref", PREF_APP_UPDATE_ENABLED, true) &&
|
||||
gCanCheckForUpdates && this._enabled;
|
||||
},
|
||||
|
@ -167,10 +167,11 @@ var gCloseWindowTimeoutCounter = 0;
|
||||
|
||||
// The following vars are for restoring previous preference values (if present)
|
||||
// when the test finishes.
|
||||
var gAppUpdateEnabled; // app.update.enabled
|
||||
var gAppUpdateURLDefault; // app.update.url (default prefbranch)
|
||||
var gAppUpdateURL; // app.update.url.override
|
||||
var gExtUpdateURL; // extensions.update.url
|
||||
var gAppUpdateEnabled; // app.update.enabled
|
||||
var gAppUpdateMetroEnabled; // app.update.metro.enabled
|
||||
var gAppUpdateURLDefault; // app.update.url (default prefbranch)
|
||||
var gAppUpdateURL; // app.update.url.override
|
||||
var gExtUpdateURL; // extensions.update.url
|
||||
|
||||
var gTestCounter = -1;
|
||||
var gWin;
|
||||
@ -809,6 +810,11 @@ function setupPrefs() {
|
||||
}
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_ENABLED, true)
|
||||
|
||||
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_METRO_ENABLED)) {
|
||||
gAppUpdateMetroEnabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_METRO_ENABLED);
|
||||
}
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_METRO_ENABLED, true)
|
||||
|
||||
if (Services.prefs.prefHasUserValue(PREF_EXTENSIONS_UPDATE_URL)) {
|
||||
gExtUpdateURL = Services.prefs.getCharPref(PREF_EXTENSIONS_UPDATE_URL);
|
||||
}
|
||||
@ -845,6 +851,13 @@ function resetPrefs() {
|
||||
Services.prefs.clearUserPref(PREF_APP_UPDATE_ENABLED);
|
||||
}
|
||||
|
||||
if (gAppUpdateMetroEnabled !== undefined) {
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_METRO_ENABLED, gAppUpdateMetroEnabled);
|
||||
}
|
||||
else if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_METRO_ENABLED)) {
|
||||
Services.prefs.clearUserPref(PREF_APP_UPDATE_METRO_ENABLED);
|
||||
}
|
||||
|
||||
if (gExtUpdateURL !== undefined) {
|
||||
Services.prefs.setCharPref(PREF_EXTENSIONS_UPDATE_URL, gExtUpdateURL);
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ const PREF_APP_UPDATE_CERT_MAXERRORS = "app.update.cert.maxErrors";
|
||||
const PREF_APP_UPDATE_CERT_REQUIREBUILTIN = "app.update.cert.requireBuiltIn";
|
||||
const PREF_APP_UPDATE_CHANNEL = "app.update.channel";
|
||||
const PREF_APP_UPDATE_ENABLED = "app.update.enabled";
|
||||
const PREF_APP_UPDATE_METRO_ENABLED = "app.update.metro.enabled";
|
||||
const PREF_APP_UPDATE_IDLETIME = "app.update.idletime";
|
||||
const PREF_APP_UPDATE_LOG = "app.update.log";
|
||||
const PREF_APP_UPDATE_NEVER_BRANCH = "app.update.never.";
|
||||
|
@ -358,6 +358,7 @@ function cleanUp() {
|
||||
*/
|
||||
function setDefaultPrefs() {
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_ENABLED, true);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_METRO_ENABLED, true);
|
||||
// Don't display UI for a successful installation. Some apps may not set this
|
||||
// pref to false like Firefox does.
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_SHOW_INSTALLED_UI, false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user