Bug 718255 - Merge nsIPrefBranch2 with nsIPrefBranch - Part G, remove remaining uses of nsIPrefBranch2; r=bsmedberg

This commit is contained in:
Geoff Lankow 2012-01-18 23:23:28 +13:00
parent 38a6e24cbf
commit c59ab7ad07
22 changed files with 33 additions and 46 deletions

View File

@ -67,7 +67,7 @@
#include "nsILocaleService.h"
#include "nsILocalFile.h"
#include "nsIObserverService.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIResProtocolHandler.h"
#include "nsIScriptError.h"
@ -190,12 +190,9 @@ nsChromeRegistryChrome::Init()
SelectLocaleFromPref(prefs);
nsCOMPtr<nsIPrefBranch2> prefs2 (do_QueryInterface(prefs));
if (prefs2) {
rv = prefs2->AddObserver(MATCH_OS_LOCALE_PREF, this, true);
rv = prefs2->AddObserver(SELECTED_LOCALE_PREF, this, true);
rv = prefs2->AddObserver(SELECTED_SKIN_PREF, this, true);
}
rv = prefs->AddObserver(MATCH_OS_LOCALE_PREF, this, true);
rv = prefs->AddObserver(SELECTED_LOCALE_PREF, this, true);
rv = prefs->AddObserver(SELECTED_SKIN_PREF, this, true);
}
nsCOMPtr<nsIObserverService> obsService = mozilla::services::GetObserverService();
@ -220,7 +217,7 @@ nsChromeRegistryChrome::CheckForOSAccessibility()
RefreshSkins();
}
nsCOMPtr<nsIPrefBranch2> prefs (do_GetService(NS_PREFSERVICE_CONTRACTID));
nsCOMPtr<nsIPrefBranch> prefs (do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs) {
prefs->RemoveObserver(SELECTED_SKIN_PREF, this);
}
@ -387,7 +384,7 @@ nsChromeRegistryChrome::Observe(nsISupports *aSubject, const char *aTopic,
false, uiLocale);
if (NS_SUCCEEDED(rv) && !uiLocale.IsEmpty()) {
CopyUTF16toUTF8(uiLocale, mSelectedLocale);
nsCOMPtr<nsIPrefBranch2> prefs (do_GetService(NS_PREFSERVICE_CONTRACTID));
nsCOMPtr<nsIPrefBranch> prefs (do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs) {
prefs->RemoveObserver(SELECTED_LOCALE_PREF, this);
}

View File

@ -64,7 +64,6 @@ var gPrefObserver = {
var prefSvc = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
this._branch = prefSvc.getBranch("security.csp.");
this._branch.QueryInterface(Components.interfaces.nsIPrefBranch2);
this._branch.addObserver("", this, false);
this._debugEnabled = this._branch.getBoolPref("debug");
},

View File

@ -222,7 +222,7 @@ function initPrefs()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch2);
getService(Components.interfaces.nsIPrefBranch);
// Disables the app level scroll acceleration
prefSvc.setIntPref("mousewheel.acceleration.start", -1);
prefSvc.setBoolPref("mousewheel.system_scroll_override_on_root_content.enabled", false);
@ -233,7 +233,7 @@ function clearPrefs()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch2);
getService(Components.interfaces.nsIPrefBranch);
prefSvc.clearUserPref("mousewheel.acceleration.start");
prefSvc.clearUserPref("mousewheel.system_scroll_override_on_root_content.enabled");

View File

@ -70,7 +70,7 @@ function initPrefs()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch2);
getService(Components.interfaces.nsIPrefBranch);
// Disables the app level scroll acceleration
prefSvc.setIntPref("mousewheel.acceleration.start", -1);
prefSvc.setBoolPref("mousewheel.system_scroll_override_on_root_content.enabled", false);
@ -83,7 +83,7 @@ function clearPrefs()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch2);
getService(Components.interfaces.nsIPrefBranch);
if (prefSvc.prefHasUserValue("mousewheel.acceleration.start"))
prefSvc.clearUserPref("mousewheel.acceleration.start");

View File

@ -45,7 +45,7 @@ function isEnabledMiddleClickPaste()
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch2);
getService(Components.interfaces.nsIPrefBranch);
try {
return prefs.getBoolPref("middlemouse.paste");
} catch (e) {

View File

@ -50,7 +50,6 @@
#include "nsIWindowWatcher.h"
#include "nsIDOMWindow.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefLocalizedString.h"
#include "nsIObserverService.h"
#include "nsContentUtils.h"
@ -218,7 +217,7 @@ ContentParent::Init()
obs->AddObserver(this, "a11y-init-or-shutdown", false);
#endif
}
nsCOMPtr<nsIPrefBranch2> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs) {
prefs->AddObserver("", this, false);
}
@ -331,7 +330,7 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
SetChildMemoryReporters(empty);
// remove the global remote preferences observers
nsCOMPtr<nsIPrefBranch2> prefs
nsCOMPtr<nsIPrefBranch> prefs
(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs) {
prefs->RemoveObserver("", this);
@ -1117,7 +1116,7 @@ ContentParent::RecvLoadURIExternal(const IPC::URI& uri)
/* void onDispatchedEvent (in nsIThreadInternal thread); */
NS_IMETHODIMP
ContentParent::OnDispatchedEvent(nsIThreadInternal *thread)
{
{
NS_NOTREACHED("OnDispatchedEvent unimplemented");
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@ -80,7 +80,7 @@
#include "nsHashtable.h"
#include "nsIProxyInfo.h"
#include "nsPluginLogging.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefBranch.h"
#include "nsIScriptChannel.h"
#include "nsIBlocklistService.h"
#include "nsVersionComparator.h"

View File

@ -67,7 +67,7 @@
#include "nsIPermissionManager.h"
#include "nsIObserverService.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefBranch.h"
#include "nsIJSContextStack.h"
#include "nsThreadUtils.h"
#include "mozilla/Services.h"

View File

@ -51,7 +51,6 @@
#include "nsIURI.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranch2.h"
#include "nsIChannel.h"
#include "nsIHttpChannelInternal.h"
#include "nsIDOMWindow.h"
@ -105,7 +104,7 @@ nsCookiePermission::Init()
if (NS_FAILED(rv)) return false;
// failure to access the pref service is non-fatal...
nsCOMPtr<nsIPrefBranch2> prefBranch =
nsCOMPtr<nsIPrefBranch> prefBranch =
do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefBranch) {
prefBranch->AddObserver(kCookiesLifetimePolicy, this, false);

View File

@ -41,7 +41,6 @@
#include "nsIServiceManager.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranch2.h"
/**
* The Popup Window Manager maintains popup window permissions by website.
@ -73,7 +72,7 @@ nsPopupWindowManager::Init()
nsresult rv;
mPermissionManager = do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
nsCOMPtr<nsIPrefBranch2> prefBranch =
nsCOMPtr<nsIPrefBranch> prefBranch =
do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
bool permission;

View File

@ -43,7 +43,7 @@
*/
#include "mozilla/ModuleUtils.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefBranch.h"
#include "nsIObserver.h"
#include "nsThreadUtils.h"
#include "nsProxyRelease.h"
@ -944,7 +944,7 @@ nsGIOProtocolHandler::Init()
sGIOLog = PR_NewLogModule("gio");
#endif
nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs)
{
InitSupportedProtocolsPref(prefs);

View File

@ -47,7 +47,7 @@ extern "C" {
#include "mozilla/ModuleUtils.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefBranch.h"
#include "nsIObserver.h"
#include "nsThreadUtils.h"
#include "nsProxyRelease.h"
@ -799,7 +799,7 @@ nsGnomeVFSProtocolHandler::Init()
}
}
nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs)
{
InitSupportedProtocolsPref(prefs);

View File

@ -40,7 +40,7 @@
#include "nsIObserver.h"
#include "nsWeakReference.h"
#include "nsIPermissionManager.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefBranch.h"
class nsIPrefBranch;
@ -71,7 +71,7 @@ private:
bool *aFromPrefs);
nsCOMPtr<nsIPermissionManager> mPermissionManager;
nsCOMPtr<nsIPrefBranch2> mPrefBranchInternal;
nsCOMPtr<nsIPrefBranch> mPrefBranchInternal;
static PRUint8 mBehaviorPref[];
};

View File

@ -45,7 +45,6 @@
#include "nsIObserverService.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranch2.h"
#include "nsIWeakReference.h"
#include "nsCRT.h"
#include "nsNetUtil.h"

View File

@ -67,7 +67,6 @@
#include "prlog.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranch2.h"
#include "nsIDateTimeFormat.h"
#include "nsDateTimeFormatCID.h"
#include "nsIDOMEvent.h"
@ -1782,8 +1781,7 @@ nsNSSComponent::InitializeNSS(bool showWarningBox)
PK11_SetPasswordFunc(PK11PasswordPrompt);
// Register an observer so we can inform NSS when these prefs change
nsCOMPtr<nsIPrefBranch2> pbi = do_QueryInterface(mPrefBranch);
pbi->AddObserver("security.", this, false);
mPrefBranch->AddObserver("security.", this, false);
SSL_OptionSetDefault(SSL_ENABLE_SSL2, false);
SSL_OptionSetDefault(SSL_V2_COMPATIBLE_HELLO, false);
@ -1907,8 +1905,7 @@ nsNSSComponent::ShutdownNSS()
UnregisterMyOCSPAIAInfoCallback();
if (mPrefBranch) {
nsCOMPtr<nsIPrefBranch2> pbi = do_QueryInterface(mPrefBranch);
pbi->RemoveObserver("security.", this);
mPrefBranch->RemoveObserver("security.", this);
}
ShutdownSmartCardThreads();

View File

@ -101,7 +101,7 @@
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
_PrefSvc = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService)
.QueryInterface(Components.interfaces.nsIPrefBranch2);
.QueryInterface(Components.interfaces.nsIPrefBranch);
return _PrefSvc;
} catch (e) {}
return null;

View File

@ -88,7 +88,6 @@ WeaveCrypto.prototype = {
try {
// Preferences. Add observer so we get notified of changes.
this.prefBranch = Services.prefs.getBranch("services.sync.log.");
this.prefBranch.QueryInterface(Ci.nsIPrefBranch2);
this.prefBranch.addObserver("cryptoDebug", this.observer, false);
this.observer._self = this;
this.debug = this.prefBranch.getBoolPref("cryptoDebug");

View File

@ -257,7 +257,7 @@ PrefTracker.prototype = {
case "weave:engine:start-tracking":
if (!this._enabled) {
Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch2).addObserver("", this, false);
.getService(Ci.nsIPrefBranch).addObserver("", this, false);
this._enabled = true;
}
break;
@ -268,7 +268,7 @@ PrefTracker.prototype = {
case "profile-before-change":
this.__prefs = null;
Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch2).removeObserver("", this);
.getService(Ci.nsIPrefBranch).removeObserver("", this);
break;
case "nsPref:changed":
// Trigger a sync for MULTI-DEVICE for a change that determines

View File

@ -436,8 +436,7 @@ Preferences.prototype = {
if (this._defaultBranch) {
prefSvc = prefSvc.getDefaultBranch(this._prefBranch);
} else {
prefSvc = prefSvc.getBranch(this._prefBranch)
.QueryInterface(Ci.nsIPrefBranch2);
prefSvc = prefSvc.getBranch(this._prefBranch);
}
this.__defineGetter__("_prefSvc", function() prefSvc);

View File

@ -195,7 +195,7 @@ function test_observe_prefs_nsIObserver() {
observed: false,
observe: function(subject, topic, data) {
this.observed = !this.observed;
do_check_true(subject instanceof Ci.nsIPrefBranch2);
do_check_true(subject instanceof Ci.nsIPrefBranch);
do_check_eq(topic, "nsPref:changed");
do_check_eq(data, "test_observe_prefs_nsIObserver");
}

View File

@ -77,7 +77,7 @@ var gCurrentTestIndex = -1;
var gIgnoreScrollEvent = true;
var gPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch2);
getService(Components.interfaces.nsIPrefBranch);
const kPrefSmoothScroll = "general.smoothScroll";
const kPrefNameTimeout = "mousewheel.transaction.timeout";
const kDefaultTimeout = gPrefSvc.getIntPref(kPrefNameTimeout);

View File

@ -109,7 +109,7 @@ var gLitesnEvents = kListenEvent_None;
var gTimer;
var gPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch2);
getService(Components.interfaces.nsIPrefBranch);
const kPrefSmoothScroll = "general.smoothScroll";
const kPrefNameTimeout = "mousewheel.transaction.timeout";
const kPrefNameIgnoreMoveDelay = "mousewheel.transaction.ignoremovedelay";