本文整理汇总了C++中nsCOMPtr::AddWakeLockListener方法的典型用法代码示例。如果您正苦于以下问题:C++ nsCOMPtr::AddWakeLockListener方法的具体用法?C++ nsCOMPtr::AddWakeLockListener怎么用?C++ nsCOMPtr::AddWakeLockListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsCOMPtr
的用法示例。
在下文中一共展示了nsCOMPtr::AddWakeLockListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
nsresult
nsAppShell::Init()
{
#ifdef PR_LOGGING
if (!gWidgetLog)
gWidgetLog = PR_NewLogModule("Widget");
#endif
mObserversHash.Init();
nsresult rv = nsBaseAppShell::Init();
AndroidBridge* bridge = AndroidBridge::Bridge();
nsCOMPtr<nsIObserverService> obsServ =
mozilla::services::GetObserverService();
if (obsServ) {
obsServ->AddObserver(this, "xpcom-shutdown", false);
}
if (sPowerManagerService)
sPowerManagerService->AddWakeLockListener(sWakeLockListener);
if (!bridge)
return rv;
Preferences::AddStrongObservers(this, kObservedPrefs);
bool match;
rv = Preferences::GetBool(PREFNAME_MATCH_OS, &match);
NS_ENSURE_SUCCESS(rv, rv);
if (match) {
bridge->SetSelectedLocale(EmptyString());
return NS_OK;
}
nsAutoString locale;
rv = Preferences::GetLocalizedString(PREFNAME_UA_LOCALE, &locale);
if (NS_FAILED(rv)) {
rv = Preferences::GetString(PREFNAME_UA_LOCALE, &locale);
}
bridge->SetSelectedLocale(locale);
mAllowCoalescingTouches = Preferences::GetBool(PREFNAME_COALESCE_TOUCHES, true);
return rv;
}
示例2:
nsresult
nsAppShell::Init()
{
if (!gWidgetLog)
gWidgetLog = PR_NewLogModule("Widget");
nsresult rv = nsBaseAppShell::Init();
nsCOMPtr<nsIObserverService> obsServ =
mozilla::services::GetObserverService();
if (obsServ) {
obsServ->AddObserver(this, "browser-delayed-startup-finished", false);
obsServ->AddObserver(this, "profile-after-change", false);
obsServ->AddObserver(this, "xpcom-shutdown", false);
}
if (sPowerManagerService)
sPowerManagerService->AddWakeLockListener(sWakeLockListener);
Preferences::AddStrongObservers(this, kObservedPrefs);
mAllowCoalescingTouches = Preferences::GetBool(PREFNAME_COALESCE_TOUCHES, true);
return rv;
}