зеркало из https://github.com/mozilla/gecko-dev.git
Bug 668157 part.1 Add Preferences::GetType() and Preferences::GetDefaultType() r=roc
This commit is contained in:
Родитель
a892cfdc01
Коммит
fdfd964ead
|
@ -237,6 +237,11 @@ public:
|
||||||
*/
|
*/
|
||||||
static bool HasUserValue(const char* aPref);
|
static bool HasUserValue(const char* aPref);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the type of the pref.
|
||||||
|
*/
|
||||||
|
static PRInt32 GetType(const char* aPref);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds/Removes the observer for the root pref branch.
|
* Adds/Removes the observer for the root pref branch.
|
||||||
* The observer is referenced strongly if AddStrongObserver is used. On the
|
* The observer is referenced strongly if AddStrongObserver is used. On the
|
||||||
|
@ -343,6 +348,11 @@ public:
|
||||||
static nsresult GetDefaultComplex(const char* aPref, const nsIID &aType,
|
static nsresult GetDefaultComplex(const char* aPref, const nsIID &aType,
|
||||||
void** aResult);
|
void** aResult);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the type of the pref.
|
||||||
|
*/
|
||||||
|
static PRInt32 GetDefaultType(const char* aPref);
|
||||||
|
|
||||||
// Used to synchronise preferences between chrome and content processes.
|
// Used to synchronise preferences between chrome and content processes.
|
||||||
static void MirrorPreferences(nsTArray<PrefTuple,
|
static void MirrorPreferences(nsTArray<PrefTuple,
|
||||||
nsTArrayInfallibleAllocator> *aArray);
|
nsTArrayInfallibleAllocator> *aArray);
|
||||||
|
|
|
@ -1328,6 +1328,16 @@ Preferences::HasUserValue(const char* aPref)
|
||||||
return PREF_HasUserPref(aPref);
|
return PREF_HasUserPref(aPref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
PRInt32
|
||||||
|
Preferences::GetType(const char* aPref)
|
||||||
|
{
|
||||||
|
NS_ENSURE_TRUE(InitStaticMembers(), nsIPrefBranch::PREF_INVALID);
|
||||||
|
PRInt32 result;
|
||||||
|
return NS_SUCCEEDED(sRootBranch->GetPrefType(aPref, &result)) ?
|
||||||
|
result : nsIPrefBranch::PREF_INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
nsresult
|
nsresult
|
||||||
Preferences::AddStrongObserver(nsIObserver* aObserver,
|
Preferences::AddStrongObserver(nsIObserver* aObserver,
|
||||||
|
@ -1640,4 +1650,14 @@ Preferences::GetDefaultComplex(const char* aPref, const nsIID &aType,
|
||||||
return sDefaultRootBranch->GetComplexValue(aPref, aType, aResult);
|
return sDefaultRootBranch->GetComplexValue(aPref, aType, aResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
PRInt32
|
||||||
|
Preferences::GetDefaultType(const char* aPref)
|
||||||
|
{
|
||||||
|
NS_ENSURE_TRUE(InitStaticMembers(), nsIPrefBranch::PREF_INVALID);
|
||||||
|
PRInt32 result;
|
||||||
|
return NS_SUCCEEDED(sDefaultRootBranch->GetPrefType(aPref, &result)) ?
|
||||||
|
result : nsIPrefBranch::PREF_INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
Загрузка…
Ссылка в новой задаче