gecko-dev/toolkit/xre/Bootstrap.cpp
Jim Chen 53a1107cd1 Bug 1343075 - Use GeckoEditableSupport from PuppetWidget; r=masayuki r=rbarker r=snorp r=esawin
Bug 1343075 - 1a. Add TextEventDispatcherListener::GetIMEUpdatePreference; r=masayuki

Add a GetIMEUpdatePreference method to TextEventDispatcherListener to
optionally control which IME notifications are received by NotifyIME.
This patch also makes nsBaseWidget forward its GetIMEUpdatePreference
call to the widget's native TextEventDispatcherListener.

Bug 1343075 - 1b. Implement GetIMEUpdatePreference for all TextEventDispatcherListener; r=masayuki

This patch implements GetIMEUpdatePreference for all
TextEventDispatcherListener implementations, by moving previous
implementations of nsIWidget::GetIMEUpdatePreference.

Bug 1343075 - 2. Allow setting a PuppetWidget's native TextEventDispatcherListener; r=masayuki

In PuppetWidget, add getter and setter for the widget's native
TextEventDispatcherListener. This allows overriding of PuppetWidget's
default IME handling. For example, on Android, the PuppetWidget's native
TextEventDispatcherListener will communicate directly with Java IME code
in the main process.

Bug 1343075 - 3. Add AIDL interface for main process; r=rbarker

Add AIDL definition and implementation for an interface for the main
process that child processes can access.

Bug 1343075 - 4. Set Gecko thread JNIEnv for child process; r=snorp

Add a JNIEnv* parameter to XRE_SetAndroidChildFds, which is used to set
the Gecko thread JNIEnv for child processes. XRE_SetAndroidChildFds is
the only Android-specific entry point for child processes, so I think
it's the most logical place to initialize JNI.

Bug 1343075 - 5. Support multiple remote GeckoEditableChild; r=esawin

Support remote GeckoEditableChild instances that are created in the
content processes and connect to the parent process GeckoEditableParent
through binders.

Support having multiple GeckoEditableChild instances in GeckoEditable by
keeping track of which child is currently focused, and only allow
calls to/from the focused child by using access tokens.

Bug 1343075 - 6. Add method to get GeckoEditableParent instance; r=esawin

Add IProcessManager.getEditableParent, which a content process can call
to get the GeckoEditableParent instance that corresponds to a given
content process tab, from the main process.

Bug 1343075 - 7. Support GeckoEditableSupport in content processes; r=esawin

Support creating and running GeckoEditableSupport attached to a
PuppetWidget in content processes.

Because we don't know PuppetWidget's lifetime as well as nsWindow's,
when attached to PuppetWidget, we need to attach/detach our native
object on focus/blur, respectively.

Bug 1343075 - 8. Connect GeckoEditableSupport on PuppetWidget creation; r=esawin

Listen to the "tab-child-created" notification and attach our content
process GeckoEditableSupport to the new PuppetWidget.

Bug 1343075 - 9. Update auto-generated bindings; r=me
2017-03-07 22:34:39 -05:00

106 lines
2.7 KiB
C++

/* -*- Mode: C++; tab-width: 8; 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 "mozilla/Bootstrap.h"
#include "nsXPCOM.h"
namespace mozilla {
class BootstrapImpl final : public Bootstrap
{
protected:
virtual void Dispose() override
{
delete this;
}
public:
BootstrapImpl()
{
}
~BootstrapImpl()
{
}
virtual void NS_LogInit() override {
::NS_LogInit();
}
virtual void NS_LogTerm() override {
::NS_LogTerm();
}
virtual void XRE_TelemetryAccumulate(int aID, uint32_t aSample) override {
::XRE_TelemetryAccumulate(aID, aSample);
}
virtual void XRE_StartupTimelineRecord(int aEvent, mozilla::TimeStamp aWhen) override {
::XRE_StartupTimelineRecord(aEvent, aWhen);
}
virtual int XRE_main(int argc, char* argv[], const BootstrapConfig& aConfig) override {
return ::XRE_main(argc, argv, aConfig);
}
virtual void XRE_StopLateWriteChecks() override {
::XRE_StopLateWriteChecks();
}
virtual int XRE_XPCShellMain(int argc, char** argv, char** envp, const XREShellData* aShellData) override {
return ::XRE_XPCShellMain(argc, argv, envp, aShellData);
}
virtual GeckoProcessType XRE_GetProcessType() override {
return ::XRE_GetProcessType();
}
virtual void XRE_SetProcessType(const char* aProcessTypeString) override {
::XRE_SetProcessType(aProcessTypeString);
}
virtual nsresult XRE_InitChildProcess(int argc, char* argv[], const XREChildData* aChildData) override {
return ::XRE_InitChildProcess(argc, argv, aChildData);
}
virtual void XRE_EnableSameExecutableForContentProc() override {
::XRE_EnableSameExecutableForContentProc();
}
#ifdef MOZ_WIDGET_ANDROID
virtual void GeckoStart(JNIEnv* aEnv, char** argv, int argc, const StaticXREAppData& aAppData) override {
::GeckoStart(aEnv, argv, argc, aAppData);
}
virtual void XRE_SetAndroidChildFds(JNIEnv* aEnv, int aCrashFd, int aIPCFd) override {
::XRE_SetAndroidChildFds(aEnv, aCrashFd, aIPCFd);
}
#endif
#ifdef LIBFUZZER
virtual void XRE_LibFuzzerSetDriver(LibFuzzerDriver aDriver) override {
::XRE_LibFuzzerSetDriver(aDriver);
}
#endif
#ifdef MOZ_IPDL_TESTS
virtual int XRE_RunIPDLTest(int argc, char **argv) override {
return ::XRE_RunIPDLTest(argc, argv);
}
#endif
};
extern "C" NS_EXPORT void NS_FROZENCALL
XRE_GetBootstrap(Bootstrap::UniquePtr& b)
{
static bool sBootstrapInitialized = false;
MOZ_RELEASE_ASSERT(!sBootstrapInitialized);
sBootstrapInitialized = true;
b.reset(new BootstrapImpl());
}
} // namespace mozilla