Backout changeset c1161ca4bf13
This commit is contained in:
@@ -1302,16 +1302,6 @@ abstract public class GeckoApp
|
|||||||
Runnable r = new SessionSnapshotRunnable(tab);
|
Runnable r = new SessionSnapshotRunnable(tab);
|
||||||
GeckoAppShell.getHandler().postDelayed(r, 500);
|
GeckoAppShell.getHandler().postDelayed(r, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
GeckoAppShell.sendEventToGecko(
|
|
||||||
GeckoEvent.createMetaViewportQueryEvent(tab.getId(),
|
|
||||||
new GeckoEvent.Callback() {
|
|
||||||
public void callback(GeckoEvent ev, String data) {
|
|
||||||
Log.i(LOGTAG, "Meta Viewport Data:" + data);
|
|
||||||
// To do: do something with this data
|
|
||||||
}
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleShowToast(final String message, final String duration) {
|
void handleShowToast(final String message, final String duration) {
|
||||||
|
|||||||
@@ -62,10 +62,6 @@ import android.util.Log;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class GeckoEvent {
|
public class GeckoEvent {
|
||||||
public interface Callback {
|
|
||||||
public void callback(GeckoEvent event, String jsonData);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final String LOGTAG = "GeckoEvent";
|
private static final String LOGTAG = "GeckoEvent";
|
||||||
|
|
||||||
private static final int INVALID = -1;
|
private static final int INVALID = -1;
|
||||||
@@ -93,7 +89,6 @@ public class GeckoEvent {
|
|||||||
private static final int PROXIMITY_EVENT = 23;
|
private static final int PROXIMITY_EVENT = 23;
|
||||||
private static final int ACTIVITY_RESUMING = 24;
|
private static final int ACTIVITY_RESUMING = 24;
|
||||||
private static final int SCREENSHOT = 25;
|
private static final int SCREENSHOT = 25;
|
||||||
private static final int META_VIEWPORT_QUERY = 26;
|
|
||||||
|
|
||||||
public static final int IME_COMPOSITION_END = 0;
|
public static final int IME_COMPOSITION_END = 0;
|
||||||
public static final int IME_COMPOSITION_BEGIN = 1;
|
public static final int IME_COMPOSITION_BEGIN = 1;
|
||||||
@@ -141,9 +136,6 @@ public class GeckoEvent {
|
|||||||
public boolean mCanBeMetered;
|
public boolean mCanBeMetered;
|
||||||
|
|
||||||
public int mNativeWindow;
|
public int mNativeWindow;
|
||||||
public int mTabId;
|
|
||||||
|
|
||||||
Callback mCallback;
|
|
||||||
|
|
||||||
private GeckoEvent(int evType) {
|
private GeckoEvent(int evType) {
|
||||||
mType = evType;
|
mType = evType;
|
||||||
@@ -390,14 +382,6 @@ public class GeckoEvent {
|
|||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GeckoEvent createMetaViewportQueryEvent(int tabId, Callback callback) {
|
|
||||||
Log.i("GeckoEvent", "createMetaViewportQueryEvent");
|
|
||||||
GeckoEvent event = new GeckoEvent(META_VIEWPORT_QUERY);
|
|
||||||
event.mCallback = callback;
|
|
||||||
event.mTabId = tabId;
|
|
||||||
return event;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeckoEvent createLoadEvent(String uri) {
|
public static GeckoEvent createLoadEvent(String uri) {
|
||||||
GeckoEvent event = new GeckoEvent(LOAD_URI);
|
GeckoEvent event = new GeckoEvent(LOAD_URI);
|
||||||
event.mCharacters = uri;
|
event.mCharacters = uri;
|
||||||
@@ -425,10 +409,4 @@ public class GeckoEvent {
|
|||||||
event.mMetaState = tabId;
|
event.mMetaState = tabId;
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doCallback(String jsonData) {
|
|
||||||
if (mCallback != null) {
|
|
||||||
mCallback.callback(this, jsonData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,8 +76,6 @@ jfieldID AndroidGeckoEvent::jLocationField = 0;
|
|||||||
jfieldID AndroidGeckoEvent::jAddressField = 0;
|
jfieldID AndroidGeckoEvent::jAddressField = 0;
|
||||||
jfieldID AndroidGeckoEvent::jBandwidthField = 0;
|
jfieldID AndroidGeckoEvent::jBandwidthField = 0;
|
||||||
jfieldID AndroidGeckoEvent::jCanBeMeteredField = 0;
|
jfieldID AndroidGeckoEvent::jCanBeMeteredField = 0;
|
||||||
jfieldID AndroidGeckoEvent::jTabIdField = 0;
|
|
||||||
jmethodID AndroidGeckoEvent::jDoCallbackMethod = 0;
|
|
||||||
|
|
||||||
jclass AndroidPoint::jPointClass = 0;
|
jclass AndroidPoint::jPointClass = 0;
|
||||||
jfieldID AndroidPoint::jXField = 0;
|
jfieldID AndroidPoint::jXField = 0;
|
||||||
@@ -210,9 +208,6 @@ AndroidGeckoEvent::InitGeckoEventClass(JNIEnv *jEnv)
|
|||||||
jAddressField = getField("mAddress", "Landroid/location/Address;");
|
jAddressField = getField("mAddress", "Landroid/location/Address;");
|
||||||
jBandwidthField = getField("mBandwidth", "D");
|
jBandwidthField = getField("mBandwidth", "D");
|
||||||
jCanBeMeteredField = getField("mCanBeMetered", "Z");
|
jCanBeMeteredField = getField("mCanBeMetered", "Z");
|
||||||
|
|
||||||
jTabIdField = getField("mTabId", "I");
|
|
||||||
jDoCallbackMethod = getMethod("doCallback", "(Ljava/lang/String;)V");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -590,10 +585,6 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jobject jobj)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case META_VIEWPORT_QUERY:
|
|
||||||
mTabId = jenv->GetIntField(jobj, jTabIdField);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VIEWPORT:
|
case VIEWPORT:
|
||||||
case BROADCAST: {
|
case BROADCAST: {
|
||||||
ReadCharactersField(jenv);
|
ReadCharactersField(jenv);
|
||||||
@@ -625,6 +616,11 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jobject jobj)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case SCREENSHOT: {
|
||||||
|
mMetaState = jenv->GetIntField(jobj, jMetaStateField);
|
||||||
|
ReadPointArray(mPoints, jenv, jPoints, 2);
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -669,15 +665,6 @@ AndroidPoint::Init(JNIEnv *jenv, jobject jobj)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
AndroidGeckoEvent::DoCallback(const nsAString& data) {
|
|
||||||
JNIEnv* env = AndroidBridge::GetJNIEnv();
|
|
||||||
if (!env)
|
|
||||||
return;
|
|
||||||
jstring jData = env->NewString(nsPromiseFlatString(data).get(), data.Length());
|
|
||||||
env->CallVoidMethod(wrapped_obj, jDoCallbackMethod, jData);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AndroidGeckoGLLayerClient::Init(jobject jobj)
|
AndroidGeckoGLLayerClient::Init(jobject jobj)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -546,8 +546,6 @@ public:
|
|||||||
nsGeoPositionAddress* GeoAddress() { return mGeoAddress; }
|
nsGeoPositionAddress* GeoAddress() { return mGeoAddress; }
|
||||||
double Bandwidth() { return mBandwidth; }
|
double Bandwidth() { return mBandwidth; }
|
||||||
bool CanBeMetered() { return mCanBeMetered; }
|
bool CanBeMetered() { return mCanBeMetered; }
|
||||||
int TabId() { return mTabId; }
|
|
||||||
void DoCallback(const nsAString& data);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int mAction;
|
int mAction;
|
||||||
@@ -573,7 +571,6 @@ protected:
|
|||||||
nsRefPtr<nsGeoPositionAddress> mGeoAddress;
|
nsRefPtr<nsGeoPositionAddress> mGeoAddress;
|
||||||
double mBandwidth;
|
double mBandwidth;
|
||||||
bool mCanBeMetered;
|
bool mCanBeMetered;
|
||||||
int mTabId;
|
|
||||||
|
|
||||||
void ReadIntArray(nsTArray<int> &aVals,
|
void ReadIntArray(nsTArray<int> &aVals,
|
||||||
JNIEnv *jenv,
|
JNIEnv *jenv,
|
||||||
@@ -628,9 +625,6 @@ protected:
|
|||||||
|
|
||||||
static jfieldID jBandwidthField;
|
static jfieldID jBandwidthField;
|
||||||
static jfieldID jCanBeMeteredField;
|
static jfieldID jCanBeMeteredField;
|
||||||
static jfieldID jTabIdField;
|
|
||||||
|
|
||||||
static jmethodID jDoCallbackMethod;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum {
|
enum {
|
||||||
@@ -659,7 +653,6 @@ public:
|
|||||||
PROXIMITY_EVENT = 23,
|
PROXIMITY_EVENT = 23,
|
||||||
ACTIVITY_RESUMING = 24,
|
ACTIVITY_RESUMING = 24,
|
||||||
SCREENSHOT = 25,
|
SCREENSHOT = 25,
|
||||||
META_VIEWPORT_QUERY = 26,
|
|
||||||
dummy_java_enum_list_end
|
dummy_java_enum_list_end
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include "nsContentUtils.h"
|
|
||||||
#ifdef MOZ_ANDROID_HISTORY
|
#ifdef MOZ_ANDROID_HISTORY
|
||||||
#include "nsAndroidHistory.h"
|
#include "nsAndroidHistory.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -453,32 +453,6 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
case AndroidGeckoEvent::META_VIEWPORT_QUERY:
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
|
||||||
mBrowserApp->GetWindowForTab(curEvent->TabId(), getter_AddRefs(domWindow));
|
|
||||||
if (!domWindow)
|
|
||||||
break;
|
|
||||||
nsCOMPtr<nsIDOMDocument> domDocument;
|
|
||||||
domWindow->GetDocument(getter_AddRefs(domDocument));
|
|
||||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDocument);
|
|
||||||
ViewportInfo vi = nsContentUtils::GetViewportInfo(doc);
|
|
||||||
nsAutoString data;
|
|
||||||
data.AppendLiteral("{");
|
|
||||||
data.AppendPrintf("\"defaultZoom\": %f,", vi.defaultZoom);
|
|
||||||
data.AppendPrintf("\"minZoom\": %f,", vi.minZoom);
|
|
||||||
data.AppendPrintf("\"maxZoom\": %f,", vi.maxZoom);
|
|
||||||
data.AppendPrintf("\"width\": %d,", vi.width);
|
|
||||||
data.AppendPrintf("\"height\": %d,", vi.height);
|
|
||||||
data.AppendPrintf("\"autoSize\": %s,", vi.autoSize ? "true" : "false");
|
|
||||||
data.AppendPrintf("\"allowZoom\": %s,", vi.allowZoom ? "true" : "false");
|
|
||||||
data.AppendPrintf("\"autoScale\": %s", vi.autoScale ? "true" : "false");
|
|
||||||
data.AppendLiteral("}");
|
|
||||||
|
|
||||||
curEvent->DoCallback(data);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case AndroidGeckoEvent::VIEWPORT:
|
case AndroidGeckoEvent::VIEWPORT:
|
||||||
case AndroidGeckoEvent::BROADCAST: {
|
case AndroidGeckoEvent::BROADCAST: {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user