Bug 1363567 - 2. Move onFullScreenPluginHidden to GeckoApp; r=rbarker

Move the native call onFullScreenPluginHidden from GeckoAppShell to
GeckoApp itself.

MozReview-Commit-ID: APhGRBTNl0X
This commit is contained in:
Jim Chen 2017-05-15 23:11:18 -04:00
parent d0aff50e27
commit 3858e8e18e
10 changed files with 71 additions and 35 deletions

View File

@ -1087,6 +1087,9 @@ public abstract class GeckoApp extends GeckoActivity
}
}
@WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
private static native void onFullScreenPluginHidden(View view);
private void showSetImageResult(final boolean success, final int message, final String path) {
ThreadUtils.postToUiThread(new Runnable() {
@Override
@ -2804,7 +2807,7 @@ public abstract class GeckoApp extends GeckoActivity
}
if (mFullScreenPluginView != null) {
GeckoAppShell.onFullScreenPluginHidden(mFullScreenPluginView);
onFullScreenPluginHidden(mFullScreenPluginView);
removeFullScreenPluginView(mFullScreenPluginView);
return;
}

View File

@ -1384,9 +1384,6 @@ public class GeckoAppShell
}
}
@WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
public static native void onFullScreenPluginHidden(View view);
/**
* A plugin that wish to be loaded in the WebView must provide this permission
* in their AndroidManifest.xml.

View File

@ -86,7 +86,7 @@ template<class Impl>
class GeckoAppShell::Natives : public mozilla::jni::NativeImpl<GeckoAppShell, Impl>
{
public:
static const JNINativeMethod methods[7];
static const JNINativeMethod methods[6];
};
template<class Impl>
@ -104,10 +104,6 @@ const JNINativeMethod GeckoAppShell::Natives<Impl>::methods[] = {
mozilla::jni::NativeStub<GeckoAppShell::NotifyUriVisited_t, Impl>
::template Wrap<&Impl::NotifyUriVisited>),
mozilla::jni::MakeNativeMethod<GeckoAppShell::OnFullScreenPluginHidden_t>(
mozilla::jni::NativeStub<GeckoAppShell::OnFullScreenPluginHidden_t, Impl>
::template Wrap<&Impl::OnFullScreenPluginHidden>),
mozilla::jni::MakeNativeMethod<GeckoAppShell::OnLocationChanged_t>(
mozilla::jni::NativeStub<GeckoAppShell::OnLocationChanged_t, Impl>
::template Wrap<&Impl::OnLocationChanged>),

View File

@ -546,9 +546,6 @@ auto GeckoAppShell::NotifyWakeLockChanged(mozilla::jni::String::Param a0, mozill
return mozilla::jni::Method<NotifyWakeLockChanged_t>::Call(GeckoAppShell::Context(), nullptr, a0, a1);
}
constexpr char GeckoAppShell::OnFullScreenPluginHidden_t::name[];
constexpr char GeckoAppShell::OnFullScreenPluginHidden_t::signature[];
constexpr char GeckoAppShell::OnLocationChanged_t::name[];
constexpr char GeckoAppShell::OnLocationChanged_t::signature[];

View File

@ -1493,24 +1493,6 @@ public:
static auto NotifyWakeLockChanged(mozilla::jni::String::Param, mozilla::jni::String::Param) -> void;
struct OnFullScreenPluginHidden_t {
typedef GeckoAppShell Owner;
typedef void ReturnType;
typedef void SetterType;
typedef mozilla::jni::Args<
mozilla::jni::Object::Param> Args;
static constexpr char name[] = "onFullScreenPluginHidden";
static constexpr char signature[] =
"(Landroid/view/View;)V";
static const bool isStatic = true;
static const mozilla::jni::ExceptionMode exceptionMode =
mozilla::jni::ExceptionMode::ABORT;
static const mozilla::jni::CallingThread callingThread =
mozilla::jni::CallingThread::UI;
static const mozilla::jni::DispatchTarget dispatchTarget =
mozilla::jni::DispatchTarget::GECKO;
};
struct OnLocationChanged_t {
typedef GeckoAppShell Owner;
typedef void ReturnType;

View File

@ -36,6 +36,21 @@ const JNINativeMethod ANRReporter::Natives<Impl>::methods[] = {
::template Wrap<&Impl::RequestNativeStack>)
};
template<class Impl>
class GeckoApp::Natives : public mozilla::jni::NativeImpl<GeckoApp, Impl>
{
public:
static const JNINativeMethod methods[1];
};
template<class Impl>
const JNINativeMethod GeckoApp::Natives<Impl>::methods[] = {
mozilla::jni::MakeNativeMethod<GeckoApp::OnFullScreenPluginHidden_t>(
mozilla::jni::NativeStub<GeckoApp::OnFullScreenPluginHidden_t, Impl>
::template Wrap<&Impl::OnFullScreenPluginHidden>)
};
template<class Impl>
class GeckoJavaSampler::Natives : public mozilla::jni::NativeImpl<GeckoJavaSampler, Impl>
{

View File

@ -52,6 +52,9 @@ auto GeckoApp::AddPluginView(mozilla::jni::Object::Param a0) -> void
return mozilla::jni::Method<AddPluginView_t>::Call(GeckoApp::Context(), nullptr, a0);
}
constexpr char GeckoApp::OnFullScreenPluginHidden_t::name[];
constexpr char GeckoApp::OnFullScreenPluginHidden_t::signature[];
constexpr char GeckoApp::RemovePluginView_t::name[];
constexpr char GeckoApp::RemovePluginView_t::signature[];

View File

@ -156,6 +156,24 @@ public:
static auto AddPluginView(mozilla::jni::Object::Param) -> void;
struct OnFullScreenPluginHidden_t {
typedef GeckoApp Owner;
typedef void ReturnType;
typedef void SetterType;
typedef mozilla::jni::Args<
mozilla::jni::Object::Param> Args;
static constexpr char name[] = "onFullScreenPluginHidden";
static constexpr char signature[] =
"(Landroid/view/View;)V";
static const bool isStatic = true;
static const mozilla::jni::ExceptionMode exceptionMode =
mozilla::jni::ExceptionMode::ABORT;
static const mozilla::jni::CallingThread callingThread =
mozilla::jni::CallingThread::UI;
static const mozilla::jni::DispatchTarget dispatchTarget =
mozilla::jni::DispatchTarget::GECKO;
};
struct RemovePluginView_t {
typedef GeckoApp Owner;
typedef void ReturnType;

View File

@ -0,0 +1,28 @@
/* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_GeckoApp_h__
#define mozilla_GeckoApp_h__
#include "FennecJNINatives.h"
#include "nsPluginInstanceOwner.h"
namespace mozilla {
class GeckoApp final
: public java::GeckoApp::Natives<GeckoApp>
{
GeckoApp() = delete;
public:
static void OnFullScreenPluginHidden(jni::Object::Param aView)
{
nsPluginInstanceOwner::ExitFullScreen(aView.Get());
}
};
} // namespace mozilla
#endif // mozilla_GeckoApp_h__

View File

@ -70,6 +70,7 @@
#include "GeckoProcessManager.h"
#include "GeckoScreenOrientation.h"
#include "PrefsHelper.h"
#include "fennec/GeckoApp.h"
#include "fennec/MemoryMonitor.h"
#include "fennec/Telemetry.h"
#include "fennec/ThumbnailHelper.h"
@ -364,11 +365,6 @@ public:
aName->ToString(), aTopic->ToCString().get(),
aCookie->ToString().get());
}
static void OnFullScreenPluginHidden(jni::Object::Param aView)
{
nsPluginInstanceOwner::ExitFullScreen(aView.Get());
}
};
nsAppShell::nsAppShell()
@ -403,6 +399,7 @@ nsAppShell::nsAppShell()
if (jni::IsFennec()) {
mozilla::ANRReporter::Init();
mozilla::GeckoApp::Init();
mozilla::MemoryMonitor::Init();
mozilla::widget::Telemetry::Init();
mozilla::ThumbnailHelper::Init();