Bug 888482 - Send event to set layer client; r=snorp

This commit is contained in:
Jim Chen 2014-09-30 18:20:58 -04:00
Родитель fb28ffc373
Коммит f6e00ce7f5
5 изменённых файлов: 5 добавлений и 32 удалений

Просмотреть файл

@ -1374,6 +1374,9 @@ public abstract class GeckoApp
layerView.initializeView(EventDispatcher.getInstance()); layerView.initializeView(EventDispatcher.getInstance());
mLayerView = layerView; mLayerView = layerView;
GeckoAppShell.setLayerView(layerView); GeckoAppShell.setLayerView(layerView);
GeckoAppShell.sendEventToGecko(GeckoEvent.createObjectEvent(
GeckoEvent.ACTION_OBJECT_LAYER_CLIENT, layerView.getLayerClientObject()));
// bind the GeckoEditable instance to the new LayerView // bind the GeckoEditable instance to the new LayerView
GeckoAppShell.notifyIMEContext(GeckoEditableListener.IME_STATE_DISABLED, "", "", ""); GeckoAppShell.notifyIMEContext(GeckoEditableListener.IME_STATE_DISABLED, "", "", "");
} }
@ -1588,7 +1591,6 @@ public abstract class GeckoApp
if (selectedTab != null) if (selectedTab != null)
Tabs.getInstance().notifyListeners(selectedTab, Tabs.TabEvents.SELECTED); Tabs.getInstance().notifyListeners(selectedTab, Tabs.TabEvents.SELECTED);
geckoConnected(); geckoConnected();
GeckoAppShell.setLayerClient(mLayerView.getLayerClientObject());
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Viewport:Flush", null)); GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Viewport:Flush", null));
} }

Просмотреть файл

@ -198,8 +198,6 @@ public class GeckoAppShell
public static native void nativeInit(); public static native void nativeInit();
// helper methods // helper methods
// public static native void setSurfaceView(GeckoSurfaceView sv);
public static native void setLayerClient(Object client);
public static native void onResume(); public static native void onResume();
public static void callObserver(String observerKey, String topic, String data) { public static void callObserver(String observerKey, String topic, String data) {
sendEventToGecko(GeckoEvent.createCallObserverEvent(observerKey, topic, data)); sendEventToGecko(GeckoEvent.createCallObserverEvent(observerKey, topic, data));
@ -335,9 +333,6 @@ public class GeckoAppShell
// run gecko -- it will spawn its own thread // run gecko -- it will spawn its own thread
GeckoAppShell.nativeInit(); GeckoAppShell.nativeInit();
if (sLayerView != null)
GeckoAppShell.setLayerClient(sLayerView.getLayerClientObject());
// First argument is the .apk path // First argument is the .apk path
String combinedArgs = apkPath + " -greomni " + apkPath; String combinedArgs = apkPath + " -greomni " + apkPath;
if (args != null) if (args != null)

Просмотреть файл

@ -174,6 +174,8 @@ public class GeckoView extends LayerView
BrowserDB.initialize(profile.getName()); BrowserDB.initialize(profile.getName());
GeckoAppShell.setLayerView(this); GeckoAppShell.setLayerView(this);
GeckoAppShell.sendEventToGecko(GeckoEvent.createObjectEvent(
GeckoEvent.ACTION_OBJECT_LAYER_CLIENT, getLayerClientObject()));
GeckoThread.createAndStart(); GeckoThread.createAndStart();
} else if(GeckoThread.checkLaunchState(GeckoThread.LaunchState.GeckoRunning)) { } else if(GeckoThread.checkLaunchState(GeckoThread.LaunchState.GeckoRunning)) {
// If Gecko is already running, that means the Activity was // If Gecko is already running, that means the Activity was
@ -247,7 +249,6 @@ public class GeckoView extends LayerView
if (selectedTab != null) if (selectedTab != null)
Tabs.getInstance().notifyListeners(selectedTab, Tabs.TabEvents.SELECTED); Tabs.getInstance().notifyListeners(selectedTab, Tabs.TabEvents.SELECTED);
geckoConnected(); geckoConnected();
GeckoAppShell.setLayerClient(getLayerClientObject());
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Viewport:Flush", null)); GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Viewport:Flush", null));
} }

Просмотреть файл

@ -96,25 +96,6 @@ Java_org_mozilla_gecko_GeckoAppShell_nativeInit(JNIEnv * arg0, jclass arg1) {
#ifdef JNI_STUBS #ifdef JNI_STUBS
typedef void (*Java_org_mozilla_gecko_GeckoAppShell_setLayerClient_t)(JNIEnv *, jclass, jobject);
static Java_org_mozilla_gecko_GeckoAppShell_setLayerClient_t f_Java_org_mozilla_gecko_GeckoAppShell_setLayerClient;
extern "C" NS_EXPORT void JNICALL
Java_org_mozilla_gecko_GeckoAppShell_setLayerClient(JNIEnv * arg0, jclass arg1, jobject arg2) {
if (!f_Java_org_mozilla_gecko_GeckoAppShell_setLayerClient) {
arg0->ThrowNew(arg0->FindClass("java/lang/UnsupportedOperationException"),
"JNI Function called before it was loaded");
return ;
}
f_Java_org_mozilla_gecko_GeckoAppShell_setLayerClient(arg0, arg1, arg2);
}
#endif
#ifdef JNI_BINDINGS
xul_dlsym("Java_org_mozilla_gecko_GeckoAppShell_setLayerClient", &f_Java_org_mozilla_gecko_GeckoAppShell_setLayerClient);
#endif
#ifdef JNI_STUBS
typedef void (*Java_org_mozilla_gecko_GeckoAppShell_onResume_t)(JNIEnv *, jclass); typedef void (*Java_org_mozilla_gecko_GeckoAppShell_onResume_t)(JNIEnv *, jclass);
static Java_org_mozilla_gecko_GeckoAppShell_onResume_t f_Java_org_mozilla_gecko_GeckoAppShell_onResume; static Java_org_mozilla_gecko_GeckoAppShell_onResume_t f_Java_org_mozilla_gecko_GeckoAppShell_onResume;
extern "C" NS_EXPORT void JNICALL extern "C" NS_EXPORT void JNICALL

Просмотреть файл

@ -119,12 +119,6 @@ Java_org_mozilla_gecko_GeckoAppShell_runUiThreadCallback(JNIEnv* env, jclass)
return AndroidBridge::Bridge()->RunDelayedUiThreadTasks(); return AndroidBridge::Bridge()->RunDelayedUiThreadTasks();
} }
NS_EXPORT void JNICALL
Java_org_mozilla_gecko_GeckoAppShell_setLayerClient(JNIEnv *jenv, jclass, jobject obj)
{
AndroidBridge::Bridge()->SetLayerClient(jenv, obj);
}
NS_EXPORT void JNICALL NS_EXPORT void JNICALL
Java_org_mozilla_gecko_GeckoAppShell_onResume(JNIEnv *jenv, jclass jc) Java_org_mozilla_gecko_GeckoAppShell_onResume(JNIEnv *jenv, jclass jc)
{ {