nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID); if (prefs) { prefs->RegisterCallback("browser.blink_allowed", PrefsChanged, nsnull);
nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID); if (prefBranch) { PRBool boolPrefValue = PR_TRUE; prefBranch->GetBoolPref("browser.blink_allowed", &boolPrefValue); sBlinkIsAllowed = boolPrefValue;  nsCOMPtr<nsIObserver> observer = new BlinkPrefObserver(); if (observer) { nsCOMPtr<nsIPrefBranchInternal> pbi = do_QueryInterface(prefBranch); if (pbi) { pbi->AddObserver("browser.blink_allowed", observer, PR_FALSE); } }
static PRBool BlinkIsAllowed(void){  if (!sPrefIsLoaded) {    // Set up a listener and check the initial value    nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID);    if (prefs) {      prefs->RegisterCallback("browser.blink_allowed", PrefsChanged,                               nsnull);    }    PrefsChanged(nsnull, nsnull);    sPrefIsLoaded = PR_TRUE;  }  return sBlinkIsAllowed;}