mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
Remove Windows Metro/WinRT code.
This commit is contained in:
@@ -18,4 +18,4 @@
|
||||
# Modifying this file will now automatically clobber the buildbot machines \o/
|
||||
#
|
||||
|
||||
Clobber required for libvpx 1.4 update
|
||||
Clobber required for removing metro browser platform code.
|
||||
|
||||
@@ -1180,13 +1180,6 @@ AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
|
||||
nsresult rv = Accessible::HandleAccEvent(aEvent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Don't fire native MSAA events or mess with the system caret
|
||||
// when running in metro mode. This confuses input focus tracking
|
||||
// in metro's UIA implementation.
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t eventType = aEvent->GetEventType();
|
||||
|
||||
static_assert(sizeof(gWinEventMap)/sizeof(gWinEventMap[0]) == nsIAccessibleEvent::EVENT_LAST_ENTRY,
|
||||
|
||||
@@ -231,39 +231,32 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool metroOnDesktop = false;
|
||||
|
||||
// Desktop browser launch
|
||||
if (mainFlags != XRE_MAIN_FLAG_USE_METRO && !metroOnDesktop) {
|
||||
ScopedAppData appData(&sAppData);
|
||||
nsCOMPtr<nsIFile> exeFile;
|
||||
rv = mozilla::BinaryPath::GetFile(argv[0], getter_AddRefs(exeFile));
|
||||
if (NS_FAILED(rv)) {
|
||||
Output("Couldn't find the application directory.\n");
|
||||
return 255;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> greDir;
|
||||
exeFile->GetParent(getter_AddRefs(greDir));
|
||||
#ifdef XP_MACOSX
|
||||
nsCOMPtr<nsIFile> parent;
|
||||
greDir->GetParent(getter_AddRefs(parent));
|
||||
greDir = parent.forget();
|
||||
greDir->AppendNative(NS_LITERAL_CSTRING(kOSXResourcesFolder));
|
||||
#endif
|
||||
nsCOMPtr<nsIFile> appSubdir;
|
||||
greDir->Clone(getter_AddRefs(appSubdir));
|
||||
appSubdir->Append(NS_LITERAL_STRING(kDesktopFolder));
|
||||
|
||||
SetStrongPtr(appData.directory, static_cast<nsIFile*>(appSubdir.get()));
|
||||
// xreDirectory already has a refcount from NS_NewLocalFile
|
||||
appData.xreDirectory = xreDirectory;
|
||||
|
||||
return XRE_main(argc, argv, &appData, mainFlags);
|
||||
ScopedAppData appData(&sAppData);
|
||||
nsCOMPtr<nsIFile> exeFile;
|
||||
rv = mozilla::BinaryPath::GetFile(argv[0], getter_AddRefs(exeFile));
|
||||
if (NS_FAILED(rv)) {
|
||||
Output("Couldn't find the application directory.\n");
|
||||
return 255;
|
||||
}
|
||||
|
||||
NS_NOTREACHED("browser do_main failed to pickup proper initialization");
|
||||
return 255;
|
||||
nsCOMPtr<nsIFile> greDir;
|
||||
exeFile->GetParent(getter_AddRefs(greDir));
|
||||
#ifdef XP_MACOSX
|
||||
nsCOMPtr<nsIFile> parent;
|
||||
greDir->GetParent(getter_AddRefs(parent));
|
||||
greDir = parent.forget();
|
||||
greDir->AppendNative(NS_LITERAL_CSTRING(kOSXResourcesFolder));
|
||||
#endif
|
||||
nsCOMPtr<nsIFile> appSubdir;
|
||||
greDir->Clone(getter_AddRefs(appSubdir));
|
||||
appSubdir->Append(NS_LITERAL_STRING(kDesktopFolder));
|
||||
|
||||
SetStrongPtr(appData.directory, static_cast<nsIFile*>(appSubdir.get()));
|
||||
// xreDirectory already has a refcount from NS_NewLocalFile
|
||||
appData.xreDirectory = xreDirectory;
|
||||
|
||||
return XRE_main(argc, argv, &appData, mainFlags);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -123,7 +123,6 @@ pref("app.update.cert.maxErrors", 5);
|
||||
// |app.update.url.override| user preference has been set for testing updates or
|
||||
// when the |app.update.cert.checkAttributes| preference is set to false. Also,
|
||||
// the |app.update.url.override| preference should ONLY be used for testing.
|
||||
// IMPORTANT! metro.js should also be updated for updates to certs.X.issuerName
|
||||
pref("app.update.certs.1.issuerName", "CN=Thawte SSL CA,O=\"Thawte, Inc.\",C=US");
|
||||
pref("app.update.certs.1.commonName", "aus3.mozilla.org");
|
||||
|
||||
@@ -139,7 +138,6 @@ pref("app.update.enabled", true);
|
||||
pref("app.update.auto", true);
|
||||
|
||||
// See chart in nsUpdateService.js source for more details
|
||||
// incompatibilities are ignored by updates in Metro
|
||||
pref("app.update.mode", 1);
|
||||
|
||||
// If set to true, the Update Service will present no UI for any event.
|
||||
|
||||
@@ -667,9 +667,10 @@ class Automation(object):
|
||||
stackFixerFunction = lambda line: stackFixerModule.fixSymbols(line)
|
||||
del sys.path[0]
|
||||
|
||||
# With metro browser runs this script launches the metro test harness which launches the browser.
|
||||
# The metro test harness hands back the real browser process id via log output which we need to
|
||||
# With indirect browser runs, this script launches the test harness which launches the browser.
|
||||
# The test harness hands back the real browser process id via log output which we need to
|
||||
# pick up on and parse out. This variable tracks the real browser process id if we find it.
|
||||
# XXX: Previously used by metro. Do we still need this?
|
||||
browserProcessId = -1
|
||||
|
||||
(line, didTimeout) = self.readWithTimeout(logsource, timeout)
|
||||
@@ -684,12 +685,6 @@ class Automation(object):
|
||||
|
||||
(line, didTimeout) = self.readWithTimeout(logsource, timeout)
|
||||
|
||||
if "METRO_BROWSER_PROCESS" in line:
|
||||
index = line.find("=")
|
||||
if index:
|
||||
browserProcessId = line[index+1:].rstrip()
|
||||
self.log.info("INFO | automation.py | metro browser sub process id detected: %s", browserProcessId)
|
||||
|
||||
if not hitMaxTime and maxTime and datetime.now() - startTime > timedelta(seconds = maxTime):
|
||||
# Kill the application.
|
||||
hitMaxTime = True
|
||||
|
||||
@@ -34,15 +34,6 @@
|
||||
fun:_ZN13CrashReporter14SetupExtraDataEP7nsIFileRK19nsACString_internal
|
||||
...
|
||||
}
|
||||
{
|
||||
We purposely leak the StatisticsReporter object
|
||||
Memcheck:Leak
|
||||
fun:malloc
|
||||
fun:moz_xmalloc
|
||||
fun:operator new
|
||||
fun:_Z21XRE_CreateStatsObjectv
|
||||
...
|
||||
}
|
||||
|
||||
####################################
|
||||
# Leaks in third party libraries #
|
||||
|
||||
@@ -12,8 +12,8 @@ export WIN32_REDIST_DIR=${_VSPATH}/VC/redist/x86/Microsoft.VC100.CRT
|
||||
## moz tools location for 64-bit builders ##
|
||||
export MOZ_TOOLS=C:/mozilla-build/moztools
|
||||
|
||||
## includes: win8 sdk includes, winrt headers for metro, msvc 10 std library, directx sdk for d3d9 ##
|
||||
export INCLUDE=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/shared:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/um:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/winrt:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/winrt/wrl:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/winrt/wrl/wrappers:${_VSPATH}/vc/include:${_VSPATH}/vc/atlmfc/include:/c/tools/sdks/dx10/include
|
||||
## includes: win8 sdk includes, msvc 10 std library, directx sdk for d3d9 ##
|
||||
export INCLUDE=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/shared:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/um:${_VSPATH}/vc/include:${_VSPATH}/vc/atlmfc/include:/c/tools/sdks/dx10/include
|
||||
|
||||
## libs: win8 sdk x86 (32-bit) libs, msvc 10 (32-bit) std library, msvc 10 atl libs, directx sdk (32-bit) for d3d9 ##
|
||||
export LIBPATH=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/Lib/win8/um/x86:${_VSPATH}/vc/lib:${_VSPATH}/vc/atlmfc/lib:/c/tools/sdks/dx10/lib
|
||||
|
||||
@@ -4,8 +4,8 @@ export WIN32_REDIST_DIR=${_VSPATH}/VC/redist/x86/Microsoft.VC120.CRT
|
||||
## moz tools location for 64-bit builders ##
|
||||
export MOZ_TOOLS=C:/mozilla-build/moztools
|
||||
|
||||
## includes: win8.1 sdk includes, winrt headers for metro, msvc std library, directx sdk for d3d9 ##
|
||||
export INCLUDE=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/shared:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/um:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/winrt:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/winrt/wrl:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/winrt/wrl/wrappers:${_VSPATH}/vc/include:${_VSPATH}/vc/atlmfc/include:/c/tools/sdks/dx10/include
|
||||
## includes: win8.1 sdk includes, msvc std library, directx sdk for d3d9 ##
|
||||
export INCLUDE=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/shared:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/um:${_VSPATH}/vc/include:${_VSPATH}/vc/atlmfc/include:/c/tools/sdks/dx10/include
|
||||
|
||||
## libs: win8.1 sdk x86 (32-bit) libs, msvc (32-bit) std library, msvc atl libs, directx sdk (32-bit) for d3d9 ##
|
||||
export LIBPATH=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/Lib/winv6.3/um/x86:${_VSPATH}/vc/lib:${_VSPATH}/vc/atlmfc/lib:/c/tools/sdks/dx10/lib
|
||||
|
||||
@@ -9,8 +9,8 @@ fi
|
||||
## SDK redist ##
|
||||
export WIN32_REDIST_DIR=${_VSPATH}/VC/redist/x64/Microsoft.VC100.CRT
|
||||
|
||||
## includes: win8 sdk includes, winrt headers for metro, msvc 10 std library, directx sdk for d3d9 ##
|
||||
export INCLUDE=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/shared:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/um:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/winrt:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/winrt/wrl:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/winrt/wrl/wrappers:${_VSPATH}/vc/include:${_VSPATH}/vc/atlmfc/include:/c/tools/sdks/dx10/include
|
||||
## includes: win8 sdk includes, msvc 10 std library, directx sdk for d3d9 ##
|
||||
export INCLUDE=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/shared:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/um:${_VSPATH}/vc/include:${_VSPATH}/vc/atlmfc/include:/c/tools/sdks/dx10/include
|
||||
|
||||
## libs: win8 sdk x64 (64-bit) libs, msvc 10 (64-bit) std library, msvc 10 atl libs, directx sdk (64-bit) for d3d9 ##
|
||||
export LIBPATH=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/Lib/win8/um/x64:${_VSPATH}/vc/lib/amd64:${_VSPATH}/vc/atlmfc/lib/amd64:/c/tools/sdks/dx10/lib/x64
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
_VSPATH="/c/tools/vs2013"
|
||||
export WIN32_REDIST_DIR=${_VSPATH}/VC/redist/x64/Microsoft.VC120.CRT
|
||||
|
||||
## includes: win8.1 sdk includes, winrt headers for metro, msvc std library, directx sdk for d3d9 ##
|
||||
export INCLUDE=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/shared:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/um:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/winrt:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/winrt/wrl:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/winrt/wrl/wrappers:${_VSPATH}/vc/include:${_VSPATH}/vc/atlmfc/include:/c/tools/sdks/dx10/include
|
||||
## includes: win8.1 sdk includes, msvc std library, directx sdk for d3d9 ##
|
||||
export INCLUDE=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/shared:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/um:${_VSPATH}/vc/include:${_VSPATH}/vc/atlmfc/include:/c/tools/sdks/dx10/include
|
||||
|
||||
## libs: win8.1 sdk x64 (64-bit) libs, msvc (64-bit) std library, msvc atl libs, directx sdk (64-bit) for d3d9 ##
|
||||
export LIBPATH=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/Lib/winv6.3/um/x64:${_VSPATH}/vc/lib/amd64:${_VSPATH}/vc/atlmfc/lib/amd64:/c/tools/sdks/dx10/lib/x64
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ CURRENT_TIER := $(subst recurse_,,$(CURRENT_TIER:-deps=))
|
||||
# The rules here are doing directory traversal, so we don't want further
|
||||
# recursion to happen when running make -C subdir $tier. But some make files
|
||||
# further call make -C something else, and sometimes expect recursion to
|
||||
# happen in that case (see browser/metro/locales/Makefile.in for example).
|
||||
# happen in that case.
|
||||
# Conveniently, every invocation of make increases MAKELEVEL, so only stop
|
||||
# recursion from happening at current MAKELEVEL + 1.
|
||||
ifdef CURRENT_TIER
|
||||
|
||||
@@ -422,20 +422,6 @@ dnl ========================================================
|
||||
dnl Special win32 checks
|
||||
dnl ========================================================
|
||||
|
||||
MOZ_ARG_ENABLE_BOOL(metro,
|
||||
[ --enable-metro Enable Windows Metro build targets],
|
||||
MOZ_METRO=1,
|
||||
MOZ_METRO=)
|
||||
if test -n "$MOZ_METRO"; then
|
||||
AC_DEFINE(MOZ_METRO)
|
||||
# toolkit/library/makefile.in needs these, see nsDllMain.
|
||||
CRTDLLVERSION=110
|
||||
CRTEXPDLLVERSION=1-1-0
|
||||
fi
|
||||
|
||||
AC_SUBST(CRTDLLVERSION)
|
||||
AC_SUBST(CRTEXPDLLVERSION)
|
||||
|
||||
# Target the Windows 8.1 SDK by default
|
||||
WINSDK_TARGETVER=603
|
||||
WINVER=600
|
||||
@@ -558,16 +544,6 @@ See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
|
||||
WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
|
||||
fi
|
||||
|
||||
dnl Confirm we have the pri tools on win8 builds
|
||||
if test -n "$MOZ_METRO"; then
|
||||
AC_MSG_CHECKING([for makepri])
|
||||
AC_CHECK_PROGS(MAKEPRI, makepri, "")
|
||||
if test -z "MAKEPRI" ; then
|
||||
AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
|
||||
fi
|
||||
AC_SUBST(MAKEPRI)
|
||||
fi
|
||||
|
||||
dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
|
||||
dnl not something else like "magnetic tape manipulation utility".
|
||||
MSMT_TOOL=`${MT-mt} 2>&1|grep 'Microsoft (R) Manifest Tool'`
|
||||
@@ -8263,8 +8239,6 @@ AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
|
||||
AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
|
||||
AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
|
||||
|
||||
AC_SUBST(MOZ_METRO)
|
||||
|
||||
AC_SUBST(MOZ_ANDROID_HISTORY)
|
||||
AC_SUBST(MOZ_WEBSMS_BACKEND)
|
||||
AC_SUBST(MOZ_ANDROID_BEAM)
|
||||
|
||||
@@ -1871,7 +1871,7 @@ public:
|
||||
*
|
||||
* Making the fullscreen API content only is useful on platforms where we
|
||||
* still want chrome to be visible or accessible while content is
|
||||
* fullscreen, like on Windows 8 in Metro mode.
|
||||
* fullscreen.
|
||||
*
|
||||
* Note that if the fullscreen API is content only, chrome can still go
|
||||
* fullscreen by setting the "fullScreen" attribute on its XUL window.
|
||||
|
||||
@@ -104,7 +104,7 @@ SVGDocument::EnsureNonSVGUserAgentStyleSheetsLoaded()
|
||||
|
||||
if (IsBeingUsedAsImage()) {
|
||||
// nsDocumentViewer::CreateStyleSet skipped loading all user-agent/user
|
||||
// style sheets in this case, but we'll need B2G/Fennec/Metro's
|
||||
// style sheets in this case, but we'll need B2G/Fennec's
|
||||
// content.css. We could load all the sheets registered with the
|
||||
// nsIStyleSheetService (and maybe we should) but most likely it isn't
|
||||
// desirable or necessary for foreignObject in SVG-as-an-image. Instead we
|
||||
@@ -113,7 +113,7 @@ SVGDocument::EnsureNonSVGUserAgentStyleSheetsLoaded()
|
||||
// SVG-as-an-image down.
|
||||
//
|
||||
// We do this before adding UASheet() etc. below because
|
||||
// EnsureOnDemandBuiltInUASheet prepends, and B2G/Fennec/Metro's
|
||||
// EnsureOnDemandBuiltInUASheet prepends, and B2G/Fennec's
|
||||
// content.css must come after UASheet() etc.
|
||||
nsCOMPtr<nsICategoryManager> catMan =
|
||||
do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
|
||||
|
||||
@@ -263,7 +263,7 @@ If the CSS touch-action property is enabled, the above steps are modified as fol
|
||||
The bulk of the input processing in the APZ code happens on what we call "the input thread".
|
||||
In practice the input thread could be the Goanna main thread, the compositor thread, or some other thread.
|
||||
There are obvious downsides to using the Goanna main thread - that is, "asynchronous" panning and zooming is not really asynchronous as input events can only be processed while Goanna is idle.
|
||||
However, this is the current state of things on B2G and Metro.
|
||||
However, this is the current state of things on B2G.
|
||||
Using the compositor thread as the input thread could work on some platforms, but may be inefficient on others.
|
||||
For example, on Android (Fennec) we receive input events from the system on a dedicated UI thread.
|
||||
We would have to redispatch the input events to the compositor thread if we wanted to the input thread to be the same as the compositor thread.
|
||||
|
||||
@@ -345,47 +345,6 @@ CompositorD3D11::Initialize()
|
||||
mDevice->QueryInterface(dxgiDevice.StartAssignment());
|
||||
dxgiDevice->GetAdapter(getter_AddRefs(dxgiAdapter));
|
||||
|
||||
#ifdef MOZ_METRO
|
||||
if (IsRunningInWindowsMetro()) {
|
||||
nsRefPtr<IDXGIFactory2> dxgiFactory;
|
||||
dxgiAdapter->GetParent(IID_PPV_ARGS(dxgiFactory.StartAssignment()));
|
||||
|
||||
nsIntRect rect;
|
||||
mWidget->GetClientBounds(rect);
|
||||
|
||||
DXGI_SWAP_CHAIN_DESC1 swapDesc = { 0 };
|
||||
// Automatically detect the width and the height from the winrt CoreWindow
|
||||
swapDesc.Width = rect.width;
|
||||
swapDesc.Height = rect.height;
|
||||
// This is the most common swapchain format
|
||||
swapDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
swapDesc.Stereo = false;
|
||||
// Don't use multi-sampling
|
||||
swapDesc.SampleDesc.Count = 1;
|
||||
swapDesc.SampleDesc.Quality = 0;
|
||||
swapDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||
// Use double buffering to enable flip
|
||||
swapDesc.BufferCount = 2;
|
||||
swapDesc.Scaling = DXGI_SCALING_NONE;
|
||||
// All Metro style apps must use this SwapEffect
|
||||
swapDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
|
||||
swapDesc.Flags = 0;
|
||||
|
||||
/**
|
||||
* Create a swap chain, this swap chain will contain the backbuffer for
|
||||
* the window we draw to. The front buffer is the full screen front
|
||||
* buffer.
|
||||
*/
|
||||
nsRefPtr<IDXGISwapChain1> swapChain1;
|
||||
hr = dxgiFactory->CreateSwapChainForCoreWindow(
|
||||
dxgiDevice, (IUnknown *)mWidget->GetNativeData(NS_NATIVE_ICOREWINDOW),
|
||||
&swapDesc, nullptr, getter_AddRefs(swapChain1));
|
||||
if (FAILED(hr)) {
|
||||
return false;
|
||||
}
|
||||
mSwapChain = swapChain1;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
nsRefPtr<IDXGIFactory> dxgiFactory;
|
||||
dxgiAdapter->GetParent(IID_PPV_ARGS(dxgiFactory.StartAssignment()));
|
||||
@@ -1233,16 +1192,9 @@ CompositorD3D11::VerifyBufferSize()
|
||||
mDefaultRT = nullptr;
|
||||
}
|
||||
|
||||
if (IsRunningInWindowsMetro()) {
|
||||
hr = mSwapChain->ResizeBuffers(2, mSize.width, mSize.height,
|
||||
DXGI_FORMAT_B8G8R8A8_UNORM,
|
||||
0);
|
||||
mDisableSequenceForNextFrame = true;
|
||||
} else {
|
||||
hr = mSwapChain->ResizeBuffers(1, mSize.width, mSize.height,
|
||||
DXGI_FORMAT_B8G8R8A8_UNORM,
|
||||
0);
|
||||
}
|
||||
hr = mSwapChain->ResizeBuffers(1, mSize.width, mSize.height,
|
||||
DXGI_FORMAT_B8G8R8A8_UNORM,
|
||||
0);
|
||||
|
||||
return Succeeded(hr);
|
||||
}
|
||||
|
||||
@@ -111,8 +111,7 @@ DCFromDrawTarget::DCFromDrawTarget(DrawTarget& aDrawTarget)
|
||||
static const char *kFeatureLevelPref =
|
||||
"gfx.direct3d.last_used_feature_level_idx";
|
||||
static const int kSupportedFeatureLevels[] =
|
||||
{ D3D10_FEATURE_LEVEL_10_1, D3D10_FEATURE_LEVEL_10_0,
|
||||
D3D10_FEATURE_LEVEL_9_3 };
|
||||
{ D3D10_FEATURE_LEVEL_10_1, D3D10_FEATURE_LEVEL_10_0 };
|
||||
|
||||
class GfxD2DSurfaceReporter final : public nsIMemoryReporter
|
||||
{
|
||||
@@ -664,10 +663,6 @@ gfxWindowsPlatform::VerifyD2DDevice(bool aAttemptForce)
|
||||
nsRefPtr<ID3D10Device1> device;
|
||||
|
||||
int supportedFeatureLevelsCount = ArrayLength(kSupportedFeatureLevels);
|
||||
// If we're not running in Metro don't allow DX9.3
|
||||
if (!IsRunningInWindowsMetro()) {
|
||||
supportedFeatureLevelsCount--;
|
||||
}
|
||||
|
||||
nsRefPtr<IDXGIAdapter1> adapter1 = GetDXGIAdapter();
|
||||
|
||||
|
||||
@@ -79,9 +79,6 @@ extern const wchar_t* kPropNameTabContent;
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
extern UINT sAppShellGoannaMsgId;
|
||||
#ifdef MOZ_METRO
|
||||
extern UINT sDefaultBrowserMsgId;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,11 +413,6 @@ ProcessOrDeferMessage(HWND hwnd,
|
||||
if (uMsg && uMsg == mozilla::widget::sAppShellGoannaMsgId) {
|
||||
// Widget's registered native event callback
|
||||
deferred = new DeferredSendMessage(hwnd, uMsg, wParam, lParam);
|
||||
#ifdef MOZ_METRO
|
||||
} else if (uMsg && uMsg == mozilla::widget::sDefaultBrowserMsgId) {
|
||||
// Metro widget's system shutdown message
|
||||
deferred = new DeferredSendMessage(hwnd, uMsg, wParam, lParam);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -498,13 +490,6 @@ WindowIsDeferredWindow(HWND hWnd)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_METRO
|
||||
// immersive UI ICoreWindow
|
||||
if (className.EqualsLiteral("Windows.UI.Core.CoreWindow")) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Plugin windows that can trigger ipc calls in child:
|
||||
// 'ShockwaveFlashFullScreen' - flash fullscreen window
|
||||
// 'QTNSHIDDEN' - QuickTime
|
||||
|
||||
@@ -340,14 +340,6 @@ MOZ_CHECK_COMPILER_WRAPPER
|
||||
dnl Special win32 checks
|
||||
dnl ========================================================
|
||||
|
||||
MOZ_ARG_ENABLE_BOOL(metro,
|
||||
[ --enable-metro Enable Windows Metro build targets],
|
||||
MOZ_METRO=1,
|
||||
MOZ_METRO=)
|
||||
if test -n "$MOZ_METRO"; then
|
||||
AC_DEFINE(MOZ_METRO)
|
||||
fi
|
||||
|
||||
# Target the Windows 8.1 SDK by default
|
||||
WINSDK_TARGETVER=603
|
||||
WINVER=600
|
||||
@@ -3733,7 +3725,6 @@ AC_SUBST(OS_COMPILE_CXXFLAGS)
|
||||
AC_SUBST(OS_LDFLAGS)
|
||||
AC_SUBST(OS_LIBS)
|
||||
AC_SUBST(CROSS_COMPILE)
|
||||
AC_SUBST(MOZ_METRO)
|
||||
|
||||
AC_SUBST(HOST_CC)
|
||||
AC_SUBST(HOST_CXX)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
# Simple test. Should fail on platforms where input type color isn't activated
|
||||
# yet. Missing platforms are B2G (bug 875751), Android (bug 875750) and Metro
|
||||
# (bug 895464).
|
||||
# yet. Missing platforms are B2G (bug 875751) and Android (bug 875750).
|
||||
fails-if(B2G||Android) == input-color-1.html input-color-1-ref.html
|
||||
|
||||
default-preferences pref(dom.forms.color,true)
|
||||
|
||||
@@ -804,17 +804,9 @@ Preferences::NotifyServiceObservers(const char *aTopic)
|
||||
nsresult
|
||||
Preferences::UseDefaultPrefFile()
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIFile> aFile;
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_METRO)
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
rv = NS_GetSpecialDirectory(NS_METRO_APP_PREFS_50_FILE, getter_AddRefs(aFile));
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
rv = NS_GetSpecialDirectory(NS_APP_PREFS_50_FILE, getter_AddRefs(aFile));
|
||||
}
|
||||
nsresult rv = NS_GetSpecialDirectory(NS_APP_PREFS_50_FILE, getter_AddRefs(aFile));
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = ReadAndOwnUserPrefFile(aFile);
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
// File Name Defines
|
||||
|
||||
#define PREFS_FILE_50_NAME NS_LITERAL_CSTRING("prefs.js")
|
||||
#define PREFS_FILE_METRO_50_NAME NS_LITERAL_CSTRING("metro-prefs.js")
|
||||
#define USER_CHROME_DIR_50_NAME NS_LITERAL_CSTRING("chrome")
|
||||
#define LOCAL_STORE_FILE_50_NAME NS_LITERAL_CSTRING("localstore.rdf")
|
||||
#define PANELS_FILE_50_NAME NS_LITERAL_CSTRING("panels.rdf")
|
||||
@@ -170,11 +169,6 @@ nsProfileDirServiceProvider::GetFile(const char *prop, bool *persistant, nsIFile
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = localFile->AppendNative(PREFS_FILE_50_NAME);
|
||||
}
|
||||
else if (strcmp(prop, NS_METRO_APP_PREFS_50_FILE) == 0) {
|
||||
rv = domainDir->Clone(getter_AddRefs(localFile));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = localFile->AppendNative(PREFS_FILE_METRO_50_NAME);
|
||||
}
|
||||
else if (strcmp(prop, NS_APP_USER_PROFILE_50_DIR) == 0) {
|
||||
rv = domainDir->Clone(getter_AddRefs(localFile));
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
# mobile/android: {aa3c5121-dab2-40e2-81ca-7ea25febc110}
|
||||
# mobile/xul: {a23983c0-fd0e-11dc-95ff-0800200c9a66}
|
||||
# suite (comm): {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
|
||||
# metro browser: {99bceaaa-e3c6-48c1-b981-ef9b46b67d60}
|
||||
|
||||
# The Data Reporting Service drives collection and submission of metrics
|
||||
# and other useful data to Mozilla. It drives the display of the data
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
# mobile/android: {aa3c5121-dab2-40e2-81ca-7ea25febc110}
|
||||
# mobile/xul: {a23983c0-fd0e-11dc-95ff-0800200c9a66}
|
||||
# suite (comm): {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
|
||||
# metro browser: {99bceaaa-e3c6-48c1-b981-ef9b46b67d60}
|
||||
#
|
||||
# In theory we should do this for all these instructions, but in practice it is
|
||||
# sufficient to do it for the app-startup one, and the file is simpler that way.
|
||||
@@ -16,7 +15,7 @@
|
||||
# Weave.js
|
||||
component {74b89fb0-f200-4ae8-a3ec-dd164117f6de} Weave.js
|
||||
contract @mozilla.org/weave/service;1 {74b89fb0-f200-4ae8-a3ec-dd164117f6de}
|
||||
category app-startup WeaveService service,@mozilla.org/weave/service;1 application={3c2e2abc-06d4-11e1-ac3b-374f68613e61} application={8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66} application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} application={99bceaaa-e3c6-48c1-b981-ef9b46b67d60}
|
||||
category app-startup WeaveService service,@mozilla.org/weave/service;1 application={3c2e2abc-06d4-11e1-ac3b-374f68613e61} application={8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66} application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
|
||||
component {d28f8a0b-95da-48f4-b712-caf37097be41} Weave.js
|
||||
contract @mozilla.org/network/protocol/about;1?what=sync-log {d28f8a0b-95da-48f4-b712-caf37097be41}
|
||||
|
||||
|
||||
@@ -286,7 +286,6 @@ MozMillController.prototype.waitFor = assert.waitFor;
|
||||
MozMillController.prototype.open = function (url) {
|
||||
switch (this.mozmillModule.Application) {
|
||||
case "Firefox":
|
||||
case "MetroFirefox":
|
||||
// Stop a running page load to not overlap requests
|
||||
if (this.browserObject.selectedBrowser) {
|
||||
this.browserObject.selectedBrowser.stop();
|
||||
@@ -937,27 +936,12 @@ Tabs.prototype.__defineGetter__("length", function () {
|
||||
|
||||
Tabs.prototype.__defineGetter__("activeTabIndex", function () {
|
||||
var browser = this.controller.browserObject;
|
||||
|
||||
switch(this.controller.mozmillModule.Application) {
|
||||
case "MetroFirefox":
|
||||
return browser.tabs.indexOf(browser.selectedTab);
|
||||
case "Firefox":
|
||||
default:
|
||||
return browser.tabContainer.selectedIndex;
|
||||
}
|
||||
return browser.tabContainer.selectedIndex;
|
||||
});
|
||||
|
||||
Tabs.prototype.selectTabIndex = function (aIndex) {
|
||||
var browser = this.controller.browserObject;
|
||||
|
||||
switch(this.controller.mozmillModule.Application) {
|
||||
case "MetroFirefox":
|
||||
browser.selectedTab = browser.tabs[aIndex];
|
||||
break;
|
||||
case "Firefox":
|
||||
default:
|
||||
browser.selectTabAtIndex(aIndex);
|
||||
}
|
||||
browser.selectTabAtIndex(aIndex);
|
||||
}
|
||||
|
||||
function browserAdditions (controller) {
|
||||
|
||||
@@ -19,8 +19,7 @@ Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const applicationIdMap = {
|
||||
'{8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}': 'Firefox',
|
||||
'{99bceaaa-e3c6-48c1-b981-ef9b46b67d60}': 'MetroFirefox'
|
||||
'{8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}': 'Firefox'
|
||||
}
|
||||
const applicationName = applicationIdMap[Services.appinfo.ID] || Services.appinfo.name;
|
||||
|
||||
@@ -49,13 +48,7 @@ function Copy (obj) {
|
||||
* @returns {Object} The browser element
|
||||
*/
|
||||
function getBrowserObject(aWindow) {
|
||||
switch(applicationName) {
|
||||
case "MetroFirefox":
|
||||
return aWindow.Browser;
|
||||
case "Firefox":
|
||||
default:
|
||||
return aWindow.gBrowser;
|
||||
}
|
||||
return aWindow.gBrowser;
|
||||
}
|
||||
|
||||
function getChromeWindow(aWindow) {
|
||||
|
||||
@@ -82,9 +82,6 @@ StartupCache::CollectReports(nsIHandleReportCallback* aHandleReport,
|
||||
}
|
||||
|
||||
static const char sStartupCacheName[] = "startupCache." SC_WORDSIZE "." SC_ENDIAN;
|
||||
#if defined(XP_WIN) && defined(MOZ_METRO)
|
||||
static const char sMetroStartupCacheName[] = "metroStartupCache." SC_WORDSIZE "." SC_ENDIAN;
|
||||
#endif
|
||||
|
||||
StartupCache*
|
||||
StartupCache::GetSingleton()
|
||||
@@ -199,14 +196,7 @@ StartupCache::Init()
|
||||
if (NS_FAILED(rv) && rv != NS_ERROR_FILE_ALREADY_EXISTS)
|
||||
return rv;
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_METRO)
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
rv = file->AppendNative(NS_LITERAL_CSTRING(sMetroStartupCacheName));
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
rv = file->AppendNative(NS_LITERAL_CSTRING(sStartupCacheName));
|
||||
}
|
||||
rv = file->AppendNative(NS_LITERAL_CSTRING(sStartupCacheName));
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
@@ -57,9 +57,6 @@ endif
|
||||
|
||||
ifeq (windows,$(MOZ_WIDGET_TOOLKIT))
|
||||
TEST_HARNESS_BINS += screenshot$(BIN_SUFFIX)
|
||||
ifdef MOZ_METRO
|
||||
TEST_HARNESS_BINS += metrotestharness$(BIN_SUFFIX)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef MOZ_DMD
|
||||
|
||||
@@ -245,7 +245,6 @@
|
||||
var windowMediator = Cc['@mozilla.org/appshell/window-mediator;1'].
|
||||
getService(Ci.nsIWindowMediator);
|
||||
var winType = gConfig.testRoot == "browser" ? "navigator:browser" :
|
||||
gConfig.testRoot == "metro" ? "navigator:browser" :
|
||||
gConfig.testRoot == "webapprtChrome" ? "webapprt:webapp" :
|
||||
null;
|
||||
if (!winType) {
|
||||
|
||||
@@ -51,7 +51,6 @@ function b2gStart() {
|
||||
function testInit() {
|
||||
gConfig = readConfig();
|
||||
if (gConfig.testRoot == "browser" ||
|
||||
gConfig.testRoot == "metro" ||
|
||||
gConfig.testRoot == "webapprtChrome") {
|
||||
// Make sure to launch the test harness for the first opened window only
|
||||
var prefs = Services.prefs;
|
||||
|
||||
@@ -65,24 +65,6 @@ def ThunderbirdRunner(*args, **kwargs):
|
||||
return GoannaRuntimeRunner(*args, **kwargs)
|
||||
|
||||
|
||||
def MetroRunner(*args, **kwargs):
|
||||
"""
|
||||
Create a Windows metro Firefox runner.
|
||||
|
||||
:param binary: Path to metro Firefox binary.
|
||||
:param cmdargs: Arguments to pass into binary.
|
||||
:param profile: Profile object to use.
|
||||
:param env: Environment variables to pass into the goanna process.
|
||||
:param clean_profile: If True, restores profile back to original state.
|
||||
:param process_class: Class used to launch the binary.
|
||||
:param process_args: Arguments to pass into process_class.
|
||||
:param symbols_path: Path to symbol files used for crash analysis.
|
||||
:returns: A GoannaRuntimeRunner for metro Firefox.
|
||||
"""
|
||||
kwargs['app_ctx'] = get_app_context('metro')()
|
||||
return GoannaRuntimeRunner(*args, **kwargs)
|
||||
|
||||
|
||||
def B2GDesktopRunner(*args, **kwargs):
|
||||
"""
|
||||
Create a B2G desktop runner.
|
||||
@@ -177,7 +159,6 @@ runners = {
|
||||
'b2g_emulator': B2GEmulatorRunner,
|
||||
'b2g_device': B2GDeviceRunner,
|
||||
'firefox': FirefoxRunner,
|
||||
'metro': MetroRunner,
|
||||
'thunderbird': ThunderbirdRunner,
|
||||
}
|
||||
|
||||
|
||||
@@ -192,10 +192,6 @@ user_pref("browser.download.panel.shown", true);
|
||||
// which test runs first and happens to open about:newtab
|
||||
user_pref("browser.newtabpage.introShown", true);
|
||||
|
||||
// prefs for firefox metro.
|
||||
// Disable first-tun tab
|
||||
user_pref("browser.firstrun.count", 0);
|
||||
|
||||
// Tell the PBackground infrastructure to run a test at startup.
|
||||
user_pref("pbackground.testing", true);
|
||||
|
||||
|
||||
@@ -84,13 +84,9 @@ let CrashMonitorInternal = {
|
||||
* Path to checkpoint file.
|
||||
*
|
||||
* Each time a new notification is received, this file is written to
|
||||
* disc to reflect the information in |checkpoints|. Although Firefox for
|
||||
* Desktop and Metro share the same profile, they need to keep record of
|
||||
* crashes separately.
|
||||
* disc to reflect the information in |checkpoints|.
|
||||
*/
|
||||
path: (Services.metro && Services.metro.immersive) ?
|
||||
OS.Path.join(OS.Constants.Path.profileDir, "metro", "sessionCheckpoints.json"):
|
||||
OS.Path.join(OS.Constants.Path.profileDir, "sessionCheckpoints.json"),
|
||||
path: OS.Path.join(OS.Constants.Path.profileDir, "sessionCheckpoints.json"),
|
||||
|
||||
/**
|
||||
* Load checkpoints from previous session asynchronously.
|
||||
@@ -178,9 +174,6 @@ this.CrashMonitor = {
|
||||
);
|
||||
|
||||
CrashMonitorInternal.initialized = true;
|
||||
if (Services.metro && Services.metro.immersive) {
|
||||
OS.File.makeDir(OS.Path.join(OS.Constants.Path.profileDir, "metro"));
|
||||
}
|
||||
return promise;
|
||||
},
|
||||
|
||||
|
||||
@@ -947,13 +947,8 @@ nsDownloadManager::Init()
|
||||
// When MOZ_JSDOWNLOADS is undefined, we still check the preference that can
|
||||
// be used to enable the JavaScript API during the migration process.
|
||||
mUseJSTransfer = Preferences::GetBool(PREF_BD_USEJSTRANSFER, false);
|
||||
#elif defined(XP_WIN)
|
||||
// When MOZ_JSDOWNLOADS is defined on Windows, this component is disabled
|
||||
// unless we are running in Windows Metro. The conversion of Windows Metro
|
||||
// to use the JavaScript API for downloads is tracked in bug 906042.
|
||||
mUseJSTransfer = !IsRunningInWindowsMetro();
|
||||
#else
|
||||
mUseJSTransfer = true;
|
||||
mUseJSTransfer = true;
|
||||
#endif
|
||||
|
||||
if (mUseJSTransfer)
|
||||
|
||||
@@ -457,13 +457,7 @@ this.DownloadIntegration = {
|
||||
#elifdef MOZ_WIDGET_GONK
|
||||
directoryPath = yield this.getSystemDownloadsDirectory();
|
||||
#else
|
||||
// For Metro mode on Windows 8, we want searchability for documents
|
||||
// that the user chose to open with an external application.
|
||||
if (Services.metro && Services.metro.immersive) {
|
||||
directoryPath = yield this.getSystemDownloadsDirectory();
|
||||
} else {
|
||||
directoryPath = this._getDirectory("TmpD");
|
||||
}
|
||||
directoryPath = this._getDirectory("TmpD");
|
||||
#endif
|
||||
throw new Task.Result(directoryPath);
|
||||
}.bind(this));
|
||||
|
||||
@@ -143,7 +143,6 @@ nsAppStartup::nsAppStartup() :
|
||||
mInterrupted(false),
|
||||
mIsSafeModeNecessary(false),
|
||||
mStartupCrashTrackingEnded(false),
|
||||
mRestartTouchEnvironment(false),
|
||||
mRestartNotSameProfile(false)
|
||||
{ }
|
||||
|
||||
@@ -284,9 +283,7 @@ nsAppStartup::Run(void)
|
||||
}
|
||||
|
||||
nsresult retval = NS_OK;
|
||||
if (mRestartTouchEnvironment) {
|
||||
retval = NS_SUCCESS_RESTART_METRO_APP;
|
||||
} else if (mRestart) {
|
||||
if (mRestart) {
|
||||
retval = NS_SUCCESS_RESTART_APP;
|
||||
} else if (mRestartNotSameProfile) {
|
||||
retval = NS_SUCCESS_RESTART_APP_NOT_SAME_PROFILE;
|
||||
@@ -384,17 +381,12 @@ nsAppStartup::Quit(uint32_t aMode)
|
||||
gRestartMode = (aMode & 0xF0);
|
||||
}
|
||||
|
||||
if (!mRestartTouchEnvironment) {
|
||||
mRestartTouchEnvironment = (aMode & eRestartTouchEnvironment) != 0;
|
||||
gRestartMode = (aMode & 0xF0);
|
||||
}
|
||||
|
||||
if (!mRestartNotSameProfile) {
|
||||
mRestartNotSameProfile = (aMode & eRestartNotSameProfile) != 0;
|
||||
gRestartMode = (aMode & 0xF0);
|
||||
}
|
||||
|
||||
if (mRestart || mRestartTouchEnvironment || mRestartNotSameProfile) {
|
||||
if (mRestart || mRestartNotSameProfile) {
|
||||
// Mark the next startup as a restart.
|
||||
PR_SetEnv("MOZ_APP_RESTART=1");
|
||||
|
||||
@@ -464,7 +456,7 @@ nsAppStartup::Quit(uint32_t aMode)
|
||||
NS_NAMED_LITERAL_STRING(shutdownStr, "shutdown");
|
||||
NS_NAMED_LITERAL_STRING(restartStr, "restart");
|
||||
obsService->NotifyObservers(nullptr, "quit-application",
|
||||
(mRestart || mRestartTouchEnvironment || mRestartNotSameProfile) ?
|
||||
(mRestart || mRestartNotSameProfile) ?
|
||||
restartStr.get() : shutdownStr.get());
|
||||
}
|
||||
|
||||
@@ -590,14 +582,6 @@ nsAppStartup::GetWasRestarted(bool *aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAppStartup::GetRestartingTouchEnvironment(bool *aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = mRestartTouchEnvironment;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAppStartup::SetInterrupted(bool aInterrupted)
|
||||
{
|
||||
|
||||
@@ -62,7 +62,6 @@ private:
|
||||
bool mInterrupted; // Was startup interrupted by an interactive prompt?
|
||||
bool mIsSafeModeNecessary; // Whether safe mode is necessary
|
||||
bool mStartupCrashTrackingEnded; // Whether startup crash tracking has already ended
|
||||
bool mRestartTouchEnvironment; // Quit (eRestartTouchEnvironment)
|
||||
bool mRestartNotSameProfile; // Quit(eRestartNotSameProfile)
|
||||
|
||||
#if defined(XP_WIN)
|
||||
|
||||
@@ -32,11 +32,6 @@ interface nsIAppStartup : nsISupports
|
||||
* This return code indicates that the application should be
|
||||
* restarted because quit was called with the eRestart flag.
|
||||
|
||||
* @returnCode NS_SUCCESS_RESTART_METRO_APP
|
||||
* This return code indicates that the application should be
|
||||
* restarted in metro because quit was called with the
|
||||
* eRestartTouchEnviroment flag.
|
||||
|
||||
* @returnCode NS_SUCCESS_RESTART_APP_NOT_SAME_PROFILE
|
||||
* This return code indicates that the application should be
|
||||
* restarted without necessarily using the same profile because
|
||||
@@ -132,13 +127,6 @@ interface nsIAppStartup : nsISupports
|
||||
*/
|
||||
const uint32_t eRestartx86_64 = 0x40;
|
||||
|
||||
/**
|
||||
* Restart the application in a touch-optimized environment (such as Metro)
|
||||
* after quitting. The application will be restarted with the same profile
|
||||
* and an empty command line.
|
||||
*/
|
||||
const uint32_t eRestartTouchEnvironment = 0x80;
|
||||
|
||||
/**
|
||||
* Restart the application after quitting. The application will be
|
||||
* restarted with an empty command line and the normal profile selection
|
||||
@@ -185,12 +173,6 @@ interface nsIAppStartup : nsISupports
|
||||
*/
|
||||
readonly attribute boolean wasRestarted;
|
||||
|
||||
/**
|
||||
* True if the application is being restarted in a touch-optimized
|
||||
* environment (such as Metro).
|
||||
*/
|
||||
readonly attribute boolean restartingTouchEnvironment;
|
||||
|
||||
/**
|
||||
* Returns an object with main, process, firstPaint, sessionRestored properties.
|
||||
* Properties may not be available depending on platform or application
|
||||
|
||||
@@ -658,7 +658,7 @@
|
||||
|
||||
<field name="blockedPopups">null</field>
|
||||
|
||||
<!-- Obsolete name for blockedPopups. Used by metro and android. -->
|
||||
<!-- Obsolete name for blockedPopups. Used by android. -->
|
||||
<property name="pageReport"
|
||||
onget="return this.blockedPopups;"
|
||||
readonly="true"/>
|
||||
|
||||
@@ -28,13 +28,6 @@ def Libxul(name):
|
||||
'winspool.drv'
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_METRO']:
|
||||
DELAYLOAD_DLLS += [
|
||||
'API-MS-WIN-CORE-WINRT-L' + CONFIG['CRTEXPDLLVERSION'] + '.DLL',
|
||||
'API-MS-WIN-CORE-WINRT-STRING-L' + CONFIG['CRTEXPDLLVERSION'] + '.DLL',
|
||||
'uiautomationcore.dll'
|
||||
]
|
||||
|
||||
if CONFIG['ACCESSIBILITY']:
|
||||
DELAYLOAD_DLLS += ['oleacc.dll']
|
||||
|
||||
@@ -359,11 +352,6 @@ if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
OS_LIBS += [
|
||||
'oleacc',
|
||||
]
|
||||
if CONFIG['MOZ_METRO']:
|
||||
OS_LIBS += [
|
||||
'uiautomationcore',
|
||||
'runtimeobject',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_ENABLE_QT']:
|
||||
OS_LIBS += CONFIG['XEXT_LIBS']
|
||||
|
||||
@@ -29,8 +29,3 @@ localhost=(local files)
|
||||
# %1$S is the file size
|
||||
# %2$S is the file size unit
|
||||
backupFileSizeText=%1$S %2$S
|
||||
|
||||
# LOCALIZATION NOTE (windows8TouchTitle): this is the name of the folder used
|
||||
# to store bookmarks created in Metro mode and share bookmarks between Metro
|
||||
# and Desktop.
|
||||
windows8TouchTitle=Windows 8 Touch
|
||||
@@ -501,7 +501,11 @@ Finder.prototype = {
|
||||
},
|
||||
|
||||
_getWindow: function () {
|
||||
return this._docShell.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
|
||||
try {
|
||||
return this._docShell.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
|
||||
} catch(e) {
|
||||
Cu.reportError(e);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -7803,128 +7803,3 @@
|
||||
Exch $0 ; return elapsed seconds
|
||||
!macroend
|
||||
|
||||
!ifdef MOZ_METRO
|
||||
; Removes the CEH registration if it's set to our installation directory.
|
||||
; If it's set to some other installation directory, then it should be removed
|
||||
; by that installation.
|
||||
!macro RemoveDEHRegistrationIfMatchingCall un
|
||||
|
||||
Function ${un}RemoveDEHRegistrationIfMatchingCall
|
||||
; Retrieve DEH ID from the stack into $R9
|
||||
Exch $R9
|
||||
Exch 1
|
||||
|
||||
; Retrieve Protocol Activation ID from stack into $R8
|
||||
Exch $R8
|
||||
Exch 2
|
||||
|
||||
; Retrieve File Activation ID from stack into $R7
|
||||
Exch $R7
|
||||
|
||||
; Backup the old values of R6 and R5 on the stack
|
||||
Push $R6
|
||||
Push $R5
|
||||
|
||||
; Conditionally remove the DEH as long as we are the default (HKCU)
|
||||
ReadRegStr $R6 HKCU "Software\Classes\CLSID\$R9\LocalServer32" ""
|
||||
${${un}GetLongPath} "$INSTDIR" $R5
|
||||
StrCmp "$R6" "" next +1
|
||||
IfFileExists "$R6" +1 clearHKCU
|
||||
${${un}GetParent} "$R6" $R6
|
||||
${${un}GetLongPath} "$R6" $R6
|
||||
StrCmp "$R5" "$R6" clearHKCU next
|
||||
clearHKCU:
|
||||
DeleteRegKey HKCU "Software\Classes\CLSID\$R9"
|
||||
DeleteRegValue HKCU "Software\Classes\$R8\shell\open\command" "DelegateExecute"
|
||||
DeleteRegValue HKCU "Software\Classes\$R7\shell\open\command" "DelegateExecute"
|
||||
next:
|
||||
|
||||
; Conditionally remove the DEH as long as we are the default (HKLM)
|
||||
ReadRegStr $R6 HKLM "Software\Classes\CLSID\$R9\LocalServer32" ""
|
||||
${${un}GetLongPath} "$INSTDIR" $R5
|
||||
StrCmp "$R6" "" done +1
|
||||
IfFileExists "$R6" +1 clearHKLM
|
||||
${${un}GetParent} "$R6" $R6
|
||||
${${un}GetLongPath} "$R6" $R6
|
||||
StrCmp "$R5" "$R6" clearHKLM done
|
||||
clearHKLM:
|
||||
DeleteRegKey HKLM "Software\Classes\CLSID\$R9"
|
||||
DeleteRegValue HKLM "Software\Classes\$R8\shell\open\command" "DelegateExecute"
|
||||
DeleteRegValue HKLM "Software\Classes\$R7\shell\open\command" "DelegateExecute"
|
||||
done:
|
||||
|
||||
; Always remove the AppUserModelID keys for this installation
|
||||
DeleteRegKey HKCU "Software\Classes\$AppUserModelID"
|
||||
DeleteRegKey HKLM "Software\Classes\$AppUserModelID"
|
||||
|
||||
; Restore the registers back to their original state
|
||||
Pop $R5
|
||||
Pop $R6
|
||||
Exch $R7
|
||||
Exch 2
|
||||
Exch $R8
|
||||
Exch 1
|
||||
Exch $R9
|
||||
FunctionEnd
|
||||
!macroend
|
||||
|
||||
!macro RemoveDEHRegistrationIfMatching
|
||||
!insertmacro RemoveDEHRegistrationIfMatchingCall ""
|
||||
!macroend
|
||||
|
||||
!macro un.RemoveDEHRegistrationIfMatching
|
||||
!insertmacro RemoveDEHRegistrationIfMatchingCall "un."
|
||||
!macroend
|
||||
|
||||
!macro CleanupMetroBrowserHandlerValues un DELEGATE_EXECUTE_HANDLER_ID \
|
||||
PROTOCOL_ACTIVATION_ID \
|
||||
FILE_ACTIVATION_ID
|
||||
Push ${FILE_ACTIVATION_ID}
|
||||
Push ${PROTOCOL_ACTIVATION_ID}
|
||||
Push ${DELEGATE_EXECUTE_HANDLER_ID}
|
||||
Call ${un}RemoveDEHRegistrationIfMatchingCall
|
||||
!macroend
|
||||
!define CleanupMetroBrowserHandlerValues '!insertmacro CleanupMetroBrowserHandlerValues ""'
|
||||
!define un.CleanupMetroBrowserHandlerValues '!insertmacro CleanupMetroBrowserHandlerValues "un."'
|
||||
|
||||
!macro AddMetroBrowserHandlerValues DELEGATE_EXECUTE_HANDLER_ID \
|
||||
DELEGATE_EXECUTE_HANDLER_PATH \
|
||||
APP_USER_MODEL_ID \
|
||||
PROTOCOL_ACTIVATION_ID \
|
||||
FILE_ACTIVATION_ID
|
||||
; Win8 doesn't use conventional progid command data to launch anymore.
|
||||
; Instead it uses a delegate execute handler which is a light weight COM
|
||||
; server for choosing the metro or desktop browser to launch depending
|
||||
; on the current environment (metro/desktop) it was activated in.
|
||||
WriteRegStr SHCTX "Software\Classes\${APP_USER_MODEL_ID}" "" ""
|
||||
WriteRegStr SHCTX "Software\Classes\${APP_USER_MODEL_ID}\.exe" "" ""
|
||||
WriteRegStr SHCTX "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell" "" "open"
|
||||
WriteRegStr SHCTX "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell\open" "CommandId" "open"
|
||||
WriteRegStr SHCTX "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell\open\command" "" "$2"
|
||||
WriteRegStr SHCTX "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell\open\command" "DelegateExecute" "${DELEGATE_EXECUTE_HANDLER_ID}"
|
||||
|
||||
; Augment the url handler registrations with additional data needed for Metro
|
||||
WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}" "AppUserModelID" "${APP_USER_MODEL_ID}"
|
||||
WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\Application" "AppUserModelID" "${APP_USER_MODEL_ID}"
|
||||
WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\Application" "ApplicationName" "$BrandShortName"
|
||||
WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\Application" "ApplicationIcon" "$INSTDIR\${FileMainEXE},0"
|
||||
WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\Application" "ApplicationCompany" "${CompanyName}"
|
||||
WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\Application" "ApplicationDescription" "$(REG_APP_DESC)"
|
||||
WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\shell" "" "open"
|
||||
WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\shell\open" "CommandId" "open"
|
||||
WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\shell\open\command" "DelegateExecute" "${DELEGATE_EXECUTE_HANDLER_ID}"
|
||||
|
||||
; Augment the file handler registrations with additional data needed for Metro
|
||||
WriteRegStr SHCTX "Software\Classes\${FILE_ACTIVATION_ID}" "AppUserModelID" "${APP_USER_MODEL_ID}"
|
||||
WriteRegStr SHCTX "Software\Classes\${FILE_ACTIVATION_ID}\shell" "" "open"
|
||||
WriteRegStr SHCTX "Software\Classes\${FILE_ACTIVATION_ID}\shell\open" "CommandId" "open"
|
||||
WriteRegStr SHCTX "Software\Classes\${FILE_ACTIVATION_ID}\shell\open\command" "DelegateExecute" "${DELEGATE_EXECUTE_HANDLER_ID}"
|
||||
|
||||
; Win8 Metro delegate execute handler registration
|
||||
WriteRegStr SHCTX "Software\Classes\CLSID\${DELEGATE_EXECUTE_HANDLER_ID}" "" "$BrandShortName CommandExecuteHandler"
|
||||
WriteRegStr SHCTX "Software\Classes\CLSID\${DELEGATE_EXECUTE_HANDLER_ID}" "AppId" "${DELEGATE_EXECUTE_HANDLER_ID}"
|
||||
WriteRegStr SHCTX "Software\Classes\CLSID\${DELEGATE_EXECUTE_HANDLER_ID}\LocalServer32" "" "${DELEGATE_EXECUTE_HANDLER_PATH}"
|
||||
!macroend
|
||||
!define AddMetroBrowserHandlerValues "!insertmacro AddMetroBrowserHandlerValues"
|
||||
!endif ;end MOZ_METRO
|
||||
|
||||
|
||||
@@ -2,17 +2,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifdef MOZ_METRO
|
||||
// Needed for COM calls to launch Metro applications
|
||||
#undef WINVER
|
||||
#undef _WIN32_WINNT
|
||||
#define WINVER 0x602
|
||||
#define _WIN32_WINNT 0x602
|
||||
#include <objbase.h>
|
||||
#include <shobjidl.h>
|
||||
#pragma comment(lib, "ole32.lib")
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
// Needed for CreateToolhelp32Snapshot
|
||||
@@ -616,71 +605,3 @@ IsUnpromptedElevation(BOOL &isUnpromptedElevation)
|
||||
RegCloseKey(baseKey);
|
||||
return success;
|
||||
}
|
||||
|
||||
#ifdef MOZ_METRO
|
||||
/*
|
||||
* Retrieve the app model id of the firefox metro browser.
|
||||
*
|
||||
* @aPathBuffer Buffer to fill
|
||||
* @aCharLength Length of buffer to fill in characters
|
||||
*/
|
||||
bool GetDefaultBrowserAppModelID(WCHAR* aIDBuffer, long aCharLength)
|
||||
{
|
||||
if (!aIDBuffer || aCharLength <= 0)
|
||||
return false;
|
||||
|
||||
memset(aIDBuffer, 0, (sizeof(WCHAR)*aCharLength));
|
||||
static const WCHAR* kDefaultMetroBrowserIDPathKey = L"FirefoxURL";
|
||||
|
||||
HKEY key;
|
||||
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, kDefaultMetroBrowserIDPathKey,
|
||||
0, KEY_READ, &key) != ERROR_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
DWORD len = aCharLength * sizeof(WCHAR);
|
||||
memset(aIDBuffer, 0, len);
|
||||
if (RegQueryValueExW(key, L"AppUserModelID", nullptr, nullptr,
|
||||
(LPBYTE)aIDBuffer, &len) != ERROR_SUCCESS || !len) {
|
||||
RegCloseKey(key);
|
||||
return false;
|
||||
}
|
||||
RegCloseKey(key);
|
||||
return true;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
LaunchDefaultMetroBrowser()
|
||||
{
|
||||
CoInitialize(nullptr);
|
||||
HRESULT hr = E_FAIL;
|
||||
// The interface that allows us to activate the browser
|
||||
IApplicationActivationManager *activateMgr;
|
||||
if (FAILED(hr = CoCreateInstance(CLSID_ApplicationActivationManager,
|
||||
nullptr, CLSCTX_LOCAL_SERVER,
|
||||
IID_IApplicationActivationManager,
|
||||
(void**)&activateMgr))) {
|
||||
CoUninitialize();
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Activation is based on the browser's registered app model id
|
||||
WCHAR appModelID[256];
|
||||
if (!GetDefaultBrowserAppModelID(appModelID, (sizeof(appModelID)/sizeof(WCHAR)))) {
|
||||
activateMgr->Release();
|
||||
CoUninitialize();
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Hand off focus rights to the out-of-process activation server. Without
|
||||
// this the metro interface won't launch.
|
||||
CoAllowSetForegroundWindow(activateMgr, nullptr);
|
||||
|
||||
// Launch default browser in Metro
|
||||
DWORD processID;
|
||||
hr = activateMgr->ActivateApplication(appModelID, L"", AO_NOERRORUI,
|
||||
&processID);
|
||||
activateMgr->Release();
|
||||
CoUninitialize();
|
||||
return hr;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -26,8 +26,3 @@ BOOL IsUnpromptedElevation(BOOL &isUnpromptedElevation);
|
||||
#define TEST_ONLY_FALLBACK_KEY_PATH \
|
||||
BASE_SERVICE_REG_KEY L"\\3932ecacee736d366d6436db0f55bce4"
|
||||
|
||||
#ifdef MOZ_METRO
|
||||
bool GetDefaultBrowserAppModelID(WCHAR* aIDBuffer, long aCharLength);
|
||||
HRESULT LaunchDefaultMetroBrowser();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -443,9 +443,8 @@ interface nsIApplicationUpdateService : nsISupports
|
||||
/**
|
||||
* Whether or not a different instance is handling updates of this
|
||||
* installation. This currently only ever returns true on Windows
|
||||
* when 2 instances of an application are open or when both the Metro
|
||||
* and Desktop browsers are open. Only one of the instances will actually
|
||||
* handle updates for the installation.
|
||||
* when 2 instances of an application are open. Only one of the
|
||||
* instances will actually handle updates for the installation.
|
||||
*/
|
||||
readonly attribute boolean isOtherInstanceHandlingUpdates;
|
||||
|
||||
|
||||
@@ -181,7 +181,6 @@ var gCloseWindowTimeoutCounter = 0;
|
||||
// The following vars are for restoring previous preference values (if present)
|
||||
// when the test finishes.
|
||||
var gAppUpdateEnabled; // app.update.enabled
|
||||
var gAppUpdateMetroEnabled; // app.update.metro.enabled
|
||||
var gAppUpdateServiceEnabled; // app.update.service.enabled
|
||||
var gAppUpdateStagingEnabled; // app.update.staging.enabled
|
||||
var gAppUpdateURLDefault; // app.update.url (default prefbranch)
|
||||
@@ -898,11 +897,6 @@ function setupPrefs() {
|
||||
}
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_ENABLED, true);
|
||||
|
||||
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_METRO_ENABLED)) {
|
||||
gAppUpdateMetroEnabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_METRO_ENABLED);
|
||||
}
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_METRO_ENABLED, true);
|
||||
|
||||
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_SERVICE_ENABLED)) {
|
||||
gAppUpdateServiceEnabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED);
|
||||
}
|
||||
@@ -983,13 +977,6 @@ function resetPrefs() {
|
||||
Services.prefs.clearUserPref(PREF_APP_UPDATE_ENABLED);
|
||||
}
|
||||
|
||||
if (gAppUpdateMetroEnabled !== undefined) {
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_METRO_ENABLED, gAppUpdateMetroEnabled);
|
||||
}
|
||||
else if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_METRO_ENABLED)) {
|
||||
Services.prefs.clearUserPref(PREF_APP_UPDATE_METRO_ENABLED);
|
||||
}
|
||||
|
||||
if (gAppUpdateServiceEnabled !== undefined) {
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, gAppUpdateServiceEnabled);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ const PREF_APP_UPDATE_CERT_MAXERRORS = "app.update.cert.maxErrors";
|
||||
const PREF_APP_UPDATE_CERT_REQUIREBUILTIN = "app.update.cert.requireBuiltIn";
|
||||
const PREF_APP_UPDATE_CHANNEL = "app.update.channel";
|
||||
const PREF_APP_UPDATE_ENABLED = "app.update.enabled";
|
||||
const PREF_APP_UPDATE_METRO_ENABLED = "app.update.metro.enabled";
|
||||
const PREF_APP_UPDATE_IDLETIME = "app.update.idletime";
|
||||
const PREF_APP_UPDATE_LOG = "app.update.log";
|
||||
const PREF_APP_UPDATE_NEVER_BRANCH = "app.update.never.";
|
||||
|
||||
@@ -1047,7 +1047,6 @@ function doTestFinish() {
|
||||
*/
|
||||
function setDefaultPrefs() {
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_ENABLED, true);
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_METRO_ENABLED, true);
|
||||
// Don't display UI for a successful installation. Some apps may not set this
|
||||
// pref to false like Firefox does.
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_SHOW_INSTALLED_UI, false);
|
||||
|
||||
@@ -70,7 +70,6 @@
|
||||
#else
|
||||
#define PARENT_WAIT 10000
|
||||
#endif
|
||||
#define IMMERSIVE_PARENT_WAIT 15000
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
// These functions are defined in launchchild_osx.mm
|
||||
@@ -1804,23 +1803,6 @@ PatchIfFile::Finish(int status)
|
||||
#include "uachelper.h"
|
||||
#include "pathhash.h"
|
||||
|
||||
#ifdef MOZ_METRO
|
||||
/**
|
||||
* Determines if the update came from an Immersive browser
|
||||
* @return true if the update came from an immersive browser
|
||||
*/
|
||||
bool
|
||||
IsUpdateFromMetro(int argc, NS_tchar **argv)
|
||||
{
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (!wcsicmp(L"-ServerName:DefaultBrowserServer", argv[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Launch the post update application (helper.exe). It takes in the path of the
|
||||
* callback application to calculate the path of helper.exe.
|
||||
@@ -2624,15 +2606,10 @@ int NS_main(int argc, NS_tchar **argv)
|
||||
// Otherwise, wait for the parent process to exit before starting the
|
||||
// update.
|
||||
if (parent) {
|
||||
bool updateFromMetro = false;
|
||||
#ifdef MOZ_METRO
|
||||
updateFromMetro = IsUpdateFromMetro(argc, argv);
|
||||
#endif
|
||||
DWORD waitTime = updateFromMetro ?
|
||||
IMMERSIVE_PARENT_WAIT : PARENT_WAIT;
|
||||
DWORD waitTime = PARENT_WAIT;
|
||||
DWORD result = WaitForSingleObject(parent, waitTime);
|
||||
CloseHandle(parent);
|
||||
if (result != WAIT_OBJECT_0 && !updateFromMetro)
|
||||
if (result != WAIT_OBJECT_0)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-228
@@ -95,9 +95,6 @@
|
||||
#include <windows.h>
|
||||
#include "cairo/cairo-features.h"
|
||||
#include "mozilla/WindowsVersion.h"
|
||||
#ifdef MOZ_METRO
|
||||
#include <roapi.h>
|
||||
#endif
|
||||
|
||||
#ifndef PROCESS_DEP_ENABLE
|
||||
#define PROCESS_DEP_ENABLE 0x1
|
||||
@@ -126,10 +123,6 @@
|
||||
#include "nsXREDirProvider.h"
|
||||
#include "nsToolkitCompsCID.h"
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_METRO)
|
||||
#include "updatehelper.h"
|
||||
#endif
|
||||
|
||||
#include "nsINIParser.h"
|
||||
#include "mozilla/Omnijar.h"
|
||||
#include "mozilla/StartupTimeline.h"
|
||||
@@ -566,16 +559,13 @@ ProcessDDE(nsINativeAppSupport* aNative, bool aWait)
|
||||
/**
|
||||
* Determines if there is support for showing the profile manager
|
||||
*
|
||||
* @return true in all environments except for Windows Metro
|
||||
* @return currently true in all environments
|
||||
* XXX: This was false for Metro. Possibly remove this logic.
|
||||
*/
|
||||
static bool
|
||||
CanShowProfileManager()
|
||||
{
|
||||
#if defined(XP_WIN)
|
||||
return XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Desktop;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -2688,38 +2678,6 @@ static DWORD WINAPI 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 "GoannaProfiler.h"
|
||||
|
||||
// Encapsulates startup and shutdown state for XRE_main
|
||||
@@ -2811,19 +2769,6 @@ XREMain::XRE_mainInit(bool* aExitFlag)
|
||||
fire_glxtest_process();
|
||||
#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
|
||||
@@ -3406,12 +3351,6 @@ 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));
|
||||
@@ -3868,7 +3807,6 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
// Check for an application initiated restart. This is one that
|
||||
// corresponds to nsIAppStartup.quit(eRestart)
|
||||
if (rv == NS_SUCCESS_RESTART_APP
|
||||
|| rv == NS_SUCCESS_RESTART_METRO_APP
|
||||
|| rv == NS_SUCCESS_RESTART_APP_NOT_SAME_PROFILE) {
|
||||
appInitiatedRestart = true;
|
||||
|
||||
@@ -3912,15 +3850,7 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
MOZ_gdk_display_close(mGdkDisplay);
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_METRO) && defined(XP_WIN)
|
||||
if (rv == NS_SUCCESS_RESTART_METRO_APP) {
|
||||
LaunchDefaultMetroBrowser();
|
||||
rv = NS_OK;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
rv = LaunchChild(mNativeApp, true);
|
||||
}
|
||||
rv = LaunchChild(mNativeApp, true);
|
||||
|
||||
return rv == NS_ERROR_LAUNCHED_CHILD_PROCESS ? 0 : 1;
|
||||
}
|
||||
@@ -3936,173 +3866,18 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
return NS_FAILED(rv) ? 1 : 0;
|
||||
}
|
||||
|
||||
#if defined(MOZ_METRO) && defined(XP_WIN)
|
||||
extern bool XRE_MetroCoreApplicationRun();
|
||||
static XREMain* xreMainPtr;
|
||||
|
||||
// must be called by the thread we want as the main thread
|
||||
nsresult
|
||||
XRE_metroStartup(bool runXREMain)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// XXX This call, odly enough, will set this thread as
|
||||
// the main thread. (see bug 1033358)
|
||||
ScopedLogging log;
|
||||
|
||||
bool exit = false;
|
||||
if (xreMainPtr->XRE_mainStartup(&exit) != 0 || exit)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Start the real application
|
||||
xreMainPtr->mScopedXPCOM = MakeUnique<ScopedXPCOMStartup>();
|
||||
if (!xreMainPtr->mScopedXPCOM)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
rv = xreMainPtr->mScopedXPCOM->Initialize();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (runXREMain) {
|
||||
rv = xreMainPtr->XRE_mainRun();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
XRE_metroShutdown()
|
||||
{
|
||||
xreMainPtr->mScopedXPCOM = nullptr;
|
||||
|
||||
#ifdef MOZ_INSTRUMENT_EVENT_LOOP
|
||||
mozilla::ShutdownEventTracing();
|
||||
#endif
|
||||
|
||||
// unlock the profile after ScopedXPCOMStartup object (xpcom)
|
||||
// has gone out of scope. see bug #386739 for more details
|
||||
xreMainPtr->mProfileLock->Unlock();
|
||||
gProfileLock = nullptr;
|
||||
|
||||
XRE_DeinitCommandLine();
|
||||
}
|
||||
|
||||
class WinRTInitWrapper
|
||||
{
|
||||
public:
|
||||
WinRTInitWrapper() {
|
||||
mResult = ::RoInitialize(RO_INIT_MULTITHREADED);
|
||||
}
|
||||
~WinRTInitWrapper() {
|
||||
if (SUCCEEDED(mResult)) {
|
||||
::RoUninitialize();
|
||||
}
|
||||
}
|
||||
HRESULT mResult;
|
||||
};
|
||||
|
||||
int
|
||||
XRE_mainMetro(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
{
|
||||
char aLocal;
|
||||
GoannaProfilerInitRAII profilerGuard(&aLocal);
|
||||
|
||||
PROFILER_LABEL("Startup", "XRE_Main",
|
||||
js::ProfileEntry::Category::OTHER);
|
||||
|
||||
mozilla::IOInterposerInit ioInterposerGuard;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
xreMainPtr = new XREMain();
|
||||
if (!xreMainPtr) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Inits Winrt and COM underneath it.
|
||||
WinRTInitWrapper wrap;
|
||||
|
||||
gArgc = argc;
|
||||
gArgv = argv;
|
||||
|
||||
NS_ENSURE_TRUE(aAppData, 2);
|
||||
|
||||
xreMainPtr->mAppData = new ScopedAppData(aAppData);
|
||||
if (!xreMainPtr->mAppData)
|
||||
return 1;
|
||||
// used throughout this file
|
||||
gAppData = xreMainPtr->mAppData;
|
||||
|
||||
// init
|
||||
bool exit = false;
|
||||
if (xreMainPtr->XRE_mainInit(&exit) != 0 || exit)
|
||||
return 1;
|
||||
|
||||
// Located in widget, will call back into XRE_metroStartup and
|
||||
// XRE_metroShutdown above.
|
||||
if (!XRE_MetroCoreApplicationRun()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// XRE_metroShutdown should have already been called on the worker
|
||||
// thread that called XRE_metroStartup.
|
||||
NS_ASSERTION(!xreMainPtr->mScopedXPCOM,
|
||||
"XPCOM Shutdown hasn't occured, and we are exiting.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SetWindowsEnvironment(WindowsEnvironmentType aEnvID);
|
||||
#endif // MOZ_METRO || !defined(XP_WIN)
|
||||
|
||||
void
|
||||
XRE_StopLateWriteChecks(void) {
|
||||
mozilla::StopLateWriteChecks();
|
||||
}
|
||||
|
||||
// Separate stub function to let us specifically suppress it in Valgrind
|
||||
void
|
||||
XRE_CreateStatsObject()
|
||||
{
|
||||
// A initializer to initialize histogram collection, a chromium
|
||||
// thing used by Telemetry (and effectively a global; it's all static).
|
||||
// Note: purposely leaked
|
||||
base::StatisticsRecorder* statistics_recorder = new base::StatisticsRecorder();
|
||||
MOZ_LSAN_INTENTIONALLY_LEAK_OBJECT(statistics_recorder);
|
||||
unused << statistics_recorder;
|
||||
}
|
||||
|
||||
int
|
||||
XRE_main(int argc, char* argv[], const nsXREAppData* aAppData, uint32_t aFlags)
|
||||
{
|
||||
#if !defined(MOZ_METRO) || !defined(XP_WIN)
|
||||
XREMain main;
|
||||
|
||||
XRE_CreateStatsObject();
|
||||
int result = main.XRE_main(argc, argv, aAppData);
|
||||
mozilla::RecordShutdownEndTimeStamp();
|
||||
return result;
|
||||
#else
|
||||
if (aFlags == XRE_MAIN_FLAG_USE_METRO) {
|
||||
SetWindowsEnvironment(WindowsEnvironmentType_Metro);
|
||||
}
|
||||
|
||||
// Desktop
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Desktop) {
|
||||
XREMain main;
|
||||
int result = main.XRE_main(argc, argv, aAppData);
|
||||
mozilla::RecordShutdownEndTimeStamp();
|
||||
return result;
|
||||
}
|
||||
|
||||
// Metro
|
||||
NS_ASSERTION(XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro,
|
||||
"Unknown Windows environment");
|
||||
|
||||
SetLastWinRunType(AHE_IMMERSIVE);
|
||||
|
||||
int result = XRE_mainMetro(argc, argv, aAppData);
|
||||
mozilla::RecordShutdownEndTimeStamp();
|
||||
return result;
|
||||
#endif // MOZ_METRO || !defined(XP_WIN)
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
||||
@@ -796,23 +796,6 @@ XRE_InstallX11ErrorHandler()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
static WindowsEnvironmentType
|
||||
sWindowsEnvironmentType = WindowsEnvironmentType_Desktop;
|
||||
|
||||
void
|
||||
SetWindowsEnvironment(WindowsEnvironmentType aEnvID)
|
||||
{
|
||||
sWindowsEnvironmentType = aEnvID;
|
||||
}
|
||||
|
||||
WindowsEnvironmentType
|
||||
XRE_GetWindowsEnvironment()
|
||||
{
|
||||
return sWindowsEnvironmentType;
|
||||
}
|
||||
#endif // XP_WIN
|
||||
|
||||
#ifdef MOZ_B2G_LOADER
|
||||
extern const nsXREAppData* gAppData;
|
||||
|
||||
|
||||
@@ -321,19 +321,6 @@ IsOlderVersion(nsIFile *versionFile, const char *appVersion)
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_METRO)
|
||||
static bool
|
||||
IsWindowsMetroUpdateRequest(int appArgc, char **appArgv)
|
||||
{
|
||||
for (int index = 0; index < appArgc; index++) {
|
||||
if (!strcmp(appArgv[index], "--metro-update")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool
|
||||
CopyFileIntoUpdateDir(nsIFile *parentDir, const char *leafName, nsIFile *updateDir)
|
||||
{
|
||||
@@ -574,15 +561,7 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir,
|
||||
// just needs to replace the update directory.
|
||||
pid.AppendLiteral("/replace");
|
||||
|
||||
int immersiveArgc = 0;
|
||||
#if defined(XP_WIN) && defined(MOZ_METRO)
|
||||
// If this is desktop doing an update for metro, or if we're the metro browser
|
||||
// we want to launch the metro browser after we're finished.
|
||||
if (IsWindowsMetroUpdateRequest(appArgc, appArgv) || IsRunningInWindowsMetro()) {
|
||||
immersiveArgc = 1;
|
||||
}
|
||||
#endif
|
||||
int argc = appArgc + 6 + immersiveArgc;
|
||||
int argc = appArgc + 6;
|
||||
char **argv = new char*[argc + 1];
|
||||
if (!argv)
|
||||
return;
|
||||
@@ -596,11 +575,6 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir,
|
||||
argv[6] = (char*) appFilePath.get();
|
||||
for (int i = 1; i < appArgc; ++i)
|
||||
argv[6 + i] = appArgv[i];
|
||||
#ifdef XP_WIN
|
||||
if (immersiveArgc) {
|
||||
argv[argc - 1] = "-ServerName:DefaultBrowserServer";
|
||||
}
|
||||
#endif
|
||||
argv[argc] = nullptr;
|
||||
} else {
|
||||
argc = 5;
|
||||
@@ -859,15 +833,7 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
|
||||
#endif
|
||||
}
|
||||
|
||||
int immersiveArgc = 0;
|
||||
#if defined(XP_WIN) && defined(MOZ_METRO)
|
||||
// If this is desktop doing an update for metro, or if we're the metro browser
|
||||
// we want to launch the metro browser after we're finished.
|
||||
if (IsWindowsMetroUpdateRequest(appArgc, appArgv) || IsRunningInWindowsMetro()) {
|
||||
immersiveArgc = 1;
|
||||
}
|
||||
#endif
|
||||
int argc = appArgc + 6 + immersiveArgc;
|
||||
int argc = appArgc + 6;
|
||||
char **argv = new char*[argc + 1 ];
|
||||
if (!argv)
|
||||
return;
|
||||
@@ -881,11 +847,6 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
|
||||
argv[6] = (char*) appFilePath.get();
|
||||
for (int i = 1; i < appArgc; ++i)
|
||||
argv[6 + i] = appArgv[i];
|
||||
#ifdef XP_WIN
|
||||
if (immersiveArgc) {
|
||||
argv[argc - 1] = "-ServerName:DefaultBrowserServer";
|
||||
}
|
||||
#endif
|
||||
argv[argc] = nullptr;
|
||||
} else {
|
||||
argc = 5;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "nsSetDllDirectory.h"
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_METRO) || defined(__GNUC__)
|
||||
#if defined(__GNUC__)
|
||||
#define XRE_DONT_SUPPORT_XPSP2
|
||||
#endif
|
||||
|
||||
|
||||
@@ -406,9 +406,6 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent,
|
||||
else if (!strcmp(aProperty, NS_APP_PREFS_50_FILE)) {
|
||||
rv = file->AppendNative(NS_LITERAL_CSTRING("prefs.js"));
|
||||
}
|
||||
else if (!strcmp(aProperty, NS_METRO_APP_PREFS_50_FILE)) {
|
||||
rv = file->AppendNative(NS_LITERAL_CSTRING("metro-prefs.js"));
|
||||
}
|
||||
else if (!strcmp(aProperty, NS_LOCALSTORE_UNSAFE_FILE)) {
|
||||
rv = file->AppendNative(NS_LITERAL_CSTRING("localstore.rdf"));
|
||||
}
|
||||
@@ -1100,8 +1097,7 @@ nsXREDirProvider::GetUpdateRootDir(nsIFile* *aResult)
|
||||
// Get the local app data directory and if a vendor name exists append it.
|
||||
// If only a product name exists, append it. If neither exist fallback to
|
||||
// old handling. We don't use the product name on purpose because we want a
|
||||
// shared update directory for different apps run from the same path (like
|
||||
// Metro & Desktop).
|
||||
// shared update directory for different apps run from the same path.
|
||||
nsCOMPtr<nsIFile> localDir;
|
||||
if (pathHashResult && (hasVendor || gAppData->name) &&
|
||||
NS_SUCCEEDED(GetUserDataDirectoryHome(getter_AddRefs(localDir), true)) &&
|
||||
|
||||
@@ -68,10 +68,7 @@ static mozilla::StaticAutoPtr<mozilla::ProfilerIOInterposeObserver>
|
||||
sInterposeObserver;
|
||||
|
||||
// The name that identifies the goanna thread for calls to
|
||||
// profiler_register_thread. For all platform except metro
|
||||
// the thread that calls mozilla_sampler_init is considered
|
||||
// the goanna thread. With metro the goanna thread is
|
||||
// registered later based on this thread name.
|
||||
// profiler_register_thread.
|
||||
static const char * gGoannaThreadName = "GoannaMain";
|
||||
|
||||
void Sampler::Startup() {
|
||||
@@ -493,10 +490,6 @@ void mozilla_sampler_init(void* stackTop)
|
||||
tlsPseudoStack.set(stack);
|
||||
|
||||
bool isMainThread = true;
|
||||
#ifdef XP_WIN
|
||||
// For metrofx, we'll register the main thread once it's created.
|
||||
isMainThread = !(XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro);
|
||||
#endif
|
||||
Sampler::RegisterCurrentThread(isMainThread ?
|
||||
gGoannaThreadName : "Application Thread",
|
||||
stack, isMainThread, stackTop);
|
||||
|
||||
@@ -400,18 +400,8 @@ static nsresult GetDownloadDirectory(nsIFile **_directory,
|
||||
else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
#elif defined(XP_WIN)
|
||||
// On metro we want to be able to search opened files and the temp directory
|
||||
// is exlcuded in searches.
|
||||
nsresult rv;
|
||||
if (IsRunningInWindowsMetro()) {
|
||||
rv = NS_GetSpecialDirectory(NS_WIN_DEFAULT_DOWNLOAD_DIR, getter_AddRefs(dir));
|
||||
} else {
|
||||
rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(dir));
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
#else
|
||||
// On all other platforms, we default to the systems temporary directory.
|
||||
// On all other platforms, we default to the system's temporary directory.
|
||||
nsresult rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(dir));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
#endif
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(398fb953-335d-42f1-9e91-e238b56bf4ad)]
|
||||
|
||||
interface nsIMetroUIUtils : nsISupports {
|
||||
/**
|
||||
* Obtains the current page URI
|
||||
*/
|
||||
attribute AString currentPageURI;
|
||||
|
||||
/**
|
||||
* Obtains the current page title
|
||||
*/
|
||||
attribute AString currentPageTitle;
|
||||
|
||||
/**
|
||||
* Determines if the browser has selected content
|
||||
*/
|
||||
attribute boolean hasSelectedContent;
|
||||
|
||||
/**
|
||||
* Determines the text that should be shared
|
||||
*/
|
||||
attribute AString shareText;
|
||||
|
||||
/**
|
||||
* Determines the HTML that should be shared
|
||||
*/
|
||||
attribute AString shareHTML;
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* aKeyNameIndex is the widget::KeyNameIndex value.
|
||||
*/
|
||||
|
||||
// Windows (both Desktop and Metro)
|
||||
// Windows
|
||||
#define KEY_MAP_WIN(aCPPKeyName, aNativeKey)
|
||||
#define KEY_MAP_WIN_JPN(aCPPKeyName, aNativeKey)
|
||||
#define KEY_MAP_WIN_KOR(aCPPKeyName, aNativeKey)
|
||||
|
||||
@@ -85,12 +85,6 @@ XPIDL_SOURCES += [
|
||||
'nsITransferable.idl',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_METRO']:
|
||||
XPIDL_SOURCES += [
|
||||
'MetroUIUtils.idl',
|
||||
'nsIWinMetroUtils.idl',
|
||||
]
|
||||
|
||||
XPIDL_MODULE = 'widget'
|
||||
|
||||
EXPORTS += [
|
||||
|
||||
@@ -28,9 +28,6 @@
|
||||
*/
|
||||
|
||||
#include "nsXULAppAPI.h"
|
||||
#if defined(MOZ_METRO) && defined(XP_WIN)
|
||||
#include "winrt/MetroAppShell.h"
|
||||
#endif
|
||||
|
||||
static nsIAppShell *sAppShell;
|
||||
|
||||
@@ -39,29 +36,13 @@ nsAppShellInit()
|
||||
{
|
||||
NS_ASSERTION(!sAppShell, "already initialized");
|
||||
|
||||
#if !defined(MOZ_METRO) || !defined(XP_WIN)
|
||||
sAppShell = new nsAppShell();
|
||||
#else
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
sAppShell = new MetroAppShell();
|
||||
} else {
|
||||
sAppShell = new nsAppShell();
|
||||
}
|
||||
#endif
|
||||
if (!sAppShell)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(sAppShell);
|
||||
|
||||
nsresult rv;
|
||||
#if !defined(MOZ_METRO) || !defined(XP_WIN)
|
||||
rv = static_cast<nsAppShell*>(sAppShell)->Init();
|
||||
#else
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
rv = static_cast<MetroAppShell*>(sAppShell)->Init();
|
||||
} else {
|
||||
rv = static_cast<nsAppShell*>(sAppShell)->Init();
|
||||
}
|
||||
#endif
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(sAppShell);
|
||||
return rv;
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* Integration with the "Metro"/"Modern" UI environment in Windows 8.
|
||||
*
|
||||
* Note: browser/metro/base/content/browser.js contains a stub
|
||||
* implementation of this interface for non-Windows systems, for testing and
|
||||
* development purposes only.
|
||||
*/
|
||||
[scriptable, uuid(319faae0-82ca-4c2f-8a24-2b2445e5a72a)]
|
||||
interface nsIWinMetroUtils : nsISupports
|
||||
{
|
||||
/**
|
||||
* Determine if the current device has the hardware capabilities to run
|
||||
* in metro mode.
|
||||
*/
|
||||
readonly attribute boolean supported;
|
||||
|
||||
/**
|
||||
* Determine if the current browser is running in the metro immersive
|
||||
* environment.
|
||||
*/
|
||||
readonly attribute boolean immersive;
|
||||
|
||||
/**
|
||||
* Determine the activation URI
|
||||
*/
|
||||
readonly attribute AString activationURI;
|
||||
|
||||
/**
|
||||
* Determine the previous execution state. The possible values of this
|
||||
* attribute are exactly those values in the
|
||||
* Windows::ApplicationModel::Activation enumeration.
|
||||
*/
|
||||
readonly attribute long previousExecutionState;
|
||||
|
||||
/**
|
||||
* Helper for our restart logic up in the about flyout. We set this
|
||||
* right before we restart for an update so that MetroAppShell can
|
||||
* communicate this to the ceh.
|
||||
*/
|
||||
attribute boolean updatePending;
|
||||
|
||||
/*
|
||||
* Determine if metro firefox is running in the foreground.
|
||||
*/
|
||||
readonly attribute boolean foreground;
|
||||
|
||||
/**
|
||||
* Show the settings flyout
|
||||
*/
|
||||
void showSettingsFlyout();
|
||||
|
||||
/**
|
||||
* Launches the specified application with the specified arguments and
|
||||
* switches to Desktop mode if in metro mode.
|
||||
*/
|
||||
void launchInDesktop(in AString aPath, in AString aArguments);
|
||||
|
||||
/**
|
||||
* Displays a native Windows 8 toast.
|
||||
*
|
||||
* @param aAppId Application ID for current application.
|
||||
* If using Metro mode, it can be null string.
|
||||
*/
|
||||
void showNativeToast(in AString aTitle, in AString aMessage,
|
||||
in AString anImage, in AString aCookie,
|
||||
[optional] in AString aAppId);
|
||||
|
||||
/**
|
||||
* Secondary tiles are a Windows 8 specific feature for pinning new tiles
|
||||
* to the start screen. Tiles can later be activated whether the browser is
|
||||
* already opened or not.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Pins a new tile to the Windows 8 start screen.
|
||||
*
|
||||
* @param aTileID An ID which can later be used to remove the tile
|
||||
* ID must only contain valid filesystem characters
|
||||
* @param aShortName A short name for the tile
|
||||
* @param aDiplayName The name that will be displayed on the tile
|
||||
* @param aActivationArgs The arguments to pass to the browser upon
|
||||
* activation of the tile
|
||||
* @param aTileImage An image for the normal tile view
|
||||
* @param aSmallTileImage An image for the small tile view
|
||||
*/
|
||||
void pinTileAsync(in AString aTileID,
|
||||
in AString aShortName,
|
||||
in AString aDisplayName,
|
||||
in AString aActivationArgs,
|
||||
in AString aTileImage,
|
||||
in AString aSmallTileImage);
|
||||
|
||||
/**
|
||||
* Unpins a tile from the Windows 8 start screen.
|
||||
*
|
||||
* @param aTileID An existing ID which was previously pinned
|
||||
* ID must only contain valid filesystem characters
|
||||
*/
|
||||
void unpinTileAsync(in AString aTileID);
|
||||
|
||||
/**
|
||||
* Determines if a tile is pinned to the Windows 8 start screen.
|
||||
*
|
||||
* @param aTileID An ID which may have been pinned with pinTileAsync
|
||||
* ID must only contain valid filesystem characters
|
||||
* @return true if the tile is pinned
|
||||
*/
|
||||
bool isTilePinned(in AString aTileID);
|
||||
|
||||
/**
|
||||
* Soft keyboard attributes. Used in unison with shown/hidden observer
|
||||
* events sent via FrameworkView.
|
||||
*
|
||||
* keyboardVisible - returns true if the soft keyboard is currently
|
||||
* displayed, false otherwise.
|
||||
* keyboardX, keyboardY, keyboardWidth, keyboardHeight - occlude rect
|
||||
* of the keyboard when displayed in device independent pixels.
|
||||
*/
|
||||
readonly attribute boolean keyboardVisible;
|
||||
readonly attribute unsigned long keyboardX;
|
||||
readonly attribute unsigned long keyboardY;
|
||||
readonly attribute unsigned long keyboardWidth;
|
||||
readonly attribute unsigned long keyboardHeight;
|
||||
|
||||
/**
|
||||
* Settings panel links. addSettingsPanelEntry adds an entry to
|
||||
* the settings flyout panel that the user can invoke.
|
||||
*
|
||||
* @param aChromePanelId panel id invoked via nsIBrowserDOMWindow's
|
||||
* ShowPanel api. Example: 'prefs-container'
|
||||
* @return a unique identifier that will be passed as "data" in the
|
||||
* "metro-settings-entry-selected" notification when the entry is clicked
|
||||
*/
|
||||
unsigned long addSettingsPanelEntry(in AString aLabel);
|
||||
|
||||
/**
|
||||
* Change the value of the "switch primary and secondary buttons" preference.
|
||||
* See the Windows SwapMouseButton API docs for details.
|
||||
* Included here for use in automated tests (see bug 839460).
|
||||
*
|
||||
* @param aSwap true to enable the preference, false to disable it.
|
||||
* @return original value of the preference.
|
||||
*/
|
||||
bool swapMouseButton(in bool aSwap);
|
||||
};
|
||||
@@ -123,10 +123,6 @@
|
||||
#define NS_WIN_JUMPLISTBUILDER_CID \
|
||||
{ 0x73a5946f, 0x608d, 0x454f, { 0x9d, 0x33, 0xb, 0x8f, 0x8c, 0x72, 0x94, 0xb6 } }
|
||||
|
||||
// {DE95B8C9-F0E8-4AD5-95A2-06C12F53EC2E}
|
||||
#define NS_WIN_METROUTILS_CID \
|
||||
{ 0xde95b8c9, 0xf0e8, 0x4ad5, { 0x95, 0xa2, 0x06, 0xc1, 0x2f, 0x53, 0xec, 0x2e }}
|
||||
|
||||
// {2B9A1F2C-27CE-45b6-8D4E-755D0E34F8DB}
|
||||
#define NS_WIN_JUMPLISTITEM_CID \
|
||||
{ 0x2b9a1f2c, 0x27ce, 0x45b6, { 0x8d, 0x4e, 0x75, 0x5d, 0x0e, 0x34, 0xf8, 0xdb } }
|
||||
|
||||
@@ -142,6 +142,7 @@ static_assert(sizeof(kVirtualKeyName) / sizeof(const char*) == 0x100,
|
||||
// Unique id counter associated with a keydown / keypress events. Used in
|
||||
// identifing keypress events for removal from async event dispatch queue
|
||||
// in metrofx after preventDefault is called on keydown events.
|
||||
// XXX: Do we still need this?
|
||||
static uint32_t sUniqueKeyEventId = 0;
|
||||
|
||||
struct DeadKeyEntry
|
||||
@@ -296,11 +297,6 @@ ModifierKeyState::InitMouseEvent(WidgetInputEvent& aMouseEvent) const
|
||||
aMouseEvent.mClass == eSimpleGestureEventClass,
|
||||
"called with non-mouse event");
|
||||
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
// Buttons for immersive mode are handled in MetroInput.
|
||||
return;
|
||||
}
|
||||
|
||||
WidgetMouseEventBase& mouseEvent = *aMouseEvent.AsMouseEventBase();
|
||||
mouseEvent.buttons = 0;
|
||||
if (::GetKeyState(VK_LBUTTON) < 0) {
|
||||
|
||||
@@ -326,7 +326,6 @@ bool
|
||||
MouseScrollHandler::DispatchEvent(nsWindowBase* aWidget,
|
||||
WidgetGUIEvent& aEvent)
|
||||
{
|
||||
// note, in metrofx, this will always return false for now
|
||||
return aWidget->DispatchScrollEvent(&aEvent);
|
||||
}
|
||||
|
||||
@@ -1095,11 +1094,6 @@ MouseScrollHandler::Device::GetWorkaroundPref(const char* aPrefName,
|
||||
void
|
||||
MouseScrollHandler::Device::Init()
|
||||
{
|
||||
// Not supported in metro mode.
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
return;
|
||||
}
|
||||
|
||||
sFakeScrollableWindowNeeded =
|
||||
GetWorkaroundPref("ui.trackpoint_hack.enabled",
|
||||
(TrackPoint::IsDriverInstalled() ||
|
||||
|
||||
@@ -243,11 +243,6 @@ WinTaskbar::~WinTaskbar() {
|
||||
// static
|
||||
bool
|
||||
WinTaskbar::GetAppUserModelID(nsAString & aDefaultGroupId) {
|
||||
// For win8 metro builds, we can't set this. The value is static
|
||||
// for the app.
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
return false;
|
||||
}
|
||||
// If marked as such in prefs, use a hash of the profile path for the id
|
||||
// instead of the install path hash setup by the installer.
|
||||
bool useProfile =
|
||||
@@ -336,10 +331,6 @@ WinTaskbar::RegisterAppUserModelID() {
|
||||
if (!IsWin7OrLater())
|
||||
return false;
|
||||
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SetCurrentProcessExplicitAppUserModelIDPtr funcAppUserModelID = nullptr;
|
||||
bool retVal = false;
|
||||
|
||||
|
||||
+11
-27
@@ -40,10 +40,6 @@
|
||||
#include "nsIThread.h"
|
||||
#include "MainThreadUtils.h"
|
||||
#include "gfxColor.h"
|
||||
#ifdef MOZ_METRO
|
||||
#include "winrt/MetroInput.h"
|
||||
#include "winrt/MetroUtils.h"
|
||||
#endif // MOZ_METRO
|
||||
|
||||
#ifdef NS_ENABLE_TSF
|
||||
#include <textstor.h>
|
||||
@@ -539,26 +535,18 @@ double
|
||||
WinUtils::LogToPhysFactor()
|
||||
{
|
||||
// dpi / 96.0
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
#ifdef MOZ_METRO
|
||||
return MetroUtils::LogToPhysFactor();
|
||||
#else
|
||||
return 1.0;
|
||||
#endif
|
||||
} else {
|
||||
HDC hdc = ::GetDC(nullptr);
|
||||
double result = ::GetDeviceCaps(hdc, LOGPIXELSY) / 96.0;
|
||||
::ReleaseDC(nullptr, hdc);
|
||||
HDC hdc = ::GetDC(nullptr);
|
||||
double result = ::GetDeviceCaps(hdc, LOGPIXELSY) / 96.0;
|
||||
::ReleaseDC(nullptr, hdc);
|
||||
|
||||
if (result == 0) {
|
||||
// Bug 1012487 - This can occur when the Screen DC is used off the
|
||||
// main thread on windows. For now just assume a 100% DPI for this
|
||||
// drawing call.
|
||||
// XXX - fixme!
|
||||
result = 1.0;
|
||||
}
|
||||
return result;
|
||||
if (result == 0) {
|
||||
// Bug 1012487 - This can occur when the Screen DC is used off the
|
||||
// main thread on windows. For now just assume a 100% DPI for this
|
||||
// drawing call.
|
||||
// XXX - fixme!
|
||||
result = 1.0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* static */
|
||||
@@ -1682,11 +1670,7 @@ WinUtils::SetupKeyModifiersSequence(nsTArray<KeyPair>* aArray,
|
||||
bool
|
||||
WinUtils::ShouldHideScrollbars()
|
||||
{
|
||||
#ifdef MOZ_METRO
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
return widget::winrt::MetroInput::IsInputModeImprecise();
|
||||
}
|
||||
#endif // MOZ_METRO
|
||||
// Optional for future environments. Make it a pref for users?
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
if CONFIG['MOZ_METRO']:
|
||||
DIRS += ['winrt']
|
||||
|
||||
TEST_DIRS += ['tests']
|
||||
|
||||
EXPORTS += [
|
||||
|
||||
@@ -294,9 +294,6 @@ nsresult nsClipboard::GetGlobalData(HGLOBAL aHGBL, void ** aData, uint32_t * aLe
|
||||
result = NS_OK;
|
||||
}
|
||||
} else {
|
||||
#ifdef MOZ_METRO
|
||||
return result;
|
||||
#endif
|
||||
// We really shouldn't ever get here
|
||||
// but just in case
|
||||
*aData = nullptr;
|
||||
|
||||
@@ -482,11 +482,10 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
|
||||
aResult = 0;
|
||||
break;
|
||||
case eIntID_ColorPickerAvailable:
|
||||
// We don't have a color picker implemented on Metro yet (bug 895464)
|
||||
aResult = (XRE_GetWindowsEnvironment() != WindowsEnvironmentType_Metro);
|
||||
aResult = true;
|
||||
break;
|
||||
case eIntID_UseOverlayScrollbars:
|
||||
aResult = (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro);
|
||||
aResult = false;
|
||||
break;
|
||||
case eIntID_AllowOverlayScrollbarsOverlap:
|
||||
aResult = 0;
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsWindow.h"
|
||||
#ifdef MOZ_METRO
|
||||
#include "winrt/MetroWidget.h"
|
||||
#endif
|
||||
#include "nsPrintfCString.h"
|
||||
#include "WinUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
@@ -3209,22 +3206,20 @@ nsTextStore::GetTextExt(TsViewCookie vcView,
|
||||
if (event.mReply.mRect.height <= 0)
|
||||
event.mReply.mRect.height = 1;
|
||||
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Desktop) {
|
||||
// convert to unclipped screen rect
|
||||
nsWindow* refWindow = static_cast<nsWindow*>(
|
||||
event.mReply.mFocusedWidget ? event.mReply.mFocusedWidget : mWidget);
|
||||
// Result rect is in top level widget coordinates
|
||||
refWindow = refWindow->GetTopLevelWindow(false);
|
||||
if (!refWindow) {
|
||||
PR_LOG(sTextStoreLog, PR_LOG_ERROR,
|
||||
("TSF: 0x%p nsTextStore::GetTextExt() FAILED due to "
|
||||
"no top level window", this));
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
event.mReply.mRect.MoveBy(refWindow->WidgetToScreenOffset());
|
||||
// convert to unclipped screen rect
|
||||
nsWindow* refWindow = static_cast<nsWindow*>(
|
||||
event.mReply.mFocusedWidget ? event.mReply.mFocusedWidget : mWidget);
|
||||
// Result rect is in top level widget coordinates
|
||||
refWindow = refWindow->GetTopLevelWindow(false);
|
||||
if (!refWindow) {
|
||||
PR_LOG(sTextStoreLog, PR_LOG_ERROR,
|
||||
("TSF: 0x%p nsTextStore::GetTextExt() FAILED due to "
|
||||
"no top level window", this));
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
event.mReply.mRect.MoveBy(refWindow->WidgetToScreenOffset());
|
||||
|
||||
// get bounding screen rect to test for clipping
|
||||
if (!GetScreenExtInternal(*prc)) {
|
||||
PR_LOG(sTextStoreLog, PR_LOG_ERROR,
|
||||
@@ -3322,50 +3317,36 @@ nsTextStore::GetScreenExtInternal(RECT &aScreenExt)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
nsIntRect boundRect;
|
||||
if (NS_FAILED(mWidget->GetClientBounds(boundRect))) {
|
||||
PR_LOG(sTextStoreLog, PR_LOG_ERROR,
|
||||
("TSF: 0x%p nsTextStore::GetScreenExtInternal() FAILED due to "
|
||||
"failed to get the client bounds", this));
|
||||
return false;
|
||||
}
|
||||
nsWindow* refWindow = static_cast<nsWindow*>(
|
||||
event.mReply.mFocusedWidget ?
|
||||
event.mReply.mFocusedWidget : mWidget);
|
||||
// Result rect is in top level widget coordinates
|
||||
refWindow = refWindow->GetTopLevelWindow(false);
|
||||
if (!refWindow) {
|
||||
PR_LOG(sTextStoreLog, PR_LOG_ERROR,
|
||||
("TSF: 0x%p nsTextStore::GetScreenExtInternal() FAILED due to "
|
||||
"no top level window", this));
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIntRect boundRect;
|
||||
if (NS_FAILED(refWindow->GetClientBounds(boundRect))) {
|
||||
PR_LOG(sTextStoreLog, PR_LOG_ERROR,
|
||||
("TSF: 0x%p nsTextStore::GetScreenExtInternal() FAILED due to "
|
||||
"failed to get the client bounds", this));
|
||||
return false;
|
||||
}
|
||||
|
||||
boundRect.MoveTo(0, 0);
|
||||
|
||||
// Clip frame rect to window rect
|
||||
boundRect.IntersectRect(LayoutDevicePixel::ToUntyped(event.mReply.mRect), boundRect);
|
||||
if (!boundRect.IsEmpty()) {
|
||||
boundRect.MoveBy(refWindow->WidgetToScreenOffsetUntyped());
|
||||
::SetRect(&aScreenExt, boundRect.x, boundRect.y,
|
||||
boundRect.XMost(), boundRect.YMost());
|
||||
} else {
|
||||
NS_ASSERTION(XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Desktop,
|
||||
"environment isn't WindowsEnvironmentType_Desktop!");
|
||||
nsWindow* refWindow = static_cast<nsWindow*>(
|
||||
event.mReply.mFocusedWidget ?
|
||||
event.mReply.mFocusedWidget : mWidget);
|
||||
// Result rect is in top level widget coordinates
|
||||
refWindow = refWindow->GetTopLevelWindow(false);
|
||||
if (!refWindow) {
|
||||
PR_LOG(sTextStoreLog, PR_LOG_ERROR,
|
||||
("TSF: 0x%p nsTextStore::GetScreenExtInternal() FAILED due to "
|
||||
"no top level window", this));
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIntRect boundRect;
|
||||
if (NS_FAILED(refWindow->GetClientBounds(boundRect))) {
|
||||
PR_LOG(sTextStoreLog, PR_LOG_ERROR,
|
||||
("TSF: 0x%p nsTextStore::GetScreenExtInternal() FAILED due to "
|
||||
"failed to get the client bounds", this));
|
||||
return false;
|
||||
}
|
||||
|
||||
boundRect.MoveTo(0, 0);
|
||||
|
||||
// Clip frame rect to window rect
|
||||
boundRect.IntersectRect(LayoutDevicePixel::ToUntyped(event.mReply.mRect), boundRect);
|
||||
if (!boundRect.IsEmpty()) {
|
||||
boundRect.MoveBy(refWindow->WidgetToScreenOffsetUntyped());
|
||||
::SetRect(&aScreenExt, boundRect.x, boundRect.y,
|
||||
boundRect.XMost(), boundRect.YMost());
|
||||
} else {
|
||||
::SetRectEmpty(&aScreenExt);
|
||||
}
|
||||
::SetRectEmpty(&aScreenExt);
|
||||
}
|
||||
|
||||
PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
|
||||
@@ -4296,11 +4277,6 @@ nsTextStore::OnMouseButtonEventInternal(const IMENotification& aIMENotification)
|
||||
void
|
||||
nsTextStore::CreateNativeCaret()
|
||||
{
|
||||
// This method must work only on desktop application.
|
||||
if (XRE_GetWindowsEnvironment() != WindowsEnvironmentType_Desktop) {
|
||||
return;
|
||||
}
|
||||
|
||||
PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
|
||||
("TSF: 0x%p nsTextStore::CreateNativeCaret(), "
|
||||
"mComposition.IsComposing()=%s",
|
||||
|
||||
@@ -297,7 +297,7 @@ protected:
|
||||
// application. Otherwise, this does nothing.
|
||||
void CreateNativeCaret();
|
||||
|
||||
// Holds the pointer to our current win32 or metro widget
|
||||
// Holds the pointer to our current win32 widget
|
||||
nsRefPtr<nsWindowBase> mWidget;
|
||||
// Document manager for the currently focused editor
|
||||
nsRefPtr<ITfDocumentMgr> mDocumentMgr;
|
||||
|
||||
@@ -31,13 +31,6 @@
|
||||
#include "nsWindow.h"
|
||||
// Content processes
|
||||
#include "nsFilePickerProxy.h"
|
||||
// Metro
|
||||
#ifdef MOZ_METRO
|
||||
#include "winrt/MetroAppShell.h"
|
||||
#include "winrt/MetroWidget.h"
|
||||
#include "winrt/nsMetroFilePicker.h"
|
||||
#include "winrt/nsWinMetroUtils.h"
|
||||
#endif
|
||||
|
||||
// Drag & Drop, Clipboard
|
||||
#include "nsClipboardHelper.h"
|
||||
@@ -68,18 +61,8 @@ WindowConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
if (aOuter != nullptr) {
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
#ifdef MOZ_METRO
|
||||
widget = new MetroWidget;
|
||||
#else
|
||||
NS_RUNTIMEABORT("build does not support metro.");
|
||||
#endif
|
||||
} else {
|
||||
widget = new nsWindow;
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIWidget> widget = new nsWindow;
|
||||
return widget->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
@@ -91,14 +74,8 @@ ChildWindowConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
if (aOuter != nullptr) {
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
return NS_NOINTERFACE;
|
||||
} else {
|
||||
widget = new ChildWindow;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWidget> widget = new ChildWindow;
|
||||
return widget->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
@@ -110,17 +87,8 @@ FilePickerConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
if (aOuter != nullptr) {
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsCOMPtr<nsIFilePicker> picker;
|
||||
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
#ifdef MOZ_METRO
|
||||
picker = new nsMetroFilePicker;
|
||||
#else
|
||||
NS_RUNTIMEABORT("build does not support metro.");
|
||||
#endif
|
||||
} else {
|
||||
picker = new nsFilePicker;
|
||||
}
|
||||
nsCOMPtr<nsIFilePicker> picker = new nsFilePicker;
|
||||
return picker->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
@@ -132,20 +100,8 @@ ColorPickerConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
if (aOuter != nullptr) {
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsCOMPtr<nsIColorPicker> picker;
|
||||
|
||||
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
|
||||
#ifdef MOZ_METRO
|
||||
// TODO
|
||||
// picker = new nsMetroColorPicker;
|
||||
NS_ERROR("metro color picker isn't implemented currently");
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
#else
|
||||
NS_RUNTIMEABORT("build does not support metro.");
|
||||
#endif
|
||||
} else {
|
||||
picker = new nsColorPicker;
|
||||
}
|
||||
nsCOMPtr<nsIColorPicker> picker = new nsColorPicker;
|
||||
return picker->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
@@ -164,9 +120,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
|
||||
#ifdef MOZ_METRO
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWinMetroUtils)
|
||||
#endif
|
||||
#ifdef NS_PRINTING
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintOptionsWin, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorWin)
|
||||
@@ -201,9 +154,6 @@ NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTITEM_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTSEPARATOR_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTLINK_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTSHORTCUT_CID);
|
||||
#ifdef MOZ_METRO
|
||||
NS_DEFINE_NAMED_CID(NS_WIN_METROUTILS_CID);
|
||||
#endif
|
||||
NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_BIDIKEYBOARD_CID);
|
||||
#ifdef NS_PRINTING
|
||||
@@ -238,9 +188,6 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
|
||||
{ &kNS_WIN_JUMPLISTSHORTCUT_CID, false, nullptr, JumpListShortcutConstructor },
|
||||
{ &kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceConstructor, Module::MAIN_PROCESS_ONLY },
|
||||
{ &kNS_BIDIKEYBOARD_CID, false, nullptr, nsBidiKeyboardConstructor },
|
||||
#ifdef MOZ_METRO
|
||||
{ &kNS_WIN_METROUTILS_CID, false, nullptr, nsWinMetroUtilsConstructor },
|
||||
#endif
|
||||
#ifdef NS_PRINTING
|
||||
{ &kNS_PRINTSETTINGSSERVICE_CID, false, nullptr, nsPrintOptionsWinConstructor },
|
||||
{ &kNS_PRINTER_ENUMERATOR_CID, false, nullptr, nsPrinterEnumeratorWinConstructor },
|
||||
@@ -273,9 +220,6 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
|
||||
{ "@mozilla.org/windows-jumplistshortcut;1", &kNS_WIN_JUMPLISTSHORTCUT_CID },
|
||||
{ "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, Module::MAIN_PROCESS_ONLY },
|
||||
{ "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID },
|
||||
#ifdef MOZ_METRO
|
||||
{ "@mozilla.org/windows-metroutils;1", &kNS_WIN_METROUTILS_CID },
|
||||
#endif
|
||||
#ifdef NS_PRINTING
|
||||
{ "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID },
|
||||
{ "@mozilla.org/gfx/printerenumerator;1", &kNS_PRINTER_ENUMERATOR_CID },
|
||||
|
||||
@@ -5411,23 +5411,6 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_SETTINGCHANGE:
|
||||
if (IsWin8OrLater() && lParam &&
|
||||
!wcsicmp(L"ConvertibleSlateMode", (wchar_t*)lParam)) {
|
||||
// If we're switching into slate mode, switch to Metro for hardware
|
||||
// that supports this feature if the pref is set.
|
||||
if (GetSystemMetrics(SM_CONVERTIBLESLATEMODE) == 0 &&
|
||||
Preferences::GetBool("browser.shell.desktop-auto-switch-enabled",
|
||||
false)) {
|
||||
nsCOMPtr<nsIAppStartup> appStartup(do_GetService(NS_APPSTARTUP_CONTRACTID));
|
||||
if (appStartup) {
|
||||
appStartup->Quit(nsIAppStartup::eForceQuit |
|
||||
nsIAppStartup::eRestartTouchEnvironment);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
if (msg == nsAppShell::GetTaskbarButtonCreatedMessage()) {
|
||||
|
||||
@@ -1,315 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "APZController.h"
|
||||
#include "base/message_loop.h"
|
||||
#include "mozilla/layers/GoannaContentController.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "MetroUtils.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "mozilla/layers/APZCCallbackHelper.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIDOMWindowUtils.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "mozilla/TouchEvents.h"
|
||||
|
||||
//#define DEBUG_CONTROLLER 1
|
||||
|
||||
#ifdef DEBUG_CONTROLLER
|
||||
#include "WinUtils.h"
|
||||
using namespace mozilla::widget;
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
namespace winrt {
|
||||
|
||||
nsRefPtr<mozilla::layers::APZCTreeManager> APZController::sAPZC;
|
||||
|
||||
/*
|
||||
* Metro layout specific - test to see if a sub document is a
|
||||
* tab.
|
||||
*/
|
||||
static bool
|
||||
IsTab(nsCOMPtr<nsIDocument>& aSubDocument)
|
||||
{
|
||||
nsRefPtr<nsIDocument> parent = aSubDocument->GetParentDocument();
|
||||
if (!parent) {
|
||||
NS_WARNING("huh? IsTab should always get a sub document for a parameter");
|
||||
return false;
|
||||
}
|
||||
return parent->IsRootDisplayDocument();
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the sub document associated with the scroll id.
|
||||
*/
|
||||
static bool
|
||||
GetDOMTargets(uint64_t aScrollId,
|
||||
nsCOMPtr<nsIDocument>& aSubDocument,
|
||||
nsCOMPtr<nsIContent>& aTargetContent)
|
||||
{
|
||||
// For tabs and subframes this will return the HTML sub document
|
||||
aTargetContent = nsLayoutUtils::FindContentFor(aScrollId);
|
||||
if (!aTargetContent) {
|
||||
return false;
|
||||
}
|
||||
nsCOMPtr<mozilla::dom::Element> domElement = do_QueryInterface(aTargetContent);
|
||||
if (!domElement) {
|
||||
return false;
|
||||
}
|
||||
|
||||
aSubDocument = domElement->OwnerDoc();
|
||||
|
||||
if (!aSubDocument) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the root element equals domElement, FindElementWithViewId found
|
||||
// a document, vs. an element within a document.
|
||||
if (aSubDocument->GetRootElement() == domElement && IsTab(aSubDocument)) {
|
||||
aTargetContent = nullptr;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
APZController::SetPendingResponseFlusher(APZPendingResponseFlusher* aFlusher)
|
||||
{
|
||||
mFlusher = aFlusher;
|
||||
}
|
||||
|
||||
void
|
||||
APZController::ContentReceivedInputBlock(const uint64_t aInputBlockId, bool aPreventDefault)
|
||||
{
|
||||
if (!sAPZC) {
|
||||
return;
|
||||
}
|
||||
sAPZC->ContentReceivedInputBlock(aInputBlockId, aPreventDefault);
|
||||
}
|
||||
|
||||
bool
|
||||
APZController::HitTestAPZC(ScreenIntPoint& aPoint)
|
||||
{
|
||||
if (!sAPZC) {
|
||||
return false;
|
||||
}
|
||||
return sAPZC->HitTestAPZC(aPoint);
|
||||
}
|
||||
|
||||
void
|
||||
APZController::TransformCoordinateToGoanna(const ScreenIntPoint& aPoint,
|
||||
LayoutDeviceIntPoint* aRefPointOut)
|
||||
{
|
||||
if (!sAPZC || !aRefPointOut) {
|
||||
return;
|
||||
}
|
||||
sAPZC->TransformCoordinateToGoanna(aPoint, aRefPointOut);
|
||||
}
|
||||
|
||||
nsEventStatus
|
||||
APZController::ReceiveInputEvent(WidgetInputEvent* aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId)
|
||||
{
|
||||
MOZ_ASSERT(aEvent);
|
||||
|
||||
if (!sAPZC) {
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
return sAPZC->ReceiveInputEvent(*aEvent->AsInputEvent(), aOutTargetGuid, aOutInputBlockId);
|
||||
}
|
||||
|
||||
// APZC sends us this request when we need to update the display port on
|
||||
// the scrollable frame the apzc is managing.
|
||||
void
|
||||
APZController::RequestContentRepaint(const FrameMetrics& aFrameMetrics)
|
||||
{
|
||||
#ifdef DEBUG_CONTROLLER
|
||||
WinUtils::Log("APZController::RequestContentRepaint scrollid=%I64d",
|
||||
aFrameMetrics.GetScrollId());
|
||||
#endif
|
||||
|
||||
// This must be on the goanna thread since we access the dom
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
#ifdef DEBUG_CONTROLLER
|
||||
WinUtils::Log("APZController: mScrollOffset: %f %f", aFrameMetrics.mScrollOffset.x,
|
||||
aFrameMetrics.mScrollOffset.y);
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIDocument> subDocument;
|
||||
nsCOMPtr<nsIContent> targetContent;
|
||||
if (!GetDOMTargets(aFrameMetrics.GetScrollId(),
|
||||
subDocument, targetContent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we're dealing with a sub frame or content editable element,
|
||||
// call UpdateSubFrame.
|
||||
if (targetContent) {
|
||||
#ifdef DEBUG_CONTROLLER
|
||||
WinUtils::Log("APZController: detected subframe or content editable");
|
||||
#endif
|
||||
FrameMetrics metrics = aFrameMetrics;
|
||||
mozilla::layers::APZCCallbackHelper::UpdateSubFrame(targetContent, metrics);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CONTROLLER
|
||||
WinUtils::Log("APZController: detected tab");
|
||||
#endif
|
||||
|
||||
// We're dealing with a tab, call UpdateRootFrame.
|
||||
nsCOMPtr<nsIDOMWindowUtils> utils;
|
||||
nsCOMPtr<nsIDOMWindow> window = subDocument->GetDefaultView();
|
||||
if (window) {
|
||||
utils = do_GetInterface(window);
|
||||
if (utils) {
|
||||
FrameMetrics metrics = aFrameMetrics;
|
||||
mozilla::layers::APZCCallbackHelper::UpdateRootFrame(utils, metrics);
|
||||
|
||||
#ifdef DEBUG_CONTROLLER
|
||||
WinUtils::Log("APZController: %I64d mDisplayPortMargins: %0.2f %0.2f %0.2f %0.2f",
|
||||
metrics.GetScrollId(),
|
||||
metrics.GetDisplayPortMargins().left,
|
||||
metrics.GetDisplayPortMargins().top,
|
||||
metrics.GetDisplayPortMargins().right,
|
||||
metrics.GetDisplayPortMargins().bottom);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
APZController::AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
|
||||
const uint32_t& aScrollGeneration)
|
||||
{
|
||||
#ifdef DEBUG_CONTROLLER
|
||||
WinUtils::Log("APZController::AcknowledgeScrollUpdate scrollid=%I64d gen=%lu",
|
||||
aScrollId, aScrollGeneration);
|
||||
#endif
|
||||
mozilla::layers::APZCCallbackHelper::AcknowledgeScrollUpdate(aScrollId, aScrollGeneration);
|
||||
}
|
||||
|
||||
void
|
||||
APZController::HandleDoubleTap(const CSSPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
APZController::HandleSingleTap(const CSSPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
APZController::HandleLongTap(const CSSPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid,
|
||||
uint64_t aInputBlockId)
|
||||
{
|
||||
if (mFlusher) {
|
||||
mFlusher->FlushPendingContentResponse();
|
||||
}
|
||||
ContentReceivedInputBlock(aInputBlockId, false);
|
||||
}
|
||||
|
||||
void
|
||||
APZController::HandleLongTapUp(const CSSPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
}
|
||||
|
||||
// requests that we send a mozbrowserasyncscroll domevent. not in use.
|
||||
void
|
||||
APZController::SendAsyncScrollDOMEvent(bool aIsRoot,
|
||||
const CSSRect &aContentRect,
|
||||
const CSSSize &aScrollableSize)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
APZController::PostDelayedTask(Task* aTask, int aDelayMs)
|
||||
{
|
||||
MessageLoop::current()->PostDelayedTask(FROM_HERE, aTask, aDelayMs);
|
||||
}
|
||||
|
||||
bool
|
||||
APZController::GetRootZoomConstraints(ZoomConstraints* aOutConstraints)
|
||||
{
|
||||
if (aOutConstraints) {
|
||||
// Until we support the meta-viewport tag properly allow zooming
|
||||
// from 1/4 to 4x by default.
|
||||
aOutConstraints->mAllowZoom = true;
|
||||
aOutConstraints->mAllowDoubleTapZoom = false;
|
||||
aOutConstraints->mMinZoom = CSSToParentLayerScale(0.25f);
|
||||
aOutConstraints->mMaxZoom = CSSToParentLayerScale(4.0f);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// apzc notifications
|
||||
|
||||
class TransformedStartEvent : public nsRunnable
|
||||
{
|
||||
NS_IMETHOD Run() {
|
||||
MetroUtils::FireObserver("apzc-transform-start", L"");
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
class TransformedEndEvent : public nsRunnable
|
||||
{
|
||||
NS_IMETHOD Run() {
|
||||
MetroUtils::FireObserver("apzc-transform-end", L"");
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
APZController::NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
|
||||
APZStateChange aChange,
|
||||
int aArg)
|
||||
{
|
||||
switch (aChange) {
|
||||
case APZStateChange::TransformBegin:
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
MetroUtils::FireObserver("apzc-transform-begin", L"");
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIRunnable> runnable = new TransformedStartEvent();
|
||||
NS_DispatchToMainThread(runnable);
|
||||
break;
|
||||
}
|
||||
case APZStateChange::TransformEnd:
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
MetroUtils::FireObserver("apzc-transform-end", L"");
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIRunnable> runnable = new TransformedEndEvent();
|
||||
NS_DispatchToMainThread(runnable);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// We don't currently care about other state changes.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} } }
|
||||
@@ -1,79 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "mozwrlbase.h"
|
||||
|
||||
#include "mozilla/layers/GoannaContentController.h"
|
||||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "FrameMetrics.h"
|
||||
#include "Units.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
namespace winrt {
|
||||
|
||||
class APZPendingResponseFlusher
|
||||
{
|
||||
public:
|
||||
virtual void FlushPendingContentResponse() = 0;
|
||||
};
|
||||
|
||||
class APZController :
|
||||
public mozilla::layers::GoannaContentController
|
||||
{
|
||||
typedef mozilla::layers::FrameMetrics FrameMetrics;
|
||||
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
|
||||
typedef mozilla::layers::ZoomConstraints ZoomConstraints;
|
||||
|
||||
public:
|
||||
APZController() :
|
||||
mFlusher(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
// GoannaContentController interface
|
||||
virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics);
|
||||
virtual void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId, const uint32_t& aScrollGeneration);
|
||||
virtual void HandleDoubleTap(const mozilla::CSSPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid);
|
||||
virtual void HandleSingleTap(const mozilla::CSSPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid);
|
||||
virtual void HandleLongTap(const mozilla::CSSPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid,
|
||||
uint64_t aInputBlockId);
|
||||
virtual void HandleLongTapUp(const mozilla::CSSPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
const mozilla::layers::ScrollableLayerGuid& aGuid);
|
||||
virtual void SendAsyncScrollDOMEvent(bool aIsRoot, const mozilla::CSSRect &aContentRect, const mozilla::CSSSize &aScrollableSize);
|
||||
virtual void PostDelayedTask(Task* aTask, int aDelayMs);
|
||||
virtual bool GetRootZoomConstraints(ZoomConstraints* aOutConstraints);
|
||||
virtual void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
|
||||
APZStateChange aChange,
|
||||
int aArg);
|
||||
|
||||
void SetPendingResponseFlusher(APZPendingResponseFlusher* aFlusher);
|
||||
|
||||
bool HitTestAPZC(mozilla::ScreenIntPoint& aPoint);
|
||||
void TransformCoordinateToGoanna(const mozilla::ScreenIntPoint& aPoint,
|
||||
LayoutDeviceIntPoint* aRefPointOut);
|
||||
void ContentReceivedInputBlock(uint64_t aInputBlockId, bool aPreventDefault);
|
||||
nsEventStatus ReceiveInputEvent(mozilla::WidgetInputEvent* aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId);
|
||||
|
||||
public:
|
||||
// todo: make this a member variable as prep for multiple views
|
||||
static nsRefPtr<mozilla::layers::APZCTreeManager> sAPZC;
|
||||
|
||||
private:
|
||||
APZPendingResponseFlusher* mFlusher;
|
||||
};
|
||||
|
||||
} } }
|
||||
@@ -1,458 +0,0 @@
|
||||
|
||||
/* this file contains the definitions for DisplayInformation related interfaces
|
||||
copied over from Windows.Graphics.Display.h file in the windows 8.1 SDK
|
||||
This file can be deleted once our build system moves to 8.1. */
|
||||
|
||||
/* File created by MIDL compiler version 8.00.0603 */
|
||||
/* @@MIDL_FILE_HEADING( ) */
|
||||
|
||||
/* Forward Declarations */
|
||||
|
||||
#ifndef ____FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable_FWD_DEFINED__
|
||||
#define ____FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable_FWD_DEFINED__
|
||||
typedef interface __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable;
|
||||
|
||||
#endif /* ____FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef ____x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformationStatics_FWD_DEFINED__
|
||||
#define ____x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformationStatics_FWD_DEFINED__
|
||||
typedef interface __x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformationStatics __x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformationStatics;
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace ABI {
|
||||
namespace Windows {
|
||||
namespace Graphics {
|
||||
namespace Display {
|
||||
interface IDisplayInformationStatics;
|
||||
} /* end namespace */
|
||||
} /* end namespace */
|
||||
} /* end namespace */
|
||||
} /* end namespace */
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* ____x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformationStatics_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef ____x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformation_FWD_DEFINED__
|
||||
#define ____x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformation_FWD_DEFINED__
|
||||
typedef interface __x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformation __x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformation;
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace ABI {
|
||||
namespace Windows {
|
||||
namespace Graphics {
|
||||
namespace Display {
|
||||
interface IDisplayInformation;
|
||||
} /* end namespace */
|
||||
} /* end namespace */
|
||||
} /* end namespace */
|
||||
} /* end namespace */
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* ____x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformation_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace ABI {
|
||||
namespace Windows {
|
||||
namespace Graphics {
|
||||
namespace Display {
|
||||
class DisplayInformation;
|
||||
} /*Display*/
|
||||
} /*Graphics*/
|
||||
} /*Windows*/
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace ABI {
|
||||
namespace Windows {
|
||||
namespace Graphics {
|
||||
namespace Display {
|
||||
interface IDisplayInformation;
|
||||
} /*Display*/
|
||||
} /*Graphics*/
|
||||
} /*Windows*/
|
||||
}
|
||||
#endif
|
||||
|
||||
interface IInspectable;
|
||||
|
||||
|
||||
/* interface __MIDL_itf_windows2Egraphics2Edisplay_0000_0000 */
|
||||
/* [local] */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_windows2Egraphics2Edisplay_0000_0000_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_windows2Egraphics2Edisplay_0000_0000_v0_0_s_ifspec;
|
||||
|
||||
/* interface __MIDL_itf_windows2Egraphics2Edisplay_0000_0580 */
|
||||
|
||||
|
||||
|
||||
|
||||
/* interface __MIDL_itf_windows2Egraphics2Edisplay_0000_0580 */
|
||||
|
||||
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_windows2Egraphics2Edisplay_0000_0580_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_windows2Egraphics2Edisplay_0000_0580_v0_0_s_ifspec;
|
||||
|
||||
/* interface __MIDL_itf_windows2Egraphics2Edisplay_0000_0001 */
|
||||
/* [local] */
|
||||
|
||||
#ifndef DEF___FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable_USE
|
||||
#define DEF___FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable_USE
|
||||
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
|
||||
namespace ABI { namespace Windows { namespace Foundation {
|
||||
template <>
|
||||
struct __declspec(uuid("86c4f619-67b6-51c7-b30d-d8cf13625327"))
|
||||
ITypedEventHandler<ABI::Windows::Graphics::Display::DisplayInformation*,IInspectable*> : ITypedEventHandler_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::Graphics::Display::DisplayInformation*, ABI::Windows::Graphics::Display::IDisplayInformation*>,IInspectable*> {
|
||||
static const wchar_t* z_get_rc_name_impl() {
|
||||
return L"Windows.Foundation.TypedEventHandler`2<Windows.Graphics.Display.DisplayInformation, Object>"; }
|
||||
};
|
||||
typedef ITypedEventHandler<ABI::Windows::Graphics::Display::DisplayInformation*,IInspectable*> __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable_t;
|
||||
#define ____FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable_FWD_DEFINED__
|
||||
#define __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable ABI::Windows::Foundation::__FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable_t
|
||||
|
||||
/* ABI */ } /* Windows */ } /* Foundation */ }
|
||||
#endif //__cplusplus
|
||||
#endif /* DEF___FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable_USE */
|
||||
|
||||
#ifndef DEF___FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable
|
||||
#define DEF___FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable
|
||||
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
|
||||
|
||||
|
||||
/* interface __MIDL_itf_windows2Egraphics2Edisplay_0000_0004 */
|
||||
/* [local] */
|
||||
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_windows2Egraphics2Edisplay_0000_0004_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_windows2Egraphics2Edisplay_0000_0004_v0_0_s_ifspec;
|
||||
|
||||
#ifndef ____FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable_INTERFACE_DEFINED__
|
||||
#define ____FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable_INTERFACE_DEFINED__
|
||||
|
||||
/* interface __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable */
|
||||
/* [unique][uuid][object] */
|
||||
|
||||
|
||||
|
||||
/* interface __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable */
|
||||
/* [unique][uuid][object] */
|
||||
|
||||
|
||||
EXTERN_C const IID IID___FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
|
||||
MIDL_INTERFACE("86c4f619-67b6-51c7-b30d-d8cf13625327")
|
||||
__FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable : public IUnknown
|
||||
{
|
||||
public:
|
||||
virtual HRESULT STDMETHODCALLTYPE Invoke(
|
||||
/* [in] */ __RPC__in_opt ABI::Windows::Graphics::Display::IDisplayInformation *sender,
|
||||
/* [in] */ __RPC__in_opt IInspectable *e) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#else /* C style interface */
|
||||
|
||||
typedef struct __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectableVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
__RPC__in __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable * This,
|
||||
/* [in] */ __RPC__in REFIID riid,
|
||||
/* [annotation][iid_is][out] */
|
||||
_COM_Outptr_ void **ppvObject);
|
||||
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
__RPC__in __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable * This);
|
||||
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
__RPC__in __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable * This);
|
||||
|
||||
HRESULT ( STDMETHODCALLTYPE *Invoke )(
|
||||
__RPC__in __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable * This,
|
||||
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformation *sender,
|
||||
/* [in] */ __RPC__in_opt IInspectable *e);
|
||||
|
||||
END_INTERFACE
|
||||
} __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectableVtbl;
|
||||
|
||||
interface __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable
|
||||
{
|
||||
CONST_VTBL struct __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectableVtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef COBJMACROS
|
||||
|
||||
|
||||
#define __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable_QueryInterface(This,riid,ppvObject) \
|
||||
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
|
||||
|
||||
#define __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable_AddRef(This) \
|
||||
( (This)->lpVtbl -> AddRef(This) )
|
||||
|
||||
#define __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable_Release(This) \
|
||||
( (This)->lpVtbl -> Release(This) )
|
||||
|
||||
|
||||
#define __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable_Invoke(This,sender,e) \
|
||||
( (This)->lpVtbl -> Invoke(This,sender,e) )
|
||||
|
||||
#endif /* COBJMACROS */
|
||||
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* ____FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_windows2Egraphics2Edisplay_0000_0005 */
|
||||
/* [local] */
|
||||
|
||||
#endif /* pinterface */
|
||||
#endif /* DEF___FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_windows2Egraphics2Edisplay_0000_0005 */
|
||||
/* [local] */
|
||||
|
||||
|
||||
/* interface __x_ABI_CWindows_CGraphics_CDisplay_CIDisplayPropertiesEventHandler */
|
||||
/* [uuid][object] */
|
||||
|
||||
|
||||
|
||||
/* interface ABI::Windows::Graphics::Display::IDisplayPropertiesEventHandler */
|
||||
/* [uuid][object] */
|
||||
|
||||
|
||||
|
||||
|
||||
/* interface __MIDL_itf_windows2Egraphics2Edisplay_0000_0006 */
|
||||
/* [local] */
|
||||
|
||||
#if !defined(____x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformationStatics_INTERFACE_DEFINED__)
|
||||
extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_Windows_Graphics_Display_IDisplayInformationStatics[] = L"Windows.Graphics.Display.IDisplayInformationStatics";
|
||||
#endif /* !defined(____x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformationStatics_INTERFACE_DEFINED__) */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_windows2Egraphics2Edisplay_0000_0006 */
|
||||
/* [local] */
|
||||
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_windows2Egraphics2Edisplay_0000_0006_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_windows2Egraphics2Edisplay_0000_0006_v0_0_s_ifspec;
|
||||
|
||||
#ifndef ____x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformationStatics_INTERFACE_DEFINED__
|
||||
#define ____x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformationStatics_INTERFACE_DEFINED__
|
||||
|
||||
/* interface __x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformationStatics */
|
||||
/* [uuid][object] */
|
||||
|
||||
|
||||
|
||||
/* interface ABI::Windows::Graphics::Display::IDisplayInformationStatics */
|
||||
/* [uuid][object] */
|
||||
|
||||
|
||||
EXTERN_C const IID IID___x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformationStatics;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
namespace ABI {
|
||||
namespace Windows {
|
||||
namespace Graphics {
|
||||
namespace Display {
|
||||
|
||||
MIDL_INTERFACE("C6A02A6C-D452-44DC-BA07-96F3C6ADF9D1")
|
||||
IDisplayInformationStatics : public IInspectable
|
||||
{
|
||||
public:
|
||||
virtual HRESULT STDMETHODCALLTYPE GetForCurrentView(
|
||||
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::Graphics::Display::IDisplayInformation **current) = 0;
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AutoRotationPreferences(
|
||||
/* [out][retval] */ __RPC__out ABI::Windows::Graphics::Display::DisplayOrientations *value) = 0;
|
||||
|
||||
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_AutoRotationPreferences(
|
||||
/* [in] */ ABI::Windows::Graphics::Display::DisplayOrientations value) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE add_DisplayContentsInvalidated(
|
||||
/* [in] */ __RPC__in_opt __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable *handler,
|
||||
/* [out][retval] */ __RPC__out EventRegistrationToken *token) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE remove_DisplayContentsInvalidated(
|
||||
/* [in] */ EventRegistrationToken token) = 0;
|
||||
|
||||
};
|
||||
|
||||
extern const __declspec(selectany) IID & IID_IDisplayInformationStatics = __uuidof(IDisplayInformationStatics);
|
||||
|
||||
|
||||
} /* end namespace */
|
||||
} /* end namespace */
|
||||
} /* end namespace */
|
||||
} /* end namespace */
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* ____x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformationStatics_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_windows2Egraphics2Edisplay_0000_0007 */
|
||||
/* [local] */
|
||||
|
||||
#if !defined(____x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformation_INTERFACE_DEFINED__)
|
||||
extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_Windows_Graphics_Display_IDisplayInformation[] = L"Windows.Graphics.Display.IDisplayInformation";
|
||||
#endif /* !defined(____x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformation_INTERFACE_DEFINED__) */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_windows2Egraphics2Edisplay_0000_0007 */
|
||||
/* [local] */
|
||||
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_windows2Egraphics2Edisplay_0000_0007_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_windows2Egraphics2Edisplay_0000_0007_v0_0_s_ifspec;
|
||||
|
||||
#ifndef ____x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformation_INTERFACE_DEFINED__
|
||||
#define ____x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformation_INTERFACE_DEFINED__
|
||||
|
||||
/* interface __x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformation */
|
||||
/* [uuid][object] */
|
||||
|
||||
|
||||
|
||||
/* interface ABI::Windows::Graphics::Display::IDisplayInformation */
|
||||
/* [uuid][object] */
|
||||
|
||||
|
||||
EXTERN_C const IID IID___x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformation;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
namespace ABI {
|
||||
namespace Windows {
|
||||
namespace Graphics {
|
||||
namespace Display {
|
||||
|
||||
MIDL_INTERFACE("BED112AE-ADC3-4DC9-AE65-851F4D7D4799")
|
||||
IDisplayInformation : public IInspectable
|
||||
{
|
||||
public:
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CurrentOrientation(
|
||||
/* [out][retval] */ __RPC__out ABI::Windows::Graphics::Display::DisplayOrientations *value) = 0;
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_NativeOrientation(
|
||||
/* [out][retval] */ __RPC__out ABI::Windows::Graphics::Display::DisplayOrientations *value) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE add_OrientationChanged(
|
||||
/* [in] */ __RPC__in_opt __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable *handler,
|
||||
/* [out][retval] */ __RPC__out EventRegistrationToken *token) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE remove_OrientationChanged(
|
||||
/* [in] */ EventRegistrationToken token) = 0;
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ResolutionScale(
|
||||
/* [out][retval] */ __RPC__out ABI::Windows::Graphics::Display::ResolutionScale *value) = 0;
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LogicalDpi(
|
||||
/* [out][retval] */ __RPC__out FLOAT *value) = 0;
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RawDpiX(
|
||||
/* [out][retval] */ __RPC__out FLOAT *value) = 0;
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RawDpiY(
|
||||
/* [out][retval] */ __RPC__out FLOAT *value) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE add_DpiChanged(
|
||||
/* [in] */ __RPC__in_opt __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable *handler,
|
||||
/* [out][retval] */ __RPC__out EventRegistrationToken *token) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE remove_DpiChanged(
|
||||
/* [in] */ EventRegistrationToken token) = 0;
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_StereoEnabled(
|
||||
/* [out][retval] */ __RPC__out boolean *value) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE add_StereoEnabledChanged(
|
||||
/* [in] */ __RPC__in_opt __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable *handler,
|
||||
/* [out][retval] */ __RPC__out EventRegistrationToken *token) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE remove_StereoEnabledChanged(
|
||||
/* [in] */ EventRegistrationToken token) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE GetColorProfileAsync(
|
||||
/* [out][retval] */ __RPC__deref_out_opt __FIAsyncOperation_1_Windows__CStorage__CStreams__CIRandomAccessStream **asyncInfo) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE add_ColorProfileChanged(
|
||||
/* [in] */ __RPC__in_opt __FITypedEventHandler_2_Windows__CGraphics__CDisplay__CDisplayInformation_IInspectable *handler,
|
||||
/* [out][retval] */ __RPC__out EventRegistrationToken *token) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE remove_ColorProfileChanged(
|
||||
/* [in] */ EventRegistrationToken token) = 0;
|
||||
|
||||
};
|
||||
|
||||
extern const __declspec(selectany) IID & IID_IDisplayInformation = __uuidof(IDisplayInformation);
|
||||
|
||||
|
||||
} /* end namespace */
|
||||
} /* end namespace */
|
||||
} /* end namespace */
|
||||
} /* end namespace */
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* ____x_ABI_CWindows_CGraphics_CDisplay_CIDisplayInformation_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_windows2Egraphics2Edisplay_0000_0008 */
|
||||
/* [local] */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_windows2Egraphics2Edisplay_0000_0009 */
|
||||
/* [local] */
|
||||
|
||||
#ifndef RUNTIMECLASS_Windows_Graphics_Display_DisplayInformation_DEFINED
|
||||
#define RUNTIMECLASS_Windows_Graphics_Display_DisplayInformation_DEFINED
|
||||
extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_Windows_Graphics_Display_DisplayInformation[] = L"Windows.Graphics.Display.DisplayInformation";
|
||||
#endif
|
||||
|
||||
|
||||
/* interface __MIDL_itf_windows2Egraphics2Edisplay_0000_0009 */
|
||||
/* [local] */
|
||||
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_windows2Egraphics2Edisplay_0000_0009_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_windows2Egraphics2Edisplay_0000_0009_v0_0_s_ifspec;
|
||||
|
||||
/* Additional Prototypes for ALL interfaces */
|
||||
|
||||
/* end of Additional Prototypes */
|
||||
@@ -1,507 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "FrameworkView.h"
|
||||
#include "MetroAppShell.h"
|
||||
#include "MetroWidget.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "MetroUtils.h"
|
||||
#include "MetroApp.h"
|
||||
#include "UIABridgePublic.h"
|
||||
#include "KeyboardLayout.h"
|
||||
|
||||
// generated
|
||||
#include "UIABridge.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::widget::winrt;
|
||||
#ifdef ACCESSIBILITY
|
||||
using namespace mozilla::a11y;
|
||||
#endif
|
||||
using namespace ABI::Windows::ApplicationModel;
|
||||
using namespace ABI::Windows::ApplicationModel::Core;
|
||||
using namespace ABI::Windows::ApplicationModel::Activation;
|
||||
using namespace ABI::Windows::UI::Core;
|
||||
using namespace ABI::Windows::UI::ViewManagement;
|
||||
using namespace ABI::Windows::UI::Input;
|
||||
using namespace ABI::Windows::Devices::Input;
|
||||
using namespace ABI::Windows::System;
|
||||
using namespace ABI::Windows::Foundation;
|
||||
using namespace Microsoft::WRL;
|
||||
using namespace Microsoft::WRL::Wrappers;
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
namespace winrt {
|
||||
|
||||
// statics
|
||||
bool FrameworkView::sKeyboardIsVisible = false;
|
||||
Rect FrameworkView::sKeyboardRect;
|
||||
HSTRING FrameworkView::sActivationURI = NULL;
|
||||
ApplicationExecutionState FrameworkView::sPreviousExecutionState;
|
||||
nsTArray<nsString>* sSettingsArray;
|
||||
|
||||
FrameworkView::FrameworkView(MetroApp* aMetroApp) :
|
||||
mDPI(-1.0f),
|
||||
mWidget(nullptr),
|
||||
mShuttingDown(false),
|
||||
mMetroApp(aMetroApp),
|
||||
mWindow(nullptr),
|
||||
mMetroInput(nullptr),
|
||||
mWinVisible(false),
|
||||
mWinActiveState(false)
|
||||
{
|
||||
mActivated.value = 0;
|
||||
mWindowActivated.value = 0;
|
||||
mWindowVisibilityChanged.value = 0;
|
||||
mWindowSizeChanged.value = 0;
|
||||
mSoftKeyboardHidden.value = 0;
|
||||
mSoftKeyboardShown.value = 0;
|
||||
mDisplayPropertiesChanged.value = 0;
|
||||
mAutomationProviderRequested.value = 0;
|
||||
mDataTransferRequested.value = 0;
|
||||
mSearchQuerySubmitted.value = 0;
|
||||
mPlayToRequested.value = 0;
|
||||
mSettingsPane.value = 0;
|
||||
mPrintManager.value = 0;
|
||||
memset(&sKeyboardRect, 0, sizeof(Rect));
|
||||
sSettingsArray = new nsTArray<nsString>();
|
||||
LogFunction();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// IFrameworkView impl.
|
||||
|
||||
HRESULT
|
||||
FrameworkView::Initialize(ICoreApplicationView* aAppView)
|
||||
{
|
||||
LogFunction();
|
||||
if (mShuttingDown)
|
||||
return E_FAIL;
|
||||
|
||||
aAppView->add_Activated(Callback<__FITypedEventHandler_2_Windows__CApplicationModel__CCore__CCoreApplicationView_Windows__CApplicationModel__CActivation__CIActivatedEventArgs_t>(
|
||||
this, &FrameworkView::OnActivated).Get(), &mActivated);
|
||||
|
||||
//CoCreateInstance(CLSID_WICImagingFactory, nullptr,
|
||||
// CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&mWicFactory));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::Uninitialize()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::Load(HSTRING aEntryPoint)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// called by winrt on startup
|
||||
HRESULT
|
||||
FrameworkView::Run()
|
||||
{
|
||||
LogFunction();
|
||||
|
||||
// Initialize XPCOM, create mWidget and go! We get a
|
||||
// callback in MetroAppShell::Run, in which we kick
|
||||
// off normal browser execution / event dispatching.
|
||||
mMetroApp->Run();
|
||||
|
||||
// Goanna is completely shut down at this point.
|
||||
WinUtils::Log("Exiting FrameworkView::Run()");
|
||||
|
||||
WindowsDeleteString(sActivationURI);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::ActivateView()
|
||||
{
|
||||
LogFunction();
|
||||
|
||||
UpdateWidgetSizeAndPosition();
|
||||
|
||||
nsIntRegion region(nsIntRect(0, 0, mWindowBounds.width, mWindowBounds.height));
|
||||
mWidget->Paint(region);
|
||||
|
||||
// Activate the window, this kills the splash screen
|
||||
mWindow->Activate();
|
||||
|
||||
ProcessLaunchArguments();
|
||||
AddEventHandlers();
|
||||
SetupContracts();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::SetWindow(ICoreWindow* aWindow)
|
||||
{
|
||||
LogFunction();
|
||||
|
||||
NS_ASSERTION(!mWindow, "Attempting to set a window on a view that already has a window!");
|
||||
NS_ASSERTION(aWindow, "Attempting to set a null window on a view!");
|
||||
|
||||
mWindow = aWindow;
|
||||
UpdateLogicalDPI();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// FrameworkView impl.
|
||||
|
||||
void
|
||||
FrameworkView::AddEventHandlers() {
|
||||
NS_ASSERTION(mWindow, "SetWindow must be called before AddEventHandlers!");
|
||||
NS_ASSERTION(mWidget, "SetWidget must be called before AddEventHAndlers!");
|
||||
|
||||
mMetroInput = Make<MetroInput>(mWidget.Get(),
|
||||
mWindow.Get());
|
||||
|
||||
mWindow->add_VisibilityChanged(Callback<__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CVisibilityChangedEventArgs>(
|
||||
this, &FrameworkView::OnWindowVisibilityChanged).Get(), &mWindowVisibilityChanged);
|
||||
mWindow->add_Activated(Callback<__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CWindowActivatedEventArgs_t>(
|
||||
this, &FrameworkView::OnWindowActivated).Get(), &mWindowActivated);
|
||||
mWindow->add_SizeChanged(Callback<__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CWindowSizeChangedEventArgs_t>(
|
||||
this, &FrameworkView::OnWindowSizeChanged).Get(), &mWindowSizeChanged);
|
||||
|
||||
mWindow->add_AutomationProviderRequested(Callback<__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CAutomationProviderRequestedEventArgs_t>(
|
||||
this, &FrameworkView::OnAutomationProviderRequested).Get(), &mAutomationProviderRequested);
|
||||
|
||||
HRESULT hr;
|
||||
ComPtr<ABI::Windows::Graphics::Display::IDisplayPropertiesStatics> dispProps;
|
||||
if (SUCCEEDED(GetActivationFactory(HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayProperties).Get(), dispProps.GetAddressOf()))) {
|
||||
hr = dispProps->add_LogicalDpiChanged(Callback<ABI::Windows::Graphics::Display::IDisplayPropertiesEventHandler, FrameworkView>(
|
||||
this, &FrameworkView::OnLogicalDpiChanged).Get(), &mDisplayPropertiesChanged);
|
||||
LogHRESULT(hr);
|
||||
}
|
||||
|
||||
ComPtr<ABI::Windows::UI::ViewManagement::IInputPaneStatics> inputStatic;
|
||||
if (SUCCEEDED(hr = GetActivationFactory(HStringReference(RuntimeClass_Windows_UI_ViewManagement_InputPane).Get(), inputStatic.GetAddressOf()))) {
|
||||
ComPtr<ABI::Windows::UI::ViewManagement::IInputPane> inputPane;
|
||||
if (SUCCEEDED(inputStatic->GetForCurrentView(inputPane.GetAddressOf()))) {
|
||||
inputPane->add_Hiding(Callback<__FITypedEventHandler_2_Windows__CUI__CViewManagement__CInputPane_Windows__CUI__CViewManagement__CInputPaneVisibilityEventArgs_t>(
|
||||
this, &FrameworkView::OnSoftkeyboardHidden).Get(), &mSoftKeyboardHidden);
|
||||
inputPane->add_Showing(Callback<__FITypedEventHandler_2_Windows__CUI__CViewManagement__CInputPane_Windows__CUI__CViewManagement__CInputPaneVisibilityEventArgs_t>(
|
||||
this, &FrameworkView::OnSoftkeyboardShown).Get(), &mSoftKeyboardShown);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called by MetroApp
|
||||
void
|
||||
FrameworkView::Shutdown()
|
||||
{
|
||||
LogFunction();
|
||||
mShuttingDown = true;
|
||||
|
||||
if (mWindow && mWindowVisibilityChanged.value) {
|
||||
mWindow->remove_VisibilityChanged(mWindowVisibilityChanged);
|
||||
mWindow->remove_Activated(mWindowActivated);
|
||||
mWindow->remove_Closed(mWindowClosed);
|
||||
mWindow->remove_SizeChanged(mWindowSizeChanged);
|
||||
mWindow->remove_AutomationProviderRequested(mAutomationProviderRequested);
|
||||
}
|
||||
|
||||
ComPtr<ABI::Windows::Graphics::Display::IDisplayPropertiesStatics> dispProps;
|
||||
if (mDisplayPropertiesChanged.value &&
|
||||
SUCCEEDED(GetActivationFactory(HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayProperties).Get(), dispProps.GetAddressOf()))) {
|
||||
dispProps->remove_LogicalDpiChanged(mDisplayPropertiesChanged);
|
||||
}
|
||||
|
||||
ComPtr<ABI::Windows::UI::ViewManagement::IInputPaneStatics> inputStatic;
|
||||
if (mSoftKeyboardHidden.value &&
|
||||
SUCCEEDED(GetActivationFactory(HStringReference(RuntimeClass_Windows_UI_ViewManagement_InputPane).Get(), inputStatic.GetAddressOf()))) {
|
||||
ComPtr<ABI::Windows::UI::ViewManagement::IInputPane> inputPane;
|
||||
if (SUCCEEDED(inputStatic->GetForCurrentView(inputPane.GetAddressOf()))) {
|
||||
inputPane->remove_Hiding(mSoftKeyboardHidden);
|
||||
inputPane->remove_Showing(mSoftKeyboardShown);
|
||||
}
|
||||
}
|
||||
|
||||
if (mAutomationProvider) {
|
||||
ComPtr<IUIABridge> provider;
|
||||
mAutomationProvider.As(&provider);
|
||||
if (provider) {
|
||||
provider->Disconnect();
|
||||
}
|
||||
}
|
||||
mAutomationProvider = nullptr;
|
||||
|
||||
mMetroInput = nullptr;
|
||||
delete sSettingsArray;
|
||||
sSettingsArray = nullptr;
|
||||
mWidget = nullptr;
|
||||
mMetroApp = nullptr;
|
||||
mWindow = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
FrameworkView::SetCursor(CoreCursorType aCursorType, DWORD aCustomId)
|
||||
{
|
||||
if (mShuttingDown) {
|
||||
return;
|
||||
}
|
||||
NS_ASSERTION(mWindow, "SetWindow must be called before SetCursor!");
|
||||
ComPtr<ABI::Windows::UI::Core::ICoreCursorFactory> factory;
|
||||
AssertHRESULT(GetActivationFactory(HStringReference(RuntimeClass_Windows_UI_Core_CoreCursor).Get(), factory.GetAddressOf()));
|
||||
ComPtr<ABI::Windows::UI::Core::ICoreCursor> cursor;
|
||||
AssertHRESULT(factory->CreateCursor(aCursorType, aCustomId, cursor.GetAddressOf()));
|
||||
mWindow->put_PointerCursor(cursor.Get());
|
||||
}
|
||||
|
||||
void
|
||||
FrameworkView::ClearCursor()
|
||||
{
|
||||
if (mShuttingDown) {
|
||||
return;
|
||||
}
|
||||
NS_ASSERTION(mWindow, "SetWindow must be called before ClearCursor!");
|
||||
mWindow->put_PointerCursor(nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
FrameworkView::UpdateLogicalDPI()
|
||||
{
|
||||
ComPtr<ABI::Windows::Graphics::Display::IDisplayPropertiesStatics> dispProps;
|
||||
HRESULT hr = GetActivationFactory(HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayProperties).Get(),
|
||||
dispProps.GetAddressOf());
|
||||
AssertHRESULT(hr);
|
||||
FLOAT value;
|
||||
AssertHRESULT(dispProps->get_LogicalDpi(&value));
|
||||
SetDpi(value);
|
||||
}
|
||||
|
||||
void
|
||||
FrameworkView::GetBounds(nsIntRect &aRect)
|
||||
{
|
||||
// May be called by compositor thread
|
||||
if (mShuttingDown) {
|
||||
return;
|
||||
}
|
||||
aRect = mWindowBounds;
|
||||
}
|
||||
|
||||
void
|
||||
FrameworkView::UpdateWidgetSizeAndPosition()
|
||||
{
|
||||
if (mShuttingDown)
|
||||
return;
|
||||
|
||||
NS_ASSERTION(mWindow, "SetWindow must be called before UpdateWidgetSizeAndPosition!");
|
||||
NS_ASSERTION(mWidget, "SetWidget must be called before UpdateWidgetSizeAndPosition!");
|
||||
|
||||
UpdateBounds();
|
||||
mWidget->Move(0, 0);
|
||||
mWidget->Resize(0, 0, mWindowBounds.width, mWindowBounds.height, true);
|
||||
mWidget->SizeModeChanged();
|
||||
}
|
||||
|
||||
bool
|
||||
FrameworkView::IsEnabled() const
|
||||
{
|
||||
return mWinActiveState;
|
||||
}
|
||||
|
||||
bool
|
||||
FrameworkView::IsVisible() const
|
||||
{
|
||||
// we could check the wnd in MetroWidget for this, but
|
||||
// generally we don't let nsIWidget control visibility
|
||||
// or activation.
|
||||
return mWinVisible;
|
||||
}
|
||||
|
||||
void FrameworkView::SetDpi(float aDpi)
|
||||
{
|
||||
if (aDpi != mDPI) {
|
||||
LogFunction();
|
||||
|
||||
mDPI = aDpi;
|
||||
|
||||
// notify the widget that dpi has changed
|
||||
if (mWidget) {
|
||||
mWidget->ChangedDPI();
|
||||
UpdateBounds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FrameworkView::UpdateBounds()
|
||||
{
|
||||
if (!mWidget)
|
||||
return;
|
||||
|
||||
RECT winRect;
|
||||
GetClientRect(mWidget->GetICoreWindowHWND(), &winRect);
|
||||
|
||||
mWindowBounds = nsIntRect(winRect.left,
|
||||
winRect.top,
|
||||
winRect.right - winRect.left,
|
||||
winRect.bottom - winRect.top);
|
||||
}
|
||||
|
||||
void
|
||||
FrameworkView::SetWidget(MetroWidget* aWidget)
|
||||
{
|
||||
NS_ASSERTION(!mWidget, "Attempting to set a widget for a view that already has a widget!");
|
||||
NS_ASSERTION(aWidget, "Attempting to set a null widget for a view!");
|
||||
LogFunction();
|
||||
mWidget = aWidget;
|
||||
mWidget->FindMetroWindow();
|
||||
UpdateBounds();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// Event handlers
|
||||
|
||||
void
|
||||
FrameworkView::SendActivationEvent()
|
||||
{
|
||||
if (mShuttingDown) {
|
||||
return;
|
||||
}
|
||||
NS_ASSERTION(mWindow, "SetWindow must be called before SendActivationEvent!");
|
||||
mWidget->Activated(mWinActiveState);
|
||||
if (mWinActiveState) {
|
||||
UpdateWidgetSizeAndPosition();
|
||||
}
|
||||
EnsureAutomationProviderCreated();
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::OnWindowVisibilityChanged(ICoreWindow* aWindow,
|
||||
IVisibilityChangedEventArgs* aArgs)
|
||||
{
|
||||
// If we're visible, or we can't determine if we're visible, just store
|
||||
// that we are visible.
|
||||
boolean visible;
|
||||
mWinVisible = FAILED(aArgs->get_Visible(&visible)) || visible;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::OnActivated(ICoreApplicationView* aApplicationView,
|
||||
IActivatedEventArgs* aArgs)
|
||||
{
|
||||
LogFunction();
|
||||
|
||||
if (mShuttingDown) {
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
aArgs->get_PreviousExecutionState(&sPreviousExecutionState);
|
||||
bool startup = sPreviousExecutionState == ApplicationExecutionState::ApplicationExecutionState_Terminated ||
|
||||
sPreviousExecutionState == ApplicationExecutionState::ApplicationExecutionState_ClosedByUser ||
|
||||
sPreviousExecutionState == ApplicationExecutionState::ApplicationExecutionState_NotRunning;
|
||||
ProcessActivationArgs(aArgs, startup);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::OnSoftkeyboardHidden(IInputPane* aSender,
|
||||
IInputPaneVisibilityEventArgs* aArgs)
|
||||
{
|
||||
LogFunction();
|
||||
sKeyboardIsVisible = false;
|
||||
memset(&sKeyboardRect, 0, sizeof(Rect));
|
||||
MetroUtils::FireObserver("metro_softkeyboard_hidden");
|
||||
aArgs->put_EnsuredFocusedElementInView(true);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::OnSoftkeyboardShown(IInputPane* aSender,
|
||||
IInputPaneVisibilityEventArgs* aArgs)
|
||||
{
|
||||
LogFunction();
|
||||
sKeyboardIsVisible = true;
|
||||
aSender->get_OccludedRect(&sKeyboardRect);
|
||||
MetroUtils::FireObserver("metro_softkeyboard_shown");
|
||||
aArgs->put_EnsuredFocusedElementInView(true);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::OnWindowSizeChanged(ICoreWindow* aSender, IWindowSizeChangedEventArgs* aArgs)
|
||||
{
|
||||
LogFunction();
|
||||
UpdateWidgetSizeAndPosition();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::OnWindowActivated(ICoreWindow* aSender, IWindowActivatedEventArgs* aArgs)
|
||||
{
|
||||
LogFunction();
|
||||
if (!mWidget) {
|
||||
return S_OK;
|
||||
}
|
||||
CoreWindowActivationState state;
|
||||
aArgs->get_WindowActivationState(&state);
|
||||
mWinActiveState = !(state == CoreWindowActivationState::CoreWindowActivationState_Deactivated);
|
||||
SendActivationEvent();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::OnLogicalDpiChanged(IInspectable* aSender)
|
||||
{
|
||||
LogFunction();
|
||||
UpdateLogicalDPI();
|
||||
if (mWidget) {
|
||||
mWidget->Invalidate();
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
FrameworkView::EnsureAutomationProviderCreated()
|
||||
{
|
||||
#ifdef ACCESSIBILITY
|
||||
if (!mWidget || mShuttingDown)
|
||||
return false;
|
||||
|
||||
if (mAutomationProvider) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Accessible *rootAccessible = mWidget->GetRootAccessible();
|
||||
if (rootAccessible) {
|
||||
IInspectable* inspectable;
|
||||
HRESULT hr;
|
||||
AssertRetHRESULT(hr = UIABridge_CreateInstance(&inspectable), hr); // Addref
|
||||
IUIABridge* bridge = nullptr;
|
||||
inspectable->QueryInterface(IID_IUIABridge, (void**)&bridge); // Addref
|
||||
if (bridge) {
|
||||
bridge->Init(this, mWindow.Get(), (ULONG)rootAccessible);
|
||||
mAutomationProvider = inspectable;
|
||||
inspectable->Release();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::OnAutomationProviderRequested(ICoreWindow* aSender,
|
||||
IAutomationProviderRequestedEventArgs* aArgs)
|
||||
{
|
||||
LogFunction();
|
||||
if (!EnsureAutomationProviderCreated())
|
||||
return E_FAIL;
|
||||
HRESULT hr = aArgs->put_AutomationProvider(mAutomationProvider.Get());
|
||||
if (FAILED(hr)) {
|
||||
WinUtils::Log("put failed? %X", hr);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
} } }
|
||||
@@ -1,205 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "MetroWidget.h"
|
||||
#include "MetroInput.h"
|
||||
#include "gfxWindowsPlatform.h"
|
||||
#include "nsDataHashtable.h"
|
||||
|
||||
#include "mozwrlbase.h"
|
||||
|
||||
#include <windows.system.h>
|
||||
#include <Windows.ApplicationModel.core.h>
|
||||
#include <Windows.ApplicationModel.h>
|
||||
#include <Windows.Applicationmodel.Activation.h>
|
||||
#include <Windows.ApplicationModel.search.h>
|
||||
#include <windows.ui.core.h>
|
||||
#include <windows.ui.viewmanagement.h>
|
||||
#include <windows.ui.applicationsettings.h>
|
||||
#include <windows.ui.popups.h>
|
||||
#include <windows.graphics.printing.h>
|
||||
#include <windows.graphics.display.h>
|
||||
#include <windows.media.playto.h>
|
||||
#include <d2d1_1.h>
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
namespace winrt {
|
||||
|
||||
class MetroApp;
|
||||
|
||||
class FrameworkView : public Microsoft::WRL::RuntimeClass<ABI::Windows::ApplicationModel::Core::IFrameworkView>
|
||||
{
|
||||
InspectableClass(L"FrameworkView", TrustLevel::BaseTrust)
|
||||
|
||||
typedef mozilla::layers::LayerManager LayerManager;
|
||||
|
||||
typedef ABI::Windows::Foundation::Rect Rect;
|
||||
typedef ABI::Windows::UI::Core::IWindowSizeChangedEventArgs IWindowSizeChangedEventArgs;
|
||||
typedef ABI::Windows::UI::Core::ICoreWindowEventArgs ICoreWindowEventArgs;
|
||||
typedef ABI::Windows::UI::Core::IWindowActivatedEventArgs IWindowActivatedEventArgs;
|
||||
typedef ABI::Windows::UI::Core::IAutomationProviderRequestedEventArgs IAutomationProviderRequestedEventArgs;
|
||||
typedef ABI::Windows::UI::Core::ICoreWindow ICoreWindow;
|
||||
typedef ABI::Windows::UI::Core::ICoreDispatcher ICoreDispatcher;
|
||||
typedef ABI::Windows::UI::Core::IVisibilityChangedEventArgs IVisibilityChangedEventArgs;
|
||||
typedef ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs IInputPaneVisibilityEventArgs;
|
||||
typedef ABI::Windows::UI::ViewManagement::IInputPane IInputPane;
|
||||
typedef ABI::Windows::UI::ViewManagement::ApplicationViewState ApplicationViewState;
|
||||
typedef ABI::Windows::UI::ApplicationSettings::ISettingsPane ISettingsPane;
|
||||
typedef ABI::Windows::UI::ApplicationSettings::ISettingsPaneCommandsRequestedEventArgs ISettingsPaneCommandsRequestedEventArgs;
|
||||
typedef ABI::Windows::UI::Popups::IUICommand IUICommand;
|
||||
typedef ABI::Windows::ApplicationModel::Activation::ILaunchActivatedEventArgs ILaunchActivatedEventArgs;
|
||||
typedef ABI::Windows::ApplicationModel::Activation::IActivatedEventArgs IActivatedEventArgs;
|
||||
typedef ABI::Windows::ApplicationModel::Activation::ISearchActivatedEventArgs ISearchActivatedEventArgs;
|
||||
typedef ABI::Windows::ApplicationModel::Activation::IFileActivatedEventArgs IFileActivatedEventArgs;
|
||||
typedef ABI::Windows::ApplicationModel::Core::ICoreApplicationView ICoreApplicationView;
|
||||
typedef ABI::Windows::ApplicationModel::DataTransfer::IDataTransferManager IDataTransferManager;
|
||||
typedef ABI::Windows::ApplicationModel::DataTransfer::IDataRequestedEventArgs IDataRequestedEventArgs;
|
||||
typedef ABI::Windows::ApplicationModel::Search::ISearchPane ISearchPane;
|
||||
typedef ABI::Windows::ApplicationModel::Search::ISearchPaneQuerySubmittedEventArgs ISearchPaneQuerySubmittedEventArgs;
|
||||
typedef ABI::Windows::Media::PlayTo::IPlayToManager IPlayToManager;
|
||||
typedef ABI::Windows::Media::PlayTo::IPlayToSourceRequestedEventArgs IPlayToSourceRequestedEventArgs;
|
||||
typedef ABI::Windows::Graphics::Printing::IPrintManager IPrintManager;
|
||||
typedef ABI::Windows::Graphics::Printing::IPrintTaskRequestedEventArgs IPrintTaskRequestedEventArgs;
|
||||
typedef ABI::Windows::Graphics::Printing::IPrintTaskSourceRequestedArgs IPrintTaskSourceRequestedArgs;
|
||||
|
||||
public:
|
||||
FrameworkView(MetroApp* aMetroApp);
|
||||
|
||||
// IFrameworkView Methods
|
||||
STDMETHODIMP Initialize(ICoreApplicationView* aAppView);
|
||||
STDMETHODIMP SetWindow(ICoreWindow* aWindow);
|
||||
STDMETHODIMP Load(HSTRING aEntryPoint);
|
||||
STDMETHODIMP Run();
|
||||
STDMETHODIMP Uninitialize();
|
||||
|
||||
HRESULT ActivateView();
|
||||
|
||||
// Public apis for MetroWidget
|
||||
float GetDPI() { return mDPI; }
|
||||
ICoreWindow* GetCoreWindow() { return mWindow.Get(); }
|
||||
void SetWidget(MetroWidget* aWidget);
|
||||
MetroWidget* GetWidget() { return mWidget.Get(); }
|
||||
void GetBounds(nsIntRect &aRect);
|
||||
void SetCursor(ABI::Windows::UI::Core::CoreCursorType aCursorType, DWORD aCustomId = 0);
|
||||
void ClearCursor();
|
||||
bool IsEnabled() const;
|
||||
bool IsVisible() const;
|
||||
|
||||
// Activation apis for nsIWinMetroUtils
|
||||
static int GetPreviousExecutionState() { return sPreviousExecutionState; }
|
||||
static void GetActivationURI(nsAString &aActivationURI) {
|
||||
unsigned int length;
|
||||
aActivationURI = WindowsGetStringRawBuffer(sActivationURI, &length);
|
||||
}
|
||||
|
||||
// Soft keyboard info for nsIWinMetroUtils
|
||||
static bool IsKeyboardVisible() { return sKeyboardIsVisible; }
|
||||
static ABI::Windows::Foundation::Rect KeyboardVisibleRect() { return sKeyboardRect; }
|
||||
|
||||
// MetroApp apis
|
||||
void SetupContracts();
|
||||
void Shutdown();
|
||||
|
||||
// MetroContracts settings panel enumerator entry
|
||||
void AddSetting(ISettingsPaneCommandsRequestedEventArgs* aArgs, uint32_t aId,
|
||||
Microsoft::WRL::Wrappers::HString& aSettingName);
|
||||
protected:
|
||||
// Event Handlers
|
||||
HRESULT OnActivated(ICoreApplicationView* aApplicationView,
|
||||
IActivatedEventArgs* aArgs);
|
||||
HRESULT OnWindowVisibilityChanged(ICoreWindow* aCoreWindow,
|
||||
IVisibilityChangedEventArgs* aArgs);
|
||||
|
||||
HRESULT OnWindowSizeChanged(ICoreWindow* aSender,
|
||||
IWindowSizeChangedEventArgs* aArgs);
|
||||
HRESULT OnWindowActivated(ICoreWindow* aSender,
|
||||
IWindowActivatedEventArgs* aArgs);
|
||||
HRESULT OnLogicalDpiChanged(IInspectable* aSender);
|
||||
|
||||
HRESULT OnAutomationProviderRequested(ICoreWindow* aSender,
|
||||
IAutomationProviderRequestedEventArgs* aArgs);
|
||||
|
||||
HRESULT OnSoftkeyboardHidden(IInputPane* aSender,
|
||||
IInputPaneVisibilityEventArgs* aArgs);
|
||||
HRESULT OnSoftkeyboardShown(IInputPane* aSender,
|
||||
IInputPaneVisibilityEventArgs* aArgs);
|
||||
|
||||
HRESULT OnDataShareRequested(IDataTransferManager*, IDataRequestedEventArgs* aArgs);
|
||||
HRESULT OnSearchQuerySubmitted(ISearchPane* aPane, ISearchPaneQuerySubmittedEventArgs* aArgs);
|
||||
HRESULT OnSettingsCommandsRequested(ISettingsPane* aPane, ISettingsPaneCommandsRequestedEventArgs* aArgs);
|
||||
HRESULT OnPlayToSourceRequested(IPlayToManager* aPane, IPlayToSourceRequestedEventArgs* aArgs);
|
||||
HRESULT OnSettingsCommandInvoked(IUICommand* aCommand);
|
||||
HRESULT OnPrintTaskRequested(IPrintManager* aMgr, IPrintTaskRequestedEventArgs* aArgs);
|
||||
HRESULT OnPrintTaskSourceRequested(IPrintTaskSourceRequestedArgs* aArgs);
|
||||
|
||||
protected:
|
||||
void SetDpi(float aDpi);
|
||||
void UpdateWidgetSizeAndPosition();
|
||||
void PerformURILoad(Microsoft::WRL::Wrappers::HString& aString);
|
||||
void PerformSearch(Microsoft::WRL::Wrappers::HString& aQuery);
|
||||
void PerformURILoadOrSearch(Microsoft::WRL::Wrappers::HString& aString);
|
||||
bool EnsureAutomationProviderCreated();
|
||||
void SearchActivated(Microsoft::WRL::ComPtr<ISearchActivatedEventArgs>& aArgs, bool aStartup);
|
||||
void FileActivated(Microsoft::WRL::ComPtr<IFileActivatedEventArgs>& aArgs, bool aStartup);
|
||||
void LaunchActivated(Microsoft::WRL::ComPtr<ILaunchActivatedEventArgs>& aArgs, bool aStartup);
|
||||
void ProcessActivationArgs(IActivatedEventArgs* aArgs, bool aStartup);
|
||||
void UpdateForWindowSizeChange();
|
||||
void SendActivationEvent();
|
||||
void UpdateLogicalDPI();
|
||||
void FireViewStateObservers();
|
||||
void ProcessLaunchArguments();
|
||||
void UpdateBounds();
|
||||
|
||||
// Printing and preview
|
||||
void CreatePrintControl(IPrintDocumentPackageTarget* aDocPackageTarget,
|
||||
D2D1_PRINT_CONTROL_PROPERTIES* aPrintControlProperties);
|
||||
HRESULT ClosePrintControl();
|
||||
void PrintPage(uint32_t aPageNumber, D2D1_RECT_F aImageableArea,
|
||||
D2D1_SIZE_F aPageSize, IStream* aPagePrintTicketStream);
|
||||
void AddEventHandlers();
|
||||
|
||||
private:
|
||||
EventRegistrationToken mActivated;
|
||||
EventRegistrationToken mWindowActivated;
|
||||
EventRegistrationToken mWindowVisibilityChanged;
|
||||
EventRegistrationToken mWindowClosed;
|
||||
EventRegistrationToken mWindowSizeChanged;
|
||||
EventRegistrationToken mSoftKeyboardHidden;
|
||||
EventRegistrationToken mSoftKeyboardShown;
|
||||
EventRegistrationToken mDisplayPropertiesChanged;
|
||||
EventRegistrationToken mAutomationProviderRequested;
|
||||
EventRegistrationToken mDataTransferRequested;
|
||||
EventRegistrationToken mSearchQuerySubmitted;
|
||||
EventRegistrationToken mPlayToRequested;
|
||||
EventRegistrationToken mSettingsPane;
|
||||
EventRegistrationToken mPrintManager;
|
||||
|
||||
private:
|
||||
nsIntRect mWindowBounds; // in device-pixel coordinates
|
||||
float mDPI;
|
||||
bool mShuttingDown;
|
||||
nsAutoString mActivationCommandLine;
|
||||
Microsoft::WRL::ComPtr<IInspectable> mAutomationProvider;
|
||||
//Microsoft::WRL::ComPtr<ID2D1PrintControl> mD2DPrintControl;
|
||||
// Private critical section protects D2D device context for on-screen
|
||||
// rendering from that for print/preview in the different thread.
|
||||
//Microsoft::WRL::ComPtr<IWICImagingFactory2> mWicFactory;
|
||||
Microsoft::WRL::ComPtr<MetroApp> mMetroApp;
|
||||
Microsoft::WRL::ComPtr<ICoreWindow> mWindow;
|
||||
Microsoft::WRL::ComPtr<MetroWidget> mWidget;
|
||||
Microsoft::WRL::ComPtr<MetroInput> mMetroInput;
|
||||
bool mWinVisible;
|
||||
bool mWinActiveState;
|
||||
|
||||
static bool sKeyboardIsVisible;
|
||||
static Rect sKeyboardRect;
|
||||
static HSTRING sActivationURI;
|
||||
static ABI::Windows::ApplicationModel::Activation::ApplicationExecutionState sPreviousExecutionState;
|
||||
};
|
||||
|
||||
} } }
|
||||
@@ -1,19 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MIDL_GENERATED_FILES = \
|
||||
UIABridge_i.c \
|
||||
UIABridge_p.c \
|
||||
dlldata.c \
|
||||
$(NULL)
|
||||
|
||||
GARBAGE += $(MIDL_GENERATED_FILES) done_gen
|
||||
|
||||
do_interfaces_gen: UIABridge.idl
|
||||
$(MIDL) $(srcdir)/UIABridge.idl -I $(srcdir)
|
||||
touch $@
|
||||
|
||||
export:: do_interfaces_gen
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
@@ -1,282 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "MetroApp.h"
|
||||
#include "MetroWidget.h"
|
||||
#include "mozilla/IOInterposer.h"
|
||||
#include "mozilla/widget/AudioSession.h"
|
||||
#include "nsIRunnable.h"
|
||||
#include "MetroUtils.h"
|
||||
#include "MetroAppShell.h"
|
||||
#include "nsICommandLineRunner.h"
|
||||
#include "FrameworkView.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "GoannaProfiler.h"
|
||||
#include <shellapi.h>
|
||||
|
||||
using namespace ABI::Windows::ApplicationModel;
|
||||
using namespace ABI::Windows::ApplicationModel::Core;
|
||||
using namespace ABI::Windows::UI::Core;
|
||||
using namespace ABI::Windows::System;
|
||||
using namespace ABI::Windows::Foundation;
|
||||
using namespace Microsoft::WRL;
|
||||
using namespace Microsoft::WRL::Wrappers;
|
||||
using namespace mozilla::widget;
|
||||
|
||||
// Metro specific XRE methods we call from here on an
|
||||
// appropriate thread.
|
||||
extern nsresult XRE_metroStartup(bool runXREMain);
|
||||
extern void XRE_metroShutdown();
|
||||
|
||||
static const char* gGoannaThreadName = "GoannaMain";
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
extern PRLogModuleInfo* gWindowsLog;
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
namespace winrt {
|
||||
|
||||
ComPtr<FrameworkView> sFrameworkView;
|
||||
ComPtr<MetroApp> sMetroApp;
|
||||
ComPtr<ICoreApplication> sCoreApp;
|
||||
bool MetroApp::sGoannaShuttingDown = false;
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// IFrameworkViewSource impl.
|
||||
|
||||
// Called after CoreApplication::Run(app)
|
||||
HRESULT
|
||||
MetroApp::CreateView(ABI::Windows::ApplicationModel::Core::IFrameworkView **aViewProvider)
|
||||
{
|
||||
// This entry point is called on the metro main thread, but the thread won't
|
||||
// be recognized as such until after Run() is called below. XPCOM has not
|
||||
// gone through startup at this point.
|
||||
|
||||
// Note that we create the view which creates our native window for us. The
|
||||
// goanna widget gets created by goanna, and the two get hooked up later in
|
||||
// MetroWidget::Create().
|
||||
|
||||
LogFunction();
|
||||
|
||||
sFrameworkView = Make<FrameworkView>(this);
|
||||
sFrameworkView.Get()->AddRef();
|
||||
*aViewProvider = sFrameworkView.Get();
|
||||
return !sFrameworkView ? E_FAIL : S_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// MetroApp impl.
|
||||
|
||||
void
|
||||
MetroApp::Run()
|
||||
{
|
||||
LogThread();
|
||||
|
||||
// Name this thread for debugging and register it with the profiler
|
||||
// and IOInterposer as the main goanna thread.
|
||||
char aLocal;
|
||||
PR_SetCurrentThreadName(gGoannaThreadName);
|
||||
profiler_register_thread(gGoannaThreadName, &aLocal);
|
||||
IOInterposer::RegisterCurrentThread(true);
|
||||
|
||||
HRESULT hr;
|
||||
hr = sCoreApp->add_Suspending(Callback<__FIEventHandler_1_Windows__CApplicationModel__CSuspendingEventArgs_t>(
|
||||
this, &MetroApp::OnSuspending).Get(), &mSuspendEvent);
|
||||
AssertHRESULT(hr);
|
||||
|
||||
hr = sCoreApp->add_Resuming(Callback<__FIEventHandler_1_IInspectable_t>(
|
||||
this, &MetroApp::OnResuming).Get(), &mResumeEvent);
|
||||
AssertHRESULT(hr);
|
||||
|
||||
WinUtils::Log("Calling XRE_metroStartup.");
|
||||
nsresult rv = XRE_metroStartup(true);
|
||||
WinUtils::Log("Exiting XRE_metroStartup.");
|
||||
if (NS_FAILED(rv)) {
|
||||
WinUtils::Log("XPCOM startup initialization failed, bailing. rv=%X", rv);
|
||||
CoreExit();
|
||||
}
|
||||
}
|
||||
|
||||
// Free all xpcom related resources before calling the xre shutdown call.
|
||||
// Must be called on the metro main thread. Currently called from appshell.
|
||||
void
|
||||
MetroApp::Shutdown()
|
||||
{
|
||||
LogThread();
|
||||
|
||||
if (sCoreApp) {
|
||||
sCoreApp->remove_Suspending(mSuspendEvent);
|
||||
sCoreApp->remove_Resuming(mResumeEvent);
|
||||
}
|
||||
|
||||
if (sFrameworkView) {
|
||||
sFrameworkView->Shutdown();
|
||||
}
|
||||
|
||||
MetroApp::sGoannaShuttingDown = true;
|
||||
|
||||
// Shut down xpcom
|
||||
XRE_metroShutdown();
|
||||
|
||||
// Unhook this thread from the profiler
|
||||
profiler_unregister_thread();
|
||||
}
|
||||
|
||||
// Request a shutdown of the application
|
||||
void
|
||||
MetroApp::CoreExit()
|
||||
{
|
||||
LogFunction();
|
||||
HRESULT hr;
|
||||
ComPtr<ICoreApplicationExit> coreExit;
|
||||
HStringReference className(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication);
|
||||
hr = GetActivationFactory(className.Get(), coreExit.GetAddressOf());
|
||||
NS_ASSERTION(SUCCEEDED(hr), "Activation of ICoreApplicationExit");
|
||||
if (SUCCEEDED(hr)) {
|
||||
coreExit->Exit();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MetroApp::ActivateBaseView()
|
||||
{
|
||||
if (sFrameworkView) {
|
||||
sFrameworkView->ActivateView();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* TBD: when we support multiple widgets, we'll need a way to sync up the view
|
||||
* created in CreateView with the widget goanna creates. Currently we only have
|
||||
* one view (sFrameworkView) and one main widget.
|
||||
*/
|
||||
void
|
||||
MetroApp::SetWidget(MetroWidget* aPtr)
|
||||
{
|
||||
LogThread();
|
||||
|
||||
NS_ASSERTION(aPtr, "setting null base widget?");
|
||||
|
||||
// Both of these calls AddRef the ptr we pass in
|
||||
aPtr->SetView(sFrameworkView.Get());
|
||||
sFrameworkView->SetWidget(aPtr);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// MetroApp events
|
||||
|
||||
HRESULT
|
||||
MetroApp::OnSuspending(IInspectable* aSender, ISuspendingEventArgs* aArgs)
|
||||
{
|
||||
LogThread();
|
||||
PostSuspendResumeProcessNotification(true);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
MetroApp::OnResuming(IInspectable* aSender, IInspectable* aArgs)
|
||||
{
|
||||
LogThread();
|
||||
PostSuspendResumeProcessNotification(false);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
MetroApp::OnAsyncTileCreated(ABI::Windows::Foundation::IAsyncOperation<bool>* aOperation,
|
||||
AsyncStatus aStatus)
|
||||
{
|
||||
WinUtils::Log("Async operation status: %d", aStatus);
|
||||
MetroUtils::FireObserver("metro_on_async_tile_created");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
MetroApp::PostSuspendResumeProcessNotification(const bool aIsSuspend)
|
||||
{
|
||||
static bool isSuspend = false;
|
||||
if (isSuspend == aIsSuspend) {
|
||||
return;
|
||||
}
|
||||
isSuspend = aIsSuspend;
|
||||
MetroUtils::FireObserver(aIsSuspend ? "suspend_process_notification" :
|
||||
"resume_process_notification");
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
MetroApp::PostSleepWakeNotification(const bool aIsSleep)
|
||||
{
|
||||
static bool isSleep = false;
|
||||
if (isSleep == aIsSleep) {
|
||||
return;
|
||||
}
|
||||
isSleep = aIsSleep;
|
||||
MetroUtils::FireObserver(aIsSleep ? "sleep_notification" :
|
||||
"wake_notification");
|
||||
}
|
||||
|
||||
} } }
|
||||
|
||||
|
||||
static bool
|
||||
IsBackgroundSessionClosedStartup()
|
||||
{
|
||||
int argc;
|
||||
LPWSTR *argv = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||
bool backgroundSessionClosed = argc > 1 && !wcsicmp(argv[1], L"-BackgroundSessionClosed");
|
||||
LocalFree(argv);
|
||||
return backgroundSessionClosed;
|
||||
}
|
||||
|
||||
bool
|
||||
XRE_MetroCoreApplicationRun()
|
||||
{
|
||||
HRESULT hr;
|
||||
LogThread();
|
||||
|
||||
using namespace mozilla::widget::winrt;
|
||||
|
||||
sMetroApp = Make<MetroApp>();
|
||||
|
||||
HStringReference className(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication);
|
||||
hr = GetActivationFactory(className.Get(), sCoreApp.GetAddressOf());
|
||||
if (FAILED(hr)) {
|
||||
LogHRESULT(hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Perform any cleanup for unclean shutdowns here, such as when the background session
|
||||
// is closed via the appbar on the left when outside of Metro. Windows restarts the
|
||||
// process solely for cleanup reasons.
|
||||
if (IsBackgroundSessionClosedStartup() && SUCCEEDED(XRE_metroStartup(false))) {
|
||||
|
||||
// Whether or not to use sessionstore depends on if the bak exists. Since host process
|
||||
// shutdown isn't a crash we shouldn't restore sessionstore.
|
||||
nsCOMPtr<nsIFile> sessionBAK;
|
||||
if (NS_FAILED(NS_GetSpecialDirectory("ProfDS", getter_AddRefs(sessionBAK)))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
sessionBAK->AppendNative(nsDependentCString("sessionstore.bak"));
|
||||
bool exists;
|
||||
if (NS_SUCCEEDED(sessionBAK->Exists(&exists)) && exists) {
|
||||
sessionBAK->Remove(false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = sCoreApp->Run(sMetroApp.Get());
|
||||
|
||||
WinUtils::Log("Exiting CoreApplication::Run");
|
||||
|
||||
sCoreApp = nullptr;
|
||||
sMetroApp = nullptr;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "mozwrlbase.h"
|
||||
|
||||
#include <windows.system.h>
|
||||
#include <windows.ui.core.h>
|
||||
#include <Windows.ApplicationModel.core.h>
|
||||
#include <Windows.ApplicationModel.h>
|
||||
#include <Windows.Applicationmodel.Activation.h>
|
||||
|
||||
class MetroWidget;
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
namespace winrt {
|
||||
|
||||
class MetroApp : public Microsoft::WRL::RuntimeClass<ABI::Windows::ApplicationModel::Core::IFrameworkViewSource>
|
||||
{
|
||||
InspectableClass(L"MetroApp", TrustLevel::BaseTrust)
|
||||
|
||||
typedef ABI::Windows::UI::Core::CoreDispatcherPriority CoreDispatcherPriority;
|
||||
typedef ABI::Windows::ApplicationModel::Activation::LaunchActivatedEventArgs LaunchActivatedEventArgs;
|
||||
typedef ABI::Windows::ApplicationModel::ISuspendingEventArgs ISuspendingEventArgs;
|
||||
typedef ABI::Windows::ApplicationModel::Core::IFrameworkView IFrameworkView;
|
||||
typedef ABI::Windows::ApplicationModel::Core::ICoreApplication ICoreApplication;
|
||||
|
||||
public:
|
||||
// IFrameworkViewSource
|
||||
STDMETHODIMP CreateView(IFrameworkView **viewProvider);
|
||||
|
||||
// ICoreApplication event
|
||||
HRESULT OnSuspending(IInspectable* aSender, ISuspendingEventArgs* aArgs);
|
||||
HRESULT OnResuming(IInspectable* aSender, IInspectable* aArgs);
|
||||
|
||||
// nsIWinMetroUtils tile related async callbacks
|
||||
HRESULT OnAsyncTileCreated(ABI::Windows::Foundation::IAsyncOperation<bool>* aOperation, AsyncStatus aStatus);
|
||||
|
||||
void Run();
|
||||
void CoreExit();
|
||||
void Shutdown();
|
||||
void ActivateBaseView();
|
||||
|
||||
// Set when goanna enters xpcom shutdown.
|
||||
static bool sGoannaShuttingDown;
|
||||
|
||||
// Shared pointers between framework and widget
|
||||
void SetWidget(MetroWidget* aPtr);
|
||||
|
||||
static void PostSuspendResumeProcessNotification(bool aIsSuspend);
|
||||
static void PostSleepWakeNotification(bool aIsSuspend);
|
||||
|
||||
private:
|
||||
EventRegistrationToken mSuspendEvent;
|
||||
EventRegistrationToken mResumeEvent;
|
||||
};
|
||||
|
||||
} } }
|
||||
@@ -1,522 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "MetroAppShell.h"
|
||||
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/widget/AudioSession.h"
|
||||
#include "mozilla/ipc/WindowsMessageLoop.h"
|
||||
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIAppStartup.h"
|
||||
#include "nsToolkitCompsCID.h"
|
||||
#include "nsIPowerManagerService.h"
|
||||
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "WinUtils.h"
|
||||
#include "nsWinMetroUtils.h"
|
||||
#include "MetroUtils.h"
|
||||
#include "MetroApp.h"
|
||||
#include "FrameworkView.h"
|
||||
#include "WakeLockListener.h"
|
||||
|
||||
#include <shellapi.h>
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::widget;
|
||||
using namespace mozilla::widget::winrt;
|
||||
using namespace Microsoft::WRL;
|
||||
using namespace Microsoft::WRL::Wrappers;
|
||||
using namespace ABI::Windows::UI::Core;
|
||||
using namespace ABI::Windows::Foundation;
|
||||
|
||||
// ProcessNextNativeEvent message wait timeout, see bug 907410.
|
||||
#define MSG_WAIT_TIMEOUT 250
|
||||
// MetroInput will occasionally ask us to flush all input so that the dom is
|
||||
// up to date. This is the maximum amount of time we'll agree to spend in
|
||||
// NS_ProcessPendingEvents.
|
||||
#define PURGE_MAX_TIMEOUT 50
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
namespace winrt {
|
||||
extern ComPtr<MetroApp> sMetroApp;
|
||||
} } }
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
// pulled from win32 app shell
|
||||
extern UINT sAppShellGoannaMsgId;
|
||||
} }
|
||||
|
||||
static ComPtr<ICoreWindowStatic> sCoreStatic;
|
||||
static bool sIsDispatching = false;
|
||||
static bool sShouldPurgeThreadQueue = false;
|
||||
static bool sBlockNativeEvents = false;
|
||||
static TimeStamp sPurgeThreadQueueStart;
|
||||
|
||||
MetroAppShell::~MetroAppShell()
|
||||
{
|
||||
if (mEventWnd) {
|
||||
SendMessage(mEventWnd, WM_CLOSE, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
MetroAppShell::Init()
|
||||
{
|
||||
LogFunction();
|
||||
|
||||
WNDCLASSW wc;
|
||||
HINSTANCE module = GetModuleHandle(nullptr);
|
||||
|
||||
mozilla::ipc::windows::InitUIThread();
|
||||
|
||||
const char16_t *const kWindowClass = L"nsAppShell:EventWindowClass";
|
||||
if (!GetClassInfoW(module, kWindowClass, &wc)) {
|
||||
wc.style = 0;
|
||||
wc.lpfnWndProc = EventWindowProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = module;
|
||||
wc.hIcon = nullptr;
|
||||
wc.hCursor = nullptr;
|
||||
wc.hbrBackground = (HBRUSH) nullptr;
|
||||
wc.lpszMenuName = (LPCWSTR) nullptr;
|
||||
wc.lpszClassName = kWindowClass;
|
||||
RegisterClassW(&wc);
|
||||
}
|
||||
|
||||
mEventWnd = CreateWindowW(kWindowClass, L"nsAppShell:EventWindow",
|
||||
0, 0, 0, 10, 10, nullptr, nullptr, module, nullptr);
|
||||
NS_ENSURE_STATE(mEventWnd);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
do_GetService("@mozilla.org/observer-service;1", &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
observerService->AddObserver(this, "dl-start", false);
|
||||
observerService->AddObserver(this, "dl-done", false);
|
||||
observerService->AddObserver(this, "dl-cancel", false);
|
||||
observerService->AddObserver(this, "dl-failed", false);
|
||||
}
|
||||
|
||||
return nsBaseAppShell::Init();
|
||||
}
|
||||
|
||||
HRESULT
|
||||
SHCreateShellItemArrayFromShellItemDynamic(IShellItem *psi, REFIID riid, void **ppv)
|
||||
{
|
||||
HMODULE shell32DLL = LoadLibraryW(L"shell32.dll");
|
||||
if (!shell32DLL) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
typedef BOOL (WINAPI* SHFn)(IShellItem *psi, REFIID riid, void **ppv);
|
||||
|
||||
HRESULT hr = E_FAIL;
|
||||
SHFn SHCreateShellItemArrayFromShellItemDynamicPtr =
|
||||
(SHFn)GetProcAddress(shell32DLL, "SHCreateShellItemArrayFromShellItem");
|
||||
FreeLibrary(shell32DLL);
|
||||
if (SHCreateShellItemArrayFromShellItemDynamicPtr) {
|
||||
hr = SHCreateShellItemArrayFromShellItemDynamicPtr(psi, riid, ppv);
|
||||
}
|
||||
|
||||
FreeLibrary(shell32DLL);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
WinLaunchDeferredMetroFirefox()
|
||||
{
|
||||
// Create an instance of the Firefox Metro CEH which is used to launch the browser
|
||||
const CLSID CLSID_FirefoxMetroDEH = {0x5100FEC1,0x212B, 0x4BF5 ,{0x9B,0xF8, 0x3E,0x65, 0x0F,0xD7,0x94,0xA3}};
|
||||
|
||||
nsRefPtr<IExecuteCommand> executeCommand;
|
||||
HRESULT hr = CoCreateInstance(CLSID_FirefoxMetroDEH,
|
||||
nullptr,
|
||||
CLSCTX_LOCAL_SERVER,
|
||||
IID_IExecuteCommand,
|
||||
getter_AddRefs(executeCommand));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
// Get the currently running exe path
|
||||
WCHAR exePath[MAX_PATH + 1] = { L'\0' };
|
||||
if (!::GetModuleFileNameW(0, exePath, MAX_PATH))
|
||||
return hr;
|
||||
|
||||
// Convert the path to a long path since GetModuleFileNameW returns the path
|
||||
// that was used to launch Firefox which is not necessarily a long path.
|
||||
if (!::GetLongPathNameW(exePath, exePath, MAX_PATH))
|
||||
return hr;
|
||||
|
||||
// Create an IShellItem for the current browser path
|
||||
nsRefPtr<IShellItem> shellItem;
|
||||
hr = WinUtils::SHCreateItemFromParsingName(exePath, nullptr, IID_IShellItem,
|
||||
getter_AddRefs(shellItem));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
// Convert to an IShellItemArray which is used for the path to launch
|
||||
nsRefPtr<IShellItemArray> shellItemArray;
|
||||
hr = SHCreateShellItemArrayFromShellItemDynamic(shellItem, IID_IShellItemArray, getter_AddRefs(shellItemArray));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
// Set the path to launch and parameters needed
|
||||
nsRefPtr<IObjectWithSelection> selection;
|
||||
hr = executeCommand->QueryInterface(IID_IObjectWithSelection, getter_AddRefs(selection));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
hr = selection->SetSelection(shellItemArray);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
if (nsWinMetroUtils::sUpdatePending) {
|
||||
hr = executeCommand->SetParameters(L"--metro-update");
|
||||
} else {
|
||||
hr = executeCommand->SetParameters(L"--metro-restart");
|
||||
}
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
// Run the default browser through the CEH
|
||||
return executeCommand->Execute();
|
||||
}
|
||||
|
||||
static WakeLockListener*
|
||||
InitWakeLock()
|
||||
{
|
||||
nsCOMPtr<nsIPowerManagerService> powerManagerService =
|
||||
do_GetService(POWERMANAGERSERVICE_CONTRACTID);
|
||||
if (powerManagerService) {
|
||||
WakeLockListener* pLock = new WakeLockListener();
|
||||
powerManagerService->AddWakeLockListener(pLock);
|
||||
return pLock;
|
||||
}
|
||||
else {
|
||||
NS_WARNING("Failed to retrieve PowerManagerService, wakelocks will be broken!");
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void
|
||||
ShutdownWakeLock(WakeLockListener* aLock)
|
||||
{
|
||||
if (!aLock) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIPowerManagerService> powerManagerService =
|
||||
do_GetService(POWERMANAGERSERVICE_CONTRACTID);
|
||||
if (powerManagerService) {
|
||||
powerManagerService->RemoveWakeLockListener(aLock);
|
||||
}
|
||||
}
|
||||
|
||||
// Called by appstartup->run in xre, which is initiated by a call to
|
||||
// XRE_metroStartup in MetroApp. This call is on the metro main thread.
|
||||
NS_IMETHODIMP
|
||||
MetroAppShell::Run(void)
|
||||
{
|
||||
LogFunction();
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
switch(XRE_GetProcessType()) {
|
||||
case GoannaProcessType_Content:
|
||||
case GoannaProcessType_IPDLUnitTest:
|
||||
mozilla::widget::StartAudioSession();
|
||||
rv = nsBaseAppShell::Run();
|
||||
mozilla::widget::StopAudioSession();
|
||||
break;
|
||||
case GoannaProcessType_Plugin:
|
||||
NS_WARNING("We don't support plugins currently.");
|
||||
// Just exit
|
||||
rv = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
case GoannaProcessType_Default: {
|
||||
{
|
||||
nsRefPtr<WakeLockListener> wakeLock = InitWakeLock();
|
||||
mozilla::widget::StartAudioSession();
|
||||
sMetroApp->ActivateBaseView();
|
||||
rv = nsBaseAppShell::Run();
|
||||
mozilla::widget::StopAudioSession();
|
||||
ShutdownWakeLock(wakeLock);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAppStartup> appStartup (do_GetService(NS_APPSTARTUP_CONTRACTID));
|
||||
bool restartingInMetro = false, restartingInDesktop = false;
|
||||
|
||||
if (!appStartup || NS_FAILED(appStartup->GetRestarting(&restartingInDesktop))) {
|
||||
WinUtils::Log("appStartup->GetRestarting() unsuccessful");
|
||||
}
|
||||
|
||||
if (appStartup && NS_SUCCEEDED(appStartup->GetRestartingTouchEnvironment(&restartingInMetro)) &&
|
||||
restartingInMetro) {
|
||||
restartingInDesktop = false;
|
||||
}
|
||||
|
||||
// This calls XRE_metroShutdown() in xre. Shuts down goanna, including
|
||||
// releasing the profile, and destroys MessagePump.
|
||||
sMetroApp->Shutdown();
|
||||
|
||||
// Handle update restart or browser switch requests
|
||||
if (restartingInDesktop) {
|
||||
WinUtils::Log("Relaunching desktop browser");
|
||||
// We can't call into the ceh to do this. Microsoft prevents switching to
|
||||
// desktop unless we go through shell execute.
|
||||
SHELLEXECUTEINFOW sinfo;
|
||||
memset(&sinfo, 0, sizeof(SHELLEXECUTEINFOW));
|
||||
sinfo.cbSize = sizeof(SHELLEXECUTEINFOW);
|
||||
// Per microsoft's metro style enabled desktop browser documentation
|
||||
// SEE_MASK_FLAG_LOG_USAGE is needed if we want to change from immersive
|
||||
// mode to desktop mode.
|
||||
sinfo.fMask = SEE_MASK_FLAG_LOG_USAGE;
|
||||
// The ceh will filter out this fake target.
|
||||
sinfo.lpFile = L"http://-desktop/";
|
||||
sinfo.lpVerb = L"open";
|
||||
sinfo.lpParameters = L"--desktop-restart";
|
||||
sinfo.nShow = SW_SHOWNORMAL;
|
||||
ShellExecuteEx(&sinfo);
|
||||
} else if (restartingInMetro) {
|
||||
HRESULT hresult = WinLaunchDeferredMetroFirefox();
|
||||
WinUtils::Log("Relaunching metro browser (hr=%X)", hresult);
|
||||
}
|
||||
|
||||
// This will free the real main thread in CoreApplication::Run()
|
||||
// once winrt cleans up this thread.
|
||||
sMetroApp->CoreExit();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Called in certain cases where we have async input events in the thread
|
||||
// queue and need to make sure they get dispatched before the stack unwinds.
|
||||
void // static
|
||||
MetroAppShell::MarkEventQueueForPurge()
|
||||
{
|
||||
sShouldPurgeThreadQueue = true;
|
||||
|
||||
// If we're dispatching native events, wait until the dispatcher is
|
||||
// off the stack.
|
||||
if (sIsDispatching) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Safe to process pending events now
|
||||
DispatchAllGoannaEvents();
|
||||
}
|
||||
|
||||
// Notification from MetroInput that all events it wanted delivered
|
||||
// have been dispatched. It is safe to start processing windowing
|
||||
// events.
|
||||
void // static
|
||||
MetroAppShell::InputEventsDispatched()
|
||||
{
|
||||
sBlockNativeEvents = false;
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
MetroAppShell::DispatchAllGoannaEvents()
|
||||
{
|
||||
// Only do this if requested and when we're not shutting down
|
||||
if (!sShouldPurgeThreadQueue || MetroApp::sGoannaShuttingDown) {
|
||||
return;
|
||||
}
|
||||
|
||||
NS_ASSERTION(NS_IsMainThread(), "DispatchAllGoannaEvents should be called on the main thread");
|
||||
|
||||
sShouldPurgeThreadQueue = false;
|
||||
sPurgeThreadQueueStart = TimeStamp::Now();
|
||||
|
||||
sBlockNativeEvents = true;
|
||||
nsIThread *thread = NS_GetCurrentThread();
|
||||
NS_ProcessPendingEvents(thread, PURGE_MAX_TIMEOUT);
|
||||
sBlockNativeEvents = false;
|
||||
}
|
||||
|
||||
static void
|
||||
ProcessNativeEvents(CoreProcessEventsOption eventOption)
|
||||
{
|
||||
HRESULT hr;
|
||||
if (!sCoreStatic) {
|
||||
hr = GetActivationFactory(HStringReference(L"Windows.UI.Core.CoreWindow").Get(), sCoreStatic.GetAddressOf());
|
||||
NS_ASSERTION(SUCCEEDED(hr), "GetActivationFactory failed?");
|
||||
AssertHRESULT(hr);
|
||||
}
|
||||
|
||||
ComPtr<ICoreWindow> window;
|
||||
AssertHRESULT(sCoreStatic->GetForCurrentThread(window.GetAddressOf()));
|
||||
ComPtr<ICoreDispatcher> dispatcher;
|
||||
hr = window->get_Dispatcher(&dispatcher);
|
||||
NS_ASSERTION(SUCCEEDED(hr), "get_Dispatcher failed?");
|
||||
AssertHRESULT(hr);
|
||||
dispatcher->ProcessEvents(eventOption);
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
MetroAppShell::ProcessOneNativeEventIfPresent()
|
||||
{
|
||||
if (sIsDispatching) {
|
||||
// Calling into ProcessNativeEvents is harmless, but won't actually process any
|
||||
// native events. So we log here so we can spot this and get a handle on the
|
||||
// corner cases where this can happen.
|
||||
WinUtils::Log("WARNING: Reentrant call into process events detected, returning early.");
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
AutoRestore<bool> dispatching(sIsDispatching);
|
||||
sIsDispatching = true;
|
||||
ProcessNativeEvents(CoreProcessEventsOption::CoreProcessEventsOption_ProcessOneIfPresent);
|
||||
}
|
||||
|
||||
DispatchAllGoannaEvents();
|
||||
|
||||
return !!HIWORD(::GetQueueStatus(MOZ_QS_ALLEVENT));
|
||||
}
|
||||
|
||||
bool
|
||||
MetroAppShell::ProcessNextNativeEvent(bool mayWait)
|
||||
{
|
||||
// NS_ProcessPendingEvents will process thread events *and* call
|
||||
// nsBaseAppShell::OnProcessNextEvent to process native events. However
|
||||
// we do not want native events getting dispatched while we are trying
|
||||
// to dispatch pending input in DispatchAllGoannaEvents since a native
|
||||
// event may be a UIA Automation call coming in to check focus.
|
||||
if (sBlockNativeEvents) {
|
||||
if ((TimeStamp::Now() - sPurgeThreadQueueStart).ToMilliseconds()
|
||||
< PURGE_MAX_TIMEOUT) {
|
||||
return false;
|
||||
}
|
||||
sBlockNativeEvents = false;
|
||||
}
|
||||
|
||||
if (ProcessOneNativeEventIfPresent()) {
|
||||
return true;
|
||||
}
|
||||
if (mayWait) {
|
||||
DWORD result = ::MsgWaitForMultipleObjectsEx(0, nullptr, MSG_WAIT_TIMEOUT,
|
||||
MOZ_QS_ALLEVENT,
|
||||
MWMO_INPUTAVAILABLE|MWMO_ALERTABLE);
|
||||
NS_WARN_IF_FALSE(result != WAIT_FAILED, "Wait failed");
|
||||
}
|
||||
return ProcessOneNativeEventIfPresent();
|
||||
}
|
||||
|
||||
void
|
||||
MetroAppShell::NativeCallback()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Native callbacks must be on the metro main thread");
|
||||
|
||||
// We shouldn't process native events during xpcom shutdown - this can
|
||||
// trigger unexpected xpcom event dispatching for the main thread when
|
||||
// the thread manager is in the process of shutting down non-main threads,
|
||||
// resulting in shutdown hangs.
|
||||
if (MetroApp::sGoannaShuttingDown) {
|
||||
return;
|
||||
}
|
||||
|
||||
NativeEventCallback();
|
||||
}
|
||||
|
||||
// static
|
||||
LRESULT CALLBACK
|
||||
MetroAppShell::EventWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (uMsg == sAppShellGoannaMsgId) {
|
||||
MetroAppShell *as = reinterpret_cast<MetroAppShell *>(lParam);
|
||||
as->NativeCallback();
|
||||
NS_RELEASE(as);
|
||||
return TRUE;
|
||||
}
|
||||
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
void
|
||||
MetroAppShell::ScheduleNativeEventCallback()
|
||||
{
|
||||
NS_ADDREF_THIS();
|
||||
PostMessage(mEventWnd, sAppShellGoannaMsgId, 0, reinterpret_cast<LPARAM>(this));
|
||||
}
|
||||
|
||||
void
|
||||
MetroAppShell::DoProcessMoreGoannaEvents()
|
||||
{
|
||||
ScheduleNativeEventCallback();
|
||||
}
|
||||
|
||||
static HANDLE
|
||||
PowerCreateRequestDyn(REASON_CONTEXT *context)
|
||||
{
|
||||
typedef HANDLE (WINAPI * PowerCreateRequestPtr)(REASON_CONTEXT *context);
|
||||
static HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
|
||||
static PowerCreateRequestPtr powerCreateRequest =
|
||||
(PowerCreateRequestPtr)GetProcAddress(kernel32, "PowerCreateRequest");
|
||||
if (!powerCreateRequest)
|
||||
return INVALID_HANDLE_VALUE;
|
||||
return powerCreateRequest(context);
|
||||
}
|
||||
|
||||
static BOOL
|
||||
PowerClearRequestDyn(HANDLE powerRequest, POWER_REQUEST_TYPE requestType)
|
||||
{
|
||||
typedef BOOL (WINAPI * PowerClearRequestPtr)(HANDLE powerRequest, POWER_REQUEST_TYPE requestType);
|
||||
static HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
|
||||
static PowerClearRequestPtr powerClearRequest =
|
||||
(PowerClearRequestPtr)GetProcAddress(kernel32, "PowerClearRequest");
|
||||
if (!powerClearRequest)
|
||||
return FALSE;
|
||||
return powerClearRequest(powerRequest, requestType);
|
||||
}
|
||||
|
||||
static BOOL
|
||||
PowerSetRequestDyn(HANDLE powerRequest, POWER_REQUEST_TYPE requestType)
|
||||
{
|
||||
typedef BOOL (WINAPI * PowerSetRequestPtr)(HANDLE powerRequest, POWER_REQUEST_TYPE requestType);
|
||||
static HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
|
||||
static PowerSetRequestPtr powerSetRequest =
|
||||
(PowerSetRequestPtr)GetProcAddress(kernel32, "PowerSetRequest");
|
||||
if (!powerSetRequest)
|
||||
return FALSE;
|
||||
return powerSetRequest(powerRequest, requestType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MetroAppShell::Observe(nsISupports *subject, const char *topic,
|
||||
const char16_t *data)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(topic);
|
||||
if (!strcmp(topic, "dl-start")) {
|
||||
if (mPowerRequestCount++ == 0) {
|
||||
WinUtils::Log("Download started - Disallowing suspend");
|
||||
REASON_CONTEXT context;
|
||||
context.Version = POWER_REQUEST_CONTEXT_VERSION;
|
||||
context.Flags = POWER_REQUEST_CONTEXT_SIMPLE_STRING;
|
||||
context.Reason.SimpleReasonString = L"downloading";
|
||||
mPowerRequest.own(PowerCreateRequestDyn(&context));
|
||||
PowerSetRequestDyn(mPowerRequest, PowerRequestExecutionRequired);
|
||||
}
|
||||
return NS_OK;
|
||||
} else if (!strcmp(topic, "dl-done") ||
|
||||
!strcmp(topic, "dl-cancel") ||
|
||||
!strcmp(topic, "dl-failed")) {
|
||||
if (--mPowerRequestCount == 0 && mPowerRequest) {
|
||||
WinUtils::Log("All downloads ended - Allowing suspend");
|
||||
PowerClearRequestDyn(mPowerRequest, PowerRequestExecutionRequired);
|
||||
mPowerRequest.reset();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return nsBaseAppShell::Observe(subject, topic, data);
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "nsBaseAppShell.h"
|
||||
#include <windows.h>
|
||||
#include "nsWindowsHelpers.h"
|
||||
#include "nsIObserver.h"
|
||||
|
||||
class MetroAppShell : public nsBaseAppShell
|
||||
{
|
||||
public:
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
MetroAppShell() :
|
||||
mEventWnd(nullptr),
|
||||
mPowerRequestCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
nsresult Init();
|
||||
void DoProcessMoreGoannaEvents();
|
||||
void NativeCallback();
|
||||
|
||||
static LRESULT CALLBACK EventWindowProc(HWND, UINT, WPARAM, LPARAM);
|
||||
static bool ProcessOneNativeEventIfPresent();
|
||||
static void MarkEventQueueForPurge();
|
||||
static void InputEventsDispatched();
|
||||
|
||||
protected:
|
||||
NS_IMETHOD Run();
|
||||
|
||||
virtual void ScheduleNativeEventCallback();
|
||||
virtual bool ProcessNextNativeEvent(bool mayWait);
|
||||
static void DispatchAllGoannaEvents();
|
||||
virtual ~MetroAppShell();
|
||||
|
||||
HWND mEventWnd;
|
||||
nsAutoHandle mPowerRequest;
|
||||
ULONG mPowerRequestCount;
|
||||
};
|
||||
@@ -1,576 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "FrameworkView.h"
|
||||
#include "MetroUtils.h"
|
||||
#include "nsICommandLineRunner.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIDOMChromeWindow.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include <wrl/wrappers/corewrappers.h>
|
||||
#include <shellapi.h>
|
||||
#include <DXGIFormat.h>
|
||||
#include <d2d1_1.h>
|
||||
#include <printpreview.h>
|
||||
#include <D3D10.h>
|
||||
#include "MetroUIUtils.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace ABI::Windows::Foundation;
|
||||
using namespace ABI::Windows::Foundation::Collections;
|
||||
using namespace Microsoft::WRL;
|
||||
using namespace Microsoft::WRL::Wrappers;
|
||||
|
||||
// Play to contract
|
||||
using namespace ABI::Windows::Media::PlayTo;
|
||||
|
||||
// Activation contracts
|
||||
using namespace ABI::Windows::ApplicationModel::Activation;
|
||||
using namespace ABI::Windows::ApplicationModel::DataTransfer;
|
||||
using namespace ABI::Windows::ApplicationModel::Search;
|
||||
|
||||
// Settings contract
|
||||
using namespace ABI::Windows::UI::ApplicationSettings;
|
||||
using namespace ABI::Windows::UI::Popups;
|
||||
|
||||
// Print contract
|
||||
using namespace ABI::Windows::Graphics::Printing;
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
namespace winrt {
|
||||
|
||||
extern nsTArray<nsString>* sSettingsArray;
|
||||
|
||||
void
|
||||
FrameworkView::SearchActivated(ComPtr<ISearchActivatedEventArgs>& aArgs, bool aStartup)
|
||||
{
|
||||
if (!aArgs)
|
||||
return;
|
||||
|
||||
HString data;
|
||||
AssertHRESULT(aArgs->get_QueryText(data.GetAddressOf()));
|
||||
if (WindowsIsStringEmpty(data.Get()))
|
||||
return;
|
||||
|
||||
unsigned int length;
|
||||
WinUtils::LogW(L"SearchActivated text=%s", data.GetRawBuffer(&length));
|
||||
if (aStartup) {
|
||||
WindowsDuplicateString(data.Get(), &sActivationURI);
|
||||
} else {
|
||||
PerformURILoadOrSearch(data);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FrameworkView::FileActivated(ComPtr<IFileActivatedEventArgs>& aArgs, bool aStartup)
|
||||
{
|
||||
if (!aArgs)
|
||||
return;
|
||||
|
||||
ComPtr<IVectorView<ABI::Windows::Storage::IStorageItem*>> list;
|
||||
AssertHRESULT(aArgs->get_Files(list.GetAddressOf()));
|
||||
ComPtr<ABI::Windows::Storage::IStorageItem> item;
|
||||
AssertHRESULT(list->GetAt(0, item.GetAddressOf()));
|
||||
HString filePath;
|
||||
AssertHRESULT(item->get_Path(filePath.GetAddressOf()));
|
||||
|
||||
if (aStartup) {
|
||||
WindowsDuplicateString(filePath.Get(), &sActivationURI);
|
||||
} else {
|
||||
PerformURILoad(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FrameworkView::LaunchActivated(ComPtr<ILaunchActivatedEventArgs>& aArgs, bool aStartup)
|
||||
{
|
||||
if (!aArgs)
|
||||
return;
|
||||
HString data;
|
||||
AssertHRESULT(aArgs->get_Arguments(data.GetAddressOf()));
|
||||
if (WindowsIsStringEmpty(data.Get()))
|
||||
return;
|
||||
|
||||
// If we're being launched from a secondary tile then we have a 2nd command line param of --url
|
||||
// and a third of the secondary tile. We want it in sActivationURI so that browser.js will
|
||||
// load it in without showing the start UI.
|
||||
int argc;
|
||||
unsigned int length;
|
||||
LPWSTR* argv = CommandLineToArgvW(data.GetRawBuffer(&length), &argc);
|
||||
if (aStartup && argc == 2 &&
|
||||
(!wcsicmp(argv[0], L"-url") ||
|
||||
!wcsicmp(argv[0], L"--url") ||
|
||||
!wcsicmp(argv[0], L"/url"))) {
|
||||
WindowsCreateString(argv[1], wcslen(argv[1]), &sActivationURI);
|
||||
} else {
|
||||
// Some other command line or this is not a startup.
|
||||
// If it is startup we process it later when XPCOM is initialilzed.
|
||||
mActivationCommandLine = data.GetRawBuffer(&length);
|
||||
if (!aStartup) {
|
||||
ProcessLaunchArguments();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FrameworkView::ProcessLaunchArguments()
|
||||
{
|
||||
if (!mActivationCommandLine.Length())
|
||||
return;
|
||||
|
||||
int argc;
|
||||
LPWSTR* argv = CommandLineToArgvW(mActivationCommandLine.BeginReading(), &argc);
|
||||
nsCOMPtr<nsICommandLineRunner> cmdLine =
|
||||
(do_CreateInstance("@mozilla.org/toolkit/command-line;1"));
|
||||
if (!cmdLine) {
|
||||
NS_WARNING("Unable to instantiate command line runner.");
|
||||
return;
|
||||
}
|
||||
|
||||
LPSTR *argvUTF8 = new LPSTR[argc];
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
NS_ConvertUTF16toUTF8 arg(argv[i]);
|
||||
argvUTF8[i] = new char[arg.Length() + 1];
|
||||
strcpy(argvUTF8[i], const_cast<char *>(arg.BeginReading()));
|
||||
WinUtils::LogW(L"Launch arg[%d]: '%s'", i, argv[i]);
|
||||
}
|
||||
|
||||
nsresult rv = cmdLine->Init(argc,
|
||||
argvUTF8,
|
||||
nullptr,
|
||||
nsICommandLine::STATE_REMOTE_EXPLICIT);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
cmdLine->Run();
|
||||
} else {
|
||||
NS_WARNING("cmdLine->Init failed.");
|
||||
}
|
||||
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
delete[] argvUTF8[i];
|
||||
}
|
||||
delete[] argvUTF8;
|
||||
}
|
||||
|
||||
void
|
||||
FrameworkView::ProcessActivationArgs(IActivatedEventArgs* aArgs, bool aStartup)
|
||||
{
|
||||
ActivationKind kind;
|
||||
if (!aArgs || FAILED(aArgs->get_Kind(&kind)))
|
||||
return;
|
||||
ComPtr<IActivatedEventArgs> args(aArgs);
|
||||
if (kind == ActivationKind::ActivationKind_Protocol) {
|
||||
WinUtils::Log("Activation argument kind: Protocol");
|
||||
ComPtr<IProtocolActivatedEventArgs> protoArgs;
|
||||
AssertHRESULT(args.As(&protoArgs));
|
||||
ComPtr<IUriRuntimeClass> uri;
|
||||
AssertHRESULT(protoArgs->get_Uri(uri.GetAddressOf()));
|
||||
if (!uri)
|
||||
return;
|
||||
|
||||
HString data;
|
||||
AssertHRESULT(uri->get_AbsoluteUri(data.GetAddressOf()));
|
||||
if (WindowsIsStringEmpty(data.Get()))
|
||||
return;
|
||||
|
||||
if (aStartup) {
|
||||
WindowsDuplicateString(data.Get(), &sActivationURI);
|
||||
} else {
|
||||
PerformURILoad(data);
|
||||
}
|
||||
} else if (kind == ActivationKind::ActivationKind_Search) {
|
||||
WinUtils::Log("Activation argument kind: Search");
|
||||
ComPtr<ISearchActivatedEventArgs> searchArgs;
|
||||
args.As(&searchArgs);
|
||||
SearchActivated(searchArgs, aStartup);
|
||||
} else if (kind == ActivationKind::ActivationKind_File) {
|
||||
WinUtils::Log("Activation argument kind: File");
|
||||
ComPtr<IFileActivatedEventArgs> fileArgs;
|
||||
args.As(&fileArgs);
|
||||
FileActivated(fileArgs, aStartup);
|
||||
} else if (kind == ActivationKind::ActivationKind_Launch) {
|
||||
WinUtils::Log("Activation argument kind: Launch");
|
||||
ComPtr<ILaunchActivatedEventArgs> launchArgs;
|
||||
args.As(&launchArgs);
|
||||
LaunchActivated(launchArgs, aStartup);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FrameworkView::SetupContracts()
|
||||
{
|
||||
LogFunction();
|
||||
HRESULT hr;
|
||||
|
||||
// Add support for the share charm to indicate that we share data to other apps
|
||||
ComPtr<IDataTransferManagerStatics> transStatics;
|
||||
hr = GetActivationFactory(HStringReference(RuntimeClass_Windows_ApplicationModel_DataTransfer_DataTransferManager).Get(),
|
||||
transStatics.GetAddressOf());
|
||||
AssertHRESULT(hr);
|
||||
ComPtr<IDataTransferManager> trans;
|
||||
AssertHRESULT(transStatics->GetForCurrentView(trans.GetAddressOf()));
|
||||
trans->add_DataRequested(Callback<__FITypedEventHandler_2_Windows__CApplicationModel__CDataTransfer__CDataTransferManager_Windows__CApplicationModel__CDataTransfer__CDataRequestedEventArgs_t>(
|
||||
this, &FrameworkView::OnDataShareRequested).Get(), &mDataTransferRequested);
|
||||
|
||||
// Add support for the search charm to indicate that you can search using our app.
|
||||
ComPtr<ISearchPaneStatics> searchStatics;
|
||||
hr = GetActivationFactory(HStringReference(RuntimeClass_Windows_ApplicationModel_Search_SearchPane).Get(),
|
||||
searchStatics.GetAddressOf());
|
||||
AssertHRESULT(hr);
|
||||
ComPtr<ISearchPane> searchPane;
|
||||
AssertHRESULT(searchStatics->GetForCurrentView(searchPane.GetAddressOf()));
|
||||
searchPane->add_QuerySubmitted(Callback<__FITypedEventHandler_2_Windows__CApplicationModel__CSearch__CSearchPane_Windows__CApplicationModel__CSearch__CSearchPaneQuerySubmittedEventArgs_t>(
|
||||
this, &FrameworkView::OnSearchQuerySubmitted).Get(), &mSearchQuerySubmitted);
|
||||
|
||||
// Add support for the devices play to charm
|
||||
ComPtr<IPlayToManagerStatics> playToStatics;
|
||||
hr = GetActivationFactory(HStringReference(RuntimeClass_Windows_Media_PlayTo_PlayToManager).Get(),
|
||||
playToStatics.GetAddressOf());
|
||||
AssertHRESULT(hr);
|
||||
ComPtr<IPlayToManager> playTo;
|
||||
AssertHRESULT(playToStatics->GetForCurrentView(playTo.GetAddressOf()));
|
||||
playTo->add_SourceRequested(Callback<__FITypedEventHandler_2_Windows__CMedia__CPlayTo__CPlayToManager_Windows__CMedia__CPlayTo__CPlayToSourceRequestedEventArgs_t>(
|
||||
this, &FrameworkView::OnPlayToSourceRequested).Get(), &mPlayToRequested);
|
||||
|
||||
// Add support for the settings charm
|
||||
ComPtr<ISettingsPaneStatics> settingsPaneStatics;
|
||||
hr = GetActivationFactory(HStringReference(RuntimeClass_Windows_UI_ApplicationSettings_SettingsPane).Get(),
|
||||
settingsPaneStatics.GetAddressOf());
|
||||
AssertHRESULT(hr);
|
||||
ComPtr<ISettingsPane> settingsPane;
|
||||
AssertHRESULT(settingsPaneStatics->GetForCurrentView(settingsPane.GetAddressOf()));
|
||||
settingsPane->add_CommandsRequested(Callback<__FITypedEventHandler_2_Windows__CUI__CApplicationSettings__CSettingsPane_Windows__CUI__CApplicationSettings__CSettingsPaneCommandsRequestedEventArgs_t>(
|
||||
this, &FrameworkView::OnSettingsCommandsRequested).Get(), &mSettingsPane);
|
||||
|
||||
// Add support for the settings print charm
|
||||
ComPtr<IPrintManagerStatic> printStatics;
|
||||
hr = GetActivationFactory(HStringReference(RuntimeClass_Windows_Graphics_Printing_PrintManager).Get(),
|
||||
printStatics.GetAddressOf());
|
||||
AssertHRESULT(hr);
|
||||
ComPtr<IPrintManager> printManager;
|
||||
AssertHRESULT(printStatics->GetForCurrentView(printManager.GetAddressOf()));
|
||||
printManager->add_PrintTaskRequested(Callback<__FITypedEventHandler_2_Windows__CGraphics__CPrinting__CPrintManager_Windows__CGraphics__CPrinting__CPrintTaskRequestedEventArgs_t>(
|
||||
this, &FrameworkView::OnPrintTaskRequested).Get(), &mPrintManager);
|
||||
}
|
||||
|
||||
void
|
||||
FrameworkView::PerformURILoad(HString& aURI)
|
||||
{
|
||||
LogFunction();
|
||||
|
||||
unsigned int length;
|
||||
WinUtils::LogW(L"PerformURILoad uri=%s", aURI.GetRawBuffer(&length));
|
||||
|
||||
nsCOMPtr<nsICommandLineRunner> cmdLine =
|
||||
(do_CreateInstance("@mozilla.org/toolkit/command-line;1"));
|
||||
if (!cmdLine) {
|
||||
NS_WARNING("Unable to instantiate command line runner.");
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoCString utf8data(NS_ConvertUTF16toUTF8(aURI.GetRawBuffer(&length)));
|
||||
|
||||
// NB: The first argument gets stripped by nsICommandLineRunner::Init,
|
||||
// so it doesn't matter what we pass as the first argument, but we
|
||||
// have to pass something.
|
||||
const char *argv[] = { "", // This argument gets stripped
|
||||
"-url",
|
||||
utf8data.BeginReading() };
|
||||
nsresult rv = cmdLine->Init(ArrayLength(argv),
|
||||
const_cast<char **>(argv), nullptr,
|
||||
nsICommandLine::STATE_REMOTE_EXPLICIT);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("cmdLine->Init failed.");
|
||||
return;
|
||||
}
|
||||
cmdLine->Run();
|
||||
}
|
||||
|
||||
void
|
||||
FrameworkView::PerformSearch(HString& aQuery)
|
||||
{
|
||||
LogFunction();
|
||||
|
||||
nsCOMPtr<nsICommandLineRunner> cmdLine =
|
||||
(do_CreateInstance("@mozilla.org/toolkit/command-line;1"));
|
||||
if (!cmdLine) {
|
||||
NS_WARNING("Unable to instantiate command line runner.");
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoCString parameter;
|
||||
parameter.Append('"');
|
||||
unsigned int length;
|
||||
parameter.Append(NS_ConvertUTF16toUTF8(aQuery.GetRawBuffer(&length)));
|
||||
parameter.Append('"');
|
||||
|
||||
// NB: The first argument gets stripped by nsICommandLineRunner::Init,
|
||||
// so it doesn't matter what we pass as the first argument, but we
|
||||
// have to pass something.
|
||||
const char *argv[] = { "", // This argument gets stripped
|
||||
"-search",
|
||||
parameter.BeginReading() };
|
||||
nsresult rv = cmdLine->Init(ArrayLength(argv),
|
||||
const_cast<char **>(argv), nullptr,
|
||||
nsICommandLine::STATE_REMOTE_EXPLICIT);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("cmdLine->Init failed.");
|
||||
return;
|
||||
}
|
||||
cmdLine->Run();
|
||||
}
|
||||
|
||||
void
|
||||
FrameworkView::PerformURILoadOrSearch(HString& aString)
|
||||
{
|
||||
LogFunction();
|
||||
|
||||
if (WindowsIsStringEmpty(aString.Get())) {
|
||||
WinUtils::Log("Emptry string passed to PerformURILoadOrSearch");
|
||||
return;
|
||||
}
|
||||
|
||||
// If we have a URI then devert to load the URI directly
|
||||
ComPtr<IUriRuntimeClass> uri;
|
||||
MetroUtils::CreateUri(aString.Get(), uri);
|
||||
if (uri) {
|
||||
PerformURILoad(aString);
|
||||
} else {
|
||||
PerformSearch(aString);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::OnDataShareRequested(IDataTransferManager* aDTM,
|
||||
IDataRequestedEventArgs* aArg)
|
||||
{
|
||||
// Only share pages that contain a title and a URI
|
||||
nsCOMPtr<nsIMetroUIUtils> metroUIUtils = do_CreateInstance("@mozilla.org/metro-ui-utils;1");
|
||||
if (!metroUIUtils)
|
||||
return E_FAIL;
|
||||
|
||||
nsString url, title;
|
||||
nsresult rv = metroUIUtils->GetCurrentPageURI(url);
|
||||
nsresult rv2 = metroUIUtils->GetCurrentPageTitle(title);
|
||||
if (NS_FAILED(rv) || NS_FAILED(rv2)) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// Get the package to share
|
||||
HRESULT hr;
|
||||
ComPtr<IDataRequest> request;
|
||||
AssertRetHRESULT(hr = aArg->get_Request(request.GetAddressOf()), hr);
|
||||
ComPtr<IDataPackage> dataPackage;
|
||||
AssertRetHRESULT(hr = request->get_Data(dataPackage.GetAddressOf()), hr);
|
||||
ComPtr<IDataPackagePropertySet> props;
|
||||
AssertRetHRESULT(hr = dataPackage->get_Properties(props.GetAddressOf()), hr);
|
||||
|
||||
// Only add a URI to the package when there is no selected content.
|
||||
// This is because most programs treat URIs as highest priority to generate
|
||||
// their own preview, but we only want the selected content to show up.
|
||||
bool hasSelectedContent = false;
|
||||
metroUIUtils->GetHasSelectedContent(&hasSelectedContent);
|
||||
if (!hasSelectedContent) {
|
||||
ComPtr<IUriRuntimeClass> uri;
|
||||
AssertRetHRESULT(hr = MetroUtils::CreateUri(HStringReference(url.BeginReading()).Get(), uri), hr);
|
||||
|
||||
// If there is no selection, then we don't support sharing for sites that
|
||||
// are not HTTP, HTTPS, FTP, and FILE.
|
||||
HString schemeHString;
|
||||
uri->get_SchemeName(schemeHString.GetAddressOf());
|
||||
unsigned int length;
|
||||
LPCWSTR scheme = schemeHString.GetRawBuffer(&length);
|
||||
if (!scheme || wcscmp(scheme, L"http") && wcscmp(scheme, L"https") &&
|
||||
wcscmp(scheme, L"ftp") && wcscmp(scheme, L"file")) {
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
AssertRetHRESULT(hr = dataPackage->SetUri(uri.Get()), hr);
|
||||
}
|
||||
|
||||
// Add whatever content metroUIUtils wants us to for the text sharing
|
||||
nsString shareText;
|
||||
if (NS_SUCCEEDED(metroUIUtils->GetShareText(shareText)) && shareText.Length()) {
|
||||
AssertRetHRESULT(hr = dataPackage->SetText(HStringReference(shareText.BeginReading()).Get()) ,hr);
|
||||
}
|
||||
|
||||
// Add whatever content metroUIUtils wants us to for the HTML sharing
|
||||
nsString shareHTML;
|
||||
if (NS_SUCCEEDED(metroUIUtils->GetShareHTML(shareHTML)) && shareHTML.Length()) {
|
||||
// The sharing format needs some special headers, so pass it through Windows
|
||||
ComPtr<IHtmlFormatHelperStatics> htmlFormatHelper;
|
||||
hr = GetActivationFactory(HStringReference(RuntimeClass_Windows_ApplicationModel_DataTransfer_HtmlFormatHelper).Get(),
|
||||
htmlFormatHelper.GetAddressOf());
|
||||
AssertRetHRESULT(hr, hr);
|
||||
HSTRING fixedHTML;
|
||||
htmlFormatHelper->CreateHtmlFormat(HStringReference(shareHTML.BeginReading()).Get(), &fixedHTML);
|
||||
|
||||
// And now add the fixed HTML to the data package
|
||||
AssertRetHRESULT(hr = dataPackage->SetHtmlFormat(fixedHTML), hr);
|
||||
}
|
||||
|
||||
// Obtain the brand name
|
||||
nsCOMPtr<nsIStringBundleService> bundleService =
|
||||
do_GetService(NS_STRINGBUNDLE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(bundleService, E_FAIL);
|
||||
nsCOMPtr<nsIStringBundle> brandBundle;
|
||||
nsString brandName;
|
||||
bundleService->CreateBundle("chrome://branding/locale/brand.properties",
|
||||
getter_AddRefs(brandBundle));
|
||||
NS_ENSURE_TRUE(brandBundle, E_FAIL);
|
||||
if(brandBundle) {
|
||||
brandBundle->GetStringFromName(MOZ_UTF16("brandFullName"),
|
||||
getter_Copies(brandName));
|
||||
}
|
||||
|
||||
// Set these properties at the end. Otherwise users can get a
|
||||
// "There was a problem with the data package" error when there
|
||||
// is simply nothing to share.
|
||||
props->put_ApplicationName(HStringReference(brandName.BeginReading()).Get());
|
||||
if (title.Length()) {
|
||||
props->put_Title(HStringReference(title.BeginReading()).Get());
|
||||
} else {
|
||||
props->put_Title(HStringReference(brandName.BeginReading()).Get());
|
||||
}
|
||||
props->put_Description(HStringReference(url.BeginReading()).Get());
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::OnSearchQuerySubmitted(ISearchPane* aPane,
|
||||
ISearchPaneQuerySubmittedEventArgs* aArgs)
|
||||
{
|
||||
LogFunction();
|
||||
HString aQuery;
|
||||
aArgs->get_QueryText(aQuery.GetAddressOf());
|
||||
PerformURILoadOrSearch(aQuery);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::OnSettingsCommandInvoked(IUICommand* aCommand)
|
||||
{
|
||||
LogFunction();
|
||||
HRESULT hr;
|
||||
uint32_t id;
|
||||
ComPtr<IPropertyValue> prop;
|
||||
AssertRetHRESULT(hr = aCommand->get_Id((IInspectable**)prop.GetAddressOf()), hr);
|
||||
AssertRetHRESULT(hr = prop->GetUInt32(&id), hr);
|
||||
|
||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||
if (obs) {
|
||||
NS_ConvertASCIItoUTF16 idStr(nsPrintfCString("%lu", id));
|
||||
obs->NotifyObservers(nullptr, "metro-settings-entry-selected", idStr.BeginReading());
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void
|
||||
FrameworkView::AddSetting(ISettingsPaneCommandsRequestedEventArgs* aArgs,
|
||||
uint32_t aId, HString& aSettingName)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
ComPtr<ABI::Windows::UI::ApplicationSettings::ISettingsPaneCommandsRequest> request;
|
||||
AssertHRESULT(aArgs->get_Request(request.GetAddressOf()));
|
||||
|
||||
// ApplicationCommands - vector that holds SettingsCommand to be invoked
|
||||
ComPtr<IVector<ABI::Windows::UI::ApplicationSettings::SettingsCommand*>> list;
|
||||
AssertHRESULT(request->get_ApplicationCommands(list.GetAddressOf()));
|
||||
|
||||
ComPtr<IUICommand> command;
|
||||
ComPtr<ISettingsCommandFactory> factory;
|
||||
hr = GetActivationFactory(HStringReference(RuntimeClass_Windows_UI_ApplicationSettings_SettingsCommand).Get(),
|
||||
factory.GetAddressOf());
|
||||
AssertHRESULT(hr);
|
||||
|
||||
// Create the IInspectable string property that identifies this command
|
||||
ComPtr<IInspectable> prop;
|
||||
ComPtr<IPropertyValueStatics> propStatics;
|
||||
hr = GetActivationFactory(HStringReference(RuntimeClass_Windows_Foundation_PropertyValue).Get(),
|
||||
propStatics.GetAddressOf());
|
||||
AssertHRESULT(hr);
|
||||
hr = propStatics->CreateUInt32(aId, prop.GetAddressOf());
|
||||
AssertHRESULT(hr);
|
||||
|
||||
// Create the command
|
||||
hr = factory->CreateSettingsCommand(prop.Get(), aSettingName.Get(),
|
||||
Callback<ABI::Windows::UI::Popups::IUICommandInvokedHandler>(
|
||||
this, &FrameworkView::OnSettingsCommandInvoked).Get(), command.GetAddressOf());
|
||||
AssertHRESULT(hr);
|
||||
|
||||
// Add it to the list
|
||||
hr = list->Append(command.Get());
|
||||
AssertHRESULT(hr);
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::OnSettingsCommandsRequested(ISettingsPane* aPane,
|
||||
ISettingsPaneCommandsRequestedEventArgs* aArgs)
|
||||
{
|
||||
if (!sSettingsArray)
|
||||
return E_FAIL;
|
||||
if (!sSettingsArray->Length())
|
||||
return S_OK;
|
||||
for (uint32_t i = 0; i < sSettingsArray->Length(); i++) {
|
||||
HString label;
|
||||
label.Set(sSettingsArray->ElementAt(i).BeginReading());
|
||||
AddSetting(aArgs, i, label);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::OnPlayToSourceRequested(IPlayToManager* aPlayToManager,
|
||||
IPlayToSourceRequestedEventArgs* aArgs)
|
||||
{
|
||||
// TODO: Implement PlayTo, find the element on the page and then do something similar to this:
|
||||
// PlayToReceiver::Dispatcher.Helper.BeginInvoke(
|
||||
// mMediaElement = ref new Windows::UI::Xaml::Controls::MediaElement();
|
||||
// mMediaElement->Source = ref new Uri("http://www.youtube.com/watch?v=2U0NFgoNI7s");
|
||||
// aArgs->SourceRequest->SetSource(mMediaElement->PlayToSource);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::OnPrintTaskSourceRequested(IPrintTaskSourceRequestedArgs* aArgs)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::OnPrintTaskRequested(IPrintManager* aPrintManager,
|
||||
IPrintTaskRequestedEventArgs* aArgs)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void
|
||||
FrameworkView::CreatePrintControl(IPrintDocumentPackageTarget* docPackageTarget,
|
||||
D2D1_PRINT_CONTROL_PROPERTIES* printControlProperties)
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT
|
||||
FrameworkView::ClosePrintControl()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Print out one page, with the given print ticket.
|
||||
// This sample has only one page and we ignore pageNumber below.
|
||||
void FrameworkView::PrintPage(uint32_t pageNumber,
|
||||
D2D1_RECT_F imageableArea,
|
||||
D2D1_SIZE_F pageSize,
|
||||
IStream* pagePrintTicketStream)
|
||||
{
|
||||
}
|
||||
|
||||
} } }
|
||||
@@ -1,96 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#pragma once
|
||||
|
||||
/* this file is included by exe stubs, don't pull xpcom into it. */
|
||||
|
||||
#include <d3d10_1.h>
|
||||
#include <dxgi.h>
|
||||
#include <d3d10misc.h>
|
||||
|
||||
/*
|
||||
* Checks to see if the d3d implementation supports feature level 9.3 or
|
||||
* above. Metrofx can't run on systems that fail this check.
|
||||
*
|
||||
* Note, this can hit perf, don't call this unless you absolutely have to.
|
||||
* Both the ceh and winrt widget code save a cached result in the registry.
|
||||
*/
|
||||
static bool D3DFeatureLevelCheck()
|
||||
{
|
||||
HMODULE dxgiModule = LoadLibraryA("dxgi.dll");
|
||||
if (!dxgiModule) {
|
||||
return false;
|
||||
}
|
||||
decltype(CreateDXGIFactory1)* createDXGIFactory1 =
|
||||
(decltype(CreateDXGIFactory1)*) GetProcAddress(dxgiModule, "CreateDXGIFactory1");
|
||||
if (!createDXGIFactory1) {
|
||||
FreeLibrary(dxgiModule);
|
||||
return false;
|
||||
}
|
||||
|
||||
HMODULE d3d10module = LoadLibraryA("d3d10_1.dll");
|
||||
if (!d3d10module) {
|
||||
FreeLibrary(dxgiModule);
|
||||
return false;
|
||||
}
|
||||
decltype(D3D10CreateDevice1)* createD3DDevice =
|
||||
(decltype(D3D10CreateDevice1)*) GetProcAddress(d3d10module,
|
||||
"D3D10CreateDevice1");
|
||||
if (!createD3DDevice) {
|
||||
FreeLibrary(d3d10module);
|
||||
FreeLibrary(dxgiModule);
|
||||
return false;
|
||||
}
|
||||
|
||||
IDXGIFactory1* factory1;
|
||||
if (FAILED(createDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&factory1))) {
|
||||
FreeLibrary(d3d10module);
|
||||
FreeLibrary(dxgiModule);
|
||||
return false;
|
||||
}
|
||||
|
||||
IDXGIAdapter1* adapter1;
|
||||
if (FAILED(factory1->EnumAdapters1(0, &adapter1))) {
|
||||
factory1->Release();
|
||||
FreeLibrary(d3d10module);
|
||||
FreeLibrary(dxgiModule);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Try for DX10.1
|
||||
ID3D10Device1* device;
|
||||
if (FAILED(createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, nullptr,
|
||||
D3D10_CREATE_DEVICE_BGRA_SUPPORT |
|
||||
D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
|
||||
D3D10_FEATURE_LEVEL_10_1,
|
||||
D3D10_1_SDK_VERSION, &device))) {
|
||||
// Try for DX10
|
||||
if (FAILED(createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, nullptr,
|
||||
D3D10_CREATE_DEVICE_BGRA_SUPPORT |
|
||||
D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
|
||||
D3D10_FEATURE_LEVEL_10_0,
|
||||
D3D10_1_SDK_VERSION, &device))) {
|
||||
// Try for DX9.3 (we fall back to cairo and cairo has support for D3D 9.3)
|
||||
if (FAILED(createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, nullptr,
|
||||
D3D10_CREATE_DEVICE_BGRA_SUPPORT |
|
||||
D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
|
||||
D3D10_FEATURE_LEVEL_9_3,
|
||||
D3D10_1_SDK_VERSION, &device))) {
|
||||
adapter1->Release();
|
||||
factory1->Release();
|
||||
FreeLibrary(d3d10module);
|
||||
FreeLibrary(dxgiModule);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
device->Release();
|
||||
adapter1->Release();
|
||||
factory1->Release();
|
||||
FreeLibrary(d3d10module);
|
||||
FreeLibrary(dxgiModule);
|
||||
return true;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,293 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#pragma once
|
||||
|
||||
// Moz headers (alphabetical)
|
||||
#include "APZController.h"
|
||||
#include "keyboardlayout.h" // mModifierKeyState
|
||||
#include "nsBaseHashtable.h" // mTouches
|
||||
#include "nsHashKeys.h" // type of key for mTouches
|
||||
#include "mozwrlbase.h"
|
||||
#include "nsDeque.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
|
||||
// System headers (alphabetical)
|
||||
#include <EventToken.h> // EventRegistrationToken
|
||||
#include <stdint.h> // uint32_t
|
||||
#include <wrl\client.h> // Microsoft::WRL::ComPtr class
|
||||
#include <wrl\implements.h> // Microsoft::WRL::InspectableClass macro
|
||||
|
||||
// Moz forward declarations
|
||||
class MetroWidget;
|
||||
struct nsIntPoint;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Touch;
|
||||
}
|
||||
}
|
||||
|
||||
// Windows forward declarations
|
||||
namespace ABI {
|
||||
namespace Windows {
|
||||
namespace Devices {
|
||||
namespace Input {
|
||||
enum PointerDeviceType;
|
||||
}
|
||||
};
|
||||
namespace Foundation {
|
||||
struct Point;
|
||||
};
|
||||
namespace UI {
|
||||
namespace Core {
|
||||
struct ICoreWindow;
|
||||
struct IAcceleratorKeyEventArgs;
|
||||
struct IKeyEventArgs;
|
||||
struct IPointerEventArgs;
|
||||
};
|
||||
namespace Input {
|
||||
struct IEdgeGesture;
|
||||
struct IEdgeGestureEventArgs;
|
||||
struct IGestureRecognizer;
|
||||
struct IManipulationCompletedEventArgs;
|
||||
struct IManipulationStartedEventArgs;
|
||||
struct IManipulationUpdatedEventArgs;
|
||||
struct IPointerPoint;
|
||||
struct IRightTappedEventArgs;
|
||||
struct ITappedEventArgs;
|
||||
struct ManipulationDelta;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
namespace winrt {
|
||||
|
||||
class MetroInput : public Microsoft::WRL::RuntimeClass<IInspectable>,
|
||||
public APZPendingResponseFlusher
|
||||
{
|
||||
InspectableClass(L"MetroInput", BaseTrust);
|
||||
|
||||
private:
|
||||
typedef mozilla::layers::AllowedTouchBehavior AllowedTouchBehavior;
|
||||
typedef uint32_t TouchBehaviorFlags;
|
||||
|
||||
// Devices
|
||||
typedef ABI::Windows::Devices::Input::PointerDeviceType PointerDeviceType;
|
||||
|
||||
// Foundation
|
||||
typedef ABI::Windows::Foundation::Point Point;
|
||||
|
||||
// UI::Core
|
||||
typedef ABI::Windows::UI::Core::ICoreWindow ICoreWindow;
|
||||
typedef ABI::Windows::UI::Core::IAcceleratorKeyEventArgs \
|
||||
IAcceleratorKeyEventArgs;
|
||||
typedef ABI::Windows::UI::Core::IKeyEventArgs IKeyEventArgs;
|
||||
typedef ABI::Windows::UI::Core::IPointerEventArgs IPointerEventArgs;
|
||||
|
||||
// UI::Input
|
||||
typedef ABI::Windows::UI::Input::IEdgeGesture IEdgeGesture;
|
||||
typedef ABI::Windows::UI::Input::IEdgeGestureEventArgs IEdgeGestureEventArgs;
|
||||
typedef ABI::Windows::UI::Input::IGestureRecognizer IGestureRecognizer;
|
||||
typedef ABI::Windows::UI::Input::IManipulationCompletedEventArgs \
|
||||
IManipulationCompletedEventArgs;
|
||||
typedef ABI::Windows::UI::Input::IManipulationStartedEventArgs \
|
||||
IManipulationStartedEventArgs;
|
||||
typedef ABI::Windows::UI::Input::IManipulationUpdatedEventArgs \
|
||||
IManipulationUpdatedEventArgs;
|
||||
typedef ABI::Windows::UI::Input::IPointerPoint IPointerPoint;
|
||||
typedef ABI::Windows::UI::Input::IRightTappedEventArgs IRightTappedEventArgs;
|
||||
typedef ABI::Windows::UI::Input::ITappedEventArgs ITappedEventArgs;
|
||||
typedef ABI::Windows::UI::Input::ManipulationDelta ManipulationDelta;
|
||||
|
||||
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
|
||||
|
||||
public:
|
||||
MetroInput(MetroWidget* aWidget,
|
||||
ICoreWindow* aWindow);
|
||||
virtual ~MetroInput();
|
||||
|
||||
// These input events are received from our window. These are basic
|
||||
// pointer and keyboard press events. MetroInput responds to them
|
||||
// by sending goanna events and forwarding these input events to its
|
||||
// GestureRecognizer to be processed into more complex input events
|
||||
// (tap, rightTap, rotate, etc)
|
||||
HRESULT OnPointerPressed(ICoreWindow* aSender,
|
||||
IPointerEventArgs* aArgs);
|
||||
HRESULT OnPointerReleased(ICoreWindow* aSender,
|
||||
IPointerEventArgs* aArgs);
|
||||
HRESULT OnPointerMoved(ICoreWindow* aSender,
|
||||
IPointerEventArgs* aArgs);
|
||||
HRESULT OnPointerEntered(ICoreWindow* aSender,
|
||||
IPointerEventArgs* aArgs);
|
||||
HRESULT OnPointerExited(ICoreWindow* aSender,
|
||||
IPointerEventArgs* aArgs);
|
||||
|
||||
// The Edge gesture event is special. It does not come from our window
|
||||
// or from our GestureRecognizer.
|
||||
HRESULT OnEdgeGestureStarted(IEdgeGesture* aSender,
|
||||
IEdgeGestureEventArgs* aArgs);
|
||||
HRESULT OnEdgeGestureCanceled(IEdgeGesture* aSender,
|
||||
IEdgeGestureEventArgs* aArgs);
|
||||
HRESULT OnEdgeGestureCompleted(IEdgeGesture* aSender,
|
||||
IEdgeGestureEventArgs* aArgs);
|
||||
|
||||
// Swipe gesture callback from the GestureRecognizer.
|
||||
HRESULT OnManipulationCompleted(IGestureRecognizer* aSender,
|
||||
IManipulationCompletedEventArgs* aArgs);
|
||||
|
||||
// Tap gesture callback from the GestureRecognizer.
|
||||
HRESULT OnTapped(IGestureRecognizer* aSender, ITappedEventArgs* aArgs);
|
||||
HRESULT OnRightTapped(IGestureRecognizer* aSender,
|
||||
IRightTappedEventArgs* aArgs);
|
||||
|
||||
void HandleTap(const Point& aPoint, unsigned int aTapCount);
|
||||
void HandleLongTap(const Point& aPoint);
|
||||
|
||||
// The APZPendingResponseFlusher implementation
|
||||
void FlushPendingContentResponse();
|
||||
|
||||
static bool IsInputModeImprecise();
|
||||
|
||||
private:
|
||||
Microsoft::WRL::ComPtr<ICoreWindow> mWindow;
|
||||
Microsoft::WRL::ComPtr<MetroWidget> mWidget;
|
||||
Microsoft::WRL::ComPtr<IGestureRecognizer> mGestureRecognizer;
|
||||
|
||||
ModifierKeyState mModifierKeyState;
|
||||
|
||||
// Tracking input level
|
||||
enum InputPrecisionLevel {
|
||||
LEVEL_PRECISE,
|
||||
LEVEL_IMPRECISE
|
||||
};
|
||||
static InputPrecisionLevel sCurrentInputLevel;
|
||||
void UpdateInputLevel(InputPrecisionLevel aInputLevel);
|
||||
|
||||
// Initialization/Uninitialization helpers
|
||||
void RegisterInputEvents();
|
||||
void UnregisterInputEvents();
|
||||
|
||||
// Hit testing for apz content
|
||||
bool mNonApzTargetForTouch;
|
||||
bool HitTestChrome(const LayoutDeviceIntPoint& pt);
|
||||
|
||||
// Event processing helpers. See function definitions for more info.
|
||||
bool TransformRefPoint(const Point& aPosition,
|
||||
LayoutDeviceIntPoint& aRefPointOut);
|
||||
void TransformTouchEvent(WidgetTouchEvent* aEvent);
|
||||
void OnPointerNonTouch(IPointerPoint* aPoint);
|
||||
void AddPointerMoveDataToRecognizer(IPointerEventArgs* aArgs);
|
||||
void InitGoannaMouseEventFromPointerPoint(WidgetMouseEvent* aEvent,
|
||||
IPointerPoint* aPoint);
|
||||
void ProcessManipulationDelta(ManipulationDelta const& aDelta,
|
||||
Point const& aPosition,
|
||||
uint32_t aMagEventType,
|
||||
uint32_t aRotEventType);
|
||||
uint16_t ProcessInputTypeForGesture(IEdgeGestureEventArgs* aArgs);
|
||||
bool ShouldDeliverInputToRecognizer();
|
||||
|
||||
// Returns array of allowed touch behaviors for touch points of given TouchEvent.
|
||||
// Note: event argument should be transformed via apzc before supplying to this method.
|
||||
void GetAllowedTouchBehavior(WidgetTouchEvent* aTransformedEvent, nsTArray<TouchBehaviorFlags>& aOutBehaviors);
|
||||
|
||||
// First, read the comment in gfx/layers/apz/src/TouchBlockState.h.
|
||||
// The following booleans track the following pieces of state:
|
||||
// mCancelable - if we have not yet notified the APZ code about the prevent-
|
||||
// default status of the current touch block. This is flipped from true
|
||||
// to false when this notification happens.
|
||||
// mRecognizerWantsEvents - If the gesture recognizer should be receiving
|
||||
// events. This is normally true, but will be set to false if the APZ
|
||||
// decides the touch block should be thrown away entirely, or if content
|
||||
// consumes the touch block.
|
||||
// XXX There is a hazard with mRecognizerWantsEvents because it is accessed
|
||||
// both in the sync and async portions of the code.
|
||||
bool mCancelable;
|
||||
bool mRecognizerWantsEvents;
|
||||
|
||||
// In the old Win32 way of doing things, we would receive a WM_TOUCH event
|
||||
// that told us the state of every touchpoint on the touch surface. If
|
||||
// multiple touchpoints had moved since the last update we would learn
|
||||
// about all their movement simultaneously.
|
||||
//
|
||||
// In the new WinRT way of doing things, we receive a separate
|
||||
// PointerPressed/PointerMoved/PointerReleased event for each touchpoint
|
||||
// that has changed.
|
||||
//
|
||||
// When we learn of touch input, we dispatch goanna events in response.
|
||||
// With the new WinRT way of doing things, we would end up sending many
|
||||
// more goanna events than we would using the Win32 mechanism. E.g.,
|
||||
// for 5 active touchpoints, we would be sending 5 times as many goanna
|
||||
// events. This caused performance to visibly degrade on modestly-powered
|
||||
// machines. In response, we no longer send touch events immediately
|
||||
// upon receiving PointerPressed or PointerMoved. Instead, we store
|
||||
// the updated touchpoint info and record the fact that the touchpoint
|
||||
// has changed. If ever we try to update a touchpoint has already
|
||||
// changed, we dispatch a touch event containing all the changed touches.
|
||||
void InitTouchEventTouchList(WidgetTouchEvent* aEvent);
|
||||
nsBaseHashtable<nsUint32HashKey,
|
||||
nsRefPtr<mozilla::dom::Touch>,
|
||||
nsRefPtr<mozilla::dom::Touch> > mTouches;
|
||||
|
||||
// These registration tokens are set when we register ourselves to receive
|
||||
// events from our window. We must hold on to them for the entire duration
|
||||
// that we want to receive these events. When we are done, we must
|
||||
// unregister ourself with the window using these tokens.
|
||||
EventRegistrationToken mTokenPointerPressed;
|
||||
EventRegistrationToken mTokenPointerReleased;
|
||||
EventRegistrationToken mTokenPointerMoved;
|
||||
EventRegistrationToken mTokenPointerEntered;
|
||||
EventRegistrationToken mTokenPointerExited;
|
||||
|
||||
// When we register ourselves to handle edge gestures, we receive a
|
||||
// token. To we unregister ourselves, we must use the token we received.
|
||||
EventRegistrationToken mTokenEdgeStarted;
|
||||
EventRegistrationToken mTokenEdgeCanceled;
|
||||
EventRegistrationToken mTokenEdgeCompleted;
|
||||
|
||||
// These registration tokens are set when we register ourselves to receive
|
||||
// events from our GestureRecognizer. It's probably not a huge deal if we
|
||||
// don't unregister ourselves with our GestureRecognizer before destroying
|
||||
// the GestureRecognizer, but it can't hurt.
|
||||
EventRegistrationToken mTokenManipulationCompleted;
|
||||
EventRegistrationToken mTokenTapped;
|
||||
EventRegistrationToken mTokenRightTapped;
|
||||
|
||||
// Due to a limitation added in 8.1 the ui thread can't re-enter the main
|
||||
// native event dispatcher in MetroAppShell. So all events delivered to us
|
||||
// on the ui thread via a native event dispatch call get bounced through
|
||||
// the goanna thread event queue using runnables. Most events can be sent
|
||||
// async without the need to see the status result. Those that do have
|
||||
// specialty callbacks. Note any event that arrives to us on the ui thread
|
||||
// that originates from another thread is safe to send sync.
|
||||
|
||||
// Async event dispatching
|
||||
void DispatchAsyncEventIgnoreStatus(WidgetInputEvent* aEvent);
|
||||
void DispatchAsyncTouchEvent(WidgetTouchEvent* aEvent);
|
||||
|
||||
// Async event callbacks
|
||||
void DeliverNextQueuedEventIgnoreStatus();
|
||||
void DeliverNextQueuedTouchEvent();
|
||||
|
||||
void HandleTouchStartEvent(WidgetTouchEvent* aEvent);
|
||||
void HandleFirstTouchMoveEvent(WidgetTouchEvent* aEvent);
|
||||
void SendPointerCancelToContent(const WidgetTouchEvent& aEvent);
|
||||
bool SendPendingResponseToApz();
|
||||
void CancelGesture();
|
||||
|
||||
// Sync event dispatching
|
||||
void DispatchEventIgnoreStatus(WidgetGUIEvent* aEvent);
|
||||
|
||||
nsDeque mInputEventQueue;
|
||||
mozilla::layers::ScrollableLayerGuid mTargetAPZCGuid;
|
||||
uint64_t mInputBlockId;
|
||||
static nsEventStatus sThrowawayStatus;
|
||||
};
|
||||
|
||||
} } }
|
||||
@@ -1,175 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
const Cr = Components.results;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function MetroUIUtils() {
|
||||
}
|
||||
|
||||
const URLElements = {
|
||||
"a": "href",
|
||||
"applet": ["archive", "code", "codebase"],
|
||||
"area": "href",
|
||||
"audio": "src",
|
||||
"base": "href",
|
||||
"blockquote": ["cite"],
|
||||
"body": "background",
|
||||
"button": "formaction",
|
||||
"command": "icon",
|
||||
"del": ["cite"],
|
||||
"embed": "src",
|
||||
"form": "action",
|
||||
"frame": ["longdesc", "src"],
|
||||
"iframe": ["longdesc", "src"],
|
||||
"img": ["longdesc", "src"],
|
||||
"input": ["formaction", "src"],
|
||||
"ins": ["cite"],
|
||||
"link": "href",
|
||||
"object": ["archive", "codebase", "data"],
|
||||
"q": ["cite"],
|
||||
"script": "src",
|
||||
"source": "src",
|
||||
};
|
||||
|
||||
MetroUIUtils.prototype = {
|
||||
classID : Components.ID("e4626085-17f7-4068-a225-66c1acc0485c"),
|
||||
QueryInterface : XPCOMUtils.generateQI([Ci.nsIMetroUIUtils]),
|
||||
/**
|
||||
* Loads the specified panel in the browser.
|
||||
* @ param aPanelId The identifier of the pane to load
|
||||
*/
|
||||
showPanel: function(aPanelId) {
|
||||
let browserWin = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
browserWin.PanelUI.show(aPanelId);
|
||||
},
|
||||
|
||||
/**
|
||||
* Determines if the browser has selected content
|
||||
*/
|
||||
get hasSelectedContent() {
|
||||
try {
|
||||
let browserWin = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let tabBrowser = browserWin.getBrowser();
|
||||
if (!browserWin || !tabBrowser || !tabBrowser.contentWindow) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let sel = tabBrowser.contentWindow.getSelection();
|
||||
return sel && sel.toString();
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Obtains the current page title
|
||||
*/
|
||||
get currentPageTitle() {
|
||||
let browserWin = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
if (!browserWin || !browserWin.content || !browserWin.content.document) {
|
||||
throw Cr.NS_ERROR_FAILURE;
|
||||
}
|
||||
return browserWin.content.document.title || "";
|
||||
},
|
||||
|
||||
/**
|
||||
* Obtains the current page URI
|
||||
*/
|
||||
get currentPageURI() {
|
||||
let browserWin = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
if (!browserWin || !browserWin.content || !browserWin.content.document) {
|
||||
throw Cr.NS_ERROR_FAILURE;
|
||||
}
|
||||
return browserWin.content.document.URL || "";
|
||||
},
|
||||
|
||||
/**
|
||||
* Determines the text that should be shared
|
||||
*/
|
||||
get shareText() {
|
||||
let browserWin = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let tabBrowser = browserWin.getBrowser();
|
||||
if (browserWin && tabBrowser && tabBrowser.contentWindow) {
|
||||
let sel = tabBrowser.contentWindow.getSelection();
|
||||
if (sel && sel.rangeCount)
|
||||
return sel;
|
||||
}
|
||||
|
||||
throw Cr.NS_ERROR_FAILURE;
|
||||
},
|
||||
|
||||
/**
|
||||
* Replaces the node's attribute value to be a fully qualified URL
|
||||
*/
|
||||
_expandAttribute : function(ioService, doc, node, attrName) {
|
||||
let attrValue = node.getAttribute(attrName);
|
||||
if (!attrValue)
|
||||
return;
|
||||
|
||||
try {
|
||||
let uri = ioService.newURI(attrValue, null, doc.baseURIObject);
|
||||
node.setAttribute(attrName, uri.spec);
|
||||
} catch (e) {
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* Replaces all attribute values in 'n' which contain URLs recursiely
|
||||
* to fully qualified URLs.
|
||||
*/
|
||||
_expandURLs: function(doc, n) {
|
||||
let ioService = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
for (let i = 0; i < n.children.length; i++) {
|
||||
let child = n.children[i];
|
||||
let childTagName = child.tagName.toLowerCase();
|
||||
|
||||
// Iterate through all known tags which can contain URLs. A tag either
|
||||
// contains a single attribute name or an array of attribute names.
|
||||
for (let tagName in URLElements) {
|
||||
if (tagName === childTagName) {
|
||||
if (URLElements[tagName] instanceof Array) {
|
||||
URLElements[tagName].forEach(function(attrName) {
|
||||
this._expandAttribute(ioService ,doc, child, attrName);
|
||||
}, this);
|
||||
} else {
|
||||
this._expandAttribute(ioService ,doc, child, URLElements[tagName]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this._expandURLs(doc, child);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Determines the HTML that should be shared
|
||||
*/
|
||||
get shareHTML() {
|
||||
let browserWin = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let tabBrowser = browserWin.getBrowser();
|
||||
let sel;
|
||||
if (browserWin && tabBrowser && tabBrowser.contentWindow &&
|
||||
(sel = tabBrowser.contentWindow.getSelection()) && sel.rangeCount) {
|
||||
let div = tabBrowser.contentWindow.document.createElement("DIV");
|
||||
for (let i = 0; i < sel.rangeCount; i++) {
|
||||
let contents = sel.getRangeAt(i).cloneContents(true);
|
||||
div.appendChild(contents);
|
||||
}
|
||||
this._expandURLs(tabBrowser.contentWindow.document, div);
|
||||
return div.outerHTML;
|
||||
}
|
||||
|
||||
throw Cr.NS_ERROR_FAILURE;
|
||||
}
|
||||
};
|
||||
|
||||
var component = [MetroUIUtils];
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory(component);
|
||||
@@ -1,3 +0,0 @@
|
||||
# MetroUIUtils.js
|
||||
component {e4626085-17f7-4068-a225-66c1acc0485c} MetroUIUtils.js
|
||||
contract @mozilla.org/metro-ui-utils;1 {e4626085-17f7-4068-a225-66c1acc0485c}
|
||||
@@ -1,190 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "MetroUtils.h"
|
||||
#include <windows.h>
|
||||
#include "nsICommandLineRunner.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIBrowserDOMWindow.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMChromeWindow.h"
|
||||
#include "nsIWindowMediator.h"
|
||||
#include "nsIURI.h"
|
||||
#include "prlog.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
#include <wrl/wrappers/corewrappers.h>
|
||||
#include <windows.ui.applicationsettings.h>
|
||||
#include <windows.graphics.display.h>
|
||||
#include "DisplayInfo_sdk81.h"
|
||||
|
||||
using namespace ABI::Windows::UI::ApplicationSettings;
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
using namespace ABI::Windows::Foundation;
|
||||
using namespace Microsoft::WRL;
|
||||
using namespace Microsoft::WRL::Wrappers;
|
||||
using namespace ABI::Windows::UI::ViewManagement;
|
||||
using namespace ABI::Windows::Graphics::Display;
|
||||
|
||||
// Conversion between logical and physical coordinates
|
||||
|
||||
double
|
||||
MetroUtils::LogToPhysFactor()
|
||||
{
|
||||
ComPtr<IDisplayInformationStatics> dispInfoStatics;
|
||||
if (SUCCEEDED(GetActivationFactory(HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayInformation).Get(),
|
||||
dispInfoStatics.GetAddressOf()))) {
|
||||
ComPtr<IDisplayInformation> dispInfo;
|
||||
if (SUCCEEDED(dispInfoStatics->GetForCurrentView(&dispInfo))) {
|
||||
FLOAT dpi;
|
||||
if (SUCCEEDED(dispInfo->get_LogicalDpi(&dpi))) {
|
||||
return (double)dpi / 96.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ComPtr<IDisplayPropertiesStatics> dispProps;
|
||||
if (SUCCEEDED(GetActivationFactory(HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayProperties).Get(),
|
||||
dispProps.GetAddressOf()))) {
|
||||
FLOAT dpi;
|
||||
if (SUCCEEDED(dispProps->get_LogicalDpi(&dpi))) {
|
||||
return (double)dpi / 96.0f;
|
||||
}
|
||||
}
|
||||
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
double
|
||||
MetroUtils::PhysToLogFactor()
|
||||
{
|
||||
return 1.0 / LogToPhysFactor();
|
||||
}
|
||||
|
||||
double
|
||||
MetroUtils::ScaleFactor()
|
||||
{
|
||||
// Return the resolution scale factor reported by the metro environment.
|
||||
// XXX TODO: also consider the desktop resolution setting, as IE appears to do?
|
||||
ComPtr<IDisplayInformationStatics> dispInfoStatics;
|
||||
if (SUCCEEDED(GetActivationFactory(HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayInformation).Get(),
|
||||
dispInfoStatics.GetAddressOf()))) {
|
||||
ComPtr<IDisplayInformation> dispInfo;
|
||||
if (SUCCEEDED(dispInfoStatics->GetForCurrentView(&dispInfo))) {
|
||||
ResolutionScale scale;
|
||||
if (SUCCEEDED(dispInfo->get_ResolutionScale(&scale))) {
|
||||
return (double)scale / 100.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ComPtr<IDisplayPropertiesStatics> dispProps;
|
||||
if (SUCCEEDED(GetActivationFactory(HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayProperties).Get(),
|
||||
dispProps.GetAddressOf()))) {
|
||||
ResolutionScale scale;
|
||||
if (SUCCEEDED(dispProps->get_ResolutionScale(&scale))) {
|
||||
return (double)scale / 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
nsIntPoint
|
||||
MetroUtils::LogToPhys(const Point& aPt)
|
||||
{
|
||||
double factor = LogToPhysFactor();
|
||||
return nsIntPoint(int32_t(NS_round(aPt.X * factor)), int32_t(NS_round(aPt.Y * factor)));
|
||||
}
|
||||
|
||||
nsIntRect
|
||||
MetroUtils::LogToPhys(const Rect& aRect)
|
||||
{
|
||||
double factor = LogToPhysFactor();
|
||||
return nsIntRect(int32_t(NS_round(aRect.X * factor)),
|
||||
int32_t(NS_round(aRect.Y * factor)),
|
||||
int32_t(NS_round(aRect.Width * factor)),
|
||||
int32_t(NS_round(aRect.Height * factor)));
|
||||
}
|
||||
|
||||
Point
|
||||
MetroUtils::PhysToLog(const nsIntPoint& aPt)
|
||||
{
|
||||
// Points contain FLOATs
|
||||
FLOAT factor = (FLOAT)PhysToLogFactor();
|
||||
Point p = { FLOAT(aPt.x) * factor, FLOAT(aPt.y) * factor };
|
||||
return p;
|
||||
}
|
||||
|
||||
nsresult
|
||||
MetroUtils::FireObserver(const char* aMessage, const char16_t* aData)
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
mozilla::services::GetObserverService();
|
||||
if (observerService) {
|
||||
return observerService->NotifyObservers(nullptr, aMessage, aData);
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
HRESULT MetroUtils::CreateUri(HSTRING aUriStr, ComPtr<IUriRuntimeClass>& aUriOut)
|
||||
{
|
||||
HRESULT hr;
|
||||
ComPtr<IUriRuntimeClassFactory> uriFactory;
|
||||
hr = GetActivationFactory(HStringReference(RuntimeClass_Windows_Foundation_Uri).Get(), &uriFactory);
|
||||
AssertRetHRESULT(hr, hr);
|
||||
ComPtr<IUriRuntimeClass> uri;
|
||||
return uriFactory->CreateUri(aUriStr, &aUriOut);
|
||||
}
|
||||
|
||||
HRESULT MetroUtils::CreateUri(HString& aHString, ComPtr<IUriRuntimeClass>& aUriOut)
|
||||
{
|
||||
return MetroUtils::CreateUri(aHString.Get(), aUriOut);
|
||||
}
|
||||
|
||||
HRESULT
|
||||
MetroUtils::GetViewState(ApplicationViewState& aState)
|
||||
{
|
||||
HRESULT hr;
|
||||
ComPtr<IApplicationViewStatics> appViewStatics;
|
||||
hr = GetActivationFactory(HStringReference(RuntimeClass_Windows_UI_ViewManagement_ApplicationView).Get(),
|
||||
appViewStatics.GetAddressOf());
|
||||
AssertRetHRESULT(hr, hr);
|
||||
hr = appViewStatics->get_Value(&aState);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
MetroUtils::TryUnsnap(bool* aResult)
|
||||
{
|
||||
HRESULT hr;
|
||||
ComPtr<IApplicationViewStatics> appViewStatics;
|
||||
hr = GetActivationFactory(HStringReference(RuntimeClass_Windows_UI_ViewManagement_ApplicationView).Get(),
|
||||
appViewStatics.GetAddressOf());
|
||||
AssertRetHRESULT(hr, hr);
|
||||
boolean success = false;
|
||||
hr = appViewStatics->TryUnsnap(&success);
|
||||
if (aResult)
|
||||
*aResult = success;
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
MetroUtils::ShowSettingsFlyout()
|
||||
{
|
||||
ComPtr<ISettingsPaneStatics> settingsPaneStatics;
|
||||
HRESULT hr = GetActivationFactory(HStringReference(RuntimeClass_Windows_UI_ApplicationSettings_SettingsPane).Get(),
|
||||
settingsPaneStatics.GetAddressOf());
|
||||
if (SUCCEEDED(hr)) {
|
||||
settingsPaneStatics->Show();
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "nsDebug.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsPoint.h"
|
||||
#include "WinUtils.h"
|
||||
|
||||
#include "mozwrlbase.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.foundation.h>
|
||||
#include <windows.ui.viewmanagement.h>
|
||||
|
||||
// HRESULT checkers, these warn on failure in debug builds
|
||||
#ifdef DEBUG
|
||||
#define DebugLogHR(hr) LogHRESULT(hr)
|
||||
#else
|
||||
#define DebugLogHR(hr)
|
||||
#endif
|
||||
#define AssertHRESULT(hr) \
|
||||
if (FAILED(hr)) { \
|
||||
DebugLogHR(hr); \
|
||||
return; \
|
||||
}
|
||||
#define AssertRetHRESULT(hr, res) \
|
||||
if (FAILED(hr)) { \
|
||||
DebugLogHR(hr); \
|
||||
return res; \
|
||||
}
|
||||
|
||||
// MS Point helpers
|
||||
#define POINT_CEIL_X(position) (uint32_t)ceil(position.X)
|
||||
#define POINT_CEIL_Y(position) (uint32_t)ceil(position.Y)
|
||||
|
||||
class nsIBrowserDOMWindow;
|
||||
class nsIDOMWindow;
|
||||
struct nsIntRect;
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
namespace winrt {
|
||||
|
||||
template<unsigned int size, typename T>
|
||||
HRESULT ActivateGenericInstance(wchar_t const (&RuntimeClassName)[size], Microsoft::WRL::ComPtr<T>& aOutObject) {
|
||||
Microsoft::WRL::ComPtr<IActivationFactory> factory;
|
||||
HRESULT hr = ABI::Windows::Foundation::GetActivationFactory(Microsoft::WRL::Wrappers::HStringReference(RuntimeClassName).Get(),
|
||||
factory.GetAddressOf());
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
Microsoft::WRL::ComPtr<IInspectable> inspect;
|
||||
hr = factory->ActivateInstance(inspect.GetAddressOf());
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
return inspect.As(&aOutObject);
|
||||
}
|
||||
|
||||
} } }
|
||||
|
||||
class MetroUtils
|
||||
{
|
||||
typedef ABI::Windows::Foundation::IUriRuntimeClass IUriRuntimeClass;
|
||||
typedef Microsoft::WRL::Wrappers::HString HString;
|
||||
typedef ABI::Windows::UI::ViewManagement::ApplicationViewState ApplicationViewState;
|
||||
typedef ABI::Windows::Foundation::Point Point;
|
||||
typedef ABI::Windows::Foundation::Rect Rect;
|
||||
|
||||
public:
|
||||
// Functions to convert between logical pixels as used by most Windows APIs
|
||||
// and physical (device) pixels.
|
||||
static double LogToPhysFactor();
|
||||
static double PhysToLogFactor();
|
||||
static nsIntPoint LogToPhys(const Point& aPt);
|
||||
static nsIntRect LogToPhys(const Rect& aRect);
|
||||
static Point PhysToLog(const nsIntPoint& aPt);
|
||||
|
||||
// Resolution scale factor
|
||||
static double ScaleFactor();
|
||||
|
||||
static nsresult FireObserver(const char* aMessage, const char16_t* aData = nullptr);
|
||||
|
||||
static HRESULT CreateUri(HSTRING aUriStr, Microsoft::WRL::ComPtr<IUriRuntimeClass>& aUriOut);
|
||||
static HRESULT CreateUri(HString& aHString, Microsoft::WRL::ComPtr<IUriRuntimeClass>& aUriOut);
|
||||
static HRESULT GetViewState(ApplicationViewState& aState);
|
||||
static HRESULT TryUnsnap(bool* aResult = nullptr);
|
||||
static HRESULT ShowSettingsFlyout();
|
||||
|
||||
private:
|
||||
static nsresult GetBrowserDOMWindow(nsCOMPtr<nsIBrowserDOMWindow> &aBWin);
|
||||
static nsresult GetMostRecentWindow(const char16_t* aType, nsIDOMWindow** aWindow);
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,277 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsdefs.h"
|
||||
#include "prlog.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsBaseWidget.h"
|
||||
#include "nsWindowBase.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsWindowDbg.h"
|
||||
#include "WindowHook.h"
|
||||
#include "TaskbarWindowPreview.h"
|
||||
#include "nsIdleService.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "mozilla/a11y/Accessible.h"
|
||||
#endif
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/layers/CompositorParent.h"
|
||||
#include "mozilla/layers/LayerManagerComposite.h"
|
||||
#include "nsDeque.h"
|
||||
#include "APZController.h"
|
||||
|
||||
#include "mozwrlbase.h"
|
||||
|
||||
#include <windows.system.h>
|
||||
#include <windows.ui.core.h>
|
||||
#include <Windows.ApplicationModel.core.h>
|
||||
#include <Windows.ApplicationModel.h>
|
||||
#include <Windows.Applicationmodel.Activation.h>
|
||||
|
||||
class nsNativeDragTarget;
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
namespace winrt {
|
||||
|
||||
class APZPendingResponseFlusher;
|
||||
class FrameworkView;
|
||||
|
||||
} } }
|
||||
|
||||
class DispatchMsg;
|
||||
|
||||
class MetroWidget : public nsWindowBase,
|
||||
public nsIObserver
|
||||
{
|
||||
typedef uint32_t TouchBehaviorFlags;
|
||||
|
||||
typedef mozilla::widget::WindowHook WindowHook;
|
||||
typedef mozilla::widget::TaskbarWindowPreview TaskbarWindowPreview;
|
||||
typedef ABI::Windows::UI::Input::IPointerPoint IPointerPoint;
|
||||
typedef ABI::Windows::UI::Core::IPointerEventArgs IPointerEventArgs;
|
||||
typedef ABI::Windows::UI::Core::IKeyEventArgs IKeyEventArgs;
|
||||
typedef ABI::Windows::UI::Core::ICharacterReceivedEventArgs ICharacterReceivedEventArgs;
|
||||
typedef mozilla::widget::winrt::FrameworkView FrameworkView;
|
||||
typedef mozilla::widget::winrt::APZController APZController;
|
||||
typedef mozilla::widget::winrt::APZPendingResponseFlusher APZPendingResponseFlusher;
|
||||
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
|
||||
|
||||
static LRESULT CALLBACK
|
||||
StaticWindowProcedure(HWND aWnd, UINT aMsg, WPARAM aWParan, LPARAM aLParam);
|
||||
LRESULT WindowProcedure(HWND aWnd, UINT aMsg, WPARAM aWParan, LPARAM aLParam);
|
||||
|
||||
public:
|
||||
MetroWidget();
|
||||
virtual ~MetroWidget();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
static HWND GetICoreWindowHWND() { return sICoreHwnd; }
|
||||
|
||||
// nsWindowBase
|
||||
virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent) override;
|
||||
virtual bool DispatchKeyboardEvent(mozilla::WidgetGUIEvent* aEvent) override;
|
||||
virtual bool DispatchScrollEvent(mozilla::WidgetGUIEvent* aEvent) override;
|
||||
virtual bool DispatchPluginEvent(const MSG &aMsg) override { return false; }
|
||||
virtual bool IsTopLevelWidget() override { return true; }
|
||||
virtual nsWindowBase* GetParentWindowBase(bool aIncludeOwner) override { return nullptr; }
|
||||
// InitEvent assumes physical coordinates and is used by shared win32 code. Do
|
||||
// not hand winrt event coordinates to this routine.
|
||||
virtual void InitEvent(mozilla::WidgetGUIEvent& aEvent,
|
||||
nsIntPoint* aPoint = nullptr) override;
|
||||
|
||||
// nsBaseWidget
|
||||
virtual void SetWidgetListener(nsIWidgetListener* aWidgetListener);
|
||||
|
||||
// nsIWidget interface
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData = nullptr);
|
||||
NS_IMETHOD Destroy();
|
||||
NS_IMETHOD EnableDragDrop(bool aEnable);
|
||||
NS_IMETHOD SetParent(nsIWidget *aNewParent);
|
||||
NS_IMETHOD Show(bool bState);
|
||||
NS_IMETHOD IsVisible(bool & aState);
|
||||
NS_IMETHOD IsEnabled(bool *aState);
|
||||
NS_IMETHOD GetBounds(nsIntRect &aRect);
|
||||
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
|
||||
NS_IMETHOD GetClientBounds(nsIntRect &aRect);
|
||||
NS_IMETHOD Invalidate(bool aEraseBackground = false,
|
||||
bool aUpdateNCArea = false,
|
||||
bool aIncludeChildren = false);
|
||||
NS_IMETHOD Invalidate(const nsIntRect & aRect);
|
||||
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
|
||||
nsEventStatus& aStatus);
|
||||
NS_IMETHOD ConstrainPosition(bool aAllowSlop, int32_t *aX, int32_t *aY);
|
||||
NS_IMETHOD Move(double aX, double aY);
|
||||
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint);
|
||||
NS_IMETHOD Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint);
|
||||
NS_IMETHOD SetFocus(bool aRaise);
|
||||
NS_IMETHOD Enable(bool aState);
|
||||
NS_IMETHOD SetCursor(nsCursor aCursor);
|
||||
NS_IMETHOD SetTitle(const nsAString& aTitle);
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener,
|
||||
bool aDoCapture);
|
||||
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
|
||||
virtual nsresult SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
||||
int32_t aNativeKeyCode,
|
||||
uint32_t aModifierFlags,
|
||||
const nsAString& aCharacters,
|
||||
const nsAString& aUnmodifiedCharacters);
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags);
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
double aDeltaX,
|
||||
double aDeltaY,
|
||||
double aDeltaZ,
|
||||
uint32_t aModifierFlags,
|
||||
uint32_t aAdditionalFlags);
|
||||
virtual bool HasPendingInputEvent();
|
||||
virtual double GetDefaultScaleInternal();
|
||||
float GetDPI();
|
||||
mozilla::LayoutDeviceIntPoint CSSIntPointToLayoutDeviceIntPoint(const mozilla::CSSIntPoint &aCSSPoint);
|
||||
void ChangedDPI();
|
||||
virtual uint32_t GetMaxTouchPoints() const override;
|
||||
virtual bool IsVisible() const;
|
||||
virtual bool IsEnabled() const;
|
||||
// ShouldUseOffMainThreadCompositing is defined in base widget
|
||||
virtual bool ShouldUseOffMainThreadCompositing();
|
||||
bool ShouldUseBasicManager();
|
||||
bool ShouldUseAPZC();
|
||||
virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
|
||||
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
|
||||
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
|
||||
bool* aAllowRetaining = nullptr);
|
||||
virtual void GetPreferredCompositorBackends(nsTArray<mozilla::layers::LayersBackend>& aHints) { aHints.AppendElement(mozilla::layers::LayersBackend::LAYERS_D3D11); }
|
||||
|
||||
// IME related interfaces
|
||||
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
|
||||
const InputContextAction& aAction);
|
||||
NS_IMETHOD_(nsIWidget::InputContext) GetInputContext();
|
||||
NS_IMETHOD GetToggledKeyState(uint32_t aKeyCode, bool* aLEDState);
|
||||
virtual nsIMEUpdatePreference GetIMEUpdatePreference() override;
|
||||
|
||||
// FrameworkView helpers
|
||||
void SizeModeChanged();
|
||||
void Activated(bool aActiveated);
|
||||
void Paint(const nsIntRegion& aInvalidRegion);
|
||||
|
||||
MetroWidget* MetroWidget::GetTopLevelWindow(bool aStopOnDialogOrPopup) { return this; }
|
||||
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
|
||||
virtual void* GetNativeData(uint32_t aDataType);
|
||||
virtual void FreeNativeData(void * data, uint32_t aDataType);
|
||||
virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset();
|
||||
|
||||
already_AddRefed<nsIPresShell> GetPresShell();
|
||||
|
||||
void UserActivity();
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
mozilla::a11y::Accessible* DispatchAccessibleEvent(uint32_t aEventType);
|
||||
mozilla::a11y::Accessible* GetAccessible();
|
||||
#endif // ACCESSIBILITY
|
||||
|
||||
// needed for current nsIFilePicker
|
||||
void PickerOpen();
|
||||
void PickerClosed();
|
||||
bool DestroyCalled() { return false; }
|
||||
void SuppressBlurEvents(bool aSuppress);
|
||||
bool BlurEventsSuppressed();
|
||||
|
||||
// needed for nsITaskbarWindowPreview
|
||||
bool HasTaskbarIconBeenCreated() { return false; }
|
||||
void SetHasTaskbarIconBeenCreated(bool created = true) { }
|
||||
already_AddRefed<nsITaskbarWindowPreview> GetTaskbarPreview() { return nullptr; }
|
||||
void SetTaskbarPreview(nsITaskbarWindowPreview *preview) { }
|
||||
WindowHook& GetWindowHook() { return mWindowHook; }
|
||||
|
||||
void SetView(FrameworkView* aView);
|
||||
void FindMetroWindow();
|
||||
virtual void SetTransparencyMode(nsTransparencyMode aMode);
|
||||
virtual nsTransparencyMode GetTransparencyMode();
|
||||
|
||||
TouchBehaviorFlags ContentGetAllowedTouchBehavior(const nsIntPoint& aPoint);
|
||||
|
||||
// apzc controller related api
|
||||
void ApzcGetAllowedTouchBehavior(mozilla::WidgetInputEvent* aTransformedEvent, nsTArray<TouchBehaviorFlags>& aOutBehaviors);
|
||||
void ApzcSetAllowedTouchBehavior(uint64_t aInputBlockId, nsTArray<TouchBehaviorFlags>& aBehaviors);
|
||||
|
||||
// Hit test a point to see if an apzc would consume input there
|
||||
bool ApzHitTest(mozilla::ScreenIntPoint& pt);
|
||||
// Transforms a coord so that it properly targets goanna content based
|
||||
// on apzc transforms currently applied.
|
||||
void ApzTransformGoannaCoordinate(const mozilla::ScreenIntPoint& pt,
|
||||
mozilla::LayoutDeviceIntPoint* aRefPointOut);
|
||||
// send ContentRecievedTouch calls to the apz with appropriate preventDefault params
|
||||
void ApzContentConsumingTouch(uint64_t aInputBlockId);
|
||||
void ApzContentIgnoringTouch(uint64_t aInputBlockId);
|
||||
// Input handling
|
||||
nsEventStatus ApzReceiveInputEvent(mozilla::WidgetInputEvent* aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId);
|
||||
// Callback for the APZController
|
||||
void SetApzPendingResponseFlusher(APZPendingResponseFlusher* aFlusher);
|
||||
|
||||
protected:
|
||||
friend class FrameworkView;
|
||||
|
||||
struct OleInitializeWrapper {
|
||||
HRESULT const hr;
|
||||
|
||||
OleInitializeWrapper()
|
||||
: hr(::OleInitialize(nullptr))
|
||||
{
|
||||
}
|
||||
|
||||
~OleInitializeWrapper() {
|
||||
if (SUCCEEDED(hr)) {
|
||||
::OleFlushClipboard();
|
||||
::OleUninitialize();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// nsBaseWidget
|
||||
void ConfigureAPZCTreeManager() override;
|
||||
already_AddRefed<GoannaContentController> NewRootContentController() override;
|
||||
|
||||
void SetSubclass();
|
||||
void RemoveSubclass();
|
||||
nsIWidgetListener* GetPaintListener();
|
||||
|
||||
virtual nsresult NotifyIMEInternal(
|
||||
const IMENotification& aIMENotification) override;
|
||||
|
||||
// Async event dispatching
|
||||
void DispatchAsyncScrollEvent(DispatchMsg* aEvent);
|
||||
void DeliverNextScrollEvent();
|
||||
void DeliverNextKeyboardEvent();
|
||||
|
||||
protected:
|
||||
OleInitializeWrapper mOleInitializeWrapper;
|
||||
WindowHook mWindowHook;
|
||||
Microsoft::WRL::ComPtr<FrameworkView> mView;
|
||||
nsTransparencyMode mTransparencyMode;
|
||||
nsIntRegion mInvalidatedRegion;
|
||||
nsCOMPtr<nsIIdleServiceInternal> mIdleService;
|
||||
HWND mWnd;
|
||||
static HWND sICoreHwnd;
|
||||
WNDPROC mMetroWndProc;
|
||||
bool mTempBasicLayerInUse;
|
||||
uint64_t mRootLayerTreeId;
|
||||
nsDeque mEventQueue;
|
||||
nsDeque mKeyEventQueue;
|
||||
nsRefPtr<APZController> mController;
|
||||
nsRefPtr<nsNativeDragTarget> mNativeDragTarget;
|
||||
};
|
||||
@@ -1,153 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "ToastNotificationHandler.h"
|
||||
#include "MetroUtils.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "FrameworkView.h"
|
||||
|
||||
using namespace ABI::Windows::Foundation;
|
||||
using namespace ABI::Windows::Data::Xml::Dom;
|
||||
using namespace Microsoft::WRL;
|
||||
using namespace Microsoft::WRL::Wrappers;
|
||||
using namespace mozilla;
|
||||
using namespace ABI::Windows::UI::Notifications;
|
||||
|
||||
typedef __FITypedEventHandler_2_Windows__CUI__CNotifications__CToastNotification_IInspectable_t ToastActivationHandler;
|
||||
typedef __FITypedEventHandler_2_Windows__CUI__CNotifications__CToastNotification_Windows__CUI__CNotifications__CToastDismissedEventArgs ToastDismissHandler;
|
||||
|
||||
bool
|
||||
ToastNotificationHandler::DisplayNotification(HSTRING title,
|
||||
HSTRING msg,
|
||||
HSTRING imagePath,
|
||||
const nsAString& aCookie,
|
||||
const nsAString& aAppId)
|
||||
{
|
||||
mCookie = aCookie;
|
||||
|
||||
Microsoft::WRL::ComPtr<IXmlDocument> toastXml =
|
||||
InitializeXmlForTemplate(ToastTemplateType::ToastTemplateType_ToastImageAndText03);
|
||||
Microsoft::WRL::ComPtr<IXmlNodeList> toastTextElements, toastImageElements;
|
||||
Microsoft::WRL::ComPtr<IXmlNode> titleTextNodeRoot, msgTextNodeRoot, imageNodeRoot, srcAttribute;
|
||||
|
||||
HSTRING textNodeStr, imageNodeStr, srcNodeStr;
|
||||
HSTRING_HEADER textHeader, imageHeader, srcHeader;
|
||||
WindowsCreateStringReference(L"text", 4, &textHeader, &textNodeStr);
|
||||
WindowsCreateStringReference(L"image", 5, &imageHeader, &imageNodeStr);
|
||||
WindowsCreateStringReference(L"src", 3, &srcHeader, &srcNodeStr);
|
||||
toastXml->GetElementsByTagName(textNodeStr, &toastTextElements);
|
||||
toastXml->GetElementsByTagName(imageNodeStr, &toastImageElements);
|
||||
|
||||
AssertRetHRESULT(toastTextElements->Item(0, &titleTextNodeRoot), false);
|
||||
AssertRetHRESULT(toastTextElements->Item(1, &msgTextNodeRoot), false);
|
||||
AssertRetHRESULT(toastImageElements->Item(0, &imageNodeRoot), false);
|
||||
|
||||
Microsoft::WRL::ComPtr<IXmlNamedNodeMap> attributes;
|
||||
AssertRetHRESULT(imageNodeRoot->get_Attributes(&attributes), false);
|
||||
AssertRetHRESULT(attributes->GetNamedItem(srcNodeStr, &srcAttribute), false);
|
||||
|
||||
SetNodeValueString(title, titleTextNodeRoot.Get(), toastXml.Get());
|
||||
SetNodeValueString(msg, msgTextNodeRoot.Get(), toastXml.Get());
|
||||
SetNodeValueString(imagePath, srcAttribute.Get(), toastXml.Get());
|
||||
|
||||
return CreateWindowsNotificationFromXml(toastXml.Get(), aAppId);
|
||||
}
|
||||
|
||||
bool
|
||||
ToastNotificationHandler::DisplayTextNotification(HSTRING title,
|
||||
HSTRING msg,
|
||||
const nsAString& aCookie,
|
||||
const nsAString& aAppId)
|
||||
{
|
||||
mCookie = aCookie;
|
||||
|
||||
Microsoft::WRL::ComPtr<IXmlDocument> toastXml =
|
||||
InitializeXmlForTemplate(ToastTemplateType::ToastTemplateType_ToastText03);
|
||||
Microsoft::WRL::ComPtr<IXmlNodeList> toastTextElements;
|
||||
Microsoft::WRL::ComPtr<IXmlNode> titleTextNodeRoot, msgTextNodeRoot;
|
||||
|
||||
HSTRING textNodeStr;
|
||||
HSTRING_HEADER textHeader;
|
||||
WindowsCreateStringReference(L"text", 4, &textHeader, &textNodeStr);
|
||||
toastXml->GetElementsByTagName(textNodeStr, &toastTextElements);
|
||||
|
||||
AssertRetHRESULT(toastTextElements->Item(0, &titleTextNodeRoot), false);
|
||||
AssertRetHRESULT(toastTextElements->Item(1, &msgTextNodeRoot), false);
|
||||
|
||||
SetNodeValueString(title, titleTextNodeRoot.Get(), toastXml.Get());
|
||||
SetNodeValueString(msg, msgTextNodeRoot.Get(), toastXml.Get());
|
||||
|
||||
return CreateWindowsNotificationFromXml(toastXml.Get(), aAppId);
|
||||
}
|
||||
|
||||
Microsoft::WRL::ComPtr<IXmlDocument>
|
||||
ToastNotificationHandler::InitializeXmlForTemplate(ToastTemplateType templateType) {
|
||||
Microsoft::WRL::ComPtr<IXmlDocument> toastXml;
|
||||
|
||||
AssertRetHRESULT(GetActivationFactory(HStringReference(RuntimeClass_Windows_UI_Notifications_ToastNotificationManager).Get(),
|
||||
mToastNotificationManagerStatics.GetAddressOf()), nullptr);
|
||||
|
||||
mToastNotificationManagerStatics->GetTemplateContent(templateType, &toastXml);
|
||||
|
||||
return toastXml;
|
||||
}
|
||||
|
||||
bool
|
||||
ToastNotificationHandler::CreateWindowsNotificationFromXml(IXmlDocument *toastXml,
|
||||
const nsAString& aAppId)
|
||||
{
|
||||
Microsoft::WRL::ComPtr<IToastNotification> notification;
|
||||
Microsoft::WRL::ComPtr<IToastNotificationFactory> factory;
|
||||
AssertRetHRESULT(GetActivationFactory(HStringReference(RuntimeClass_Windows_UI_Notifications_ToastNotification).Get(),
|
||||
factory.GetAddressOf()), false);
|
||||
AssertRetHRESULT(factory->CreateToastNotification(toastXml, ¬ification),
|
||||
false);
|
||||
|
||||
EventRegistrationToken activatedToken;
|
||||
AssertRetHRESULT(notification->add_Activated(Callback<ToastActivationHandler>(this,
|
||||
&ToastNotificationHandler::OnActivate).Get(), &activatedToken), false);
|
||||
EventRegistrationToken dismissedToken;
|
||||
AssertRetHRESULT(notification->add_Dismissed(Callback<ToastDismissHandler>(this,
|
||||
&ToastNotificationHandler::OnDismiss).Get(), &dismissedToken), false);
|
||||
|
||||
Microsoft::WRL::ComPtr<IToastNotifier> notifier;
|
||||
if (aAppId.IsEmpty()) {
|
||||
AssertRetHRESULT(mToastNotificationManagerStatics->CreateToastNotifier(
|
||||
¬ifier), false);
|
||||
} else {
|
||||
AssertRetHRESULT(mToastNotificationManagerStatics->CreateToastNotifierWithId(
|
||||
HStringReference(PromiseFlatString(aAppId).get()).Get(),
|
||||
¬ifier), false);
|
||||
}
|
||||
AssertRetHRESULT(notifier->Show(notification.Get()), false);
|
||||
|
||||
MetroUtils::FireObserver("metro_native_toast_shown", mCookie.get());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ToastNotificationHandler::SetNodeValueString(HSTRING inputString,
|
||||
Microsoft::WRL::ComPtr<IXmlNode> node, Microsoft::WRL::ComPtr<IXmlDocument> xml) {
|
||||
Microsoft::WRL::ComPtr<IXmlText> inputText;
|
||||
Microsoft::WRL::ComPtr<IXmlNode> inputTextNode, pAppendedChild;
|
||||
|
||||
AssertHRESULT(xml->CreateTextNode(inputString, &inputText));
|
||||
AssertHRESULT(inputText.As(&inputTextNode));
|
||||
AssertHRESULT(node->AppendChild(inputTextNode.Get(), &pAppendedChild));
|
||||
}
|
||||
|
||||
HRESULT ToastNotificationHandler::OnActivate(IToastNotification *notification, IInspectable *inspectable) {
|
||||
MetroUtils::FireObserver("metro_native_toast_clicked", mCookie.get());
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
ToastNotificationHandler::OnDismiss(IToastNotification *notification,
|
||||
IToastDismissedEventArgs* aArgs)
|
||||
{
|
||||
MetroUtils::FireObserver("metro_native_toast_dismissed", mCookie.get());
|
||||
delete this;
|
||||
return S_OK;
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <windows.ui.notifications.h>
|
||||
#include <windows.data.xml.dom.h>
|
||||
#include "mozwrlbase.h"
|
||||
#include "nsString.h"
|
||||
|
||||
|
||||
class ToastNotificationHandler {
|
||||
typedef ABI::Windows::UI::Notifications::IToastNotification IToastNotification;
|
||||
typedef ABI::Windows::UI::Notifications::IToastDismissedEventArgs IToastDismissedEventArgs;
|
||||
typedef ABI::Windows::UI::Notifications::IToastNotificationManagerStatics IToastNotificationManagerStatics;
|
||||
typedef ABI::Windows::UI::Notifications::ToastTemplateType ToastTemplateType;
|
||||
typedef ABI::Windows::Data::Xml::Dom::IXmlNode IXmlNode;
|
||||
typedef ABI::Windows::Data::Xml::Dom::IXmlDocument IXmlDocument;
|
||||
|
||||
void SetNodeValueString(HSTRING inputString,Microsoft::WRL::ComPtr<IXmlNode> node,
|
||||
Microsoft::WRL::ComPtr<IXmlDocument> xml);
|
||||
public:
|
||||
ToastNotificationHandler() {};
|
||||
~ToastNotificationHandler() {};
|
||||
|
||||
bool DisplayNotification(HSTRING title, HSTRING msg, HSTRING imagePath,
|
||||
const nsAString& aCookie, const nsAString& aAppId);
|
||||
bool DisplayTextNotification(HSTRING title, HSTRING msg,
|
||||
const nsAString& aCookie,
|
||||
const nsAString& aAppId);
|
||||
HRESULT OnActivate(IToastNotification *notification, IInspectable *inspectable);
|
||||
HRESULT OnDismiss(IToastNotification *notification,
|
||||
IToastDismissedEventArgs* aArgs);
|
||||
|
||||
private:
|
||||
nsString mCookie;
|
||||
Microsoft::WRL::ComPtr<IToastNotificationManagerStatics> mToastNotificationManagerStatics;
|
||||
|
||||
bool CreateWindowsNotificationFromXml(IXmlDocument *toastXml,
|
||||
const nsAString& aAppId);
|
||||
Microsoft::WRL::ComPtr<IXmlDocument> InitializeXmlForTemplate(ToastTemplateType templateType);
|
||||
};
|
||||
@@ -1,54 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#if defined(ACCESSIBILITY)
|
||||
|
||||
#include "UIAAccessibilityBridge.h"
|
||||
#include "MetroUtils.h"
|
||||
|
||||
#include <OAIdl.h>
|
||||
|
||||
#include "nsIAccessibleEvent.h"
|
||||
#include "nsIPersistentProperties2.h"
|
||||
|
||||
// generated
|
||||
#include "UIABridge.h"
|
||||
|
||||
#include <wrl/implements.h>
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
namespace winrt {
|
||||
|
||||
using namespace Microsoft::WRL;
|
||||
|
||||
NS_IMPL_ISUPPORTS(AccessibilityBridge, nsIObserver)
|
||||
|
||||
nsresult
|
||||
AccessibilityBridge::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *aData)
|
||||
{
|
||||
nsCOMPtr<nsIAccessibleEvent> ev = do_QueryInterface(aSubject);
|
||||
if (!ev) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t eventType = 0;
|
||||
ev->GetEventType(&eventType);
|
||||
if (eventType == nsIAccessibleEvent::EVENT_FOCUS) {
|
||||
Microsoft::WRL::ComPtr<IUIABridge> bridgePtr;
|
||||
mBridge.As(&bridgePtr);
|
||||
if (bridgePtr) {
|
||||
bridgePtr->FocusChangeEvent();
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} } }
|
||||
|
||||
#endif // ACCESSIBILITY
|
||||
@@ -1,80 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(ACCESSIBILITY)
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "mozilla/a11y/Accessible.h"
|
||||
|
||||
#include "mozwrlbase.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
namespace winrt {
|
||||
|
||||
// Connects to our accessibility framework to receive
|
||||
// events and query the dom.
|
||||
class AccessibilityBridge : public nsIObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
AccessibilityBridge() {}
|
||||
|
||||
~AccessibilityBridge() {
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
bool Init(IUnknown* aBridge, mozilla::a11y::Accessible* aPtr) {
|
||||
mAccess = aPtr;
|
||||
mBridge = aBridge;
|
||||
return Connect();
|
||||
}
|
||||
|
||||
bool Connect() {
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
do_GetService("@mozilla.org/observer-service;1", &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
rv = observerService->AddObserver(this, "accessible-event", false);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Connected() {
|
||||
return mAccess ? true : false;
|
||||
}
|
||||
|
||||
void Disconnect() {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
do_GetService("@mozilla.org/observer-service;1", &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("failed to get observersvc on shutdown.");
|
||||
return;
|
||||
}
|
||||
observerService->RemoveObserver(this, "accessible-event");
|
||||
mAccess = nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<mozilla::a11y::Accessible> mAccess;
|
||||
Microsoft::WRL::ComPtr<IUnknown> mBridge;
|
||||
};
|
||||
|
||||
} } }
|
||||
|
||||
#endif // ACCESSIBILITY
|
||||
@@ -1,801 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "UIABridge.h"
|
||||
#include "MetroUtils.h"
|
||||
#include "UIABridgePrivate.h"
|
||||
#include "MetroWidget.h"
|
||||
#include "WinUtils.h"
|
||||
|
||||
#include <wrl.h>
|
||||
#include <OAIdl.h>
|
||||
#include <windows.graphics.display.h>
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
using namespace mozilla::a11y;
|
||||
#endif
|
||||
using namespace mozilla::widget;
|
||||
using namespace Microsoft::WRL;
|
||||
using namespace Microsoft::WRL::Wrappers;
|
||||
using namespace ABI::Windows::UI;
|
||||
using namespace ABI::Windows::UI::Core;
|
||||
using namespace ABI::Windows::Foundation;
|
||||
using namespace ABI::Windows::System;
|
||||
|
||||
//#define DEBUG_BRIDGE
|
||||
#if !defined(DEBUG_BRIDGE)
|
||||
#undef LogThread
|
||||
#undef LogFunction
|
||||
#define LogThread()
|
||||
#define LogFunction()
|
||||
#define BridgeLog(...)
|
||||
#else
|
||||
#define BridgeLog(...) WinUtils::Log(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
|
||||
const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
|
||||
MIDL_DEFINE_GUID(IID, IID_IUIABridge, 0xc78b35b5, 0x5db, 0x43aa, 0xae, 0x73, 0x94, 0xc2, 0x33, 0xa9, 0x3c, 0x98);
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
namespace winrt {
|
||||
|
||||
#define ProviderOptions_UseClientCoordinates (ProviderOptions)0x100
|
||||
|
||||
static int gIDIndex = 2;
|
||||
ComPtr<IUIABridge> gProviderRoot = nullptr;
|
||||
static ComPtr<IUIAElement> gElement = nullptr;
|
||||
|
||||
HRESULT
|
||||
UIABridge_CreateInstance(IInspectable **retVal)
|
||||
{
|
||||
HRESULT hr = E_OUTOFMEMORY;
|
||||
*retVal = nullptr;
|
||||
ComPtr<UIABridge> spProvider = Make<UIABridge>();
|
||||
if (spProvider != nullptr &&
|
||||
SUCCEEDED(hr = spProvider.Get()->QueryInterface(IID_PPV_ARGS(retVal))) &&
|
||||
SUCCEEDED(hr = spProvider.Get()->QueryInterface(IID_PPV_ARGS(&gProviderRoot)))) {
|
||||
return S_OK;
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIATextElement_CreateInstance(IRawElementProviderFragmentRoot* aRoot)
|
||||
{
|
||||
LogFunction();
|
||||
HRESULT hr = E_OUTOFMEMORY;
|
||||
ComPtr<UIATextElement> spProvider = Make<UIATextElement>();
|
||||
if (spProvider != nullptr &&
|
||||
SUCCEEDED(hr = spProvider.Get()->QueryInterface(IID_PPV_ARGS(&gElement)))) {
|
||||
spProvider->SetIndexID(gIDIndex++);
|
||||
return S_OK;
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
||||
// IUIABridge
|
||||
|
||||
HRESULT
|
||||
UIABridge::Init(IInspectable* aView, IInspectable* aWindow, LONG_PTR aInnerPtr)
|
||||
{
|
||||
LogFunction();
|
||||
NS_ASSERTION(aView, "invalid framework view pointer");
|
||||
NS_ASSERTION(aWindow, "invalid window pointer");
|
||||
NS_ASSERTION(aInnerPtr, "invalid Accessible pointer");
|
||||
|
||||
#if defined(ACCESSIBILITY)
|
||||
// init AccessibilityBridge and connect to accessibility
|
||||
mAccBridge = new AccessibilityBridge();
|
||||
if (!mAccBridge->Init(CastToUnknown(), (Accessible*)aInnerPtr)) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
aWindow->QueryInterface(IID_PPV_ARGS(&mWindow));
|
||||
|
||||
if (FAILED(UIATextElement_CreateInstance(this)))
|
||||
return E_FAIL;
|
||||
|
||||
mAccessible = (Accessible*)aInnerPtr;
|
||||
|
||||
return S_OK;
|
||||
#endif
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIABridge::Disconnect()
|
||||
{
|
||||
LogFunction();
|
||||
#if defined(ACCESSIBILITY)
|
||||
mAccBridge->Disconnect();
|
||||
mAccessible = nullptr;
|
||||
#endif
|
||||
mWindow = nullptr;
|
||||
gElement = nullptr;
|
||||
gProviderRoot = nullptr;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
UIABridge::Connected()
|
||||
{
|
||||
return !!mAccessible;
|
||||
}
|
||||
|
||||
// IUIAElement
|
||||
|
||||
HRESULT
|
||||
UIABridge::SetFocusInternal(LONG_PTR aAccessible)
|
||||
{
|
||||
LogFunction();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIABridge::ClearFocus()
|
||||
{
|
||||
LogFunction();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
DumpChildInfo(nsRefPtr<Accessible>& aChild)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (!aChild) {
|
||||
return;
|
||||
}
|
||||
nsString str;
|
||||
aChild->Name(str);
|
||||
BridgeLog("name: %ls", str.BeginReading());
|
||||
aChild->Description(str);
|
||||
BridgeLog("description: %ls", str.BeginReading());
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool
|
||||
ChildHasFocus(nsRefPtr<Accessible>& aChild)
|
||||
{
|
||||
BridgeLog("Focus element flags: editable:%d focusable:%d readonly:%d",
|
||||
((aChild->NativeState() & mozilla::a11y::states::EDITABLE) > 0),
|
||||
((aChild->NativeState() & mozilla::a11y::states::FOCUSABLE) > 0),
|
||||
((aChild->NativeState() & mozilla::a11y::states::READONLY) > 0));
|
||||
return (((aChild->NativeState() & mozilla::a11y::states::EDITABLE) > 0) &&
|
||||
((aChild->NativeState() & mozilla::a11y::states::READONLY) == 0));
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIABridge::FocusChangeEvent()
|
||||
{
|
||||
LogFunction();
|
||||
if (!Connected()) {
|
||||
return UIA_E_ELEMENTNOTAVAILABLE;
|
||||
}
|
||||
|
||||
nsRefPtr<Accessible> child = mAccessible->FocusedChild();
|
||||
if (!child) {
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (!ChildHasFocus(child)) {
|
||||
ComPtr<IUIAElement> element;
|
||||
gElement.As(&element);
|
||||
if (!element) {
|
||||
return S_OK;
|
||||
}
|
||||
element->ClearFocus();
|
||||
UiaRaiseAutomationEvent(this, UIA_AutomationFocusChangedEventId);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// IRawElementProviderFragmentRoot
|
||||
|
||||
HRESULT
|
||||
UIABridge::ElementProviderFromPoint(double x, double y, IRawElementProviderFragment ** retVal)
|
||||
{
|
||||
LogFunction();
|
||||
*retVal = nullptr;
|
||||
if (!Connected()) {
|
||||
return UIA_E_ELEMENTNOTAVAILABLE;
|
||||
}
|
||||
gElement.Get()->QueryInterface(IID_PPV_ARGS(retVal));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Windows calls this looking for the current focus element. Windows
|
||||
// will call here before accessible sends us any observer events through
|
||||
// the accessibility bridge, so update child focus information.
|
||||
HRESULT
|
||||
UIABridge::GetFocus(IRawElementProviderFragment ** retVal)
|
||||
{
|
||||
LogFunction();
|
||||
if (!Connected()) {
|
||||
return UIA_E_ELEMENTNOTAVAILABLE;
|
||||
}
|
||||
|
||||
nsRefPtr<Accessible> child = mAccessible->FocusedChild();
|
||||
if (!child) {
|
||||
BridgeLog("mAccessible->GetFocusedChild failed.");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
DumpChildInfo(child);
|
||||
|
||||
ComPtr<IUIAElement> element;
|
||||
gElement.As(&element);
|
||||
if (!element) {
|
||||
BridgeLog("gElement as IUIAElement failed.");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (!ChildHasFocus(child)) {
|
||||
element->ClearFocus();
|
||||
} else {
|
||||
element->SetFocusInternal((LONG_PTR)child.get());
|
||||
element.Get()->QueryInterface(IID_PPV_ARGS(retVal));
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// IRawElementProviderFragment
|
||||
|
||||
HRESULT
|
||||
UIABridge::Navigate(NavigateDirection direction, IRawElementProviderFragment ** retVal)
|
||||
{
|
||||
LogFunction();
|
||||
if (!Connected()) {
|
||||
return UIA_E_ELEMENTNOTAVAILABLE;
|
||||
}
|
||||
*retVal = nullptr;
|
||||
|
||||
switch(direction) {
|
||||
case NavigateDirection_Parent:
|
||||
BridgeLog("UIABridge::Navigate NavigateDirection_Parent");
|
||||
break;
|
||||
case NavigateDirection_NextSibling:
|
||||
BridgeLog("UIABridge::Navigate NavigateDirection_NextSibling");
|
||||
break;
|
||||
case NavigateDirection_PreviousSibling:
|
||||
BridgeLog("UIABridge::Navigate NavigateDirection_PreviousSibling");
|
||||
break;
|
||||
case NavigateDirection_FirstChild:
|
||||
BridgeLog("UIABridge::Navigate NavigateDirection_FirstChild");
|
||||
gElement.Get()->QueryInterface(IID_PPV_ARGS(retVal));
|
||||
break;
|
||||
case NavigateDirection_LastChild:
|
||||
BridgeLog("UIABridge::Navigate NavigateDirection_LastChild");
|
||||
gElement.Get()->QueryInterface(IID_PPV_ARGS(retVal));
|
||||
break;
|
||||
}
|
||||
|
||||
// For the other directions (parent, next, previous) the default of nullptr is correct
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIABridge::GetRuntimeId(SAFEARRAY ** retVal)
|
||||
{
|
||||
LogFunction();
|
||||
if (!Connected()) {
|
||||
return UIA_E_ELEMENTNOTAVAILABLE;
|
||||
}
|
||||
|
||||
int runtimeId[2] = { UiaAppendRuntimeId, 1 }; // always 1
|
||||
*retVal = SafeArrayCreateVector(VT_I4, 0, ARRAYSIZE(runtimeId));
|
||||
if (*retVal != nullptr) {
|
||||
for (long index = 0; index < ARRAYSIZE(runtimeId); ++index) {
|
||||
SafeArrayPutElement(*retVal, &index, &runtimeId[index]);
|
||||
}
|
||||
} else {
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIABridge::get_BoundingRectangle(UiaRect * retVal)
|
||||
{
|
||||
LogFunction();
|
||||
if (!Connected() || !mWindow) {
|
||||
return UIA_E_ELEMENTNOTAVAILABLE;
|
||||
}
|
||||
|
||||
// returns logical pixels
|
||||
Rect bounds;
|
||||
mWindow->get_Bounds(&bounds);
|
||||
|
||||
// we need to return physical pixels
|
||||
retVal->left = WinUtils::LogToPhys(bounds.X);
|
||||
retVal->top = WinUtils::LogToPhys(bounds.Y);
|
||||
retVal->width = WinUtils::LogToPhys(bounds.Width);
|
||||
retVal->height = WinUtils::LogToPhys(bounds.Height);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIABridge::GetEmbeddedFragmentRoots(SAFEARRAY ** retVal)
|
||||
{
|
||||
if (!Connected()) {
|
||||
return UIA_E_ELEMENTNOTAVAILABLE;
|
||||
}
|
||||
// doesn't apply according to msdn.
|
||||
*retVal = nullptr;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIABridge::SetFocus()
|
||||
{
|
||||
LogFunction();
|
||||
if (!Connected()) {
|
||||
return UIA_E_ELEMENTNOTAVAILABLE;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIABridge::get_FragmentRoot(IRawElementProviderFragmentRoot ** retVal)
|
||||
{
|
||||
// we are the fragment root. Our children return us for this call.
|
||||
return QueryInterface(IID_PPV_ARGS(retVal));
|
||||
}
|
||||
|
||||
// IRawElementProviderSimple
|
||||
|
||||
HRESULT
|
||||
UIABridge::get_ProviderOptions(ProviderOptions * pRetVal)
|
||||
{
|
||||
LogFunction();
|
||||
if (!Connected()) {
|
||||
return E_FAIL;
|
||||
}
|
||||
*pRetVal = ProviderOptions_ServerSideProvider |
|
||||
ProviderOptions_UseComThreading |
|
||||
ProviderOptions_UseClientCoordinates;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIABridge::GetPatternProvider(PATTERNID patternId, IUnknown **ppRetVal)
|
||||
{
|
||||
LogFunction();
|
||||
BridgeLog("UIABridge::GetPatternProvider=%d", patternId);
|
||||
|
||||
// The root window doesn't support any specific pattern
|
||||
*ppRetVal = nullptr;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIABridge::GetPropertyValue(PROPERTYID idProp, VARIANT * pRetVal)
|
||||
{
|
||||
pRetVal->vt = VT_EMPTY;
|
||||
|
||||
switch (idProp) {
|
||||
case UIA_AutomationIdPropertyId:
|
||||
BridgeLog("UIABridge::GetPropertyValue: idProp=UIA_AutomationIdPropertyId");
|
||||
break;
|
||||
case UIA_ControlTypePropertyId:
|
||||
BridgeLog("UIABridge::GetPropertyValue: idProp=UIA_ControlTypePropertyId");
|
||||
break;
|
||||
case UIA_IsKeyboardFocusablePropertyId:
|
||||
BridgeLog("UIABridge::GetPropertyValue: idProp=UIA_IsKeyboardFocusablePropertyId");
|
||||
break;
|
||||
case UIA_IsContentElementPropertyId:
|
||||
BridgeLog("UIABridge::GetPropertyValue: idProp=UIA_IsContentElementPropertyId");
|
||||
break;
|
||||
case UIA_IsControlElementPropertyId:
|
||||
BridgeLog("UIABridge::GetPropertyValue: idProp=UIA_IsControlElementPropertyId");
|
||||
break;
|
||||
case UIA_IsEnabledPropertyId:
|
||||
BridgeLog("UIABridge::GetPropertyValue: idProp=UIA_IsEnabledPropertyId");
|
||||
break;
|
||||
case UIA_HasKeyboardFocusPropertyId:
|
||||
BridgeLog("UIABridge::GetPropertyValue: idProp=UIA_HasKeyboardFocusPropertyId");
|
||||
break;
|
||||
case UIA_NamePropertyId:
|
||||
BridgeLog("UIABridge::GetPropertyValue: idProp=UIA_NamePropertyId");
|
||||
break;
|
||||
case UIA_IsPasswordPropertyId:
|
||||
BridgeLog("UIABridge::GetPropertyValue: idProp=UIA_IsPasswordPropertyId");
|
||||
break;
|
||||
case UIA_NativeWindowHandlePropertyId:
|
||||
BridgeLog("UIABridge::GetPropertyValue: idProp=UIA_NativeWindowHandlePropertyId");
|
||||
break;
|
||||
default:
|
||||
BridgeLog("UIABridge::GetPropertyValue: idProp=%d", idProp);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!Connected()) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
switch (idProp) {
|
||||
case UIA_AutomationIdPropertyId:
|
||||
pRetVal->bstrVal = SysAllocString(L"MozillaAccessibilityBridge0001");
|
||||
pRetVal->vt = VT_BSTR;
|
||||
break;
|
||||
|
||||
case UIA_ControlTypePropertyId:
|
||||
pRetVal->vt = VT_I4;
|
||||
pRetVal->lVal = UIA_WindowControlTypeId;
|
||||
break;
|
||||
|
||||
case UIA_IsKeyboardFocusablePropertyId:
|
||||
case UIA_IsContentElementPropertyId:
|
||||
case UIA_IsControlElementPropertyId:
|
||||
case UIA_IsEnabledPropertyId:
|
||||
pRetVal->boolVal = VARIANT_TRUE;
|
||||
pRetVal->vt = VT_BOOL;
|
||||
break;
|
||||
|
||||
case UIA_HasKeyboardFocusPropertyId:
|
||||
pRetVal->vt = VT_BOOL;
|
||||
pRetVal->boolVal = VARIANT_FALSE;
|
||||
break;
|
||||
|
||||
case UIA_NamePropertyId:
|
||||
pRetVal->bstrVal = SysAllocString(L"MozillaAccessibilityBridge");
|
||||
pRetVal->vt = VT_BSTR;
|
||||
break;
|
||||
|
||||
case UIA_IsPasswordPropertyId:
|
||||
pRetVal->vt = VT_BOOL;
|
||||
pRetVal->boolVal = VARIANT_FALSE;
|
||||
break;
|
||||
|
||||
case UIA_NativeWindowHandlePropertyId:
|
||||
pRetVal->vt = VT_I4;
|
||||
pRetVal->lVal = (LONG)MetroWidget::GetICoreWindowHWND();
|
||||
break;
|
||||
|
||||
default:
|
||||
BridgeLog("UIABridge: Unhandled property");
|
||||
break;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIABridge::get_HostRawElementProvider(IRawElementProviderSimple **ppRetVal)
|
||||
{
|
||||
// We only have this in the root bridge - this is our parent ICoreWindow.
|
||||
*ppRetVal = nullptr;
|
||||
if (mWindow != nullptr) {
|
||||
IInspectable *pHostAsInspectable = nullptr;
|
||||
if (SUCCEEDED(mWindow->get_AutomationHostProvider(&pHostAsInspectable))) {
|
||||
pHostAsInspectable->QueryInterface(ppRetVal);
|
||||
pHostAsInspectable->Release();
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Element
|
||||
|
||||
HRESULT
|
||||
UIATextElement::SetFocusInternal(LONG_PTR aAccessible)
|
||||
{
|
||||
LogFunction();
|
||||
#if defined(ACCESSIBILITY)
|
||||
NS_ASSERTION(mAccessItem, "Bad accessible pointer");
|
||||
if (mAccessItem == (Accessible*)aAccessible) {
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
mAccessItem = (Accessible*)aAccessible;
|
||||
return S_OK;
|
||||
#endif
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIATextElement::ClearFocus()
|
||||
{
|
||||
LogFunction();
|
||||
mAccessItem = nullptr;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// IRawElementProviderFragment
|
||||
|
||||
HRESULT
|
||||
UIATextElement::Navigate(NavigateDirection direction, IRawElementProviderFragment ** retVal)
|
||||
{
|
||||
LogFunction();
|
||||
|
||||
*retVal = nullptr;
|
||||
switch(direction) {
|
||||
case NavigateDirection_Parent:
|
||||
gProviderRoot.Get()->QueryInterface(IID_PPV_ARGS(retVal));
|
||||
break;
|
||||
case NavigateDirection_NextSibling:
|
||||
break;
|
||||
case NavigateDirection_PreviousSibling:
|
||||
break;
|
||||
case NavigateDirection_FirstChild:
|
||||
break;
|
||||
case NavigateDirection_LastChild:
|
||||
break;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIATextElement::GetRuntimeId(SAFEARRAY ** retVal)
|
||||
{
|
||||
LogFunction();
|
||||
int runtimeId[2] = { UiaAppendRuntimeId, mIndexID };
|
||||
*retVal = SafeArrayCreateVector(VT_I4, 0, ARRAYSIZE(runtimeId));
|
||||
if (*retVal != nullptr) {
|
||||
for (long index = 0; index < ARRAYSIZE(runtimeId); ++index) {
|
||||
SafeArrayPutElement(*retVal, &index, &runtimeId[index]);
|
||||
}
|
||||
} else {
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIATextElement::get_BoundingRectangle(UiaRect * retVal)
|
||||
{
|
||||
LogFunction();
|
||||
|
||||
if (!mAccessItem) {
|
||||
return UIA_E_ELEMENTNOTAVAILABLE;
|
||||
}
|
||||
|
||||
// bounds are in physical pixels
|
||||
nsIntRect rect = mAccessItem->Bounds();
|
||||
|
||||
retVal->left = rect.x;
|
||||
retVal->top = rect.y;
|
||||
retVal->width = rect.width;
|
||||
retVal->height = rect.height;
|
||||
|
||||
BridgeLog("get_BoundingRectangle: left=%d top=%d right=%d bottom=%d", rect.x, rect.y, rect.x + rect.width, rect.y + rect.height);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIATextElement::GetEmbeddedFragmentRoots(SAFEARRAY ** retVal)
|
||||
{
|
||||
*retVal = nullptr;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIATextElement::SetFocus()
|
||||
{
|
||||
LogFunction();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIATextElement::get_FragmentRoot(IRawElementProviderFragmentRoot ** retVal)
|
||||
{
|
||||
return gProviderRoot.Get()->QueryInterface(IID_PPV_ARGS(retVal));
|
||||
}
|
||||
|
||||
// IRawElementProviderSimple
|
||||
|
||||
HRESULT
|
||||
UIATextElement::get_ProviderOptions(ProviderOptions * pRetVal)
|
||||
{
|
||||
*pRetVal = ProviderOptions_ServerSideProvider |
|
||||
ProviderOptions_UseComThreading |
|
||||
ProviderOptions_UseClientCoordinates;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIATextElement::GetPatternProvider(PATTERNID patternId, IUnknown **ppRetVal)
|
||||
{
|
||||
LogFunction();
|
||||
BridgeLog("UIATextElement::GetPatternProvider=%d", patternId);
|
||||
|
||||
// UIA_ValuePatternId - 10002
|
||||
// UIA_TextPatternId - 10014
|
||||
// UIA_TextChildPatternId - 10029
|
||||
|
||||
*ppRetVal = nullptr;
|
||||
if (patternId == UIA_TextPatternId) {
|
||||
BridgeLog("** TextPattern requested from element.");
|
||||
*ppRetVal = static_cast<ITextProvider*>(this);
|
||||
AddRef();
|
||||
return S_OK;
|
||||
} else if (patternId == UIA_ValuePatternId) {
|
||||
BridgeLog("** ValuePattern requested from element.");
|
||||
*ppRetVal = static_cast<IValueProvider*>(this);
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIATextElement::GetPropertyValue(PROPERTYID idProp, VARIANT * pRetVal)
|
||||
{
|
||||
pRetVal->vt = VT_EMPTY;
|
||||
|
||||
// native hwnd, we don't have one for elements
|
||||
if (idProp == 30020) {
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
switch (idProp) {
|
||||
case UIA_AutomationIdPropertyId:
|
||||
BridgeLog("UIATextElement::GetPropertyValue: idProp=UIA_AutomationIdPropertyId");
|
||||
break;
|
||||
case UIA_ControlTypePropertyId:
|
||||
BridgeLog("UIATextElement::GetPropertyValue: idProp=UIA_ControlTypePropertyId");
|
||||
break;
|
||||
case UIA_IsKeyboardFocusablePropertyId:
|
||||
BridgeLog("UIATextElement::GetPropertyValue: idProp=UIA_IsKeyboardFocusablePropertyId");
|
||||
break;
|
||||
case UIA_IsContentElementPropertyId:
|
||||
BridgeLog("UIATextElement::GetPropertyValue: idProp=UIA_IsContentElementPropertyId");
|
||||
break;
|
||||
case UIA_IsControlElementPropertyId:
|
||||
BridgeLog("UIATextElement::GetPropertyValue: idProp=UIA_IsControlElementPropertyId");
|
||||
break;
|
||||
case UIA_IsEnabledPropertyId:
|
||||
BridgeLog("UIATextElement::GetPropertyValue: idProp=UIA_IsEnabledPropertyId");
|
||||
break;
|
||||
case UIA_HasKeyboardFocusPropertyId:
|
||||
BridgeLog("UIATextElement::GetPropertyValue: idProp=UIA_HasKeyboardFocusPropertyId");
|
||||
break;
|
||||
case UIA_NamePropertyId:
|
||||
BridgeLog("UIATextElement::GetPropertyValue: idProp=UIA_NamePropertyId");
|
||||
break;
|
||||
case UIA_IsPasswordPropertyId:
|
||||
BridgeLog("UIATextElement::GetPropertyValue: idProp=UIA_IsPasswordPropertyId");
|
||||
break;
|
||||
default:
|
||||
BridgeLog("UIATextElement::GetPropertyValue: idProp=%d", idProp);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (idProp) {
|
||||
case UIA_AutomationIdPropertyId:
|
||||
pRetVal->bstrVal = SysAllocString(L"MozillaDocument0001");
|
||||
pRetVal->vt = VT_BSTR;
|
||||
break;
|
||||
|
||||
case UIA_ControlTypePropertyId:
|
||||
pRetVal->vt = VT_I4;
|
||||
pRetVal->lVal = UIA_EditControlTypeId;
|
||||
break;
|
||||
|
||||
case UIA_IsTextPatternAvailablePropertyId:
|
||||
case UIA_IsKeyboardFocusablePropertyId:
|
||||
case UIA_IsContentElementPropertyId:
|
||||
case UIA_IsControlElementPropertyId:
|
||||
case UIA_IsEnabledPropertyId:
|
||||
pRetVal->boolVal = VARIANT_TRUE;
|
||||
pRetVal->vt = VT_BOOL;
|
||||
break;
|
||||
|
||||
case UIA_LocalizedControlTypePropertyId:
|
||||
case UIA_LabeledByPropertyId:
|
||||
break;
|
||||
|
||||
case UIA_HasKeyboardFocusPropertyId:
|
||||
{
|
||||
if (mAccessItem) {
|
||||
if (mAccessItem->NativeState() & mozilla::a11y::states::FOCUSED) {
|
||||
pRetVal->vt = VT_BOOL;
|
||||
pRetVal->boolVal = VARIANT_TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
pRetVal->vt = VT_BOOL;
|
||||
pRetVal->boolVal = VARIANT_FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
case UIA_NamePropertyId:
|
||||
pRetVal->bstrVal = SysAllocString(L"MozillaDocument");
|
||||
pRetVal->vt = VT_BSTR;
|
||||
break;
|
||||
|
||||
case UIA_IsPasswordPropertyId:
|
||||
pRetVal->vt = VT_BOOL;
|
||||
pRetVal->boolVal = VARIANT_FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
BridgeLog("UIATextElement: Unhandled property");
|
||||
break;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIATextElement::get_HostRawElementProvider(IRawElementProviderSimple **ppRetVal)
|
||||
{
|
||||
*ppRetVal = nullptr;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// ITextProvider
|
||||
|
||||
HRESULT
|
||||
UIATextElement::GetSelection(SAFEARRAY * *pRetVal)
|
||||
{
|
||||
LogFunction();
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIATextElement::GetVisibleRanges(SAFEARRAY * *pRetVal)
|
||||
{
|
||||
LogFunction();
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIATextElement::RangeFromChild(IRawElementProviderSimple *childElement, ITextRangeProvider **pRetVal)
|
||||
{
|
||||
LogFunction();
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIATextElement::RangeFromPoint(UiaPoint point, ITextRangeProvider **pRetVal)
|
||||
{
|
||||
LogFunction();
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIATextElement::get_DocumentRange(ITextRangeProvider **pRetVal)
|
||||
{
|
||||
LogFunction();
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
UIATextElement::get_SupportedTextSelection(SupportedTextSelection *pRetVal)
|
||||
{
|
||||
LogFunction();
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
// IValueProvider
|
||||
|
||||
IFACEMETHODIMP
|
||||
UIATextElement::SetValue(LPCWSTR val)
|
||||
{
|
||||
LogFunction();
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP
|
||||
UIATextElement::get_Value(BSTR *pRetVal)
|
||||
{
|
||||
LogFunction();
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP
|
||||
UIATextElement::get_IsReadOnly(BOOL *pRetVal)
|
||||
{
|
||||
LogFunction();
|
||||
*pRetVal = FALSE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
} } }
|
||||
@@ -1,22 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#define DO_NO_IMPORTS 1
|
||||
|
||||
import "oaidl.idl";
|
||||
import "oleacc.idl";
|
||||
import "Inspectable.idl";
|
||||
|
||||
[uuid(C78B35B5-05DB-43AA-AE73-94C233A93C98)]
|
||||
interface IUIABridge : IInspectable {
|
||||
HRESULT Init([in] IInspectable* view, [in] IInspectable* window, [in] LONG_PTR inner);
|
||||
HRESULT Disconnect();
|
||||
HRESULT FocusChangeEvent();
|
||||
};
|
||||
|
||||
[uuid(9F57311C-E8AE-4991-8D9F-E069EEE96D85)]
|
||||
interface IUIAElement : IInspectable {
|
||||
HRESULT SetFocusInternal([in] LONG_PTR accessible);
|
||||
HRESULT ClearFocus();
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user