mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 913985 - Part 5: refactor the Bridge to use the generated code. r=kats
This commit is contained in:
parent
ecbfff89b9
commit
6ba50c4b94
@ -1791,7 +1791,7 @@ ContentParent::RecvGetShowPasswordSetting(bool* showPassword)
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
NS_ASSERTION(AndroidBridge::Bridge() != nullptr, "AndroidBridge is not available");
|
||||
if (AndroidBridge::Bridge() != nullptr)
|
||||
*showPassword = AndroidBridge::Bridge()->GetShowPasswordSetting();
|
||||
*showPassword = GeckoAppShell::GetShowPasswordSetting();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
@ -2262,11 +2262,7 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
||||
}
|
||||
|
||||
case kJavaContext_ANPGetValue: {
|
||||
AndroidBridge *bridge = AndroidBridge::Bridge();
|
||||
if (!bridge)
|
||||
return NPERR_GENERIC_ERROR;
|
||||
|
||||
jobject ret = bridge->GetContext();
|
||||
jobject ret = GeckoAppShell::GetContext();
|
||||
if (!ret)
|
||||
return NPERR_GENERIC_ERROR;
|
||||
|
||||
|
@ -868,7 +868,7 @@ void nsNPAPIPluginInstance::NotifyFullScreen(bool aFullScreen)
|
||||
SendLifecycleEvent(this, mFullScreen ? kEnterFullScreen_ANPLifecycleAction : kExitFullScreen_ANPLifecycleAction);
|
||||
|
||||
if (mFullScreen && mFullScreenOrientation != dom::eScreenOrientation_None) {
|
||||
AndroidBridge::Bridge()->LockScreenOrientation(mFullScreenOrientation);
|
||||
GeckoAppShell::LockScreenOrientation(mFullScreenOrientation);
|
||||
}
|
||||
}
|
||||
|
||||
@ -925,11 +925,11 @@ void nsNPAPIPluginInstance::SetFullScreenOrientation(uint32_t orientation)
|
||||
// We're already fullscreen so immediately apply the orientation change
|
||||
|
||||
if (mFullScreenOrientation != dom::eScreenOrientation_None) {
|
||||
AndroidBridge::Bridge()->LockScreenOrientation(mFullScreenOrientation);
|
||||
GeckoAppShell::LockScreenOrientation(mFullScreenOrientation);
|
||||
} else if (oldOrientation != dom::eScreenOrientation_None) {
|
||||
// We applied an orientation when we entered fullscreen, but
|
||||
// we don't want it anymore
|
||||
AndroidBridge::Bridge()->UnlockScreenOrientation();
|
||||
GeckoAppShell::UnlockScreenOrientation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1672,9 +1672,7 @@ void nsPluginInstanceOwner::RemovePluginView()
|
||||
if (!mInstance || !mJavaView)
|
||||
return;
|
||||
|
||||
if (AndroidBridge::Bridge())
|
||||
AndroidBridge::Bridge()->RemovePluginView((jobject)mJavaView, mFullScreen);
|
||||
|
||||
GeckoAppShell::RemovePluginView((jobject)mJavaView, mFullScreen);
|
||||
AndroidBridge::GetJNIEnv()->DeleteGlobalRef((jobject)mJavaView);
|
||||
mJavaView = nullptr;
|
||||
|
||||
|
@ -28,7 +28,7 @@ AndroidLocationProvider::Startup()
|
||||
{
|
||||
if (!AndroidBridge::Bridge())
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
AndroidBridge::Bridge()->EnableLocation(true);
|
||||
GeckoAppShell::EnableLocation(true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ AndroidLocationProvider::Shutdown()
|
||||
{
|
||||
if (!AndroidBridge::Bridge())
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
AndroidBridge::Bridge()->EnableLocation(false);
|
||||
GeckoAppShell::EnableLocation(false);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -55,6 +55,6 @@ AndroidLocationProvider::SetHighAccuracy(bool enable)
|
||||
{
|
||||
if (!AndroidBridge::Bridge())
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
AndroidBridge::Bridge()->EnableLocationHighAccuracy(enable);
|
||||
GeckoAppShell::EnableLocationHighAccuracy(enable);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ nsHapticFeedback::PerformSimpleAction(int32_t aType)
|
||||
{
|
||||
AndroidBridge* bridge = AndroidBridge::Bridge();
|
||||
if (bridge) {
|
||||
bridge->PerformHapticFeedback(aType == LongPress);
|
||||
GeckoAppShell::PerformHapticFeedback(aType == LongPress);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -2515,7 +2515,7 @@ public:
|
||||
#endif
|
||||
|
||||
virtual already_AddRefed<TextureImage>
|
||||
CreateDirectTextureImage(android::GraphicBuffer* aBuffer, GLenum aWrapMode)
|
||||
CreateDirectTextureImage(::android::GraphicBuffer* aBuffer, GLenum aWrapMode)
|
||||
{ return nullptr; }
|
||||
|
||||
// Before reads from offscreen texture
|
||||
|
@ -210,7 +210,7 @@ nsSurfaceTexture::~nsSurfaceTexture()
|
||||
return;
|
||||
|
||||
if (mSurfaceTexture && env) {
|
||||
AndroidBridge::Bridge()->UnregisterSurfaceTextureFrameListener(mSurfaceTexture);
|
||||
GeckoAppShell::UnregisterSurfaceTextureFrameListener(mSurfaceTexture);
|
||||
|
||||
env->DeleteGlobalRef(mSurfaceTexture);
|
||||
mSurfaceTexture = nullptr;
|
||||
@ -239,9 +239,9 @@ void
|
||||
nsSurfaceTexture::SetFrameAvailableCallback(nsIRunnable* aRunnable)
|
||||
{
|
||||
if (aRunnable)
|
||||
AndroidBridge::Bridge()->RegisterSurfaceTextureFrameListener(mSurfaceTexture, mID);
|
||||
GeckoAppShell::RegisterSurfaceTextureFrameListener(mSurfaceTexture, mID);
|
||||
else
|
||||
AndroidBridge::Bridge()->UnregisterSurfaceTextureFrameListener(mSurfaceTexture);
|
||||
GeckoAppShell::UnregisterSurfaceTextureFrameListener(mSurfaceTexture);
|
||||
|
||||
mFrameAvailableCallback = aRunnable;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::hal;
|
||||
using namespace mozilla::widget::android;
|
||||
|
||||
namespace mozilla {
|
||||
namespace hal_impl {
|
||||
@ -54,97 +55,55 @@ CancelVibrate(const WindowIdentifier &)
|
||||
{
|
||||
// Ignore WindowIdentifier parameter.
|
||||
|
||||
AndroidBridge* b = AndroidBridge::Bridge();
|
||||
if (b)
|
||||
b->CancelVibrate();
|
||||
GeckoAppShell::CancelVibrate();
|
||||
}
|
||||
|
||||
void
|
||||
EnableBatteryNotifications()
|
||||
{
|
||||
AndroidBridge* bridge = AndroidBridge::Bridge();
|
||||
if (!bridge) {
|
||||
return;
|
||||
}
|
||||
|
||||
bridge->EnableBatteryNotifications();
|
||||
GeckoAppShell::EnableBatteryNotifications();
|
||||
}
|
||||
|
||||
void
|
||||
DisableBatteryNotifications()
|
||||
{
|
||||
AndroidBridge* bridge = AndroidBridge::Bridge();
|
||||
if (!bridge) {
|
||||
return;
|
||||
}
|
||||
|
||||
bridge->DisableBatteryNotifications();
|
||||
GeckoAppShell::DisableBatteryNotifications();
|
||||
}
|
||||
|
||||
void
|
||||
GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo)
|
||||
{
|
||||
AndroidBridge* bridge = AndroidBridge::Bridge();
|
||||
if (!bridge) {
|
||||
return;
|
||||
}
|
||||
|
||||
bridge->GetCurrentBatteryInformation(aBatteryInfo);
|
||||
AndroidBridge::Bridge()->GetCurrentBatteryInformation(aBatteryInfo);
|
||||
}
|
||||
|
||||
void
|
||||
EnableNetworkNotifications()
|
||||
{
|
||||
AndroidBridge* bridge = AndroidBridge::Bridge();
|
||||
if (!bridge) {
|
||||
return;
|
||||
}
|
||||
|
||||
bridge->EnableNetworkNotifications();
|
||||
GeckoAppShell::EnableNetworkNotifications();
|
||||
}
|
||||
|
||||
void
|
||||
DisableNetworkNotifications()
|
||||
{
|
||||
AndroidBridge* bridge = AndroidBridge::Bridge();
|
||||
if (!bridge) {
|
||||
return;
|
||||
}
|
||||
|
||||
bridge->DisableNetworkNotifications();
|
||||
GeckoAppShell::DisableNetworkNotifications();
|
||||
}
|
||||
|
||||
void
|
||||
GetCurrentNetworkInformation(hal::NetworkInformation* aNetworkInfo)
|
||||
{
|
||||
AndroidBridge* bridge = AndroidBridge::Bridge();
|
||||
if (!bridge) {
|
||||
return;
|
||||
}
|
||||
|
||||
bridge->GetCurrentNetworkInformation(aNetworkInfo);
|
||||
AndroidBridge::Bridge()->GetCurrentNetworkInformation(aNetworkInfo);
|
||||
}
|
||||
|
||||
void
|
||||
EnableScreenConfigurationNotifications()
|
||||
{
|
||||
AndroidBridge* bridge = AndroidBridge::Bridge();
|
||||
if (!bridge) {
|
||||
return;
|
||||
}
|
||||
|
||||
bridge->EnableScreenOrientationNotifications();
|
||||
GeckoAppShell::EnableScreenOrientationNotifications();
|
||||
}
|
||||
|
||||
void
|
||||
DisableScreenConfigurationNotifications()
|
||||
{
|
||||
AndroidBridge* bridge = AndroidBridge::Bridge();
|
||||
if (!bridge) {
|
||||
return;
|
||||
}
|
||||
|
||||
bridge->DisableScreenOrientationNotifications();
|
||||
GeckoAppShell::DisableScreenOrientationNotifications();
|
||||
}
|
||||
|
||||
void
|
||||
@ -181,8 +140,7 @@ GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
|
||||
bool
|
||||
LockScreenOrientation(const ScreenOrientation& aOrientation)
|
||||
{
|
||||
AndroidBridge* bridge = AndroidBridge::Bridge();
|
||||
if (!bridge) {
|
||||
if (!AndroidBridge::Bridge()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -195,7 +153,7 @@ LockScreenOrientation(const ScreenOrientation& aOrientation)
|
||||
case eScreenOrientation_LandscapeSecondary:
|
||||
case eScreenOrientation_LandscapePrimary | eScreenOrientation_LandscapeSecondary:
|
||||
case eScreenOrientation_Default:
|
||||
bridge->LockScreenOrientation(aOrientation);
|
||||
GeckoAppShell::LockScreenOrientation(aOrientation);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@ -205,12 +163,7 @@ LockScreenOrientation(const ScreenOrientation& aOrientation)
|
||||
void
|
||||
UnlockScreenOrientation()
|
||||
{
|
||||
AndroidBridge* bridge = AndroidBridge::Bridge();
|
||||
if (!bridge) {
|
||||
return;
|
||||
}
|
||||
|
||||
bridge->UnlockScreenOrientation();
|
||||
GeckoAppShell::UnlockScreenOrientation();
|
||||
}
|
||||
|
||||
} // hal_impl
|
||||
|
@ -13,12 +13,12 @@ namespace hal_impl {
|
||||
|
||||
void
|
||||
EnableSensorNotifications(SensorType aSensor) {
|
||||
AndroidBridge::Bridge()->EnableSensor(aSensor);
|
||||
GeckoAppShell::EnableSensor(aSensor);
|
||||
}
|
||||
|
||||
void
|
||||
DisableSensorNotifications(SensorType aSensor) {
|
||||
AndroidBridge::Bridge()->DisableSensor(aSensor);
|
||||
GeckoAppShell::DisableSensor(aSensor);
|
||||
}
|
||||
|
||||
} // hal_impl
|
||||
|
@ -95,7 +95,7 @@ MessagePump::Run(MessagePump::Delegate* aDelegate)
|
||||
// This processes messages in the Android Looper. Note that we only
|
||||
// get here if the normal Gecko event loop has been awoken above.
|
||||
// Bug 750713
|
||||
did_work |= AndroidBridge::Bridge()->PumpMessageLoop();
|
||||
did_work |= GeckoAppShell::PumpMessageLoop();
|
||||
#endif
|
||||
|
||||
did_work |= aDelegate->DoDelayedWork(&delayed_work_time_);
|
||||
|
@ -50,10 +50,7 @@ nsAndroidHistory::RegisterVisitedCallback(nsIURI *aURI, Link *aContent)
|
||||
}
|
||||
list->AppendElement(aContent);
|
||||
|
||||
AndroidBridge *bridge = AndroidBridge::Bridge();
|
||||
if (bridge) {
|
||||
bridge->CheckURIVisited(uriString);
|
||||
}
|
||||
GeckoAppShell::CheckURIVisited(uriString);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -96,13 +93,12 @@ nsAndroidHistory::VisitURI(nsIURI *aURI, nsIURI *aLastVisitedURI, uint32_t aFlag
|
||||
if (aFlags & VisitFlags::UNRECOVERABLE_ERROR)
|
||||
return NS_OK;
|
||||
|
||||
AndroidBridge *bridge = AndroidBridge::Bridge();
|
||||
if (bridge) {
|
||||
if (AndroidBridge::Bridge()) {
|
||||
nsAutoCString uri;
|
||||
nsresult rv = aURI->GetSpec(uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
NS_ConvertUTF8toUTF16 uriString(uri);
|
||||
bridge->MarkURIVisited(uriString);
|
||||
GeckoAppShell::MarkURIVisited(uriString);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -110,13 +106,12 @@ nsAndroidHistory::VisitURI(nsIURI *aURI, nsIURI *aLastVisitedURI, uint32_t aFlag
|
||||
NS_IMETHODIMP
|
||||
nsAndroidHistory::SetURITitle(nsIURI *aURI, const nsAString& aTitle)
|
||||
{
|
||||
AndroidBridge *bridge = AndroidBridge::Bridge();
|
||||
if (bridge) {
|
||||
if (AndroidBridge::Bridge()) {
|
||||
nsAutoCString uri;
|
||||
nsresult rv = aURI->GetSpec(uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
NS_ConvertUTF8toUTF16 uriString(uri);
|
||||
bridge->SetURITitle(uriString, aTitle);
|
||||
GeckoAppShell::SetURITitle(uriString, aTitle);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#include "AndroidBridge.h"
|
||||
|
||||
using namespace mozilla::widget::android;
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsShellService, nsIShellService)
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -22,6 +24,6 @@ nsShellService::CreateShortcut(const nsAString& aTitle, const nsAString& aURI, c
|
||||
if (!aTitle.Length() || !aURI.Length() || !aIconData.Length())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mozilla::AndroidBridge::Bridge()->CreateShortcut(aTitle, aURI, aIconData, aIntent);
|
||||
GeckoAppShell::CreateShortcut(aTitle, aURI, aIconData, aIntent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ Tickler::Init()
|
||||
MOZ_ASSERT(!mThread);
|
||||
MOZ_ASSERT(!mFD);
|
||||
|
||||
AndroidBridge::Bridge()->EnableNetworkNotifications();
|
||||
GeckoAppShell::EnableNetworkNotifications();
|
||||
|
||||
mFD = PR_OpenUDPSocket(PR_AF_INET);
|
||||
if (!mFD)
|
||||
|
@ -90,7 +90,7 @@ bool CameraStreamImpl::Init(const nsCString& contentType, const uint32_t& camera
|
||||
}
|
||||
|
||||
void CameraStreamImpl::Close() {
|
||||
AndroidBridge::Bridge()->CloseCamera();
|
||||
GeckoAppShell::CloseCamera();
|
||||
mCallback = nullptr;
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#include "AndroidBridge.h"
|
||||
|
||||
using namespace mozilla::widget::android;
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsAndroidNetworkLinkService,
|
||||
nsINetworkLinkService)
|
||||
|
||||
@ -31,7 +33,7 @@ nsAndroidNetworkLinkService::GetIsLinkUp(bool *aIsUp)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aIsUp = mozilla::AndroidBridge::Bridge()->IsNetworkLinkUp();
|
||||
*aIsUp = GeckoAppShell::IsNetworkLinkUp();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -40,7 +42,7 @@ nsAndroidNetworkLinkService::GetLinkStatusKnown(bool *aIsKnown)
|
||||
{
|
||||
NS_ENSURE_TRUE(mozilla::AndroidBridge::Bridge(), NS_ERROR_NOT_IMPLEMENTED);
|
||||
|
||||
*aIsKnown = mozilla::AndroidBridge::Bridge()->IsNetworkLinkKnown();
|
||||
*aIsKnown = GeckoAppShell::IsNetworkLinkKnown();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
#include "AndroidBridge.h"
|
||||
using namespace mozilla::widget::android;
|
||||
#else
|
||||
|
||||
#include "nsXPCOM.h"
|
||||
@ -127,7 +128,7 @@ NS_IMETHODIMP nsAlertsService::CloseAlert(const nsAString& aAlertName,
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
mozilla::AndroidBridge::Bridge()->CloseNotification(aAlertName);
|
||||
GeckoAppShell::CloseNotification(aAlertName);
|
||||
return NS_OK;
|
||||
#else
|
||||
|
||||
@ -148,7 +149,7 @@ NS_IMETHODIMP nsAlertsService::OnProgress(const nsAString & aAlertName,
|
||||
const nsAString & aAlertText)
|
||||
{
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
mozilla::AndroidBridge::Bridge()->AlertsProgressListener_OnProgress(aAlertName, aProgress, aProgressMax, aAlertText);
|
||||
GeckoAppShell::AlertsProgressListener_OnProgress(aAlertName, aProgress, aProgressMax, aAlertText);
|
||||
return NS_OK;
|
||||
#else
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
@ -158,7 +159,7 @@ NS_IMETHODIMP nsAlertsService::OnProgress(const nsAString & aAlertName,
|
||||
NS_IMETHODIMP nsAlertsService::OnCancel(const nsAString & aAlertName)
|
||||
{
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
mozilla::AndroidBridge::Bridge()->CloseNotification(aAlertName);
|
||||
GeckoAppShell::CloseNotification(aAlertName);
|
||||
return NS_OK;
|
||||
#else
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -52,6 +52,7 @@
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
#include "AndroidBridge.h"
|
||||
using namespace mozilla::widget::android;
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
@ -2797,7 +2798,7 @@ nsDownload::SetState(DownloadState aState)
|
||||
if (mimeInfo)
|
||||
mimeInfo->GetMIMEType(contentType);
|
||||
|
||||
mozilla::AndroidBridge::Bridge()->ScanMedia(path, NS_ConvertUTF8toUTF16(contentType));
|
||||
GeckoAppShell::ScanMedia(path, NS_ConvertUTF8toUTF16(contentType));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ nsresult DownloadPlatform::DownloadDone(nsIURI* aSource, nsIFile* aTarget,
|
||||
#endif
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
if (!aContentType.IsEmpty()) {
|
||||
mozilla::AndroidBridge::Bridge()->ScanMedia(path, NS_ConvertUTF8toUTF16(aContentType));
|
||||
mozilla::widget::android::GeckoAppShell::ScanMedia(path, NS_ConvertUTF8toUTF16(aContentType));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ GeckoStart(void *data, const nsXREAppData *appData)
|
||||
if (result)
|
||||
LOG("XRE_main returned %d", result);
|
||||
|
||||
mozilla::AndroidBridge::Bridge()->NotifyXreExit();
|
||||
mozilla::widget::android::GeckoAppShell::NotifyXreExit();
|
||||
|
||||
free(targs[0]);
|
||||
nsMemory::Free(data);
|
||||
|
@ -1649,7 +1649,7 @@ static nsresult LaunchChild(nsINativeAppSupport* aNative,
|
||||
SaveToEnv("MOZ_LAUNCHED_CHILD=1");
|
||||
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
mozilla::AndroidBridge::Bridge()->ScheduleRestart();
|
||||
mozilla::widget::android::GeckoAppShell::ScheduleRestart();
|
||||
#else
|
||||
#if defined(XP_MACOSX)
|
||||
CommandLineServiceMac::SetupMacCommandLine(gRestartArgc, gRestartArgv, true);
|
||||
@ -1761,7 +1761,7 @@ ProfileLockedDialog(nsIFile* aProfileDir, nsIFile* aProfileLocalDir,
|
||||
if (aUnlocker) {
|
||||
int32_t button;
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
mozilla::AndroidBridge::Bridge()->KillAnyZombies();
|
||||
mozilla::widget::android::GeckoAppShell::KillAnyZombies();
|
||||
button = 1;
|
||||
#else
|
||||
const uint32_t flags =
|
||||
@ -1788,7 +1788,7 @@ ProfileLockedDialog(nsIFile* aProfileDir, nsIFile* aProfileLocalDir,
|
||||
}
|
||||
} else {
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
if (mozilla::AndroidBridge::Bridge()->UnlockProfile()) {
|
||||
if (mozilla::widget::android::GeckoAppShell::UnlockProfile()) {
|
||||
return NS_LockProfilePath(aProfileDir, aProfileLocalDir,
|
||||
nullptr, aResult);
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ typename Builder::Object BuildJavaThreadJSObject(Builder& b)
|
||||
b.DefineProperty(sample, "frames", frames);
|
||||
b.ArrayPush(samples, sample);
|
||||
|
||||
double sampleTime = AndroidBridge::Bridge()->GetSampleTimeJavaProfiling(0, sampleId);
|
||||
double sampleTime = GeckoJavaSampler::GetSampleTimeJavaProfiling(0, sampleId);
|
||||
b.DefineProperty(sample, "time", sampleTime);
|
||||
}
|
||||
typename Builder::RootedObject frame(b.context(), b.CreateObject());
|
||||
@ -282,12 +282,12 @@ void TableTicker::BuildJSObject(Builder& b, typename Builder::ObjectHandle profi
|
||||
|
||||
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
if (ProfileJava()) {
|
||||
AndroidBridge::Bridge()->PauseJavaProfiling();
|
||||
GeckoJavaSampler::PauseJavaProfiling();
|
||||
|
||||
typename Builder::RootedObject javaThread(b.context(), BuildJavaThreadJSObject(b));
|
||||
b.ArrayPush(threads, javaThread);
|
||||
|
||||
AndroidBridge::Bridge()->UnpauseJavaProfiling();
|
||||
GeckoJavaSampler::UnpauseJavaProfiling();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
#include "AndroidBridge.h"
|
||||
using namespace mozilla::widget::android;
|
||||
#endif
|
||||
|
||||
mozilla::ThreadLocal<PseudoStack *> tlsPseudoStack;
|
||||
@ -675,7 +676,7 @@ void mozilla_sampler_start(int aProfileEntries, double aInterval,
|
||||
if (javaInterval < 10) {
|
||||
aInterval = 10;
|
||||
}
|
||||
mozilla::AndroidBridge::Bridge()->StartJavaProfiling(javaInterval, 1000);
|
||||
GeckoJavaSampler::StartJavaProfiling(javaInterval, 1000);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include "nsAndroidHandlerApp.h"
|
||||
#include "AndroidBridge.h"
|
||||
|
||||
using namespace mozilla::widget::android;
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsAndroidHandlerApp, nsIHandlerApp, nsISharingHandlerApp)
|
||||
|
||||
@ -70,8 +72,7 @@ nsAndroidHandlerApp::LaunchWithURI(nsIURI *aURI, nsIInterfaceRequestor *aWindowC
|
||||
|
||||
nsCString uriSpec;
|
||||
aURI->GetSpec(uriSpec);
|
||||
return mozilla::AndroidBridge::Bridge()->
|
||||
OpenUriExternal(NS_ConvertUTF8toUTF16(uriSpec), NS_ConvertUTF8toUTF16(mMimeType), mPackageName, mClassName, mAction) ?
|
||||
return GeckoAppShell::OpenUriExternal(NS_ConvertUTF8toUTF16(uriSpec), NS_ConvertUTF8toUTF16(mMimeType), mPackageName, mClassName, mAction) ?
|
||||
NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -81,8 +82,7 @@ nsAndroidHandlerApp::Share(const nsAString & data, const nsAString & title)
|
||||
if (!mozilla::AndroidBridge::Bridge())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return mozilla::AndroidBridge::Bridge()->
|
||||
OpenUriExternal(data, NS_ConvertUTF8toUTF16(mMimeType), mPackageName,
|
||||
return GeckoAppShell::OpenUriExternal(data, NS_ConvertUTF8toUTF16(mMimeType), mPackageName,
|
||||
mClassName, mAction) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,7 @@ nsExternalSharingAppService::ShareWithDefault(const nsAString & data,
|
||||
NS_NAMED_LITERAL_STRING(sendAction, "android.intent.action.SEND");
|
||||
const nsString emptyString = EmptyString();
|
||||
if (AndroidBridge::Bridge())
|
||||
return AndroidBridge::Bridge()->
|
||||
OpenUriExternal(data, mime,
|
||||
return GeckoAppShell::OpenUriExternal(data, mime,
|
||||
emptyString,emptyString, sendAction, title) ? NS_OK : NS_ERROR_FAILURE;
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "nsStringEnumerator.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
using namespace mozilla::widget::android;
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsMIMEInfoAndroid, nsIMIMEInfo, nsIHandlerInfo)
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -29,8 +31,7 @@ nsMIMEInfoAndroid::LoadUriInternal(nsIURI * aURI)
|
||||
aURI->GetScheme(uriScheme);
|
||||
|
||||
if (mozilla::AndroidBridge::Bridge())
|
||||
return mozilla::AndroidBridge::Bridge()->
|
||||
OpenUriExternal(NS_ConvertUTF8toUTF16(uriSpec), (mType.Equals(uriScheme) || mType.Equals(uriSpec)) ? EmptyString() : NS_ConvertUTF8toUTF16(mType)) ? NS_OK : NS_ERROR_FAILURE;
|
||||
return GeckoAppShell::OpenUriExternal(NS_ConvertUTF8toUTF16(uriSpec), (mType.Equals(uriScheme) || mType.Equals(uriSpec)) ? EmptyString() : NS_ConvertUTF8toUTF16(mType)) ? NS_OK : NS_ERROR_FAILURE;
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -39,13 +39,8 @@
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#define ALOG_BRIDGE(args...) ALOG(args)
|
||||
#else
|
||||
#define ALOG_BRIDGE(args...) ((void)0)
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::widget::android;
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
NS_IMPL_ISUPPORTS0(nsFilePickerCallback)
|
||||
@ -170,14 +165,13 @@ AndroidBridge::Init(JNIEnv *jEnv)
|
||||
|
||||
mJNIEnv = nullptr;
|
||||
mThread = -1;
|
||||
mGLControllerObj = nullptr;
|
||||
mGLControllerObj = NULL;
|
||||
mOpenedGraphicsLibraries = false;
|
||||
mHasNativeBitmapAccess = false;
|
||||
mHasNativeWindowAccess = false;
|
||||
mHasNativeWindowFallback = false;
|
||||
|
||||
initInit();
|
||||
InitStubs(jEnv);
|
||||
|
||||
#ifdef MOZ_WEBSMS_BACKEND
|
||||
mAndroidSmsMessageClass = getClassGlobalRef("android/telephony/SmsMessage");
|
||||
@ -272,6 +266,52 @@ jstring AndroidBridge::NewJavaString(AutoLocalJNIFrame* frame, const nsACString&
|
||||
return NewJavaString(frame, NS_ConvertUTF8toUTF16(string));
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
__attribute__ ((visibility("default")))
|
||||
JNIEnv * GetJNIForThread()
|
||||
{
|
||||
JNIEnv *jEnv = NULL;
|
||||
JavaVM *jVm = mozilla::AndroidBridge::GetVM();
|
||||
if (!jVm) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "GetJNIForThread", "Returned a null VM");
|
||||
return NULL;
|
||||
}
|
||||
jEnv = static_cast<JNIEnv*>(PR_GetThreadPrivate(sJavaEnvThreadIndex));
|
||||
|
||||
if (jEnv)
|
||||
return jEnv;
|
||||
|
||||
int status = jVm->GetEnv((void**) &jEnv, JNI_VERSION_1_2);
|
||||
if (status) {
|
||||
|
||||
status = jVm->AttachCurrentThread(&jEnv, NULL);
|
||||
if (status) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "GetJNIForThread", "Could not attach");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PR_SetThreadPrivate(sJavaEnvThreadIndex, jEnv);
|
||||
}
|
||||
if (!jEnv) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "GetJNIForThread", "returning NULL");
|
||||
}
|
||||
return jEnv;
|
||||
}
|
||||
}
|
||||
|
||||
void AutoGlobalWrappedJavaObject::Dispose() {
|
||||
if (isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
GetJNIForThread()->DeleteGlobalRef(wrapped_obj);
|
||||
wrapped_obj = NULL;
|
||||
}
|
||||
|
||||
AutoGlobalWrappedJavaObject::~AutoGlobalWrappedJavaObject() {
|
||||
Dispose();
|
||||
}
|
||||
|
||||
static void
|
||||
getHandlersFromStringArray(JNIEnv *aJNIEnv, jobjectArray jArr, jsize aLen,
|
||||
nsIMutableArray *aHandlersArray,
|
||||
@ -311,7 +351,7 @@ AndroidBridge::GetHandlersForMimeType(const nsAString& aMimeType,
|
||||
if (!env)
|
||||
return false;
|
||||
|
||||
jobjectArray arr = GetHandlersForMimeTypeWrapper(aMimeType, aAction);
|
||||
jobjectArray arr = GeckoAppShell::GetHandlersForMimeTypeWrapper(aMimeType, aAction);
|
||||
if (!arr)
|
||||
return false;
|
||||
|
||||
@ -340,7 +380,7 @@ AndroidBridge::GetHandlersForURL(const nsAString& aURL,
|
||||
if (!env)
|
||||
return false;
|
||||
|
||||
jobjectArray arr = GetHandlersForURLWrapper(aURL, aAction);
|
||||
jobjectArray arr = GeckoAppShell::GetHandlersForURLWrapper(aURL, aAction);
|
||||
if (!arr)
|
||||
return false;
|
||||
|
||||
@ -365,7 +405,7 @@ AndroidBridge::GetMimeTypeFromExtensions(const nsACString& aFileExt, nsCString&
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
jstring jstrType = GetMimeTypeFromExtensionsWrapper(NS_ConvertUTF8toUTF16(aFileExt));
|
||||
jstring jstrType = GeckoAppShell::GetMimeTypeFromExtensionsWrapper(NS_ConvertUTF8toUTF16(aFileExt));
|
||||
if (!jstrType) {
|
||||
return;
|
||||
}
|
||||
@ -384,7 +424,7 @@ AndroidBridge::GetExtensionFromMimeType(const nsACString& aMimeType, nsACString&
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
jstring jstrExt = GetExtensionFromMimeTypeWrapper(NS_ConvertUTF8toUTF16(aMimeType));
|
||||
jstring jstrExt = GeckoAppShell::GetExtensionFromMimeTypeWrapper(NS_ConvertUTF8toUTF16(aMimeType));
|
||||
if (!jstrExt) {
|
||||
return;
|
||||
}
|
||||
@ -403,7 +443,7 @@ AndroidBridge::GetClipboardText(nsAString& aText)
|
||||
if (!env)
|
||||
return false;
|
||||
|
||||
jstring result = GetClipboardTextWrapper();
|
||||
jstring result = Clipboard::GetClipboardTextWrapper();
|
||||
if (!result)
|
||||
return false;
|
||||
|
||||
@ -414,36 +454,6 @@ AndroidBridge::GetClipboardText(nsAString& aText)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidBridge::ClipboardHasText()
|
||||
{
|
||||
ALOG_BRIDGE("AndroidBridge::ClipboardHasText");
|
||||
|
||||
JNIEnv *env = GetJNIEnv();
|
||||
if (!env)
|
||||
return false;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env);
|
||||
|
||||
jstring jStr = GetClipboardTextWrapper();
|
||||
bool ret = jStr;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::EmptyClipboard()
|
||||
{
|
||||
ALOG_BRIDGE("AndroidBridge::EmptyClipboard");
|
||||
|
||||
JNIEnv *env = GetJNIEnv();
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env, 0);
|
||||
env->CallStaticVoidMethod(mClipboardClass, jSetClipboardText, nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::ShowAlertNotification(const nsAString& aImageUrl,
|
||||
const nsAString& aAlertTitle,
|
||||
@ -457,7 +467,7 @@ AndroidBridge::ShowAlertNotification(const nsAString& aImageUrl,
|
||||
nsAppShell::gAppShell->PostEvent(AndroidGeckoEvent::MakeAddObserver(aAlertName, aAlertListener));
|
||||
}
|
||||
|
||||
ShowAlertNotificationWrapper(aImageUrl, aAlertTitle, aAlertText, aAlertCookie, aAlertName);
|
||||
GeckoAppShell::ShowAlertNotificationWrapper(aImageUrl, aAlertTitle, aAlertText, aAlertCookie, aAlertName);
|
||||
}
|
||||
|
||||
int
|
||||
@ -469,7 +479,7 @@ AndroidBridge::GetDPI()
|
||||
|
||||
const int DEFAULT_DPI = 160;
|
||||
|
||||
sDPI = GetDpiWrapper();
|
||||
sDPI = GeckoAppShell::GetDpiWrapper();
|
||||
if (!sDPI) {
|
||||
return DEFAULT_DPI;
|
||||
}
|
||||
@ -488,7 +498,7 @@ AndroidBridge::GetScreenDepth()
|
||||
|
||||
const int DEFAULT_DEPTH = 16;
|
||||
|
||||
sDepth = GetScreenDepthWrapper();
|
||||
sDepth = GeckoAppShell::GetScreenDepthWrapper();
|
||||
if (!sDepth)
|
||||
return DEFAULT_DEPTH;
|
||||
|
||||
@ -502,7 +512,7 @@ AndroidBridge::ShowFilePickerForExtensions(nsAString& aFilePath, const nsAString
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
jstring jstr = ShowFilePickerForExtensionsWrapper(aExtensions);
|
||||
jstring jstr = GeckoAppShell::ShowFilePickerForExtensionsWrapper(aExtensions);
|
||||
if (jstr == nullptr) {
|
||||
return;
|
||||
}
|
||||
@ -518,7 +528,7 @@ AndroidBridge::ShowFilePickerForMimeType(nsAString& aFilePath, const nsAString&
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
jstring jstr = ShowFilePickerForMimeTypeWrapper(aMimeType);
|
||||
jstring jstr = GeckoAppShell::ShowFilePickerForMimeTypeWrapper(aMimeType);
|
||||
if (jstr == nullptr) {
|
||||
return;
|
||||
}
|
||||
@ -531,19 +541,7 @@ void
|
||||
AndroidBridge::ShowFilePickerAsync(const nsAString& aMimeType, nsFilePickerCallback* callback)
|
||||
{
|
||||
callback->AddRef();
|
||||
ShowFilePickerAsyncWrapper(aMimeType, (int64_t) callback);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::HideProgressDialogOnce()
|
||||
{
|
||||
static bool once = false;
|
||||
if (once)
|
||||
return;
|
||||
|
||||
HideProgressDialog();
|
||||
|
||||
once = true;
|
||||
GeckoAppShell::ShowFilePickerAsyncWrapper(aMimeType, (int64_t) callback);
|
||||
}
|
||||
|
||||
void
|
||||
@ -571,7 +569,7 @@ AndroidBridge::Vibrate(const nsTArray<uint32_t>& aPattern)
|
||||
ALOG_BRIDGE(" invalid vibration duration < 0");
|
||||
return;
|
||||
}
|
||||
Vibrate1(d);
|
||||
GeckoAppShell::Vibrate1(d);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -597,7 +595,7 @@ AndroidBridge::Vibrate(const nsTArray<uint32_t>& aPattern)
|
||||
}
|
||||
env->ReleaseLongArrayElements(array, elts, 0);
|
||||
|
||||
VibrateA(array, -1/*don't repeat*/);
|
||||
GeckoAppShell::VibrateA(array, -1/*don't repeat*/);
|
||||
}
|
||||
|
||||
void
|
||||
@ -614,7 +612,7 @@ AndroidBridge::GetSystemColors(AndroidSystemColors *aColors)
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env);
|
||||
|
||||
jintArray arr = GetSystemColoursWrapper();
|
||||
jintArray arr = GeckoAppShell::GetSystemColoursWrapper();
|
||||
if (!arr)
|
||||
return;
|
||||
|
||||
@ -652,7 +650,7 @@ AndroidBridge::GetIconForExtension(const nsACString& aFileExt, uint32_t aIconSiz
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env);
|
||||
|
||||
jbyteArray arr = GetIconForExtensionWrapper(NS_ConvertUTF8toUTF16(aFileExt), aIconSize);
|
||||
jbyteArray arr = GeckoAppShell::GetIconForExtensionWrapper(NS_ConvertUTF8toUTF16(aFileExt), aIconSize);
|
||||
|
||||
NS_ASSERTION(arr != nullptr, "AndroidBridge::GetIconForExtension: Returned pixels array is null!");
|
||||
if (!arr)
|
||||
@ -680,14 +678,11 @@ AndroidBridge::SetLayerClient(JNIEnv* env, jobject jobj)
|
||||
|
||||
if (resetting) {
|
||||
// clear out the old layer client
|
||||
env->DeleteGlobalRef(mLayerClient->wrappedObject());
|
||||
delete mLayerClient;
|
||||
mLayerClient = nullptr;
|
||||
}
|
||||
|
||||
AndroidGeckoLayerClient *client = new AndroidGeckoLayerClient();
|
||||
client->Init(env->NewGlobalRef(jobj));
|
||||
mLayerClient = client;
|
||||
mLayerClient = GeckoLayerClient::Wrap(jobj);
|
||||
|
||||
if (resetting) {
|
||||
// since we are re-linking the new java objects to Gecko, we need to get
|
||||
@ -700,26 +695,17 @@ AndroidBridge::SetLayerClient(JNIEnv* env, jobject jobj)
|
||||
void
|
||||
AndroidBridge::RegisterCompositor(JNIEnv *env)
|
||||
{
|
||||
ALOG_BRIDGE("AndroidBridge::RegisterCompositor");
|
||||
if (mGLControllerObj) {
|
||||
if (mGLControllerObj != NULL && !mGLControllerObj->isNull()) {
|
||||
// we already have this set up, no need to do it again
|
||||
return;
|
||||
}
|
||||
|
||||
if (!env) {
|
||||
env = GetJNIForThread(); // called on the compositor thread
|
||||
}
|
||||
if (!env) {
|
||||
return;
|
||||
}
|
||||
|
||||
jobject glController = RegisterCompositorWrapper();
|
||||
jobject glController = LayerView::RegisterCompositorWrapper();
|
||||
if (!glController) {
|
||||
return;
|
||||
}
|
||||
|
||||
mGLControllerObj = env->NewGlobalRef(glController);
|
||||
env->DeleteLocalRef(glController);
|
||||
mGLControllerObj = GLController::Wrap(glController);
|
||||
}
|
||||
|
||||
EGLSurface
|
||||
@ -735,7 +721,7 @@ AndroidBridge::CreateEGLSurfaceForCompositor()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
jobject eglSurface = CreateEGLSurfaceForCompositorWrapper(mGLControllerObj);
|
||||
jobject eglSurface = mGLControllerObj->CreateEGLSurfaceForCompositorWrapper();
|
||||
if (!eglSurface)
|
||||
return nullptr;
|
||||
|
||||
@ -807,11 +793,6 @@ mozilla_AndroidBridge_SetMainThread(pthread_t thr)
|
||||
return AndroidBridge::Bridge()->SetMainThread(thr);
|
||||
}
|
||||
|
||||
jclass GetGeckoAppShellClass()
|
||||
{
|
||||
return mozilla::AndroidBridge::GetGeckoAppShellClass();
|
||||
}
|
||||
|
||||
void*
|
||||
AndroidBridge::GetNativeSurface(JNIEnv* env, jobject surface) {
|
||||
if (!env || !mHasNativeWindowFallback || !jSurfacePointerField)
|
||||
@ -1008,7 +989,7 @@ AndroidBridge::InitCamera(const nsCString& contentType, uint32_t camera, uint32_
|
||||
return false;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env);
|
||||
jintArray arr = InitCameraWrapper(NS_ConvertUTF8toUTF16(contentType), (int32_t) camera, (int32_t) width, (int32_t) height);
|
||||
jintArray arr = GeckoAppShell::InitCameraWrapper(NS_ConvertUTF8toUTF16(contentType), (int32_t) camera, (int32_t) width, (int32_t) height);
|
||||
|
||||
if (!arr)
|
||||
return false;
|
||||
@ -1039,7 +1020,7 @@ AndroidBridge::GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInf
|
||||
|
||||
// To prevent calling too many methods through JNI, the Java method returns
|
||||
// an array of double even if we actually want a double and a boolean.
|
||||
jdoubleArray arr = GetCurrentBatteryInformationWrapper();
|
||||
jdoubleArray arr = GeckoAppShell::GetCurrentBatteryInformationWrapper();
|
||||
if (!arr || env->GetArrayLength(arr) != 3) {
|
||||
return;
|
||||
}
|
||||
@ -1063,7 +1044,7 @@ AndroidBridge::HandleGeckoMessage(const nsAString &aMessage, nsAString &aRet)
|
||||
return;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env);
|
||||
jstring returnMessage = HandleGeckoMessageWrapper(aMessage);
|
||||
jstring returnMessage = GeckoAppShell::HandleGeckoMessageWrapper(aMessage);
|
||||
|
||||
if (!returnMessage)
|
||||
return;
|
||||
@ -1130,7 +1111,7 @@ AndroidBridge::SendMessage(const nsAString& aNumber,
|
||||
if (!QueueSmsRequest(aRequest, &requestId))
|
||||
return;
|
||||
|
||||
SendMessageWrapper(aNumber, aMessage, requestId);
|
||||
GeckoAppShell::SendMessageWrapper(aNumber, aMessage, requestId);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1142,7 +1123,7 @@ AndroidBridge::GetMessage(int32_t aMessageId, nsIMobileMessageCallback* aRequest
|
||||
if (!QueueSmsRequest(aRequest, &requestId))
|
||||
return;
|
||||
|
||||
GetMessageWrapper(aMessageId, requestId);
|
||||
GeckoAppShell::GetMessageWrapper(aMessageId, requestId);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1154,7 +1135,7 @@ AndroidBridge::DeleteMessage(int32_t aMessageId, nsIMobileMessageCallback* aRequ
|
||||
if (!QueueSmsRequest(aRequest, &requestId))
|
||||
return;
|
||||
|
||||
DeleteMessageWrapper(aMessageId, requestId);
|
||||
GeckoAppShell::DeleteMessageWrapper(aMessageId, requestId);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1183,7 +1164,7 @@ AndroidBridge::CreateMessageList(const dom::mobilemessage::SmsFilterData& aFilte
|
||||
NewJavaString(&jniFrame, aFilter.numbers()[i]));
|
||||
}
|
||||
|
||||
CreateMessageListWrapper(aFilter.startDate(), aFilter.endDate(),
|
||||
GeckoAppShell::CreateMessageListWrapper(aFilter.startDate(), aFilter.endDate(),
|
||||
numbers, aFilter.numbers().Length(),
|
||||
aFilter.delivery(), aReverse, requestId);
|
||||
}
|
||||
@ -1197,7 +1178,7 @@ AndroidBridge::GetNextMessageInList(int32_t aListId, nsIMobileMessageCallback* a
|
||||
if (!QueueSmsRequest(aRequest, &requestId))
|
||||
return;
|
||||
|
||||
GetNextMessageInListWrapper(aListId, requestId);
|
||||
GeckoAppShell::GetNextMessageInListWrapper(aListId, requestId);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -1249,7 +1230,7 @@ AndroidBridge::GetCurrentNetworkInformation(hal::NetworkInformation* aNetworkInf
|
||||
// To prevent calling too many methods through JNI, the Java method returns
|
||||
// an array of double even if we actually want a double, two booleans, and an integer.
|
||||
|
||||
jdoubleArray arr = GetCurrentNetworkInformationWrapper();
|
||||
jdoubleArray arr = GeckoAppShell::GetCurrentNetworkInformationWrapper();
|
||||
if (!arr || env->GetArrayLength(arr) != 4) {
|
||||
return;
|
||||
}
|
||||
@ -1442,7 +1423,7 @@ AndroidBridge::GetGlobalContextRef() {
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env, 4);
|
||||
|
||||
jobject context = GetContext();
|
||||
jobject context = GeckoAppShell::GetContext();
|
||||
if (!context) {
|
||||
ALOG_BRIDGE("%s: Could not GetContext()", __FUNCTION__);
|
||||
return 0;
|
||||
@ -1493,21 +1474,22 @@ AndroidBridge::UnlockWindow(void* window)
|
||||
void
|
||||
AndroidBridge::SetFirstPaintViewport(const LayerIntPoint& aOffset, const CSSToLayerScale& aZoom, const CSSRect& aCssPageRect)
|
||||
{
|
||||
AndroidGeckoLayerClient *client = mLayerClient;
|
||||
GeckoLayerClient *client = mLayerClient;
|
||||
if (!client)
|
||||
return;
|
||||
|
||||
client->SetFirstPaintViewport(aOffset, aZoom, aCssPageRect);
|
||||
client->SetFirstPaintViewport((float)aOffset.x, (float)aOffset.y, aZoom.scale,
|
||||
aCssPageRect.x, aCssPageRect.y, aCssPageRect.XMost(), aCssPageRect.YMost());
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::SetPageRect(const CSSRect& aCssPageRect)
|
||||
{
|
||||
AndroidGeckoLayerClient *client = mLayerClient;
|
||||
GeckoLayerClient *client = mLayerClient;
|
||||
if (!client)
|
||||
return;
|
||||
|
||||
client->SetPageRect(aCssPageRect);
|
||||
client->SetPageRect(aCssPageRect.x, aCssPageRect.y, aCssPageRect.XMost(), aCssPageRect.YMost());
|
||||
}
|
||||
|
||||
void
|
||||
@ -1515,26 +1497,68 @@ AndroidBridge::SyncViewportInfo(const LayerIntRect& aDisplayPort, const CSSToLay
|
||||
bool aLayersUpdated, ScreenPoint& aScrollOffset, CSSToScreenScale& aScale,
|
||||
LayerMargin& aFixedLayerMargins, ScreenPoint& aOffset)
|
||||
{
|
||||
AndroidGeckoLayerClient *client = mLayerClient;
|
||||
if (!client)
|
||||
GeckoLayerClient *client = mLayerClient;
|
||||
if (!client) {
|
||||
ALOG_BRIDGE("Exceptional Exit: %s", __PRETTY_FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
client->SyncViewportInfo(aDisplayPort, aDisplayResolution, aLayersUpdated,
|
||||
aScrollOffset, aScale, aFixedLayerMargins,
|
||||
aOffset);
|
||||
jobject viewTransformJObj = client->SyncViewportInfo(aDisplayPort.x, aDisplayPort.y,
|
||||
aDisplayPort.width, aDisplayPort.height,
|
||||
aDisplayResolution.scale, aLayersUpdated);
|
||||
NS_ABORT_IF_FALSE(viewTransformJObj, "No view transform object!");
|
||||
|
||||
if (!viewTransformJObj) {
|
||||
return;
|
||||
}
|
||||
|
||||
ViewTransform* viewTransform = ViewTransform::Wrap(viewTransformJObj);
|
||||
aScrollOffset = ScreenPoint(viewTransform->getx(), viewTransform->gety());
|
||||
aScale.scale = viewTransform->getscale();
|
||||
aFixedLayerMargins.top = viewTransform->getfixedLayerMarginTop();
|
||||
aFixedLayerMargins.right = viewTransform->getfixedLayerMarginRight();
|
||||
aFixedLayerMargins.bottom = viewTransform->getfixedLayerMarginBottom();
|
||||
aFixedLayerMargins.left = viewTransform->getfixedLayerMarginLeft();
|
||||
aOffset.x = viewTransform->getoffsetX();
|
||||
aOffset.y = viewTransform->getoffsetY();
|
||||
delete viewTransform;
|
||||
}
|
||||
|
||||
void AndroidBridge::SyncFrameMetrics(const ScreenPoint& aScrollOffset, float aZoom, const CSSRect& aCssPageRect,
|
||||
bool aLayersUpdated, const CSSRect& aDisplayPort, const CSSToLayerScale& aDisplayResolution,
|
||||
bool aIsFirstPaint, LayerMargin& aFixedLayerMargins, ScreenPoint& aOffset)
|
||||
{
|
||||
AndroidGeckoLayerClient *client = mLayerClient;
|
||||
if (!client)
|
||||
GeckoLayerClient *client = mLayerClient;
|
||||
if (!client) {
|
||||
ALOG_BRIDGE("Exceptional Exit: %s", __PRETTY_FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
client->SyncFrameMetrics(aScrollOffset, aZoom, aCssPageRect,
|
||||
aLayersUpdated, aDisplayPort, aDisplayResolution,
|
||||
aIsFirstPaint, aFixedLayerMargins, aOffset);
|
||||
// convert the displayport rect from scroll-relative CSS pixels to document-relative device pixels
|
||||
LayerRect dpUnrounded = aDisplayPort * aDisplayResolution;
|
||||
dpUnrounded += LayerPoint::FromUnknownPoint(aScrollOffset.ToUnknownPoint());
|
||||
LayerIntRect dp = gfx::RoundedToInt(dpUnrounded);
|
||||
|
||||
jobject viewTransformJObj = client->SyncFrameMetrics(aScrollOffset.x, aScrollOffset.y, aZoom,
|
||||
aCssPageRect.x, aCssPageRect.y, aCssPageRect.XMost(), aCssPageRect.YMost(),
|
||||
aLayersUpdated, dp.x, dp.y, dp.width, dp.height, aDisplayResolution.scale,
|
||||
aIsFirstPaint);
|
||||
|
||||
NS_ABORT_IF_FALSE(viewTransformJObj, "No view transform object!");
|
||||
if (!viewTransformJObj) {
|
||||
return;
|
||||
}
|
||||
ViewTransform* viewTransform = ViewTransform::Wrap(viewTransformJObj);
|
||||
|
||||
aFixedLayerMargins.top = viewTransform->getfixedLayerMarginTop();
|
||||
aFixedLayerMargins.right = viewTransform->getfixedLayerMarginRight();
|
||||
aFixedLayerMargins.bottom = viewTransform->getfixedLayerMarginBottom();
|
||||
aFixedLayerMargins.left = viewTransform->getfixedLayerMarginLeft();
|
||||
|
||||
aOffset.x = viewTransform->getoffsetX();
|
||||
aOffset.y = viewTransform->getoffsetY();
|
||||
|
||||
delete viewTransform;
|
||||
}
|
||||
|
||||
AndroidBridge::AndroidBridge()
|
||||
@ -1599,45 +1623,12 @@ JavaThreadDetachFunc(void *arg)
|
||||
vm->DetachCurrentThread();
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
__attribute__ ((visibility("default")))
|
||||
JNIEnv * GetJNIForThread()
|
||||
{
|
||||
JNIEnv *jEnv = nullptr;
|
||||
JavaVM *jVm = mozilla::AndroidBridge::GetVM();
|
||||
if (!jVm) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "GetJNIForThread", "Returned a null VM");
|
||||
return nullptr;
|
||||
}
|
||||
jEnv = static_cast<JNIEnv*>(PR_GetThreadPrivate(sJavaEnvThreadIndex));
|
||||
|
||||
if (jEnv)
|
||||
return jEnv;
|
||||
|
||||
int status = jVm->GetEnv((void**) &jEnv, JNI_VERSION_1_2);
|
||||
if (status) {
|
||||
|
||||
status = jVm->AttachCurrentThread(&jEnv, nullptr);
|
||||
if (status) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "GetJNIForThread", "Could not attach");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PR_SetThreadPrivate(sJavaEnvThreadIndex, jEnv);
|
||||
}
|
||||
if (!jEnv) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "GetJNIForThread", "returning NULL");
|
||||
}
|
||||
return jEnv;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t
|
||||
AndroidBridge::GetScreenOrientation()
|
||||
{
|
||||
ALOG_BRIDGE("AndroidBridge::GetScreenOrientation");
|
||||
|
||||
int16_t orientation = GetScreenOrientationWrapper();
|
||||
int16_t orientation = GeckoAppShell::GetScreenOrientationWrapper();
|
||||
|
||||
if (!orientation)
|
||||
return dom::eScreenOrientation_None;
|
||||
@ -1663,7 +1654,7 @@ AndroidBridge::GetProxyForURI(const nsACString & aSpec,
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env);
|
||||
jstring jstrRet = GetProxyForURIWrapper(NS_ConvertUTF8toUTF16(aSpec),
|
||||
jstring jstrRet = GeckoAppShell::GetProxyForURIWrapper(NS_ConvertUTF8toUTF16(aSpec),
|
||||
NS_ConvertUTF8toUTF16(aScheme),
|
||||
NS_ConvertUTF8toUTF16(aHost),
|
||||
aPort);
|
||||
@ -1699,7 +1690,7 @@ AndroidBridge::AddPluginView(jobject view, const LayoutDeviceRect& rect, bool is
|
||||
return;
|
||||
|
||||
CSSRect cssRect = rect / win->GetDefaultScale();
|
||||
AddPluginViewWrapper(view, cssRect.x, cssRect.y, cssRect.width, cssRect.height, isFullScreen);
|
||||
GeckoAppShell::AddPluginViewWrapper(view, cssRect.x, cssRect.y, cssRect.width, cssRect.height, isFullScreen);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
@ -1716,7 +1707,7 @@ AndroidBridge::GetThreadNameJavaProfiling(uint32_t aThreadId, nsCString & aResul
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env);
|
||||
|
||||
jstring jstrThreadName = GetThreadNameJavaProfilingWrapper(aThreadId);
|
||||
jstring jstrThreadName = GeckoJavaSampler::GetThreadNameJavaProfilingWrapper(aThreadId);
|
||||
|
||||
if (!jstrThreadName)
|
||||
return false;
|
||||
@ -1736,7 +1727,7 @@ AndroidBridge::GetFrameNameJavaProfiling(uint32_t aThreadId, uint32_t aSampleId,
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env);
|
||||
|
||||
jstring jstrSampleName = GetFrameNameJavaProfilingWrapper(aThreadId, aSampleId, aFrameId);
|
||||
jstring jstrSampleName = GeckoJavaSampler::GetFrameNameJavaProfilingWrapper(aThreadId, aSampleId, aFrameId);
|
||||
|
||||
if (!jstrSampleName)
|
||||
return false;
|
||||
@ -1857,21 +1848,72 @@ nsresult AndroidBridge::CaptureThumbnail(nsIDOMWindow *window, int32_t bufW, int
|
||||
void
|
||||
AndroidBridge::GetDisplayPort(bool aPageSizeUpdate, bool aIsBrowserContentDisplayed, int32_t tabId, nsIAndroidViewport* metrics, nsIAndroidDisplayport** displayPort)
|
||||
{
|
||||
|
||||
ALOG_BRIDGE("Enter: %s", __PRETTY_FUNCTION__);
|
||||
JNIEnv* env = GetJNIEnv();
|
||||
if (!env || !mLayerClient)
|
||||
if (!env || !mLayerClient || mLayerClient->isNull()) {
|
||||
|
||||
ALOG_BRIDGE("Exceptional Exit: %s", __PRETTY_FUNCTION__);
|
||||
return;
|
||||
}
|
||||
AutoLocalJNIFrame jniFrame(env, 0);
|
||||
mLayerClient->GetDisplayPort(&jniFrame, aPageSizeUpdate, aIsBrowserContentDisplayed, tabId, metrics, displayPort);
|
||||
|
||||
float x, y, width, height,
|
||||
pageLeft, pageTop, pageRight, pageBottom,
|
||||
cssPageLeft, cssPageTop, cssPageRight, cssPageBottom,
|
||||
zoom;
|
||||
metrics->GetX(&x);
|
||||
metrics->GetY(&y);
|
||||
metrics->GetWidth(&width);
|
||||
metrics->GetHeight(&height);
|
||||
metrics->GetPageLeft(&pageLeft);
|
||||
metrics->GetPageTop(&pageTop);
|
||||
metrics->GetPageRight(&pageRight);
|
||||
metrics->GetPageBottom(&pageBottom);
|
||||
metrics->GetCssPageLeft(&cssPageLeft);
|
||||
metrics->GetCssPageTop(&cssPageTop);
|
||||
metrics->GetCssPageRight(&cssPageRight);
|
||||
metrics->GetCssPageBottom(&cssPageBottom);
|
||||
metrics->GetZoom(&zoom);
|
||||
|
||||
ImmutableViewportMetrics jmetrics = ImmutableViewportMetrics(pageLeft, pageTop, pageRight, pageBottom,
|
||||
cssPageLeft, cssPageTop, cssPageRight, cssPageBottom,
|
||||
x, y, x + width, y + height,
|
||||
zoom);
|
||||
|
||||
jobject jobj = mLayerClient->GetDisplayPort(aPageSizeUpdate, aIsBrowserContentDisplayed, tabId, jmetrics.wrappedObject());
|
||||
if (!jobj) {
|
||||
ALOG_BRIDGE("Exceptional Exit: %s", __PRETTY_FUNCTION__);
|
||||
return;
|
||||
}
|
||||
DisplayPortMetrics* displayPortMetrics = DisplayPortMetrics::Wrap(jobj);
|
||||
|
||||
AndroidRectF rect(env, displayPortMetrics->getMPosition());
|
||||
if (jniFrame.CheckForException()) {
|
||||
ALOG_BRIDGE("Exceptional Exit: %s", __PRETTY_FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
float resolution = displayPortMetrics->getResolution();
|
||||
if (jniFrame.CheckForException()) {
|
||||
ALOG_BRIDGE("Exceptional Exit: %s", __PRETTY_FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
*displayPort = new nsAndroidDisplayport(rect, resolution);
|
||||
(*displayPort)->AddRef();
|
||||
|
||||
delete displayPortMetrics;
|
||||
ALOG_BRIDGE("Exit: %s", __PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::ContentDocumentChanged()
|
||||
{
|
||||
JNIEnv* env = GetJNIEnv();
|
||||
if (!env || !mLayerClient)
|
||||
if (!mLayerClient) {
|
||||
return;
|
||||
AutoLocalJNIFrame jniFrame(env, 0);
|
||||
mLayerClient->ContentDocumentChanged(&jniFrame);
|
||||
}
|
||||
mLayerClient->ContentDocumentChanged();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -1880,25 +1922,48 @@ AndroidBridge::IsContentDocumentDisplayed()
|
||||
JNIEnv* env = GetJNIEnv();
|
||||
if (!env || !mLayerClient)
|
||||
return false;
|
||||
AutoLocalJNIFrame jniFrame(env, 0);
|
||||
return mLayerClient->IsContentDocumentDisplayed(&jniFrame);
|
||||
|
||||
return mLayerClient->IsContentDocumentDisplayed();
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidBridge::ProgressiveUpdateCallback(bool aHasPendingNewThebesContent, const LayerRect& aDisplayPort, float aDisplayResolution, bool aDrawingCritical, gfx::Rect& aViewport, float& aScaleX, float& aScaleY)
|
||||
{
|
||||
AndroidGeckoLayerClient *client = mLayerClient;
|
||||
if (!client)
|
||||
GeckoLayerClient *client = mLayerClient;
|
||||
if (!client) {
|
||||
ALOG_BRIDGE("Exceptional Exit: %s", __PRETTY_FUNCTION__);
|
||||
return false;
|
||||
|
||||
return client->ProgressiveUpdateCallback(aHasPendingNewThebesContent, aDisplayPort, aDisplayResolution, aDrawingCritical, aViewport, aScaleX, aScaleY);
|
||||
}
|
||||
|
||||
jobject
|
||||
jobject progressiveUpdateDataJObj = client->ProgressiveUpdateCallback(aHasPendingNewThebesContent,
|
||||
(float)aDisplayPort.x,
|
||||
(float)aDisplayPort.y,
|
||||
(float)aDisplayPort.width,
|
||||
(float)aDisplayPort.height,
|
||||
aDisplayResolution,
|
||||
!aDrawingCritical);
|
||||
|
||||
NS_ABORT_IF_FALSE(progressiveUpdateDataJObj, "No progressive update data!");
|
||||
|
||||
ProgressiveUpdateData* progressiveUpdateData = ProgressiveUpdateData::Wrap(progressiveUpdateDataJObj);
|
||||
|
||||
aViewport.x = progressiveUpdateData->getx();
|
||||
aViewport.y = progressiveUpdateData->gety();
|
||||
aViewport.width = progressiveUpdateData->getwidth();
|
||||
aViewport.height = progressiveUpdateData->getheight();
|
||||
aScaleX = aScaleY = progressiveUpdateData->getscale();
|
||||
|
||||
bool ret = progressiveUpdateData->getabort();
|
||||
delete progressiveUpdateData;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
NativePanZoomController*
|
||||
AndroidBridge::SetNativePanZoomController(jobject obj)
|
||||
{
|
||||
jobject old = mNativePanZoomController;
|
||||
mNativePanZoomController = obj;
|
||||
NativePanZoomController* old = mNativePanZoomController;
|
||||
mNativePanZoomController = NativePanZoomController::Wrap(obj);
|
||||
return old;
|
||||
}
|
||||
|
||||
@ -1910,8 +1975,7 @@ AndroidBridge::RequestContentRepaint(const mozilla::layers::FrameMetrics& aFrame
|
||||
CSSToScreenScale resolution = aFrameMetrics.mZoom;
|
||||
ScreenRect dp = (aFrameMetrics.mDisplayPort + aFrameMetrics.mScrollOffset) * resolution;
|
||||
|
||||
RequestContentRepaintWrapper(mNativePanZoomController,
|
||||
dp.x, dp.y, dp.width, dp.height, resolution.scale);
|
||||
mNativePanZoomController->RequestContentRepaintWrapper(dp.x, dp.y, dp.width, dp.height, resolution.scale);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1968,7 +2032,7 @@ AndroidBridge::PostDelayedTask(Task* aTask, int aDelayMs)
|
||||
// if we're inserting it at the head of the queue, notify Java because
|
||||
// we need to get a callback at an earlier time than the last scheduled
|
||||
// callback
|
||||
PostDelayedCallbackWrapper(mNativePanZoomController, (int64_t)aDelayMs);
|
||||
mNativePanZoomController->PostDelayedCallbackWrapper((int64_t)aDelayMs);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCOMArray.h"
|
||||
|
||||
#include "AndroidJavaWrappers.h"
|
||||
#include "GeneratedJNIWrappers.h"
|
||||
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsIMIMEInfo.h"
|
||||
@ -41,7 +41,6 @@ class nsIObserver;
|
||||
extern "C" JNIEnv * GetJNIForThread();
|
||||
|
||||
extern bool mozilla_AndroidBridge_SetMainThread(pthread_t);
|
||||
extern jclass GetGeckoAppShellClass();
|
||||
|
||||
namespace base {
|
||||
class Thread;
|
||||
@ -49,6 +48,8 @@ class Thread;
|
||||
|
||||
typedef void* EGLSurface;
|
||||
|
||||
using namespace mozilla::widget::android;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace hal {
|
||||
@ -160,10 +161,6 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static jclass GetGeckoAppShellClass() {
|
||||
return sBridge->mGeckoAppShellClass;
|
||||
}
|
||||
|
||||
// The bridge needs to be constructed via ConstructBridge first,
|
||||
// and then once the Gecko main thread is spun up (Gecko side),
|
||||
// SetMainThread should be called which will create the JNIEnv for
|
||||
@ -183,7 +180,7 @@ public:
|
||||
bool ProgressiveUpdateCallback(bool aHasPendingNewThebesContent, const LayerRect& aDisplayPort, float aDisplayResolution, bool aDrawingCritical, gfx::Rect& aViewport, float& aScaleX, float& aScaleY);
|
||||
|
||||
void SetLayerClient(JNIEnv* env, jobject jobj);
|
||||
AndroidGeckoLayerClient &GetLayerClient() { return *mLayerClient; }
|
||||
GeckoLayerClient* GetLayerClient() { return mLayerClient; }
|
||||
|
||||
bool GetHandlersForURL(const nsAString& aURL,
|
||||
nsIMutableArray* handlersArray = nullptr,
|
||||
@ -200,10 +197,6 @@ public:
|
||||
|
||||
bool GetClipboardText(nsAString& aText);
|
||||
|
||||
void EmptyClipboard();
|
||||
|
||||
bool ClipboardHasText();
|
||||
|
||||
void ShowAlertNotification(const nsAString& aImageUrl,
|
||||
const nsAString& aAlertTitle,
|
||||
const nsAString& aAlertText,
|
||||
@ -220,8 +213,6 @@ public:
|
||||
|
||||
void Vibrate(const nsTArray<uint32_t>& aPattern);
|
||||
|
||||
void HideProgressDialogOnce();
|
||||
|
||||
void GetSystemColors(AndroidSystemColors *aColors);
|
||||
|
||||
void GetIconForExtension(const nsACString& aFileExt, uint32_t aIconSize, uint8_t * const aBuf);
|
||||
@ -340,7 +331,7 @@ protected:
|
||||
JNIEnv *mJNIEnv;
|
||||
pthread_t mThread;
|
||||
|
||||
AndroidGeckoLayerClient *mLayerClient;
|
||||
GeckoLayerClient *mLayerClient = NULL;
|
||||
|
||||
// the android.telephony.SmsMessage class
|
||||
jclass mAndroidSmsMessageClass;
|
||||
@ -381,7 +372,7 @@ protected:
|
||||
jclass jLayerView;
|
||||
|
||||
jfieldID jEGLSurfacePointerField;
|
||||
jobject mGLControllerObj;
|
||||
GLController *mGLControllerObj;
|
||||
|
||||
// some convinient types to have around
|
||||
jclass jStringClass;
|
||||
@ -405,15 +396,14 @@ protected:
|
||||
void (* Region_set)(void* region, void* rect);
|
||||
|
||||
private:
|
||||
jobject mNativePanZoomController;
|
||||
NativePanZoomController* mNativePanZoomController;
|
||||
// This will always be accessed from one thread (the APZC "controller"
|
||||
// thread, which is the Java UI thread), so we don't need to do locking
|
||||
// to touch it
|
||||
nsTArray<DelayedTask*> mDelayedTaskQueue;
|
||||
|
||||
public:
|
||||
#include "GeneratedJNIWrappers.h"
|
||||
jobject SetNativePanZoomController(jobject obj);
|
||||
NativePanZoomController* SetNativePanZoomController(jobject obj);
|
||||
// GeckoContentController methods
|
||||
void RequestContentRepaint(const mozilla::layers::FrameMetrics& aFrameMetrics) MOZ_OVERRIDE;
|
||||
void HandleDoubleTap(const CSSIntPoint& aPoint) MOZ_OVERRIDE;
|
||||
|
@ -17,3 +17,17 @@
|
||||
|
||||
#define getStaticMethod(fname, ftype) \
|
||||
AndroidBridge::GetStaticMethodID(jEnv, jClass, fname, ftype)
|
||||
|
||||
#ifndef ALOG
|
||||
#if defined(DEBUG) || defined(FORCE_ALOG)
|
||||
#define ALOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gecko" , ## args)
|
||||
#else
|
||||
#define ALOG(args...) ((void)0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define ALOG_BRIDGE(args...) ALOG(args)
|
||||
#else
|
||||
#define ALOG_BRIDGE(args...) ((void)0)
|
||||
#endif
|
||||
|
@ -861,10 +861,10 @@ Java_org_mozilla_gecko_gfx_NativePanZoomController_init(JNIEnv* env, jobject ins
|
||||
return;
|
||||
}
|
||||
|
||||
jobject oldRef = AndroidBridge::Bridge()->SetNativePanZoomController(env->NewGlobalRef(instance));
|
||||
if (oldRef) {
|
||||
NativePanZoomController* oldRef = AndroidBridge::Bridge()->SetNativePanZoomController(instance);
|
||||
if (oldRef && !oldRef->isNull()) {
|
||||
MOZ_ASSERT(false, "Registering a new NPZC when we already have one");
|
||||
env->DeleteGlobalRef(oldRef);
|
||||
delete oldRef;
|
||||
}
|
||||
}
|
||||
|
||||
@ -905,11 +905,11 @@ Java_org_mozilla_gecko_gfx_NativePanZoomController_destroy(JNIEnv* env, jobject
|
||||
return;
|
||||
}
|
||||
|
||||
jobject oldRef = AndroidBridge::Bridge()->SetNativePanZoomController(nullptr);
|
||||
if (!oldRef) {
|
||||
NativePanZoomController* oldRef = AndroidBridge::Bridge()->SetNativePanZoomController(NULL);
|
||||
if (!oldRef || oldRef->isNull()) {
|
||||
MOZ_ASSERT(false, "Clearing a non-existent NPZC");
|
||||
} else {
|
||||
env->DeleteGlobalRef(oldRef);
|
||||
delete oldRef;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,12 +14,6 @@
|
||||
#include "nsThreadUtils.h"
|
||||
#include "AndroidBridge.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#define ALOG_BRIDGE(args...) ALOG(args)
|
||||
#else
|
||||
#define ALOG_BRIDGE(args...)
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
jclass __jsjni_GetGlobalClassRef(const char *className);
|
||||
}
|
||||
|
@ -6,13 +6,13 @@
|
||||
#include "AndroidJavaWrappers.h"
|
||||
#include "AndroidBridge.h"
|
||||
#include "AndroidBridgeUtilities.h"
|
||||
#include "nsIAndroidBridge.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "mozilla/TouchEvents.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::widget::android;
|
||||
|
||||
jclass AndroidGeckoEvent::jGeckoEventClass = 0;
|
||||
jfieldID AndroidGeckoEvent::jActionField = 0;
|
||||
@ -91,49 +91,6 @@ jmethodID AndroidLocation::jGetBearingMethod = 0;
|
||||
jmethodID AndroidLocation::jGetSpeedMethod = 0;
|
||||
jmethodID AndroidLocation::jGetTimeMethod = 0;
|
||||
|
||||
jclass AndroidGeckoLayerClient::jGeckoLayerClientClass = 0;
|
||||
jclass AndroidGeckoLayerClient::jViewportClass = 0;
|
||||
jclass AndroidGeckoLayerClient::jDisplayportClass = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jSetFirstPaintViewport = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jSetPageRect = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jSyncViewportInfoMethod = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jSyncFrameMetricsMethod = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jCreateFrameMethod = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jActivateProgramMethod = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jDeactivateProgramMethod = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jGetDisplayPort = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jContentDocumentChanged = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jIsContentDocumentDisplayed = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jViewportCtor = 0;
|
||||
jfieldID AndroidGeckoLayerClient::jDisplayportPosition = 0;
|
||||
jfieldID AndroidGeckoLayerClient::jDisplayportResolution = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jProgressiveUpdateCallbackMethod = 0;
|
||||
|
||||
jclass AndroidLayerRendererFrame::jLayerRendererFrameClass = 0;
|
||||
jmethodID AndroidLayerRendererFrame::jBeginDrawingMethod = 0;
|
||||
jmethodID AndroidLayerRendererFrame::jDrawBackgroundMethod = 0;
|
||||
jmethodID AndroidLayerRendererFrame::jDrawForegroundMethod = 0;
|
||||
jmethodID AndroidLayerRendererFrame::jEndDrawingMethod = 0;
|
||||
|
||||
jclass AndroidViewTransform::jViewTransformClass = 0;
|
||||
jfieldID AndroidViewTransform::jXField = 0;
|
||||
jfieldID AndroidViewTransform::jYField = 0;
|
||||
jfieldID AndroidViewTransform::jScaleField = 0;
|
||||
jfieldID AndroidViewTransform::jFixedLayerMarginLeft = 0;
|
||||
jfieldID AndroidViewTransform::jFixedLayerMarginTop = 0;
|
||||
jfieldID AndroidViewTransform::jFixedLayerMarginRight = 0;
|
||||
jfieldID AndroidViewTransform::jFixedLayerMarginBottom = 0;
|
||||
jfieldID AndroidViewTransform::jOffsetXField = 0;
|
||||
jfieldID AndroidViewTransform::jOffsetYField = 0;
|
||||
|
||||
jclass AndroidProgressiveUpdateData::jProgressiveUpdateDataClass = 0;
|
||||
jfieldID AndroidProgressiveUpdateData::jXField = 0;
|
||||
jfieldID AndroidProgressiveUpdateData::jYField = 0;
|
||||
jfieldID AndroidProgressiveUpdateData::jWidthField = 0;
|
||||
jfieldID AndroidProgressiveUpdateData::jHeightField = 0;
|
||||
jfieldID AndroidProgressiveUpdateData::jScaleField = 0;
|
||||
jfieldID AndroidProgressiveUpdateData::jShouldAbortField = 0;
|
||||
|
||||
RefCountedJavaObject::~RefCountedJavaObject() {
|
||||
if (mObject)
|
||||
GetJNIForThread()->DeleteGlobalRef(mObject);
|
||||
@ -148,10 +105,7 @@ mozilla::InitAndroidJavaWrappers(JNIEnv *jEnv)
|
||||
AndroidLocation::InitLocationClass(jEnv);
|
||||
AndroidRect::InitRectClass(jEnv);
|
||||
AndroidRectF::InitRectFClass(jEnv);
|
||||
AndroidGeckoLayerClient::InitGeckoLayerClientClass(jEnv);
|
||||
AndroidLayerRendererFrame::InitLayerRendererFrameClass(jEnv);
|
||||
AndroidViewTransform::InitViewTransformClass(jEnv);
|
||||
AndroidProgressiveUpdateData::InitProgressiveUpdateDataClass(jEnv);
|
||||
InitStubs(jEnv);
|
||||
}
|
||||
|
||||
void
|
||||
@ -290,82 +244,6 @@ AndroidRectF::InitRectFClass(JNIEnv *jEnv)
|
||||
jRightField = getField("right", "F");
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoLayerClient::InitGeckoLayerClientClass(JNIEnv *jEnv)
|
||||
{
|
||||
initInit();
|
||||
|
||||
jGeckoLayerClientClass = getClassGlobalRef("org/mozilla/gecko/gfx/GeckoLayerClient");
|
||||
|
||||
jProgressiveUpdateCallbackMethod = getMethod("progressiveUpdateCallback",
|
||||
"(ZFFFFFZ)Lorg/mozilla/gecko/gfx/ProgressiveUpdateData;");
|
||||
jSetFirstPaintViewport = getMethod("setFirstPaintViewport", "(FFFFFFF)V");
|
||||
jSetPageRect = getMethod("setPageRect", "(FFFF)V");
|
||||
jSyncViewportInfoMethod = getMethod("syncViewportInfo",
|
||||
"(IIIIFZ)Lorg/mozilla/gecko/gfx/ViewTransform;");
|
||||
jSyncFrameMetricsMethod = getMethod("syncFrameMetrics",
|
||||
"(FFFFFFFZIIIIFZ)Lorg/mozilla/gecko/gfx/ViewTransform;");
|
||||
jCreateFrameMethod = getMethod("createFrame", "()Lorg/mozilla/gecko/gfx/LayerRenderer$Frame;");
|
||||
jActivateProgramMethod = getMethod("activateProgram", "()V");
|
||||
jDeactivateProgramMethod = getMethod("deactivateProgram", "()V");
|
||||
jGetDisplayPort = getMethod("getDisplayPort", "(ZZILorg/mozilla/gecko/gfx/ImmutableViewportMetrics;)Lorg/mozilla/gecko/gfx/DisplayPortMetrics;");
|
||||
jContentDocumentChanged = getMethod("contentDocumentChanged", "()V");
|
||||
jIsContentDocumentDisplayed = getMethod("isContentDocumentDisplayed", "()Z");
|
||||
|
||||
jViewportClass = getClassGlobalRef("org/mozilla/gecko/gfx/ImmutableViewportMetrics");
|
||||
jViewportCtor = getMethod("<init>", "(FFFFFFFFFFFFF)V");
|
||||
|
||||
jDisplayportClass = getClassGlobalRef("org/mozilla/gecko/gfx/DisplayPortMetrics");
|
||||
jDisplayportPosition = getField("mPosition", "Landroid/graphics/RectF;");
|
||||
jDisplayportResolution = getField("resolution", "F");
|
||||
}
|
||||
|
||||
void
|
||||
AndroidLayerRendererFrame::InitLayerRendererFrameClass(JNIEnv *jEnv)
|
||||
{
|
||||
initInit();
|
||||
|
||||
jLayerRendererFrameClass = getClassGlobalRef("org/mozilla/gecko/gfx/LayerRenderer$Frame");
|
||||
|
||||
jBeginDrawingMethod = getMethod("beginDrawing", "()V");
|
||||
jDrawBackgroundMethod = getMethod("drawBackground", "()V");
|
||||
jDrawForegroundMethod = getMethod("drawForeground", "()V");
|
||||
jEndDrawingMethod = getMethod("endDrawing", "()V");
|
||||
}
|
||||
|
||||
void
|
||||
AndroidViewTransform::InitViewTransformClass(JNIEnv *jEnv)
|
||||
{
|
||||
initInit();
|
||||
|
||||
jViewTransformClass = getClassGlobalRef("org/mozilla/gecko/gfx/ViewTransform");
|
||||
|
||||
jXField = getField("x", "F");
|
||||
jYField = getField("y", "F");
|
||||
jScaleField = getField("scale", "F");
|
||||
jFixedLayerMarginLeft = getField("fixedLayerMarginLeft", "F");
|
||||
jFixedLayerMarginTop = getField("fixedLayerMarginTop", "F");
|
||||
jFixedLayerMarginRight = getField("fixedLayerMarginRight", "F");
|
||||
jFixedLayerMarginBottom = getField("fixedLayerMarginBottom", "F");
|
||||
jOffsetXField = getField("offsetX", "F");
|
||||
jOffsetYField = getField("offsetY", "F");
|
||||
}
|
||||
|
||||
void
|
||||
AndroidProgressiveUpdateData::InitProgressiveUpdateDataClass(JNIEnv *jEnv)
|
||||
{
|
||||
initInit();
|
||||
|
||||
jProgressiveUpdateDataClass = getClassGlobalRef("org/mozilla/gecko/gfx/ProgressiveUpdateData");
|
||||
|
||||
jXField = getField("x", "F");
|
||||
jYField = getField("y", "F");
|
||||
jWidthField = getField("width", "F");
|
||||
jHeightField = getField("height", "F");
|
||||
jScaleField = getField("scale", "F");
|
||||
jShouldAbortField = getField("abort", "Z");
|
||||
}
|
||||
|
||||
#undef initInit
|
||||
#undef initClassGlobalRef
|
||||
#undef getField
|
||||
@ -892,461 +770,8 @@ AndroidPoint::Init(JNIEnv *jenv, jobject jobj)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoLayerClient::Init(jobject jobj)
|
||||
{
|
||||
NS_ASSERTION(wrapped_obj == nullptr, "Init called on non-null wrapped_obj!");
|
||||
wrapped_obj = jobj;
|
||||
}
|
||||
|
||||
void
|
||||
AndroidLayerRendererFrame::Init(JNIEnv *env, jobject jobj)
|
||||
{
|
||||
if (!isNull()) {
|
||||
Dispose(env);
|
||||
}
|
||||
|
||||
wrapped_obj = env->NewGlobalRef(jobj);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidLayerRendererFrame::Dispose(JNIEnv *env)
|
||||
{
|
||||
if (isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
env->DeleteGlobalRef(wrapped_obj);
|
||||
wrapped_obj = 0;
|
||||
}
|
||||
|
||||
void
|
||||
AndroidViewTransform::Init(jobject jobj)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(wrapped_obj == nullptr, "Init called on non-null wrapped_obj!");
|
||||
wrapped_obj = jobj;
|
||||
}
|
||||
|
||||
void
|
||||
AndroidProgressiveUpdateData::Init(jobject jobj)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(wrapped_obj == nullptr, "Init called on non-null wrapped_obj!");
|
||||
wrapped_obj = jobj;
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoLayerClient::SetFirstPaintViewport(const LayerIntPoint& aOffset, const CSSToLayerScale& aZoom, const CSSRect& aCssPageRect)
|
||||
{
|
||||
NS_ASSERTION(!isNull(), "SetFirstPaintViewport called on null layer client!");
|
||||
JNIEnv *env = GetJNIForThread(); // this is called on the compositor thread
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env, 0);
|
||||
return env->CallVoidMethod(wrapped_obj, jSetFirstPaintViewport, (float)aOffset.x, (float)aOffset.y, aZoom.scale,
|
||||
aCssPageRect.x, aCssPageRect.y, aCssPageRect.XMost(), aCssPageRect.YMost());
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoLayerClient::SetPageRect(const CSSRect& aCssPageRect)
|
||||
{
|
||||
NS_ASSERTION(!isNull(), "SetPageRect called on null layer client!");
|
||||
JNIEnv *env = GetJNIForThread(); // this is called on the compositor thread
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env, 0);
|
||||
return env->CallVoidMethod(wrapped_obj, jSetPageRect,
|
||||
aCssPageRect.x, aCssPageRect.y, aCssPageRect.XMost(), aCssPageRect.YMost());
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoLayerClient::SyncViewportInfo(const LayerIntRect& aDisplayPort, const CSSToLayerScale& aDisplayResolution,
|
||||
bool aLayersUpdated, ScreenPoint& aScrollOffset, CSSToScreenScale& aScale,
|
||||
LayerMargin& aFixedLayerMargins, ScreenPoint& aOffset)
|
||||
{
|
||||
NS_ASSERTION(!isNull(), "SyncViewportInfo called on null layer client!");
|
||||
JNIEnv *env = GetJNIForThread(); // this is called on the compositor thread
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env);
|
||||
|
||||
jobject viewTransformJObj = env->CallObjectMethod(wrapped_obj, jSyncViewportInfoMethod,
|
||||
aDisplayPort.x, aDisplayPort.y,
|
||||
aDisplayPort.width, aDisplayPort.height,
|
||||
aDisplayResolution.scale, aLayersUpdated);
|
||||
if (jniFrame.CheckForException())
|
||||
return;
|
||||
|
||||
NS_ABORT_IF_FALSE(viewTransformJObj, "No view transform object!");
|
||||
|
||||
AndroidViewTransform viewTransform;
|
||||
viewTransform.Init(viewTransformJObj);
|
||||
|
||||
aScrollOffset = ScreenPoint(viewTransform.GetX(env), viewTransform.GetY(env));
|
||||
aScale.scale = viewTransform.GetScale(env);
|
||||
viewTransform.GetFixedLayerMargins(env, aFixedLayerMargins);
|
||||
|
||||
aOffset.x = viewTransform.GetOffsetX(env);
|
||||
aOffset.y = viewTransform.GetOffsetY(env);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoLayerClient::SyncFrameMetrics(const ScreenPoint& aScrollOffset, float aZoom, const CSSRect& aCssPageRect,
|
||||
bool aLayersUpdated, const CSSRect& aDisplayPort, const CSSToLayerScale& aDisplayResolution,
|
||||
bool aIsFirstPaint, LayerMargin& aFixedLayerMargins, ScreenPoint& aOffset)
|
||||
{
|
||||
NS_ASSERTION(!isNull(), "SyncFrameMetrics called on null layer client!");
|
||||
JNIEnv *env = GetJNIForThread(); // this is called on the compositor thread
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env);
|
||||
|
||||
// convert the displayport rect from scroll-relative CSS pixels to document-relative device pixels
|
||||
LayerRect dpUnrounded = aDisplayPort * aDisplayResolution;
|
||||
dpUnrounded += LayerPoint::FromUnknownPoint(aScrollOffset.ToUnknownPoint());
|
||||
LayerIntRect dp = gfx::RoundedToInt(dpUnrounded);
|
||||
|
||||
jobject viewTransformJObj = env->CallObjectMethod(wrapped_obj, jSyncFrameMetricsMethod,
|
||||
aScrollOffset.x, aScrollOffset.y, aZoom,
|
||||
aCssPageRect.x, aCssPageRect.y, aCssPageRect.XMost(), aCssPageRect.YMost(),
|
||||
aLayersUpdated, dp.x, dp.y, dp.width, dp.height, aDisplayResolution.scale,
|
||||
aIsFirstPaint);
|
||||
|
||||
if (jniFrame.CheckForException())
|
||||
return;
|
||||
|
||||
NS_ABORT_IF_FALSE(viewTransformJObj, "No view transform object!");
|
||||
|
||||
AndroidViewTransform viewTransform;
|
||||
viewTransform.Init(viewTransformJObj);
|
||||
viewTransform.GetFixedLayerMargins(env, aFixedLayerMargins);
|
||||
aOffset.x = viewTransform.GetOffsetX(env);
|
||||
aOffset.y = viewTransform.GetOffsetY(env);
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidGeckoLayerClient::ProgressiveUpdateCallback(bool aHasPendingNewThebesContent,
|
||||
const LayerRect& aDisplayPort,
|
||||
float aDisplayResolution,
|
||||
bool aDrawingCritical,
|
||||
gfx::Rect& aViewport,
|
||||
float& aScaleX,
|
||||
float& aScaleY)
|
||||
{
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return false;
|
||||
|
||||
AutoJObject progressiveUpdateDataJObj(env, env->CallObjectMethod(wrapped_obj,
|
||||
jProgressiveUpdateCallbackMethod,
|
||||
aHasPendingNewThebesContent,
|
||||
(float)aDisplayPort.x,
|
||||
(float)aDisplayPort.y,
|
||||
(float)aDisplayPort.width,
|
||||
(float)aDisplayPort.height,
|
||||
aDisplayResolution,
|
||||
!aDrawingCritical));
|
||||
if (env->ExceptionCheck()) {
|
||||
env->ExceptionDescribe();
|
||||
env->ExceptionClear();
|
||||
return false;
|
||||
}
|
||||
|
||||
NS_ABORT_IF_FALSE(progressiveUpdateDataJObj, "No progressive update data!");
|
||||
|
||||
AndroidProgressiveUpdateData progressiveUpdateData(progressiveUpdateDataJObj);
|
||||
|
||||
aViewport.x = progressiveUpdateData.GetX(env);
|
||||
aViewport.y = progressiveUpdateData.GetY(env);
|
||||
aViewport.width = progressiveUpdateData.GetWidth(env);
|
||||
aViewport.height = progressiveUpdateData.GetHeight(env);
|
||||
aScaleX = aScaleY = progressiveUpdateData.GetScale(env);
|
||||
|
||||
return progressiveUpdateData.GetShouldAbort(env);
|
||||
}
|
||||
|
||||
jobject ConvertToJavaViewportMetrics(JNIEnv* env, nsIAndroidViewport* metrics) {
|
||||
float x, y, width, height,
|
||||
pageLeft, pageTop, pageRight, pageBottom,
|
||||
cssPageLeft, cssPageTop, cssPageRight, cssPageBottom,
|
||||
zoom;
|
||||
metrics->GetX(&x);
|
||||
metrics->GetY(&y);
|
||||
metrics->GetWidth(&width);
|
||||
metrics->GetHeight(&height);
|
||||
metrics->GetPageLeft(&pageLeft);
|
||||
metrics->GetPageTop(&pageTop);
|
||||
metrics->GetPageRight(&pageRight);
|
||||
metrics->GetPageBottom(&pageBottom);
|
||||
metrics->GetCssPageLeft(&cssPageLeft);
|
||||
metrics->GetCssPageTop(&cssPageTop);
|
||||
metrics->GetCssPageRight(&cssPageRight);
|
||||
metrics->GetCssPageBottom(&cssPageBottom);
|
||||
metrics->GetZoom(&zoom);
|
||||
|
||||
jobject jobj = env->NewObject(AndroidGeckoLayerClient::jViewportClass, AndroidGeckoLayerClient::jViewportCtor,
|
||||
pageLeft, pageTop, pageRight, pageBottom,
|
||||
cssPageLeft, cssPageTop, cssPageRight, cssPageBottom,
|
||||
x, y, x + width, y + height,
|
||||
zoom);
|
||||
return jobj;
|
||||
}
|
||||
|
||||
class nsAndroidDisplayport MOZ_FINAL : public nsIAndroidDisplayport
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
virtual nsresult GetLeft(float *aLeft) { *aLeft = mLeft; return NS_OK; }
|
||||
virtual nsresult GetTop(float *aTop) { *aTop = mTop; return NS_OK; }
|
||||
virtual nsresult GetRight(float *aRight) { *aRight = mRight; return NS_OK; }
|
||||
virtual nsresult GetBottom(float *aBottom) { *aBottom = mBottom; return NS_OK; }
|
||||
virtual nsresult GetResolution(float *aResolution) { *aResolution = mResolution; return NS_OK; }
|
||||
virtual nsresult SetLeft(float aLeft) { mLeft = aLeft; return NS_OK; }
|
||||
virtual nsresult SetTop(float aTop) { mTop = aTop; return NS_OK; }
|
||||
virtual nsresult SetRight(float aRight) { mRight = aRight; return NS_OK; }
|
||||
virtual nsresult SetBottom(float aBottom) { mBottom = aBottom; return NS_OK; }
|
||||
virtual nsresult SetResolution(float aResolution) { mResolution = aResolution; return NS_OK; }
|
||||
|
||||
nsAndroidDisplayport(AndroidRectF aRect, float aResolution):
|
||||
mLeft(aRect.Left()), mTop(aRect.Top()), mRight(aRect.Right()), mBottom(aRect.Bottom()), mResolution(aResolution) {}
|
||||
|
||||
private:
|
||||
~nsAndroidDisplayport() {}
|
||||
float mLeft, mTop, mRight, mBottom, mResolution;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsAndroidDisplayport, nsIAndroidDisplayport)
|
||||
|
||||
void createDisplayPort(AutoLocalJNIFrame *jniFrame, jobject jobj, nsIAndroidDisplayport** displayPort) {
|
||||
JNIEnv* env = jniFrame->GetEnv();
|
||||
AndroidRectF rect(env, env->GetObjectField(jobj, AndroidGeckoLayerClient::jDisplayportPosition));
|
||||
if (jniFrame->CheckForException()) return;
|
||||
float resolution = env->GetFloatField(jobj, AndroidGeckoLayerClient::jDisplayportResolution);
|
||||
if (jniFrame->CheckForException()) return;
|
||||
*displayPort = new nsAndroidDisplayport(rect, resolution);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoLayerClient::GetDisplayPort(AutoLocalJNIFrame *jniFrame, bool aPageSizeUpdate, bool aIsBrowserContentDisplayed, int32_t tabId, nsIAndroidViewport* metrics, nsIAndroidDisplayport** displayPort)
|
||||
{
|
||||
jobject jmetrics = ConvertToJavaViewportMetrics(jniFrame->GetEnv(), metrics);
|
||||
if (jniFrame->CheckForException()) return;
|
||||
if (!jmetrics)
|
||||
return;
|
||||
jobject jobj = jniFrame->GetEnv()->CallObjectMethod(wrapped_obj, jGetDisplayPort, aPageSizeUpdate, aIsBrowserContentDisplayed, tabId, jmetrics);
|
||||
if (jniFrame->CheckForException()) return;
|
||||
createDisplayPort(jniFrame, jobj, displayPort);
|
||||
(*displayPort)->AddRef();
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoLayerClient::ContentDocumentChanged(AutoLocalJNIFrame *jniFrame)
|
||||
{
|
||||
jniFrame->GetEnv()->CallVoidMethod(wrapped_obj, jContentDocumentChanged);
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidGeckoLayerClient::IsContentDocumentDisplayed(AutoLocalJNIFrame *jniFrame)
|
||||
{
|
||||
return jniFrame->GetEnv()->CallBooleanMethod(wrapped_obj, jIsContentDocumentDisplayed);
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidGeckoLayerClient::CreateFrame(AutoLocalJNIFrame *jniFrame, AndroidLayerRendererFrame& aFrame)
|
||||
{
|
||||
if (!jniFrame || !jniFrame->GetEnv())
|
||||
return false;
|
||||
|
||||
jobject frameJObj = jniFrame->GetEnv()->CallObjectMethod(wrapped_obj, jCreateFrameMethod);
|
||||
if (jniFrame->CheckForException())
|
||||
return false;
|
||||
NS_ABORT_IF_FALSE(frameJObj, "No frame object!");
|
||||
|
||||
aFrame.Init(jniFrame->GetEnv(), frameJObj);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidGeckoLayerClient::ActivateProgram(AutoLocalJNIFrame *jniFrame)
|
||||
{
|
||||
if (!jniFrame || !jniFrame->GetEnv())
|
||||
return false;
|
||||
|
||||
jniFrame->GetEnv()->CallVoidMethod(wrapped_obj, jActivateProgramMethod);
|
||||
if (jniFrame->CheckForException())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidGeckoLayerClient::DeactivateProgram(AutoLocalJNIFrame *jniFrame)
|
||||
{
|
||||
if (!jniFrame || !jniFrame->GetEnv())
|
||||
return false;
|
||||
|
||||
jniFrame->GetEnv()->CallVoidMethod(wrapped_obj, jDeactivateProgramMethod);
|
||||
if (jniFrame->CheckForException())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidLayerRendererFrame::BeginDrawing(AutoLocalJNIFrame *jniFrame)
|
||||
{
|
||||
if (!jniFrame || !jniFrame->GetEnv())
|
||||
return false;
|
||||
|
||||
jniFrame->GetEnv()->CallVoidMethod(wrapped_obj, jBeginDrawingMethod);
|
||||
if (jniFrame->CheckForException())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidLayerRendererFrame::DrawBackground(AutoLocalJNIFrame *jniFrame)
|
||||
{
|
||||
if (!jniFrame || !jniFrame->GetEnv())
|
||||
return false;
|
||||
|
||||
jniFrame->GetEnv()->CallVoidMethod(wrapped_obj, jDrawBackgroundMethod);
|
||||
if (jniFrame->CheckForException())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidLayerRendererFrame::DrawForeground(AutoLocalJNIFrame *jniFrame)
|
||||
{
|
||||
if (!jniFrame || !jniFrame->GetEnv())
|
||||
return false;
|
||||
|
||||
jniFrame->GetEnv()->CallVoidMethod(wrapped_obj, jDrawForegroundMethod);
|
||||
if (jniFrame->CheckForException())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidLayerRendererFrame::EndDrawing(AutoLocalJNIFrame *jniFrame)
|
||||
{
|
||||
if (!jniFrame || !jniFrame->GetEnv())
|
||||
return false;
|
||||
|
||||
jniFrame->GetEnv()->CallVoidMethod(wrapped_obj, jEndDrawingMethod);
|
||||
if (jniFrame->CheckForException())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
float
|
||||
AndroidViewTransform::GetX(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jXField);
|
||||
}
|
||||
|
||||
float
|
||||
AndroidViewTransform::GetY(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jYField);
|
||||
}
|
||||
|
||||
float
|
||||
AndroidViewTransform::GetScale(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jScaleField);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidViewTransform::GetFixedLayerMargins(JNIEnv *env, LayerMargin &aFixedLayerMargins)
|
||||
{
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
aFixedLayerMargins.top = env->GetFloatField(wrapped_obj, jFixedLayerMarginTop);
|
||||
aFixedLayerMargins.right = env->GetFloatField(wrapped_obj, jFixedLayerMarginRight);
|
||||
aFixedLayerMargins.bottom = env->GetFloatField(wrapped_obj, jFixedLayerMarginBottom);
|
||||
aFixedLayerMargins.left = env->GetFloatField(wrapped_obj, jFixedLayerMarginLeft);
|
||||
}
|
||||
|
||||
float
|
||||
AndroidViewTransform::GetOffsetX(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jOffsetXField);
|
||||
}
|
||||
|
||||
float
|
||||
AndroidViewTransform::GetOffsetY(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jOffsetYField);
|
||||
}
|
||||
|
||||
float
|
||||
AndroidProgressiveUpdateData::GetX(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jXField);
|
||||
}
|
||||
|
||||
float
|
||||
AndroidProgressiveUpdateData::GetY(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jYField);
|
||||
}
|
||||
|
||||
float
|
||||
AndroidProgressiveUpdateData::GetWidth(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jWidthField);
|
||||
}
|
||||
|
||||
float
|
||||
AndroidProgressiveUpdateData::GetHeight(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jHeightField);
|
||||
}
|
||||
|
||||
float
|
||||
AndroidProgressiveUpdateData::GetScale(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jScaleField);
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidProgressiveUpdateData::GetShouldAbort(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return false;
|
||||
return env->GetBooleanField(wrapped_obj, jShouldAbortField);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidRect::Init(JNIEnv *jenv, jobject jobj)
|
||||
{
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIAndroidBridge.h"
|
||||
#include "mozilla/gfx/Rect.h"
|
||||
#include "mozilla/dom/Touch.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
@ -23,21 +24,12 @@
|
||||
|
||||
//#define FORCE_ALOG 1
|
||||
|
||||
#ifndef ALOG
|
||||
#if defined(DEBUG) || defined(FORCE_ALOG)
|
||||
#define ALOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gecko" , ## args)
|
||||
#else
|
||||
#define ALOG(args...) ((void)0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class nsIAndroidDisplayport;
|
||||
class nsIAndroidViewport;
|
||||
class nsIWidget;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class AndroidGeckoLayerClient;
|
||||
class AutoLocalJNIFrame;
|
||||
|
||||
void InitAndroidJavaWrappers(JNIEnv *jEnv);
|
||||
@ -75,10 +67,10 @@ private:
|
||||
class WrappedJavaObject {
|
||||
public:
|
||||
WrappedJavaObject() :
|
||||
wrapped_obj(0)
|
||||
wrapped_obj(NULL)
|
||||
{ }
|
||||
|
||||
WrappedJavaObject(jobject jobj) {
|
||||
WrappedJavaObject(jobject jobj) : wrapped_obj(NULL) {
|
||||
Init(jobj);
|
||||
}
|
||||
|
||||
@ -87,7 +79,39 @@ public:
|
||||
}
|
||||
|
||||
bool isNull() const {
|
||||
return wrapped_obj == 0;
|
||||
return wrapped_obj == NULL;
|
||||
}
|
||||
|
||||
jobject wrappedObject() const {
|
||||
return wrapped_obj;
|
||||
}
|
||||
|
||||
protected:
|
||||
jobject wrapped_obj;
|
||||
};
|
||||
|
||||
class AutoGlobalWrappedJavaObject : protected WrappedJavaObject{
|
||||
public:
|
||||
AutoGlobalWrappedJavaObject() :
|
||||
wrapped_obj(NULL)
|
||||
{ }
|
||||
|
||||
AutoGlobalWrappedJavaObject(jobject jobj, JNIEnv* env) : wrapped_obj(NULL) {
|
||||
Init(jobj, env);
|
||||
}
|
||||
|
||||
virtual ~AutoGlobalWrappedJavaObject();
|
||||
void Dispose();
|
||||
|
||||
void Init(jobject jobj, JNIEnv* env) {
|
||||
if (!isNull()) {
|
||||
env->DeleteGlobalRef(wrapped_obj);
|
||||
}
|
||||
wrapped_obj = env->NewGlobalRef(jobj);
|
||||
}
|
||||
|
||||
bool isNull() const {
|
||||
return wrapped_obj == NULL;
|
||||
}
|
||||
|
||||
jobject wrappedObject() const {
|
||||
@ -186,128 +210,6 @@ protected:
|
||||
static jfieldID jTopField;
|
||||
};
|
||||
|
||||
class AndroidViewTransform : public WrappedJavaObject {
|
||||
public:
|
||||
static void InitViewTransformClass(JNIEnv *jEnv);
|
||||
|
||||
void Init(jobject jobj);
|
||||
|
||||
AndroidViewTransform() {}
|
||||
AndroidViewTransform(jobject jobj) { Init(jobj); }
|
||||
|
||||
float GetX(JNIEnv *env);
|
||||
float GetY(JNIEnv *env);
|
||||
float GetScale(JNIEnv *env);
|
||||
void GetFixedLayerMargins(JNIEnv *env, LayerMargin &aFixedLayerMargins);
|
||||
float GetOffsetX(JNIEnv *env);
|
||||
float GetOffsetY(JNIEnv *env);
|
||||
|
||||
private:
|
||||
static jclass jViewTransformClass;
|
||||
static jfieldID jXField;
|
||||
static jfieldID jYField;
|
||||
static jfieldID jScaleField;
|
||||
static jfieldID jFixedLayerMarginLeft;
|
||||
static jfieldID jFixedLayerMarginTop;
|
||||
static jfieldID jFixedLayerMarginRight;
|
||||
static jfieldID jFixedLayerMarginBottom;
|
||||
static jfieldID jOffsetXField;
|
||||
static jfieldID jOffsetYField;
|
||||
};
|
||||
|
||||
class AndroidProgressiveUpdateData : public WrappedJavaObject {
|
||||
public:
|
||||
static void InitProgressiveUpdateDataClass(JNIEnv *jEnv);
|
||||
|
||||
void Init(jobject jobj);
|
||||
|
||||
AndroidProgressiveUpdateData() {}
|
||||
AndroidProgressiveUpdateData(jobject jobj) { Init(jobj); }
|
||||
|
||||
float GetX(JNIEnv *env);
|
||||
float GetY(JNIEnv *env);
|
||||
float GetWidth(JNIEnv *env);
|
||||
float GetHeight(JNIEnv *env);
|
||||
float GetScale(JNIEnv *env);
|
||||
bool GetShouldAbort(JNIEnv *env);
|
||||
|
||||
private:
|
||||
static jclass jProgressiveUpdateDataClass;
|
||||
static jfieldID jXField;
|
||||
static jfieldID jYField;
|
||||
static jfieldID jWidthField;
|
||||
static jfieldID jHeightField;
|
||||
static jfieldID jScaleField;
|
||||
static jfieldID jShouldAbortField;
|
||||
};
|
||||
|
||||
class AndroidLayerRendererFrame : public WrappedJavaObject {
|
||||
public:
|
||||
static void InitLayerRendererFrameClass(JNIEnv *jEnv);
|
||||
|
||||
void Init(JNIEnv *env, jobject jobj);
|
||||
void Dispose(JNIEnv *env);
|
||||
|
||||
bool BeginDrawing(AutoLocalJNIFrame *jniFrame);
|
||||
bool DrawBackground(AutoLocalJNIFrame *jniFrame);
|
||||
bool DrawForeground(AutoLocalJNIFrame *jniFrame);
|
||||
bool EndDrawing(AutoLocalJNIFrame *jniFrame);
|
||||
|
||||
private:
|
||||
static jclass jLayerRendererFrameClass;
|
||||
static jmethodID jBeginDrawingMethod;
|
||||
static jmethodID jDrawBackgroundMethod;
|
||||
static jmethodID jDrawForegroundMethod;
|
||||
static jmethodID jEndDrawingMethod;
|
||||
};
|
||||
|
||||
class AndroidGeckoLayerClient : public WrappedJavaObject {
|
||||
public:
|
||||
static void InitGeckoLayerClientClass(JNIEnv *jEnv);
|
||||
|
||||
void Init(jobject jobj);
|
||||
|
||||
AndroidGeckoLayerClient() {}
|
||||
AndroidGeckoLayerClient(jobject jobj) { Init(jobj); }
|
||||
|
||||
void SetFirstPaintViewport(const LayerIntPoint& aOffset, const CSSToLayerScale& aZoom, const CSSRect& aCssPageRect);
|
||||
void SetPageRect(const CSSRect& aCssPageRect);
|
||||
void SyncViewportInfo(const LayerIntRect& aDisplayPort, const CSSToLayerScale& aDisplayResolution,
|
||||
bool aLayersUpdated, ScreenPoint& aScrollOffset, CSSToScreenScale& aScale,
|
||||
LayerMargin& aFixedLayerMargins, ScreenPoint& aOffset);
|
||||
void SyncFrameMetrics(const ScreenPoint& aScrollOffset, float aZoom, const CSSRect& aCssPageRect,
|
||||
bool aLayersUpdated, const CSSRect& aDisplayPort, const CSSToLayerScale& aDisplayResolution,
|
||||
bool aIsFirstPaint, LayerMargin& aFixedLayerMargins, ScreenPoint& aOffset);
|
||||
bool ProgressiveUpdateCallback(bool aHasPendingNewThebesContent, const LayerRect& aDisplayPort, float aDisplayResolution, bool aDrawingCritical, gfx::Rect& aViewport, float& aScaleX, float& aScaleY);
|
||||
bool CreateFrame(AutoLocalJNIFrame *jniFrame, AndroidLayerRendererFrame& aFrame);
|
||||
bool ActivateProgram(AutoLocalJNIFrame *jniFrame);
|
||||
bool DeactivateProgram(AutoLocalJNIFrame *jniFrame);
|
||||
void GetDisplayPort(AutoLocalJNIFrame *jniFrame, bool aPageSizeUpdate, bool aIsBrowserContentDisplayed, int32_t tabId, nsIAndroidViewport* metrics, nsIAndroidDisplayport** displayPort);
|
||||
void ContentDocumentChanged(AutoLocalJNIFrame *jniFrame);
|
||||
bool IsContentDocumentDisplayed(AutoLocalJNIFrame *jniFrame);
|
||||
|
||||
protected:
|
||||
static jclass jGeckoLayerClientClass;
|
||||
static jmethodID jSetFirstPaintViewport;
|
||||
static jmethodID jSetPageRect;
|
||||
static jmethodID jSyncViewportInfoMethod;
|
||||
static jmethodID jSyncFrameMetricsMethod;
|
||||
static jmethodID jCreateFrameMethod;
|
||||
static jmethodID jActivateProgramMethod;
|
||||
static jmethodID jDeactivateProgramMethod;
|
||||
static jmethodID jGetDisplayPort;
|
||||
static jmethodID jContentDocumentChanged;
|
||||
static jmethodID jIsContentDocumentDisplayed;
|
||||
static jmethodID jProgressiveUpdateCallbackMethod;
|
||||
|
||||
public:
|
||||
static jclass jViewportClass;
|
||||
static jclass jDisplayportClass;
|
||||
static jmethodID jViewportCtor;
|
||||
static jfieldID jDisplayportPosition;
|
||||
static jfieldID jDisplayportResolution;
|
||||
};
|
||||
|
||||
enum {
|
||||
// These keycode masks are not defined in android/keycodes.h:
|
||||
AKEYCODE_ESCAPE = 111,
|
||||
@ -433,6 +335,29 @@ enum {
|
||||
AMETA_SHIFT_MASK = AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_RIGHT_ON | AMETA_SHIFT_ON,
|
||||
};
|
||||
|
||||
class nsAndroidDisplayport MOZ_FINAL : public nsIAndroidDisplayport
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
virtual nsresult GetLeft(float *aLeft) { *aLeft = mLeft; return NS_OK; }
|
||||
virtual nsresult GetTop(float *aTop) { *aTop = mTop; return NS_OK; }
|
||||
virtual nsresult GetRight(float *aRight) { *aRight = mRight; return NS_OK; }
|
||||
virtual nsresult GetBottom(float *aBottom) { *aBottom = mBottom; return NS_OK; }
|
||||
virtual nsresult GetResolution(float *aResolution) { *aResolution = mResolution; return NS_OK; }
|
||||
virtual nsresult SetLeft(float aLeft) { mLeft = aLeft; return NS_OK; }
|
||||
virtual nsresult SetTop(float aTop) { mTop = aTop; return NS_OK; }
|
||||
virtual nsresult SetRight(float aRight) { mRight = aRight; return NS_OK; }
|
||||
virtual nsresult SetBottom(float aBottom) { mBottom = aBottom; return NS_OK; }
|
||||
virtual nsresult SetResolution(float aResolution) { mResolution = aResolution; return NS_OK; }
|
||||
|
||||
nsAndroidDisplayport(AndroidRectF aRect, float aResolution):
|
||||
mLeft(aRect.Left()), mTop(aRect.Top()), mRight(aRect.Right()), mBottom(aRect.Bottom()), mResolution(aResolution) {}
|
||||
|
||||
private:
|
||||
~nsAndroidDisplayport() {}
|
||||
float mLeft, mTop, mRight, mBottom, mResolution;
|
||||
};
|
||||
|
||||
class AndroidMotionEvent
|
||||
{
|
||||
public:
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "prenv.h"
|
||||
|
||||
#include "AndroidBridge.h"
|
||||
#include "AndroidBridgeUtilities.h"
|
||||
#include <android/log.h>
|
||||
#include <pthread.h>
|
||||
#include <wchar.h>
|
||||
@ -82,20 +83,20 @@ public:
|
||||
nsCOMPtr<nsIBrowserTab> tab;
|
||||
mBrowserApp->GetBrowserTab(mTabId, getter_AddRefs(tab));
|
||||
if (!tab) {
|
||||
AndroidBridge::Bridge()->SendThumbnail(buffer, mTabId, false);
|
||||
ThumbnailHelper::SendThumbnail(buffer, mTabId, false);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
tab->GetWindow(getter_AddRefs(domWindow));
|
||||
if (!domWindow) {
|
||||
AndroidBridge::Bridge()->SendThumbnail(buffer, mTabId, false);
|
||||
ThumbnailHelper::SendThumbnail(buffer, mTabId, false);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_ASSERTION(mPoints.Length() == 1, "Thumbnail event does not have enough coordinates");
|
||||
|
||||
nsresult rv = AndroidBridge::Bridge()->CaptureThumbnail(domWindow, mPoints[0].x, mPoints[0].y, mTabId, buffer);
|
||||
AndroidBridge::Bridge()->SendThumbnail(buffer, mTabId, NS_SUCCEEDED(rv));
|
||||
ThumbnailHelper::SendThumbnail(buffer, mTabId, NS_SUCCEEDED(rv));
|
||||
return rv;
|
||||
}
|
||||
private:
|
||||
@ -110,7 +111,7 @@ class WakeLockListener MOZ_FINAL : public nsIDOMMozWakeLockListener {
|
||||
NS_DECL_ISUPPORTS;
|
||||
|
||||
nsresult Callback(const nsAString& topic, const nsAString& state) {
|
||||
AndroidBridge::Bridge()->NotifyWakeLockChanged(topic, state);
|
||||
GeckoAppShell::NotifyWakeLockChanged(topic, state);
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
@ -202,7 +203,7 @@ nsAppShell::Init()
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (match) {
|
||||
bridge->SetSelectedLocale(EmptyString());
|
||||
GeckoAppShell::SetSelectedLocale(EmptyString());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -212,7 +213,7 @@ nsAppShell::Init()
|
||||
rv = Preferences::GetString(PREFNAME_UA_LOCALE, &locale);
|
||||
}
|
||||
|
||||
bridge->SetSelectedLocale(locale);
|
||||
GeckoAppShell::SetSelectedLocale(locale);
|
||||
mAllowCoalescingTouches = Preferences::GetBool(PREFNAME_COALESCE_TOUCHES, true);
|
||||
return rv;
|
||||
}
|
||||
@ -244,7 +245,7 @@ nsAppShell::Observe(nsISupports* aSubject,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (match) {
|
||||
bridge->SetSelectedLocale(EmptyString());
|
||||
GeckoAppShell::SetSelectedLocale(EmptyString());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -254,7 +255,7 @@ nsAppShell::Observe(nsISupports* aSubject,
|
||||
locale = Preferences::GetString(PREFNAME_UA_LOCALE);
|
||||
}
|
||||
|
||||
bridge->SetSelectedLocale(locale);
|
||||
GeckoAppShell::SetSelectedLocale(locale);
|
||||
|
||||
mAllowCoalescingTouches = Preferences::GetBool(PREFNAME_COALESCE_TOUCHES, true);
|
||||
return NS_OK;
|
||||
@ -600,7 +601,7 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
|
||||
}
|
||||
|
||||
if (curEvent->AckNeeded()) {
|
||||
AndroidBridge::Bridge()->AcknowledgeEvent();
|
||||
GeckoAppShell::AcknowledgeEvent();
|
||||
}
|
||||
|
||||
EVLOG("nsAppShell: -- done event %p %d", (void*)curEvent.get(), curEvent->Type());
|
||||
|
@ -45,7 +45,7 @@ nsClipboard::SetData(nsITransferable *aTransferable,
|
||||
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
if (AndroidBridge::Bridge())
|
||||
AndroidBridge::Bridge()->SetClipboardText(buffer);
|
||||
Clipboard::SetClipboardText(buffer);
|
||||
else
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
@ -102,7 +102,7 @@ nsClipboard::EmptyClipboard(int32_t aWhichClipboard)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
if (AndroidBridge::Bridge())
|
||||
AndroidBridge::Bridge()->EmptyClipboard();
|
||||
Clipboard::ClearText();
|
||||
} else {
|
||||
ContentChild::GetSingleton()->SendEmptyClipboard();
|
||||
}
|
||||
@ -120,7 +120,7 @@ nsClipboard::HasDataMatchingFlavors(const char **aFlavorList,
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
if (AndroidBridge::Bridge())
|
||||
*aHasText = AndroidBridge::Bridge()->ClipboardHasText();
|
||||
*aHasText = Clipboard::HasText();
|
||||
} else {
|
||||
ContentChild::GetSingleton()->SendClipboardHasText(aHasText);
|
||||
}
|
||||
|
@ -22,6 +22,6 @@ nsIMEPicker::~nsIMEPicker()
|
||||
/* void show (); */
|
||||
NS_IMETHODIMP nsIMEPicker::Show()
|
||||
{
|
||||
AndroidBridge::Bridge()->ShowInputMethodPicker();
|
||||
GeckoAppShell::ShowInputMethodPicker();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ nsLookAndFeel::GetEchoPasswordImpl()
|
||||
if (!mInitializedShowPassword) {
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
if (AndroidBridge::Bridge())
|
||||
mShowPassword = AndroidBridge::Bridge()->GetShowPasswordSetting();
|
||||
mShowPassword = GeckoAppShell::GetShowPasswordSetting();
|
||||
else
|
||||
NS_ASSERTION(AndroidBridge::Bridge() != nullptr, "AndroidBridge is not available!");
|
||||
} else {
|
||||
|
@ -59,7 +59,7 @@ nsScreenAndroid::GetColorDepth(int32_t *aColorDepth)
|
||||
void
|
||||
nsScreenAndroid::ApplyMinimumBrightness(uint32_t aBrightness)
|
||||
{
|
||||
AndroidBridge::Bridge()->SetKeepScreenOn(aBrightness == BRIGHTNESS_FULL);
|
||||
GeckoAppShell::SetKeepScreenOn(aBrightness == BRIGHTNESS_FULL);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsScreenManagerAndroid, nsIScreenManager)
|
||||
|
@ -52,6 +52,7 @@ using mozilla::unused;
|
||||
#include "nsTArray.h"
|
||||
|
||||
#include "AndroidBridge.h"
|
||||
#include "AndroidBridgeUtilities.h"
|
||||
#include "android_npapi.h"
|
||||
|
||||
#include "imgIEncoder.h"
|
||||
@ -354,7 +355,7 @@ nsWindow::GetDefaultScaleInternal()
|
||||
}
|
||||
|
||||
if (AndroidBridge::Bridge()) {
|
||||
density = AndroidBridge::Bridge()->GetDensity();
|
||||
density = GeckoAppShell::GetDensity();
|
||||
}
|
||||
|
||||
if (!density) {
|
||||
@ -519,7 +520,7 @@ nsWindow::SetSizeMode(int32_t aMode)
|
||||
{
|
||||
switch (aMode) {
|
||||
case nsSizeMode_Minimized:
|
||||
AndroidBridge::Bridge()->MoveTaskToBack();
|
||||
GeckoAppShell::MoveTaskToBack();
|
||||
break;
|
||||
case nsSizeMode_Fullscreen:
|
||||
MakeFullScreen(true);
|
||||
@ -700,7 +701,7 @@ nsWindow::DispatchEvent(WidgetGUIEvent* aEvent)
|
||||
NS_IMETHODIMP
|
||||
nsWindow::MakeFullScreen(bool aFullScreen)
|
||||
{
|
||||
AndroidBridge::Bridge()->SetFullScreen(aFullScreen);
|
||||
GeckoAppShell::SetFullScreen(aFullScreen);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1217,7 +1218,7 @@ bool nsWindow::OnMultitouchEvent(AndroidGeckoEvent *ae)
|
||||
// if this event is a down event, that means it's the start of a new block, and the
|
||||
// previous block should not be default-prevented
|
||||
bool defaultPrevented = isDownEvent ? false : preventDefaultActions;
|
||||
AndroidBridge::Bridge()->NotifyDefaultPrevented(defaultPrevented);
|
||||
GeckoAppShell::NotifyDefaultPrevented(defaultPrevented);
|
||||
sDefaultPreventedNotified = true;
|
||||
}
|
||||
|
||||
@ -1226,7 +1227,7 @@ bool nsWindow::OnMultitouchEvent(AndroidGeckoEvent *ae)
|
||||
// for the next event.
|
||||
if (isDownEvent) {
|
||||
if (preventDefaultActions) {
|
||||
AndroidBridge::Bridge()->NotifyDefaultPrevented(true);
|
||||
GeckoAppShell::NotifyDefaultPrevented(true);
|
||||
sDefaultPreventedNotified = true;
|
||||
} else {
|
||||
sDefaultPreventedNotified = false;
|
||||
@ -1835,10 +1836,10 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
|
||||
NotifyIMEOfTextChange(0, INT32_MAX / 2, INT32_MAX / 2);
|
||||
FlushIMEChanges();
|
||||
}
|
||||
AndroidBridge::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT);
|
||||
GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT);
|
||||
return;
|
||||
} else if (ae->Action() == AndroidGeckoEvent::IME_UPDATE_CONTEXT) {
|
||||
AndroidBridge::NotifyIMEContext(mInputContext.mIMEState.mEnabled,
|
||||
GeckoAppShell::NotifyIMEContext(mInputContext.mIMEState.mEnabled,
|
||||
mInputContext.mHTMLInputType,
|
||||
mInputContext.mHTMLInputInputmode,
|
||||
mInputContext.mActionHint);
|
||||
@ -1849,7 +1850,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
|
||||
// Still reply to events, but don't do anything else
|
||||
if (ae->Action() == AndroidGeckoEvent::IME_SYNCHRONIZE ||
|
||||
ae->Action() == AndroidGeckoEvent::IME_REPLACE_TEXT) {
|
||||
AndroidBridge::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT);
|
||||
GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1862,7 +1863,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
|
||||
case AndroidGeckoEvent::IME_SYNCHRONIZE:
|
||||
{
|
||||
FlushIMEChanges();
|
||||
AndroidBridge::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT);
|
||||
GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT);
|
||||
}
|
||||
break;
|
||||
case AndroidGeckoEvent::IME_REPLACE_TEXT:
|
||||
@ -1894,7 +1895,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
|
||||
}
|
||||
mIMEKeyEvents.Clear();
|
||||
FlushIMEChanges();
|
||||
AndroidBridge::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT);
|
||||
GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1916,7 +1917,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
|
||||
DispatchEvent(&event);
|
||||
}
|
||||
FlushIMEChanges();
|
||||
AndroidBridge::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT);
|
||||
GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT);
|
||||
}
|
||||
break;
|
||||
case AndroidGeckoEvent::IME_SET_SELECTION:
|
||||
@ -2096,7 +2097,7 @@ nsWindow::NotifyIME(NotificationToIME aNotification)
|
||||
case REQUEST_TO_COMMIT_COMPOSITION:
|
||||
//ALOGIME("IME: REQUEST_TO_COMMIT_COMPOSITION: s=%d", aState);
|
||||
RemoveIMEComposition();
|
||||
AndroidBridge::NotifyIME(REQUEST_TO_COMMIT_COMPOSITION);
|
||||
GeckoAppShell::NotifyIME(REQUEST_TO_COMMIT_COMPOSITION);
|
||||
return NS_OK;
|
||||
case REQUEST_TO_CANCEL_COMPOSITION:
|
||||
ALOGIME("IME: REQUEST_TO_CANCEL_COMPOSITION");
|
||||
@ -2115,11 +2116,11 @@ nsWindow::NotifyIME(NotificationToIME aNotification)
|
||||
DispatchEvent(&compEvent);
|
||||
}
|
||||
|
||||
AndroidBridge::NotifyIME(REQUEST_TO_CANCEL_COMPOSITION);
|
||||
GeckoAppShell::NotifyIME(REQUEST_TO_CANCEL_COMPOSITION);
|
||||
return NS_OK;
|
||||
case NOTIFY_IME_OF_FOCUS:
|
||||
ALOGIME("IME: NOTIFY_IME_OF_FOCUS");
|
||||
AndroidBridge::NotifyIME(NOTIFY_IME_OF_FOCUS);
|
||||
GeckoAppShell::NotifyIME(NOTIFY_IME_OF_FOCUS);
|
||||
return NS_OK;
|
||||
case NOTIFY_IME_OF_BLUR:
|
||||
ALOGIME("IME: NOTIFY_IME_OF_BLUR");
|
||||
@ -2131,7 +2132,7 @@ nsWindow::NotifyIME(NotificationToIME aNotification)
|
||||
mIMEComposing = false;
|
||||
mIMEComposingText.Truncate();
|
||||
|
||||
AndroidBridge::NotifyIME(NOTIFY_IME_OF_BLUR);
|
||||
GeckoAppShell::NotifyIME(NOTIFY_IME_OF_BLUR);
|
||||
return NS_OK;
|
||||
case NOTIFY_IME_OF_SELECTION_CHANGE:
|
||||
if (mIMEMaskSelectionUpdate) {
|
||||
@ -2191,7 +2192,7 @@ nsWindow::SetInputContext(const InputContext& aContext,
|
||||
|
||||
if (enabled == IMEState::ENABLED && aAction.UserMightRequestOpenVKB()) {
|
||||
// Don't reset keyboard when we should simply open the vkb
|
||||
AndroidBridge::NotifyIME(AndroidBridge::NOTIFY_IME_OPEN_VKB);
|
||||
GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_OPEN_VKB);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2247,7 +2248,7 @@ nsWindow::FlushIMEChanges()
|
||||
if (!event.mSucceeded)
|
||||
return;
|
||||
|
||||
AndroidBridge::NotifyIMEChange(event.mReply.mString,
|
||||
GeckoAppShell::NotifyIMEChange(event.mReply.mString,
|
||||
change.mStart,
|
||||
change.mOldEnd,
|
||||
change.mNewEnd);
|
||||
@ -2262,7 +2263,7 @@ nsWindow::FlushIMEChanges()
|
||||
if (!event.mSucceeded)
|
||||
return;
|
||||
|
||||
AndroidBridge::NotifyIMEChange(EmptyString(),
|
||||
GeckoAppShell::NotifyIMEChange(EmptyString(),
|
||||
(int32_t) event.GetSelectionStart(),
|
||||
(int32_t) event.GetSelectionEnd(), -1);
|
||||
mIMESelectionChanged = false;
|
||||
@ -2357,44 +2358,51 @@ nsWindow::DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect)
|
||||
{
|
||||
JNIEnv *env = GetJNIForThread();
|
||||
NS_ABORT_IF_FALSE(env, "No JNI environment at DrawWindowUnderlay()!");
|
||||
if (!env)
|
||||
if (!env) {
|
||||
return;
|
||||
}
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env);
|
||||
|
||||
AndroidGeckoLayerClient& client = AndroidBridge::Bridge()->GetLayerClient();
|
||||
if (!client.CreateFrame(&jniFrame, mLayerRendererFrame)) return;
|
||||
|
||||
if (!WidgetPaintsBackground())
|
||||
GeckoLayerClient* client = AndroidBridge::Bridge()->GetLayerClient();
|
||||
if (!client || client->isNull()) {
|
||||
ALOG_BRIDGE("Exceptional Exit: %s", __PRETTY_FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.ActivateProgram(&jniFrame)) return;
|
||||
if (!mLayerRendererFrame.BeginDrawing(&jniFrame)) return;
|
||||
if (!mLayerRendererFrame.DrawBackground(&jniFrame)) return;
|
||||
if (!client.DeactivateProgram(&jniFrame)) return; // redundant, but in case somebody adds code after this...
|
||||
jobject frameObj = client->CreateFrame();
|
||||
NS_ABORT_IF_FALSE(frameObj, "No frame object!");
|
||||
if (!frameObj) {
|
||||
ALOG_BRIDGE("Exceptional Exit: %s", __PRETTY_FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
mLayerRendererFrame.Init(frameObj, env);
|
||||
if (!WidgetPaintsBackground()) {
|
||||
return;
|
||||
}
|
||||
|
||||
client->ActivateProgram();
|
||||
mLayerRendererFrame.BeginDrawing();
|
||||
mLayerRendererFrame.DrawBackground();
|
||||
client->DeactivateProgram(); // redundant, but in case somebody adds code after this...
|
||||
}
|
||||
|
||||
void
|
||||
nsWindow::DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect)
|
||||
{
|
||||
PROFILER_LABEL("nsWindow", "DrawWindowOverlay");
|
||||
JNIEnv *env = GetJNIForThread();
|
||||
NS_ABORT_IF_FALSE(env, "No JNI environment at DrawWindowOverlay()!");
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env);
|
||||
|
||||
NS_ABORT_IF_FALSE(!mLayerRendererFrame.isNull(),
|
||||
"Frame should have been created in DrawWindowUnderlay()!");
|
||||
|
||||
AndroidGeckoLayerClient& client = AndroidBridge::Bridge()->GetLayerClient();
|
||||
GeckoLayerClient* client = AndroidBridge::Bridge()->GetLayerClient();
|
||||
|
||||
if (!client.ActivateProgram(&jniFrame)) return;
|
||||
if (!mLayerRendererFrame.DrawForeground(&jniFrame)) return;
|
||||
if (!mLayerRendererFrame.EndDrawing(&jniFrame)) return;
|
||||
if (!client.DeactivateProgram(&jniFrame)) return;
|
||||
mLayerRendererFrame.Dispose(env);
|
||||
client->ActivateProgram();
|
||||
mLayerRendererFrame.DrawForeground();
|
||||
mLayerRendererFrame.EndDrawing();
|
||||
client->DeactivateProgram();
|
||||
mLayerRendererFrame.Dispose();
|
||||
}
|
||||
|
||||
// off-main-thread compositor fields and functions
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsIIdleServiceInternal.h"
|
||||
#include "nsTArray.h"
|
||||
#include "AndroidJavaWrappers.h"
|
||||
#include "GeneratedJNIWrappers.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/TextRange.h"
|
||||
@ -240,7 +241,7 @@ private:
|
||||
void CreateLayerManager(int aCompositorWidth, int aCompositorHeight);
|
||||
void RedrawAll();
|
||||
|
||||
mozilla::AndroidLayerRendererFrame mLayerRendererFrame;
|
||||
mozilla::widget::android::LayerRendererFrame mLayerRendererFrame;
|
||||
|
||||
static mozilla::StaticRefPtr<mozilla::layers::APZCTreeManager> sApzcTreeManager;
|
||||
static mozilla::StaticRefPtr<mozilla::layers::LayerManager> sLayerManager;
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
#include "AndroidBridge.h"
|
||||
using namespace mozilla::widget::android;
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
@ -229,7 +230,7 @@ nsSystemInfo::Init()
|
||||
android_sdk_version = version;
|
||||
if (version >= 8 && mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str))
|
||||
SetPropertyAsAString(NS_LITERAL_STRING("hardware"), str);
|
||||
bool isTablet = mozilla::AndroidBridge::Bridge()->IsTablet();
|
||||
bool isTablet = GeckoAppShell::IsTablet();
|
||||
SetPropertyAsBool(NS_LITERAL_STRING("tablet"), isTablet);
|
||||
// NSPR "version" is the kernel version. For Android we want the Android version.
|
||||
// Rename SDK version to version and put the kernel version into kernel_version.
|
||||
|
@ -472,7 +472,7 @@ ParseManifest(NSLocationType type, FileLocation &file, char* buf, bool aChromeOn
|
||||
bool isTablet = false;
|
||||
if (mozilla::AndroidBridge::Bridge()) {
|
||||
mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build$VERSION", "RELEASE", osVersion);
|
||||
isTablet = mozilla::AndroidBridge::Bridge()->IsTablet();
|
||||
isTablet = mozilla::widget::android::GeckoAppShell::IsTablet();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1845,8 +1845,7 @@ nsLocalFile::Launch()
|
||||
|
||||
nsDependentCString fileUri = NS_LITERAL_CSTRING("file://");
|
||||
fileUri.Append(mPath);
|
||||
mozilla::AndroidBridge* bridge = mozilla::AndroidBridge::Bridge();
|
||||
return bridge->OpenUriExternal(NS_ConvertUTF8toUTF16(fileUri), NS_ConvertUTF8toUTF16(type)) ? NS_OK : NS_ERROR_FAILURE;
|
||||
return GeckoAppShell::OpenUriExternal(NS_ConvertUTF8toUTF16(fileUri), NS_ConvertUTF8toUTF16(type)) ? NS_OK : NS_ERROR_FAILURE;
|
||||
#elif defined(MOZ_WIDGET_COCOA)
|
||||
CFURLRef url;
|
||||
if (NS_SUCCEEDED(GetCFURL(&url))) {
|
||||
|
Loading…
Reference in New Issue
Block a user