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; }
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; }