Bug 337917 Make consumers stop using cids from other modules

r=dveditz sr=darin


git-svn-id: svn://10.0.0.236/trunk@198974 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
timeless%mozdev.org 2006-06-03 23:38:55 +00:00
parent 7185e837bc
commit 50666c89f3
19 changed files with 30 additions and 70 deletions

View File

@ -59,8 +59,6 @@
#include "nsIScreenManager.h"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
nscoord nsDeviceContextBeOS::mDpi = 96;
nsDeviceContextBeOS::nsDeviceContextBeOS()
@ -80,7 +78,7 @@ nsDeviceContextBeOS::nsDeviceContextBeOS()
nsDeviceContextBeOS::~nsDeviceContextBeOS()
{
nsresult rv;
nsCOMPtr<nsIPref> prefs = do_GetService(kPrefCID, &rv);
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
prefs->UnregisterCallback("layout.css.dpi", prefChanged, (void *)this);
}
@ -121,7 +119,7 @@ NS_IMETHODIMP nsDeviceContextBeOS::Init(nsNativeWidget aNativeWidget)
PRInt32 prefVal = -1;
nsresult res;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &res));
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &res));
if (NS_SUCCEEDED(res) && prefs)
{
res = prefs->GetIntPref("layout.css.dpi", &prefVal);
@ -422,7 +420,7 @@ int nsDeviceContextBeOS::prefChanged(const char *aPref, void *aClosure)
if (nsCRT::strcmp(aPref, "layout.css.dpi")==0)
{
PRInt32 dpi;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
rv = prefs->GetIntPref(aPref, &dpi);
if (NS_SUCCEEDED(rv))
context->SetDPI(dpi);

View File

@ -85,8 +85,6 @@ static PRInt32 GetXftDPI(void);
static PRInt32 GetOSDPI(void);
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
#define GDK_DEFAULT_FONT1 "-*-helvetica-medium-r-*--*-120-*-*-*-*-iso8859-1"
#define GDK_DEFAULT_FONT2 "-*-fixed-medium-r-*-*-*-120-*-*-*-*-*-*"
@ -157,7 +155,7 @@ nsDeviceContextGTK::nsDeviceContextGTK()
nsDeviceContextGTK::~nsDeviceContextGTK()
{
nsresult rv;
nsCOMPtr<nsIPref> prefs = do_GetService(kPrefCID, &rv);
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
prefs->UnregisterCallback("layout.css.dpi",
prefChanged, (void *)this);
@ -242,7 +240,7 @@ NS_IMETHODIMP nsDeviceContextGTK::Init(nsNativeWidget aNativeWidget)
// If it's positive, we use it as the logical resolution
nsresult res;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &res));
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &res));
if (NS_SUCCEEDED(res) && prefs) {
res = prefs->GetIntPref("layout.css.dpi", &prefVal);
if (NS_FAILED(res)) {
@ -687,7 +685,7 @@ int nsDeviceContextGTK::prefChanged(const char *aPref, void *aClosure)
if (nsCRT::strcmp(aPref, "layout.css.dpi")==0) {
PRInt32 dpi;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
rv = prefs->GetIntPref(aPref, &dpi);
if (NS_SUCCEEDED(rv))
context->SetDPI(dpi);

View File

@ -153,7 +153,6 @@ struct nsFontPropertyName
int mValue;
};
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static void SetCharsetLangGroup(nsFontCharSetInfo* aCharSetInfo);
static int gFontMetricsGTKCount = 0;
@ -1093,7 +1092,7 @@ InitGlobals(nsIDeviceContext *aDevice)
FreeGlobals();
return NS_ERROR_FAILURE;
}
CallGetService(kPrefCID, &gPref);
CallGetService(NS_PREF_CONTRACTID, &gPref);
if (!gPref) {
FreeGlobals();
return NS_ERROR_FAILURE;

View File

@ -888,11 +888,6 @@ nsresult nsDeviceContextMac::CreateFontAliasTable()
#pragma mark -
//------------------------------------------------------------------------
//
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
* @update 12/9/98 dwc
@ -905,7 +900,7 @@ PRUint32 nsDeviceContextMac::GetScreenResolution()
initialized = PR_TRUE;
nsresult rv;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv) && prefs) {
PRInt32 intVal;
if (NS_SUCCEEDED(prefs->GetIntPref("layout.css.dpi", &intVal)) && intVal > 0) {

View File

@ -45,8 +45,6 @@
#include "nsString.h"
#include "nsCRT.h"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
//--------------------------------------------------------------------------
nsUnicodeMappingUtil *nsUnicodeMappingUtil::gSingleton = nsnull;
@ -358,7 +356,7 @@ nsUnicodeMappingUtil::PrefEnumCallback(const char* aName, void* aClosure)
void nsUnicodeMappingUtil::InitFromPref()
{
if (!mPref) {
mPref = do_GetService(kPrefCID);
mPref = do_GetService(NS_PREF_CONTRACTID);
if (!mPref)
return;
mPref->RegisterCallback("font.name.", nsUnicodeMappingUtil::PrefChangedCallback, (void*) nsnull);

View File

@ -68,7 +68,6 @@
#define NS_REPLACEMENT_CHAR PRUnichar(0x003F) // question mark
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
#define NS_MAX_FONT_WEIGHT 900
#define NS_MIN_FONT_WEIGHT 100
@ -212,7 +211,7 @@ static nsFontCleanupObserver *gFontCleanupObserver;
static nsresult
InitGlobals(void)
{
CallGetService(kPrefCID, &gPref);
CallGetService(NS_PREF_CONTRACTID, &gPref);
if (!gPref) {
FreeGlobals();
return NS_ERROR_FAILURE;

View File

@ -50,8 +50,6 @@
#include "nsPhGfxLog.h"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
#define NS_TO_PH_RGB(ns) (ns & 0xff) << 16 | (ns & 0xff00) | ((ns >> 16) & 0xff)
nscoord nsDeviceContextPh::mDpi = 96;
@ -188,7 +186,7 @@ void nsDeviceContextPh :: CommonInit( nsNativeDeviceContext aDC ) {
PRInt32 prefVal = -1;
nsresult res;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &res));
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &res));
if( NS_SUCCEEDED( res ) && prefs ) {
res = prefs->GetIntPref("layout.css.dpi", &prefVal);
if( NS_FAILED( res ) ) {
@ -542,7 +540,7 @@ int nsDeviceContextPh::prefChanged( const char *aPref, void *aClosure ) {
if( nsCRT::strcmp(aPref, "layout.css.dpi")==0 ) {
PRInt32 dpi;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
rv = prefs->GetIntPref(aPref, &dpi);
if( NS_SUCCEEDED( rv ) ) context->SetDPI( dpi );
}

View File

@ -56,8 +56,6 @@
#include "nsReadableUtils.h"
#include "nsIPref.h"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
nsDeviceContextSpecPh :: nsDeviceContextSpecPh()
{
mPC = PpCreatePC();
@ -174,7 +172,7 @@ NS_IMETHODIMP nsDeviceContextSpecPh :: Init(nsIWidget* aWidget,
/* set the print frame / BG colors and images settings, according to the Pt_ARG_WEB_OPTION setting */
nsresult res;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &res));
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &res));
PRInt16 howToEnableFrameUI = nsIPrintSettings::kFrameEnableNone;
aPS->GetHowToEnableFrameUI(&howToEnableFrameUI);

View File

@ -46,8 +46,6 @@
#include <Pt.h>
#include <errno.h>
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
nsPixelFormat nsDrawingSurfacePh::mPixFormat = {
0, // mRedZeroMask; //red color mask in zero position
0, // mGreenZeroMask; //green color mask in zero position
@ -100,7 +98,7 @@ nsDrawingSurfacePh :: ~nsDrawingSurfacePh( )
if( mIsOffscreen ) {
nsresult rv;
nsCOMPtr<nsIPref> prefs = do_GetService(kPrefCID, &rv);
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
prefs->UnregisterCallback("browser.display.internaluse.graphics_changed", prefChanged, (void *)this);
}
@ -244,7 +242,7 @@ NS_IMETHODIMP nsDrawingSurfacePh :: Init( PRUint32 aWidth, PRUint32 aHeight, PRU
PgSetDrawBufferSizeCx( mDrawContext, 0xffff );
nsresult rv;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv)) {
prefs->RegisterCallback("browser.display.internaluse.graphics_changed", prefChanged, (void *)this);
}

View File

@ -57,8 +57,6 @@ static nsIPref* gPref = nsnull;
#undef USER_DEFINED
#define USER_DEFINED "x-user-def"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
nsFontMetricsPh::nsFontMetricsPh()
{
mDeviceContext = nsnull;
@ -87,7 +85,7 @@ nsFontMetricsPh::nsFontMetricsPh()
static nsresult InitGlobals()
{
CallGetService(kPrefCID, &gPref);
CallGetService(NS_PREF_CONTRACTID, &gPref);
if (!gPref) return NS_ERROR_FAILURE;
gFontMetricsCache = new nsHashtable();

View File

@ -109,7 +109,6 @@ class fpCString : public nsCAutoString {
#define NS_RGB_TO_GRAY(r,g,b) ((int(r) * 77 + int(g) * 150 + int(b) * 29) / 256)
#define NS_IS_BOLD(x) (((x) >= 401) ? 1 : 0)
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
/*
* global
@ -200,7 +199,7 @@ nsPostScriptObj::nsPostScriptObj() :
{
PR_LOG(nsPostScriptObjLM, PR_LOG_DEBUG, ("nsPostScriptObj::nsPostScriptObj()\n"));
CallGetService(kPrefCID, &gPrefs);
CallGetService(NS_PREF_CONTRACTID, &gPrefs);
gLangGroups = new nsHashtable();
}

View File

@ -95,8 +95,6 @@ static int x11_error_handler (Display *dpy, XErrorEvent *err) {
PRLogModuleInfo* gThebesGFXLog = nsnull;
#endif
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
NS_IMPL_ISUPPORTS_INHERITED0(nsThebesDeviceContext, DeviceContextImpl)
nsThebesDeviceContext::nsThebesDeviceContext()
@ -129,7 +127,7 @@ nsThebesDeviceContext::nsThebesDeviceContext()
nsThebesDeviceContext::~nsThebesDeviceContext()
{
nsresult rv;
nsCOMPtr<nsIPref> prefs = do_GetService(kPrefCID, &rv);
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
prefs->UnregisterCallback("layout.css.dpi",
prefChanged, (void *)this);
@ -212,7 +210,7 @@ nsThebesDeviceContext::Init(nsNativeWidget aWidget)
// If it's positive, we use it as the logical resolution
nsresult res;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &res));
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &res));
if (NS_SUCCEEDED(res) && prefs) {
res = prefs->GetIntPref("layout.css.dpi", &prefVal);
if (NS_FAILED(res)) {
@ -631,7 +629,7 @@ nsThebesDeviceContext::prefChanged(const char *aPref, void *aClosure)
if (nsCRT::strcmp(aPref, "layout.css.dpi") == 0) {
PRInt32 dpi;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
rv = prefs->GetIntPref(aPref, &dpi);
if (NS_SUCCEEDED(rv))
context->SetDPI(dpi);

View File

@ -135,7 +135,6 @@ static PRUint16* GenerateMultiByte(nsCharsetInfo* aSelf);
static PRBool LookupWinFontName(const nsAFlatString& aName,
nsAString& aWinName);
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
nsVoidArray* nsFontMetricsWin::gGlobalFonts = nsnull;
PLHashTable* nsFontMetricsWin::gFontWeights = nsnull;
@ -360,7 +359,7 @@ InitGlobals(void)
FreeGlobals();
return NS_ERROR_FAILURE;
}
CallGetService(kPrefCID, &gPref);
CallGetService(NS_PREF_CONTRACTID, &gPref);
if (!gPref) {
FreeGlobals();
return NS_ERROR_FAILURE;

View File

@ -65,8 +65,6 @@
#include "nsIDeviceContextXPrint.h"
#endif /* USE_XPRINT */
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
#define XLIB_DEFAULT_FONT1 "-*-helvetica-medium-r-*--*-120-*-*-*-*-iso8859-1"
#define XLIB_DEFAULT_FONT2 "-*-fixed-medium-r-*-*-*-120-*-*-*-*-*-*"
@ -172,7 +170,7 @@ nsDeviceContextXlib::CommonInit(void)
if (!initialized) {
initialized = 1;
nsresult res;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &res));
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &res));
if (NS_SUCCEEDED(res) && prefs) {
PRInt32 intVal = 96;
res = prefs->GetIntPref("layout.css.dpi", &intVal);

View File

@ -241,8 +241,6 @@ typedef struct
/*-----------------------------------------------------------------
* Globals
*-----------------------------------------------------------------*/
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
nsPrefMigration* nsPrefMigration::mInstance = nsnull;
nsPrefMigration *
@ -286,7 +284,7 @@ nsPrefMigration::getPrefService()
// get the prefs service
nsresult rv = NS_OK;
nsCOMPtr<nsIPref> pIMyService(do_GetService(kPrefServiceCID, &rv));
nsCOMPtr<nsIPref> pIMyService(do_GetService(NS_PREF_CONTRACTID, &rv));
if(NS_FAILED(rv)) return rv;
return NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD, NS_GET_IID(nsIPref),
@ -2453,7 +2451,7 @@ nsPrefConverter::ConvertPrefsToUTF8()
nsCStringArray prefsToMigrate;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID, &rv));
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if(NS_FAILED(rv)) return rv;
if (!prefs) return NS_ERROR_FAILURE;

View File

@ -860,11 +860,6 @@ nsresult nsDeviceContextMac::CreateFontAliasTable()
#pragma mark -
//------------------------------------------------------------------------
//
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
/** ---------------------------------------------------
* See documentation in nsIDeviceContext.h
* @update 12/9/98 dwc
@ -877,7 +872,7 @@ PRUint32 nsDeviceContextMac::GetScreenResolution()
initialized = PR_TRUE;
nsresult rv;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv) && prefs) {
PRInt32 intVal;
if (NS_SUCCEEDED(prefs->GetIntPref("layout.css.dpi", &intVal)) && intVal > 0) {

View File

@ -1075,8 +1075,6 @@ static void debug_SetCachedBoolPref(const char * aPrefName,PRBool aValue)
NS_ASSERTION(PR_FALSE, "cmon, this code is not reached dude.");
}
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
//////////////////////////////////////////////////////////////
/* static */ int PR_CALLBACK
debug_PrefChangedCallback(const char * name,void * closure)
@ -1084,7 +1082,7 @@ debug_PrefChangedCallback(const char * name,void * closure)
nsIPref * prefs = nsnull;
nsresult rv = CallGetService(kPrefCID, &prefs);
nsresult rv = CallGetService(NS_PREF_CONTRACTID, &prefs);
NS_ASSERTION(NS_SUCCEEDED(rv),"Could not get prefs service.");
NS_ASSERTION(nsnull != prefs,"Prefs services is null.");
@ -1114,7 +1112,7 @@ debug_RegisterPrefCallbacks()
nsIPref * prefs = nsnull;
nsresult rv = CallGetService(kPrefCID, &prefs);
nsresult rv = CallGetService(NS_PREF_CONTRACTID, &prefs);
NS_ASSERTION(NS_SUCCEEDED(rv),"Could not get prefs service.");
NS_ASSERTION(nsnull != prefs,"Prefs services is null.");

View File

@ -107,9 +107,6 @@
#define ENABLE_PAGE_CYCLER
#endif
/* Define Class IDs */
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
#ifdef DEBUG
static int APP_DEBUG = 0; // Set to 1 in debugger to turn on debugging.
#else
@ -632,7 +629,7 @@ NS_IMETHODIMP nsBrowserContentHandler::GetChromeUrlForTask(char **aChromeUrlForT
return NS_ERROR_NULL_POINTER;
nsresult rv = NS_ERROR_FAILURE;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID));
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID));
if (prefs) {
rv = prefs->CopyCharPref("browser.chromeURL", aChromeUrlForTask);
if (NS_SUCCEEDED(rv) && (*aChromeUrlForTask)[0] == '\0') {
@ -724,7 +721,7 @@ NS_IMETHODIMP nsBrowserContentHandler::GetDefaultArgs(PRUnichar **aDefaultArgs)
nsresult rv;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID));
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID));
if (prefs) {
if (NeedHomepageOverride(prefs)) {
rv = prefs->GetLocalizedUnicharPref(PREF_HOMEPAGE_OVERRIDE_URL, aDefaultArgs);

View File

@ -73,7 +73,6 @@
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static const char kURINC_RelatedLinksRoot[] = "NC:RelatedLinks";
@ -632,7 +631,7 @@ RelatedLinksHandlerImpl::Init()
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "child"),
&kNC_Child);
nsCOMPtr<nsIPref> prefServ(do_GetService(kPrefCID, &rv));
nsCOMPtr<nsIPref> prefServ(do_GetService(NS_PREF_CONTRACTID, &rv));
mRLServerURL = new nsString();
if (NS_SUCCEEDED(rv) && (prefServ))
{