B2G/gecko/toolkit/mozapps/extensions/AddonManager.jsm
/**
   * Notified when a preference we're interested in has changed.
   *
   * @see nsIObserver
   */
Notified when a preference we're interested in has changed.
Notified when a preference we ' re interested in has changed .
function AMI_observe(aSubject, aTopic, aData) {
    if (aTopic == "xpcom-shutdown") {
      this.shutdown();
      return;
    }
    switch (aData) {
      case PREF_EM_CHECK_COMPATIBILITY: {
        let oldValue = gCheckCompatibility;
        try {
          gCheckCompatibility = Services.prefs.getBoolPref(PREF_EM_CHECK_COMPATIBILITY);
        } catch(e) {
          gCheckCompatibility = true;
        }
        this.callManagerListeners("onCompatibilityModeChanged");
        if (gCheckCompatibility != oldValue)
          this.updateAddonAppDisabledStates();
        break;
      }
      case PREF_EM_STRICT_COMPATIBILITY: {
        let oldValue = gStrictCompatibility;
        try {
          gStrictCompatibility = Services.prefs.getBoolPref(PREF_EM_STRICT_COMPATIBILITY);
        } catch(e) {
          gStrictCompatibility = true;
        }
        this.callManagerListeners("onCompatibilityModeChanged");
        if (gStrictCompatibility != oldValue)
          this.updateAddonAppDisabledStates();
        break;
      }
      case PREF_EM_CHECK_UPDATE_SECURITY: {
        let oldValue = gCheckUpdateSecurity;
        try {
          gCheckUpdateSecurity = Services.prefs.getBoolPref(PREF_EM_CHECK_UPDATE_SECURITY);
        } catch(e) {
          gCheckUpdateSecurity = true;
        }
        this.callManagerListeners("onCheckUpdateSecurityChanged");
        if (gCheckUpdateSecurity != oldValue)
          this.updateAddonAppDisabledStates();
        break;
      }
      case PREF_EM_UPDATE_ENABLED: {
        let oldValue = gUpdateEnabled;
        try {
          gUpdateEnabled = Services.prefs.getBoolPref(PREF_EM_UPDATE_ENABLED);
        } catch(e) {
          gUpdateEnabled = true;
        }
        this.callManagerListeners("onUpdateModeChanged");
        break;
      }
      case PREF_EM_AUTOUPDATE_DEFAULT: {
        let oldValue = gAutoUpdateDefault;
        try {
          gAutoUpdateDefault = Services.prefs.getBoolPref(PREF_EM_AUTOUPDATE_DEFAULT);
        } catch(e) {
          gAutoUpdateDefault = true;
        }
        this.callManagerListeners("onUpdateModeChanged");
        break;
      }
      case PREF_EM_HOTFIX_ID: {
        try {
          gHotfixID = Services.prefs.getCharPref(PREF_EM_HOTFIX_ID);
        } catch(e) {
          gHotfixID = null;
        }
        break;
      }
    }
  }
function AMI_observe ( aSubject , aTopic , aData ) { if ( aTopic == "xpcom-shutdown" ) { this . shutdown ( ) ; return ; } switch ( aData ) { case PREF_EM_CHECK_COMPATIBILITY : { let oldValue = gCheckCompatibility ; try { gCheckCompatibility = Services . prefs . getBoolPref ( PREF_EM_CHECK_COMPATIBILITY ) ; } catch ( e ) { gCheckCompatibility = true ; } this . callManagerListeners ( "onCompatibilityModeChanged" ) ; if ( gCheckCompatibility != oldValue ) this . updateAddonAppDisabledStates ( ) ; break ; } case PREF_EM_STRICT_COMPATIBILITY : { let oldValue = gStrictCompatibility ; try { gStrictCompatibility = Services . prefs . getBoolPref ( PREF_EM_STRICT_COMPATIBILITY ) ; } catch ( e ) { gStrictCompatibility = true ; } this . callManagerListeners ( "onCompatibilityModeChanged" ) ; if ( gStrictCompatibility != oldValue ) this . updateAddonAppDisabledStates ( ) ; break ; } case PREF_EM_CHECK_UPDATE_SECURITY : { let oldValue = gCheckUpdateSecurity ; try { gCheckUpdateSecurity = Services . prefs . getBoolPref ( PREF_EM_CHECK_UPDATE_SECURITY ) ; } catch ( e ) { gCheckUpdateSecurity = true ; } this . callManagerListeners ( "onCheckUpdateSecurityChanged" ) ; if ( gCheckUpdateSecurity != oldValue ) this . updateAddonAppDisabledStates ( ) ; break ; } case PREF_EM_UPDATE_ENABLED : { let oldValue = gUpdateEnabled ; try { gUpdateEnabled = Services . prefs . getBoolPref ( PREF_EM_UPDATE_ENABLED ) ; } catch ( e ) { gUpdateEnabled = true ; } this . callManagerListeners ( "onUpdateModeChanged" ) ; break ; } case PREF_EM_AUTOUPDATE_DEFAULT : { let oldValue = gAutoUpdateDefault ; try { gAutoUpdateDefault = Services . prefs . getBoolPref ( PREF_EM_AUTOUPDATE_DEFAULT ) ; } catch ( e ) { gAutoUpdateDefault = true ; } this . callManagerListeners ( "onUpdateModeChanged" ) ; break ; } case PREF_EM_HOTFIX_ID : { try { gHotfixID = Services . prefs . getCharPref ( PREF_EM_HOTFIX_ID ) ; } catch ( e ) { gHotfixID = null ; } break ; } } }
Notified when a preference we're interested in has changed.
Notified when a preference we ' re interested in has changed .