merge fx-team to m-c

This commit is contained in:
Wes Kocher 2013-12-06 20:45:11 -06:00
commit e916fc9170
5 changed files with 58 additions and 62 deletions

View File

@ -12,6 +12,7 @@
HANDLE sCon;
LPCWSTR metroDX10Available = L"MetroD3DAvailable";
LPCWSTR metroLastAHE = L"MetroLastAHE";
typedef HRESULT (WINAPI*D3D10CreateDevice1Func)
(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE, UINT,
@ -107,6 +108,23 @@ IsProcessRunning(const wchar_t *processName, bool bCheckIfMetro)
return exists;
}
AHE_TYPE
GetLastAHE()
{
DWORD ahe;
if (GetDWORDRegKey(metroLastAHE, ahe)) {
return (AHE_TYPE) ahe;
}
return AHE_DESKTOP;
}
bool
SetLastAHE(AHE_TYPE ahe)
{
return SetDWORDRegKey(metroLastAHE, (DWORD) ahe);
}
bool
IsDX10Available()
{

View File

@ -13,6 +13,7 @@
#include <dxgi.h>
#include <d3d10misc.h>
#include <atlbase.h>
#include <shlobj.h>
//#define SHOW_CONSOLE 1
extern HANDLE sCon;
@ -24,6 +25,8 @@ void Log(const wchar_t *fmt, ...);
void SetupConsole();
#endif
AHE_TYPE GetLastAHE();
bool SetLastAHE(AHE_TYPE ahe);
bool IsDX10Available();
bool GetDWORDRegKey(LPCWSTR name, DWORD &value);
bool SetDWORDRegKey(LPCWSTR name, DWORD value);

View File

@ -262,79 +262,50 @@ public:
IFACEMETHODIMP GetValue(AHE_TYPE *aLaunchType)
{
Log(L"IExecuteCommandApplicationHostEnvironment::GetValue()");
*aLaunchType = AHE_DESKTOP;
mIsDesktopRequest = true;
if (!mIsRestartMetroRequest && IsProcessRunning(kFirefoxExe, false)) {
return S_OK;
} else if (!mIsRestartDesktopRequest && IsProcessRunning(kMetroFirefoxExe, true)) {
*aLaunchType = AHE_IMMERSIVE;
mIsDesktopRequest = false;
*aLaunchType = GetLaunchType();
mIsDesktopRequest = (*aLaunchType == AHE_DESKTOP);
SetLastAHE(*aLaunchType);
return S_OK;
}
if (!mUnkSite) {
Log(L"No mUnkSite.");
return S_OK;
/**
* Choose the appropriate launch type based on the user's previously chosen
* host environment, along with system constraints.
*/
AHE_TYPE GetLaunchType() {
AHE_TYPE ahe = GetLastAHE();
Log(L"Previous AHE: %d", ahe);
if (!mIsRestartMetroRequest && IsProcessRunning(kFirefoxExe, false)) {
Log(L"Returning AHE_DESKTOP because desktop is already running");
return AHE_DESKTOP;
} else if (!mIsRestartDesktopRequest && IsProcessRunning(kMetroFirefoxExe, true)) {
Log(L"Returning AHE_IMMERSIVE because Metro is already running");
return AHE_IMMERSIVE;
}
if (mIsRestartDesktopRequest) {
Log(L"Restarting in desktop host environment.");
return S_OK;
return AHE_DESKTOP;
}
HRESULT hr;
IServiceProvider* pSvcProvider = nullptr;
hr = mUnkSite->QueryInterface(IID_IServiceProvider, (void**)&pSvcProvider);
if (!pSvcProvider) {
Log(L"Couldn't get IServiceProvider service from explorer. (%X)", hr);
return S_OK;
if (mIsRestartMetroRequest) {
Log(L"Restarting in metro host environment.");
ahe = AHE_IMMERSIVE;
}
IExecuteCommandHost* pHost = nullptr;
// If we can't get this it's a conventional desktop launch
hr = pSvcProvider->QueryService(SID_ExecuteCommandHost,
IID_IExecuteCommandHost, (void**)&pHost);
if (!pHost) {
Log(L"Couldn't get IExecuteCommandHost service from explorer. (%X)", hr);
SafeRelease(&pSvcProvider);
return S_OK;
}
SafeRelease(&pSvcProvider);
EC_HOST_UI_MODE mode;
if (FAILED(pHost->GetUIMode(&mode))) {
Log(L"GetUIMode failed.");
SafeRelease(&pHost);
return S_OK;
}
// 0 - launched from desktop
// 1 - ?
// 2 - launched from tile interface
Log(L"GetUIMode: %d", mode);
if (ahe == AHE_IMMERSIVE) {
if (!IsDefaultBrowser()) {
mode = ECHUIM_DESKTOP;
Log(L"returning AHE_DESKTOP because we are not the default browser");
return AHE_DESKTOP;
}
if (mode == ECHUIM_DESKTOP) {
Log(L"returning AHE_DESKTOP");
SafeRelease(&pHost);
return S_OK;
}
SafeRelease(&pHost);
if (!IsDX10Available()) {
Log(L"returning AHE_DESKTOP because DX10 is not available");
*aLaunchType = AHE_DESKTOP;
mIsDesktopRequest = true;
} else {
Log(L"returning AHE_IMMERSIVE");
*aLaunchType = AHE_IMMERSIVE;
mIsDesktopRequest = false;
return AHE_DESKTOP;
}
return S_OK;
}
return ahe;
}
/*

View File

@ -24,6 +24,7 @@
/* Splitters */
.devtools-horizontal-splitter {
-moz-appearance: none;
background-image: none;
border-top: 1px solid black;
border-bottom-width: 0;
min-height: 3px;
@ -34,6 +35,7 @@
.devtools-side-splitter {
-moz-appearance: none;
background-image: none;
border: 0;
-moz-border-start: 1px solid black;
min-width: 0;

View File

@ -21,9 +21,11 @@ GARBAGE_DIRS = \
ANDROID=$(ANDROID_SDK)/../../tools/android
TARGET= $(notdir $(ANDROID_SDK))
build.xml:
$(ANDROID) create project --name GeckoViewExample --target android-18 --path $(CURDIR) --activity GeckoViewExample --package org.mozilla.geckoviewexample
$(ANDROID) update project --target android-18 --path $(CURDIR) --library $(DEPTH)/mobile/android/geckoview_library
$(ANDROID) create project --name GeckoViewExample --target $(TARGET) --path $(CURDIR) --activity GeckoViewExample --package org.mozilla.geckoviewexample
$(ANDROID) update project --target $(TARGET) --path $(CURDIR) --library $(DEPTH)/mobile/android/geckoview_library
$(UNZIP) -o $(DIST)/geckoview_library/geckoview_assets.zip
$(NSINSTALL) $(srcdir)/main.xml res/layout/
$(NSINSTALL) $(srcdir)/AndroidManifest.xml .