mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-25 22:29:07 +00:00
Bug 950241 - Update app runners last run settings to support desktop updating from metro. r=bbondy
This commit is contained in:
parent
c3235e23d0
commit
2c3fc24810
@ -2805,6 +2805,38 @@ static DWORD InitDwriteBG(LPVOID lpdwThreadParam)
|
||||
bool fire_glxtest_process();
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_METRO)
|
||||
#ifndef AHE_TYPE
|
||||
enum AHE_TYPE {
|
||||
AHE_DESKTOP = 0,
|
||||
AHE_IMMERSIVE = 1
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The Windows launcher uses this value to decide what front end ui
|
||||
* to launch. We always launch the same ui unless the user
|
||||
* specifically asks to switch. Update the value on every startup
|
||||
* based on the environment requested.
|
||||
*/
|
||||
void
|
||||
SetLastWinRunType(AHE_TYPE aType)
|
||||
{
|
||||
HKEY key;
|
||||
LONG result = RegOpenKeyExW(HKEY_CURRENT_USER,
|
||||
L"SOFTWARE\\Mozilla\\Firefox",
|
||||
0, KEY_WRITE, &key);
|
||||
if (result != ERROR_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
DWORD value = (DWORD)aType;
|
||||
result = RegSetValueEx(key, L"MetroLastAHE", 0, REG_DWORD,
|
||||
reinterpret_cast<LPBYTE>(&value),
|
||||
sizeof(DWORD));
|
||||
RegCloseKey(key);
|
||||
}
|
||||
#endif // defined(XP_WIN) && defined(MOZ_METRO)
|
||||
|
||||
#include "GeckoProfiler.h"
|
||||
|
||||
// Encapsulates startup and shutdown state for XRE_main
|
||||
@ -2898,6 +2930,19 @@ XREMain::XRE_mainInit(bool* aExitFlag)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_METRO)
|
||||
// Don't remove this arg, we want to pass it on to nsUpdateDriver
|
||||
if (CheckArg("metro-update", false, nullptr, false) == ARG_FOUND ||
|
||||
XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
// If we're doing a restart update that was initiated from metro land,
|
||||
// we'll be running desktop to handle the actual update. Request that
|
||||
// after the restart we launch into metro.
|
||||
SetLastWinRunType(AHE_IMMERSIVE);
|
||||
} else {
|
||||
SetLastWinRunType(AHE_DESKTOP);
|
||||
}
|
||||
#endif
|
||||
|
||||
SetupErrorHandling(gArgv[0]);
|
||||
|
||||
#ifdef CAIRO_HAS_DWRITE_FONT
|
||||
@ -3634,6 +3679,12 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
|
||||
*aExitFlag = true;
|
||||
return 0;
|
||||
}
|
||||
#if defined(XP_WIN) && defined(MOZ_METRO)
|
||||
if (CheckArg("metro-update", false) == ARG_FOUND) {
|
||||
*aExitFlag = true;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
rv = NS_NewToolkitProfileService(getter_AddRefs(mProfileSvc));
|
||||
@ -4237,36 +4288,6 @@ public:
|
||||
HRESULT mResult;
|
||||
};
|
||||
|
||||
#ifndef AHE_TYPE
|
||||
enum AHE_TYPE {
|
||||
AHE_DESKTOP = 0,
|
||||
AHE_IMMERSIVE = 1
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The Windows launcher uses this value to decide what front end ui
|
||||
* to launch. We always launch the same ui unless the user
|
||||
* specifically asks to switch. Update the value on every startup
|
||||
* based on the environment requested.
|
||||
*/
|
||||
void
|
||||
SetLastWinRunType(AHE_TYPE aType)
|
||||
{
|
||||
HKEY key;
|
||||
LONG result = RegOpenKeyExW(HKEY_CURRENT_USER,
|
||||
L"SOFTWARE\\Mozilla\\Firefox",
|
||||
0, KEY_WRITE, &key);
|
||||
if (result != ERROR_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
DWORD value = (DWORD)aType;
|
||||
result = RegSetValueEx(key, L"MetroLastAHE", 0, REG_DWORD,
|
||||
reinterpret_cast<LPBYTE>(&value),
|
||||
sizeof(DWORD));
|
||||
RegCloseKey(key);
|
||||
}
|
||||
|
||||
int
|
||||
XRE_mainMetro(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
{
|
||||
@ -4334,9 +4355,6 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData, uint32_t aFlags)
|
||||
#else
|
||||
if (aFlags == XRE_MAIN_FLAG_USE_METRO) {
|
||||
SetWindowsEnvironment(WindowsEnvironmentType_Metro);
|
||||
SetLastWinRunType(AHE_IMMERSIVE);
|
||||
} else {
|
||||
SetLastWinRunType(AHE_DESKTOP);
|
||||
}
|
||||
|
||||
// Desktop
|
||||
@ -4351,6 +4369,8 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData, uint32_t aFlags)
|
||||
NS_ASSERTION(XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro,
|
||||
"Unknown Windows environment");
|
||||
|
||||
SetLastWinRunType(AHE_IMMERSIVE);
|
||||
|
||||
int result = XRE_mainMetro(argc, argv, aAppData);
|
||||
mozilla::RecordShutdownEndTimeStamp();
|
||||
return result;
|
||||
|
Loading…
x
Reference in New Issue
Block a user