Bug 1511080: Add launcher process pref and enable reflection to/from the registry; r=mhowell

Depends on D15756

Differential Revision: https://phabricator.services.mozilla.com/D15757

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Aaron Klotz 2019-01-09 23:35:25 +00:00
Родитель 3d57a7f6a8
Коммит 76125849c6
3 изменённых файлов: 48 добавлений и 0 удалений

Просмотреть файл

@ -1794,3 +1794,8 @@ pref("browser.engagement.recent_visited_origins.expiry", 86400); // 24 * 60 * 60
#ifdef NIGHTLY_BUILD
pref("browser.aboutConfig.showWarning", true);
#endif
#if defined(XP_WIN) && defined(MOZ_LAUNCHER_PROCESS)
// Launcher process is disabled by default, will be selectively enabled via SHIELD
pref("browser.launcherProcess.enabled", false);
#endif // defined(XP_WIN) && defined(MOZ_LAUNCHER_PROCESS)

Просмотреть файл

@ -110,6 +110,10 @@
#include "mozilla/mscom/MainThreadRuntime.h"
#include "mozilla/widget/AudioSession.h"
#if defined(MOZ_LAUNCHER_PROCESS)
#include "mozilla/LauncherRegistryInfo.h"
#endif
#ifndef PROCESS_DEP_ENABLE
#define PROCESS_DEP_ENABLE 0x1
#endif
@ -1628,6 +1632,38 @@ static void RegisterApplicationRestartChanged(const char* aPref, void* aData) {
::UnregisterApplicationRestart();
}
}
#if defined(MOZ_LAUNCHER_PROCESS)
static void OnLauncherPrefChanged(const char* aPref, void* aData) {
bool prefVal =
Preferences::GetBool(PREF_WIN_LAUNCHER_PROCESS_ENABLED, false);
mozilla::LauncherRegistryInfo launcherRegInfo;
mozilla::LauncherVoidResult reflectResult =
launcherRegInfo.ReflectPrefToRegistry(prefVal);
MOZ_ASSERT(reflectResult.isOk());
}
static void SetupLauncherProcessPref() {
mozilla::LauncherRegistryInfo launcherRegInfo;
mozilla::LauncherResult<mozilla::LauncherRegistryInfo::EnabledState>
enabledState = launcherRegInfo.IsEnabled();
if (enabledState.isOk()) {
Preferences::SetBool(
PREF_WIN_LAUNCHER_PROCESS_ENABLED,
enabledState.unwrap() !=
mozilla::LauncherRegistryInfo::EnabledState::ForceDisabled);
}
Preferences::RegisterCallback(&OnLauncherPrefChanged,
PREF_WIN_LAUNCHER_PROCESS_ENABLED);
}
#endif // defined(MOZ_LAUNCHER_PROCESS)
#endif // XP_WIN
// If aBlankCommandLine is true, then the application will be launched with a
@ -4230,6 +4266,9 @@ nsresult XREMain::XRE_mainRun() {
#ifdef XP_WIN
Preferences::RegisterCallbackAndCall(RegisterApplicationRestartChanged,
PREF_WIN_REGISTER_APPLICATION_RESTART);
#if defined(MOZ_LAUNCHER_PROCESS)
SetupLauncherProcessPref();
#endif // defined(MOZ_LAUNCHER_PROCESS)
#endif
#if defined(HAVE_DESKTOP_STARTUP_ID) && defined(MOZ_WIDGET_GTK)

Просмотреть файл

@ -102,6 +102,10 @@ BOOL WinLaunchChild(const wchar_t* exePath, int argc, char** argv,
#define PREF_WIN_REGISTER_APPLICATION_RESTART \
"toolkit.winRegisterApplicationRestart"
#if defined(MOZ_LAUNCHER_PROCESS)
#define PREF_WIN_LAUNCHER_PROCESS_ENABLED "browser.launcherProcess.enabled"
#endif // defined(MOZ_LAUNCHER_PROCESS)
#endif
namespace mozilla {