2010-06-03 13:56:36 -07:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
2012-05-21 04:12:37 -07:00
|
|
|
* 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/. */
|
2010-06-03 13:56:36 -07:00
|
|
|
|
|
|
|
#ifndef AndroidJavaWrappers_h__
|
|
|
|
#define AndroidJavaWrappers_h__
|
|
|
|
|
|
|
|
#include <jni.h>
|
2013-04-22 11:24:43 -07:00
|
|
|
#include <android/input.h>
|
2010-06-03 13:56:36 -07:00
|
|
|
#include <android/log.h>
|
|
|
|
|
2010-06-04 14:14:43 -07:00
|
|
|
#include "nsGeoPosition.h"
|
2010-06-03 13:56:36 -07:00
|
|
|
#include "nsRect.h"
|
|
|
|
#include "nsString.h"
|
2013-03-17 00:55:16 -07:00
|
|
|
#include "nsTArray.h"
|
2013-09-05 12:32:04 -07:00
|
|
|
#include "nsIObserver.h"
|
2012-05-23 07:51:39 -07:00
|
|
|
#include "mozilla/gfx/Rect.h"
|
2013-04-17 14:39:10 -07:00
|
|
|
#include "mozilla/dom/Touch.h"
|
2013-09-25 04:21:16 -07:00
|
|
|
#include "mozilla/EventForwards.h"
|
2013-04-26 10:24:28 -07:00
|
|
|
#include "InputData.h"
|
2013-06-03 06:52:44 -07:00
|
|
|
#include "Units.h"
|
2010-06-03 13:56:36 -07:00
|
|
|
|
2010-06-25 17:52:37 -07:00
|
|
|
//#define FORCE_ALOG 1
|
|
|
|
|
2013-09-27 14:02:09 -07:00
|
|
|
#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
|
|
|
|
|
2012-09-12 14:47:08 -07:00
|
|
|
class nsIAndroidDisplayport;
|
|
|
|
class nsIAndroidViewport;
|
2013-05-17 13:17:53 -07:00
|
|
|
class nsIWidget;
|
2012-09-12 14:47:08 -07:00
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
namespace mozilla {
|
|
|
|
|
2013-09-27 14:02:09 -07:00
|
|
|
class AndroidGeckoLayerClient;
|
2012-05-04 08:08:47 -07:00
|
|
|
class AutoLocalJNIFrame;
|
2012-02-03 23:31:05 -08:00
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
void InitAndroidJavaWrappers(JNIEnv *jEnv);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Note: do not store global refs to any WrappedJavaObject;
|
|
|
|
* these are live only during a particular JNI method, as
|
|
|
|
* NewGlobalRef is -not- called on the jobject.
|
|
|
|
*
|
|
|
|
* If this is needed, WrappedJavaObject can be extended to
|
|
|
|
* handle it.
|
|
|
|
*/
|
|
|
|
|
2012-06-14 09:08:51 -07:00
|
|
|
class RefCountedJavaObject {
|
|
|
|
public:
|
|
|
|
RefCountedJavaObject(JNIEnv* env, jobject obj) : mRefCnt(0), mObject(env->NewGlobalRef(obj)) {}
|
|
|
|
|
|
|
|
~RefCountedJavaObject();
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t AddRef() { return ++mRefCnt; }
|
2012-06-14 09:08:51 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t Release() {
|
|
|
|
int32_t refcnt = --mRefCnt;
|
2012-06-14 09:08:51 -07:00
|
|
|
if (refcnt == 0)
|
|
|
|
delete this;
|
|
|
|
return refcnt;
|
|
|
|
}
|
|
|
|
|
|
|
|
jobject GetObject() { return mObject; }
|
|
|
|
private:
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mRefCnt;
|
2012-06-14 09:08:51 -07:00
|
|
|
jobject mObject;
|
|
|
|
};
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
class WrappedJavaObject {
|
|
|
|
public:
|
|
|
|
WrappedJavaObject() :
|
2013-09-27 14:02:09 -07:00
|
|
|
wrapped_obj(0)
|
2010-06-03 13:56:36 -07:00
|
|
|
{ }
|
|
|
|
|
2013-09-27 14:02:09 -07:00
|
|
|
WrappedJavaObject(jobject jobj) {
|
2010-06-03 13:56:36 -07:00
|
|
|
Init(jobj);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Init(jobject jobj) {
|
|
|
|
wrapped_obj = jobj;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isNull() const {
|
2013-09-27 14:02:09 -07:00
|
|
|
return wrapped_obj == 0;
|
2010-06-03 13:56:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
jobject wrappedObject() const {
|
|
|
|
return wrapped_obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
jobject wrapped_obj;
|
|
|
|
};
|
|
|
|
|
|
|
|
class AndroidPoint : public WrappedJavaObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static void InitPointClass(JNIEnv *jEnv);
|
|
|
|
|
|
|
|
AndroidPoint() { }
|
|
|
|
AndroidPoint(JNIEnv *jenv, jobject jobj) {
|
|
|
|
Init(jenv, jobj);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Init(JNIEnv *jenv, jobject jobj);
|
|
|
|
|
|
|
|
int X() { return mX; }
|
|
|
|
int Y() { return mY; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int mX;
|
|
|
|
int mY;
|
|
|
|
|
|
|
|
static jclass jPointClass;
|
|
|
|
static jfieldID jXField;
|
|
|
|
static jfieldID jYField;
|
|
|
|
};
|
|
|
|
|
|
|
|
class AndroidRect : public WrappedJavaObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static void InitRectClass(JNIEnv *jEnv);
|
|
|
|
|
|
|
|
AndroidRect() { }
|
|
|
|
AndroidRect(JNIEnv *jenv, jobject jobj) {
|
|
|
|
Init(jenv, jobj);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Init(JNIEnv *jenv, jobject jobj);
|
|
|
|
|
|
|
|
int Bottom() { return mBottom; }
|
|
|
|
int Left() { return mLeft; }
|
|
|
|
int Right() { return mRight; }
|
|
|
|
int Top() { return mTop; }
|
2012-02-09 09:28:10 -08:00
|
|
|
int Width() { return mRight - mLeft; }
|
|
|
|
int Height() { return mBottom - mTop; }
|
2010-06-03 13:56:36 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
int mBottom;
|
|
|
|
int mLeft;
|
|
|
|
int mRight;
|
|
|
|
int mTop;
|
|
|
|
|
|
|
|
static jclass jRectClass;
|
|
|
|
static jfieldID jBottomField;
|
|
|
|
static jfieldID jLeftField;
|
|
|
|
static jfieldID jRightField;
|
|
|
|
static jfieldID jTopField;
|
|
|
|
};
|
|
|
|
|
2012-09-12 14:47:08 -07:00
|
|
|
class AndroidRectF : public WrappedJavaObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static void InitRectFClass(JNIEnv *jEnv);
|
|
|
|
|
|
|
|
AndroidRectF() { }
|
|
|
|
AndroidRectF(JNIEnv *jenv, jobject jobj) {
|
|
|
|
Init(jenv, jobj);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Init(JNIEnv *jenv, jobject jobj);
|
|
|
|
|
|
|
|
float Bottom() { return mBottom; }
|
|
|
|
float Left() { return mLeft; }
|
|
|
|
float Right() { return mRight; }
|
|
|
|
float Top() { return mTop; }
|
|
|
|
float Width() { return mRight - mLeft; }
|
|
|
|
float Height() { return mBottom - mTop; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
float mBottom;
|
|
|
|
float mLeft;
|
|
|
|
float mRight;
|
|
|
|
float mTop;
|
|
|
|
|
|
|
|
static jclass jRectClass;
|
|
|
|
static jfieldID jBottomField;
|
|
|
|
static jfieldID jLeftField;
|
|
|
|
static jfieldID jRightField;
|
|
|
|
static jfieldID jTopField;
|
|
|
|
};
|
|
|
|
|
2013-09-27 14:02:09 -07:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2013-04-22 11:24:43 -07:00
|
|
|
enum {
|
|
|
|
// These keycode masks are not defined in android/keycodes.h:
|
|
|
|
AKEYCODE_ESCAPE = 111,
|
|
|
|
AKEYCODE_FORWARD_DEL = 112,
|
|
|
|
AKEYCODE_CTRL_LEFT = 113,
|
|
|
|
AKEYCODE_CTRL_RIGHT = 114,
|
|
|
|
AKEYCODE_CAPS_LOCK = 115,
|
|
|
|
AKEYCODE_SCROLL_LOCK = 116,
|
|
|
|
AKEYCODE_META_LEFT = 117,
|
|
|
|
AKEYCODE_META_RIGHT = 118,
|
|
|
|
AKEYCODE_FUNCTION = 119,
|
|
|
|
AKEYCODE_SYSRQ = 120,
|
|
|
|
AKEYCODE_BREAK = 121,
|
|
|
|
AKEYCODE_MOVE_HOME = 122,
|
|
|
|
AKEYCODE_MOVE_END = 123,
|
|
|
|
AKEYCODE_INSERT = 124,
|
|
|
|
AKEYCODE_FORWARD = 125,
|
|
|
|
AKEYCODE_MEDIA_PLAY = 126,
|
|
|
|
AKEYCODE_MEDIA_PAUSE = 127,
|
|
|
|
AKEYCODE_MEDIA_CLOSE = 128,
|
|
|
|
AKEYCODE_MEDIA_EJECT = 129,
|
|
|
|
AKEYCODE_MEDIA_RECORD = 130,
|
|
|
|
AKEYCODE_F1 = 131,
|
|
|
|
AKEYCODE_F2 = 132,
|
|
|
|
AKEYCODE_F3 = 133,
|
|
|
|
AKEYCODE_F4 = 134,
|
|
|
|
AKEYCODE_F5 = 135,
|
|
|
|
AKEYCODE_F6 = 136,
|
|
|
|
AKEYCODE_F7 = 137,
|
|
|
|
AKEYCODE_F8 = 138,
|
|
|
|
AKEYCODE_F9 = 139,
|
|
|
|
AKEYCODE_F10 = 140,
|
|
|
|
AKEYCODE_F11 = 141,
|
|
|
|
AKEYCODE_F12 = 142,
|
|
|
|
AKEYCODE_NUM_LOCK = 143,
|
|
|
|
AKEYCODE_NUMPAD_0 = 144,
|
|
|
|
AKEYCODE_NUMPAD_1 = 145,
|
|
|
|
AKEYCODE_NUMPAD_2 = 146,
|
|
|
|
AKEYCODE_NUMPAD_3 = 147,
|
|
|
|
AKEYCODE_NUMPAD_4 = 148,
|
|
|
|
AKEYCODE_NUMPAD_5 = 149,
|
|
|
|
AKEYCODE_NUMPAD_6 = 150,
|
|
|
|
AKEYCODE_NUMPAD_7 = 151,
|
|
|
|
AKEYCODE_NUMPAD_8 = 152,
|
|
|
|
AKEYCODE_NUMPAD_9 = 153,
|
|
|
|
AKEYCODE_NUMPAD_DIVIDE = 154,
|
|
|
|
AKEYCODE_NUMPAD_MULTIPLY = 155,
|
|
|
|
AKEYCODE_NUMPAD_SUBTRACT = 156,
|
|
|
|
AKEYCODE_NUMPAD_ADD = 157,
|
|
|
|
AKEYCODE_NUMPAD_DOT = 158,
|
|
|
|
AKEYCODE_NUMPAD_COMMA = 159,
|
|
|
|
AKEYCODE_NUMPAD_ENTER = 160,
|
|
|
|
AKEYCODE_NUMPAD_EQUALS = 161,
|
|
|
|
AKEYCODE_NUMPAD_LEFT_PAREN = 162,
|
|
|
|
AKEYCODE_NUMPAD_RIGHT_PAREN = 163,
|
|
|
|
AKEYCODE_VOLUME_MUTE = 164,
|
|
|
|
AKEYCODE_INFO = 165,
|
|
|
|
AKEYCODE_CHANNEL_UP = 166,
|
|
|
|
AKEYCODE_CHANNEL_DOWN = 167,
|
|
|
|
AKEYCODE_ZOOM_IN = 168,
|
|
|
|
AKEYCODE_ZOOM_OUT = 169,
|
|
|
|
AKEYCODE_TV = 170,
|
|
|
|
AKEYCODE_WINDOW = 171,
|
|
|
|
AKEYCODE_GUIDE = 172,
|
|
|
|
AKEYCODE_DVR = 173,
|
|
|
|
AKEYCODE_BOOKMARK = 174,
|
|
|
|
AKEYCODE_CAPTIONS = 175,
|
|
|
|
AKEYCODE_SETTINGS = 176,
|
|
|
|
AKEYCODE_TV_POWER = 177,
|
|
|
|
AKEYCODE_TV_INPUT = 178,
|
|
|
|
AKEYCODE_STB_POWER = 179,
|
|
|
|
AKEYCODE_STB_INPUT = 180,
|
|
|
|
AKEYCODE_AVR_POWER = 181,
|
|
|
|
AKEYCODE_AVR_INPUT = 182,
|
|
|
|
AKEYCODE_PROG_RED = 183,
|
|
|
|
AKEYCODE_PROG_GREEN = 184,
|
|
|
|
AKEYCODE_PROG_YELLOW = 185,
|
|
|
|
AKEYCODE_PROG_BLUE = 186,
|
|
|
|
AKEYCODE_APP_SWITCH = 187,
|
|
|
|
AKEYCODE_BUTTON_1 = 188,
|
|
|
|
AKEYCODE_BUTTON_2 = 189,
|
|
|
|
AKEYCODE_BUTTON_3 = 190,
|
|
|
|
AKEYCODE_BUTTON_4 = 191,
|
|
|
|
AKEYCODE_BUTTON_5 = 192,
|
|
|
|
AKEYCODE_BUTTON_6 = 193,
|
|
|
|
AKEYCODE_BUTTON_7 = 194,
|
|
|
|
AKEYCODE_BUTTON_8 = 195,
|
|
|
|
AKEYCODE_BUTTON_9 = 196,
|
|
|
|
AKEYCODE_BUTTON_10 = 197,
|
|
|
|
AKEYCODE_BUTTON_11 = 198,
|
|
|
|
AKEYCODE_BUTTON_12 = 199,
|
|
|
|
AKEYCODE_BUTTON_13 = 200,
|
|
|
|
AKEYCODE_BUTTON_14 = 201,
|
|
|
|
AKEYCODE_BUTTON_15 = 202,
|
|
|
|
AKEYCODE_BUTTON_16 = 203,
|
|
|
|
AKEYCODE_LANGUAGE_SWITCH = 204,
|
|
|
|
AKEYCODE_MANNER_MODE = 205,
|
|
|
|
AKEYCODE_3D_MODE = 206,
|
|
|
|
AKEYCODE_CONTACTS = 207,
|
|
|
|
AKEYCODE_CALENDAR = 208,
|
|
|
|
AKEYCODE_MUSIC = 209,
|
|
|
|
AKEYCODE_CALCULATOR = 210,
|
2013-04-23 20:49:46 -07:00
|
|
|
AKEYCODE_ZENKAKU_HANKAKU = 211,
|
|
|
|
AKEYCODE_EISU = 212,
|
|
|
|
AKEYCODE_MUHENKAN = 213,
|
|
|
|
AKEYCODE_HENKAN = 214,
|
|
|
|
AKEYCODE_KATAKANA_HIRAGANA = 215,
|
|
|
|
AKEYCODE_YEN = 216,
|
|
|
|
AKEYCODE_RO = 217,
|
|
|
|
AKEYCODE_KANA = 218,
|
|
|
|
AKEYCODE_ASSIST = 219,
|
2013-04-22 11:24:43 -07:00
|
|
|
|
|
|
|
AMETA_CTRL_ON = 0x00001000,
|
|
|
|
AMETA_CTRL_LEFT_ON = 0x00002000,
|
|
|
|
AMETA_CTRL_RIGHT_ON = 0x00004000,
|
|
|
|
AMETA_META_ON = 0x00010000,
|
|
|
|
AMETA_META_LEFT_ON = 0x00020000,
|
|
|
|
AMETA_META_RIGHT_ON = 0x00040000,
|
|
|
|
|
|
|
|
AMETA_ALT_MASK = AMETA_ALT_LEFT_ON | AMETA_ALT_RIGHT_ON | AMETA_ALT_ON,
|
|
|
|
AMETA_CTRL_MASK = AMETA_CTRL_LEFT_ON | AMETA_CTRL_RIGHT_ON | AMETA_CTRL_ON,
|
|
|
|
AMETA_META_MASK = AMETA_META_LEFT_ON | AMETA_META_RIGHT_ON | AMETA_META_ON,
|
|
|
|
AMETA_SHIFT_MASK = AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_RIGHT_ON | AMETA_SHIFT_ON,
|
2010-06-03 13:56:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class AndroidMotionEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum {
|
|
|
|
ACTION_DOWN = 0,
|
|
|
|
ACTION_UP = 1,
|
|
|
|
ACTION_MOVE = 2,
|
|
|
|
ACTION_CANCEL = 3,
|
|
|
|
ACTION_OUTSIDE = 4,
|
|
|
|
ACTION_POINTER_DOWN = 5,
|
|
|
|
ACTION_POINTER_UP = 6,
|
2012-06-15 15:34:22 -07:00
|
|
|
ACTION_HOVER_MOVE = 7,
|
|
|
|
ACTION_HOVER_ENTER = 9,
|
|
|
|
ACTION_HOVER_EXIT = 10,
|
2012-10-02 13:18:21 -07:00
|
|
|
ACTION_MAGNIFY_START = 11,
|
|
|
|
ACTION_MAGNIFY = 12,
|
|
|
|
ACTION_MAGNIFY_END = 13,
|
2010-06-03 13:56:36 -07:00
|
|
|
EDGE_TOP = 0x00000001,
|
|
|
|
EDGE_BOTTOM = 0x00000002,
|
|
|
|
EDGE_LEFT = 0x00000004,
|
|
|
|
EDGE_RIGHT = 0x00000008,
|
|
|
|
SAMPLE_X = 0,
|
|
|
|
SAMPLE_Y = 1,
|
|
|
|
SAMPLE_PRESSURE = 2,
|
|
|
|
SAMPLE_SIZE = 3,
|
|
|
|
NUM_SAMPLE_DATA = 4,
|
|
|
|
dummy_java_enum_list_end
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2010-06-04 14:14:43 -07:00
|
|
|
class AndroidLocation : public WrappedJavaObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static void InitLocationClass(JNIEnv *jEnv);
|
|
|
|
static nsGeoPosition* CreateGeoPosition(JNIEnv *jenv, jobject jobj);
|
|
|
|
static jclass jLocationClass;
|
|
|
|
static jmethodID jGetLatitudeMethod;
|
|
|
|
static jmethodID jGetLongitudeMethod;
|
|
|
|
static jmethodID jGetAltitudeMethod;
|
|
|
|
static jmethodID jGetAccuracyMethod;
|
|
|
|
static jmethodID jGetBearingMethod;
|
|
|
|
static jmethodID jGetSpeedMethod;
|
|
|
|
static jmethodID jGetTimeMethod;
|
|
|
|
};
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
class AndroidGeckoEvent : public WrappedJavaObject
|
|
|
|
{
|
2013-04-17 14:39:12 -07:00
|
|
|
private:
|
|
|
|
AndroidGeckoEvent() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void Init(JNIEnv *jenv, jobject jobj);
|
|
|
|
void Init(int aType);
|
|
|
|
void Init(AndroidGeckoEvent *aResizeEvent);
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
public:
|
|
|
|
static void InitGeckoEventClass(JNIEnv *jEnv);
|
|
|
|
|
2013-04-17 14:39:12 -07:00
|
|
|
static AndroidGeckoEvent* MakeNativePoke() {
|
|
|
|
AndroidGeckoEvent *event = new AndroidGeckoEvent();
|
|
|
|
event->Init(NATIVE_POKE);
|
|
|
|
return event;
|
2012-12-05 08:09:56 -08:00
|
|
|
}
|
2013-04-17 14:39:12 -07:00
|
|
|
|
|
|
|
static AndroidGeckoEvent* MakeIMEEvent(int aAction) {
|
|
|
|
AndroidGeckoEvent *event = new AndroidGeckoEvent();
|
|
|
|
event->Init(IME_EVENT);
|
|
|
|
event->mAction = aAction;
|
|
|
|
return event;
|
2011-11-14 19:12:14 -08:00
|
|
|
}
|
2013-04-17 14:39:12 -07:00
|
|
|
|
|
|
|
static AndroidGeckoEvent* MakeDrawEvent(const nsIntRect& aRect) {
|
|
|
|
AndroidGeckoEvent *event = new AndroidGeckoEvent();
|
|
|
|
event->Init(DRAW);
|
|
|
|
event->mRect = aRect;
|
|
|
|
return event;
|
2010-06-03 13:56:36 -07:00
|
|
|
}
|
2013-04-17 14:39:12 -07:00
|
|
|
|
|
|
|
static AndroidGeckoEvent* MakeFromJavaObject(JNIEnv *jenv, jobject jobj) {
|
|
|
|
AndroidGeckoEvent *event = new AndroidGeckoEvent();
|
|
|
|
event->Init(jenv, jobj);
|
|
|
|
return event;
|
2011-08-09 09:08:19 -07:00
|
|
|
}
|
2010-06-03 13:56:36 -07:00
|
|
|
|
2013-04-17 14:39:12 -07:00
|
|
|
static AndroidGeckoEvent* CopyResizeEvent(AndroidGeckoEvent *aResizeEvent) {
|
|
|
|
AndroidGeckoEvent *event = new AndroidGeckoEvent();
|
|
|
|
event->Init(aResizeEvent);
|
|
|
|
return event;
|
|
|
|
}
|
2010-06-03 13:56:36 -07:00
|
|
|
|
2013-04-26 10:26:46 -07:00
|
|
|
static AndroidGeckoEvent* MakeBroadcastEvent(const nsCString& topic, const nsCString& data) {
|
|
|
|
AndroidGeckoEvent* event = new AndroidGeckoEvent();
|
|
|
|
event->Init(BROADCAST);
|
|
|
|
CopyUTF8toUTF16(topic, event->mCharacters);
|
|
|
|
CopyUTF8toUTF16(data, event->mCharactersExtra);
|
|
|
|
return event;
|
|
|
|
}
|
|
|
|
|
2013-09-05 12:32:04 -07:00
|
|
|
static AndroidGeckoEvent* MakeAddObserver(const nsAString &key, nsIObserver *observer) {
|
|
|
|
AndroidGeckoEvent *event = new AndroidGeckoEvent();
|
|
|
|
event->Init(ADD_OBSERVER);
|
|
|
|
event->mCharacters.Assign(key);
|
|
|
|
event->mObserver = observer;
|
|
|
|
return event;
|
|
|
|
}
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
int Action() { return mAction; }
|
|
|
|
int Type() { return mType; }
|
2013-03-10 15:43:30 -07:00
|
|
|
bool AckNeeded() { return mAckNeeded; }
|
2010-06-03 13:56:36 -07:00
|
|
|
int64_t Time() { return mTime; }
|
2012-11-29 08:14:14 -08:00
|
|
|
const nsTArray<nsIntPoint>& Points() { return mPoints; }
|
|
|
|
const nsTArray<int>& PointIndicies() { return mPointIndicies; }
|
|
|
|
const nsTArray<float>& Pressures() { return mPressures; }
|
|
|
|
const nsTArray<float>& Orientations() { return mOrientations; }
|
|
|
|
const nsTArray<nsIntPoint>& PointRadii() { return mPointRadii; }
|
2013-09-04 06:58:08 -07:00
|
|
|
const nsTArray<nsString>& PrefNames() { return mPrefNames; }
|
2011-06-19 22:36:17 -07:00
|
|
|
double X() { return mX; }
|
|
|
|
double Y() { return mY; }
|
|
|
|
double Z() { return mZ; }
|
2010-06-03 13:56:36 -07:00
|
|
|
const nsIntRect& Rect() { return mRect; }
|
|
|
|
nsAString& Characters() { return mCharacters; }
|
2011-11-14 19:12:14 -08:00
|
|
|
nsAString& CharactersExtra() { return mCharactersExtra; }
|
2013-06-15 14:40:27 -07:00
|
|
|
nsAString& Data() { return mData; }
|
2010-06-03 13:56:36 -07:00
|
|
|
int KeyCode() { return mKeyCode; }
|
|
|
|
int MetaState() { return mMetaState; }
|
2013-04-09 15:56:03 -07:00
|
|
|
uint32_t DomKeyLocation() { return mDomKeyLocation; }
|
2013-04-22 11:24:43 -07:00
|
|
|
bool IsAltPressed() const { return (mMetaState & AMETA_ALT_MASK) != 0; }
|
|
|
|
bool IsShiftPressed() const { return (mMetaState & AMETA_SHIFT_MASK) != 0; }
|
|
|
|
bool IsCtrlPressed() const { return (mMetaState & AMETA_CTRL_MASK) != 0; }
|
|
|
|
bool IsMetaPressed() const { return (mMetaState & AMETA_META_MASK) != 0; }
|
2010-06-03 13:56:36 -07:00
|
|
|
int Flags() { return mFlags; }
|
|
|
|
int UnicodeChar() { return mUnicodeChar; }
|
2013-03-29 07:54:01 -07:00
|
|
|
int BaseUnicodeChar() { return mBaseUnicodeChar; }
|
2012-04-19 13:55:33 -07:00
|
|
|
int RepeatCount() const { return mRepeatCount; }
|
2010-06-03 13:56:36 -07:00
|
|
|
int Count() { return mCount; }
|
2012-11-01 13:11:02 -07:00
|
|
|
int Start() { return mStart; }
|
|
|
|
int End() { return mEnd; }
|
2012-01-24 16:31:33 -08:00
|
|
|
int PointerIndex() { return mPointerIndex; }
|
2010-08-04 12:47:26 -07:00
|
|
|
int RangeType() { return mRangeType; }
|
|
|
|
int RangeStyles() { return mRangeStyles; }
|
2012-12-06 11:35:59 -08:00
|
|
|
int RangeLineStyle() { return mRangeLineStyle; }
|
|
|
|
bool RangeBoldLine() { return mRangeBoldLine; }
|
2010-08-04 12:47:26 -07:00
|
|
|
int RangeForeColor() { return mRangeForeColor; }
|
|
|
|
int RangeBackColor() { return mRangeBackColor; }
|
2012-12-06 11:35:59 -08:00
|
|
|
int RangeLineColor() { return mRangeLineColor; }
|
2010-06-04 14:14:43 -07:00
|
|
|
nsGeoPosition* GeoPosition() { return mGeoPosition; }
|
2012-01-17 10:40:39 -08:00
|
|
|
double Bandwidth() { return mBandwidth; }
|
|
|
|
bool CanBeMetered() { return mCanBeMetered; }
|
2013-07-11 08:39:36 -07:00
|
|
|
bool IsWifi() { return mIsWifi; }
|
|
|
|
int DHCPGateway() { return mDHCPGateway; }
|
2012-03-20 06:09:45 -07:00
|
|
|
short ScreenOrientation() { return mScreenOrientation; }
|
2012-06-14 09:08:51 -07:00
|
|
|
RefCountedJavaObject* ByteBuffer() { return mByteBuffer; }
|
2013-03-20 15:45:07 -07:00
|
|
|
int Width() { return mWidth; }
|
|
|
|
int Height() { return mHeight; }
|
2013-09-04 06:58:08 -07:00
|
|
|
int RequestId() { return mCount; } // for convenience
|
2013-09-26 23:20:57 -07:00
|
|
|
WidgetTouchEvent MakeTouchEvent(nsIWidget* widget);
|
2013-04-26 10:24:28 -07:00
|
|
|
MultiTouchInput MakeMultiTouchInput(nsIWidget* widget);
|
2013-10-15 14:11:39 -07:00
|
|
|
WidgetMouseEvent MakeMouseEvent(nsIWidget* widget);
|
2013-04-17 14:39:12 -07:00
|
|
|
void UnionRect(nsIntRect const& aRect);
|
2013-09-05 12:32:04 -07:00
|
|
|
nsIObserver *Observer() { return mObserver; }
|
2010-06-03 13:56:36 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
int mAction;
|
|
|
|
int mType;
|
2013-03-10 15:43:30 -07:00
|
|
|
bool mAckNeeded;
|
2010-06-03 13:56:36 -07:00
|
|
|
int64_t mTime;
|
2012-01-24 16:31:33 -08:00
|
|
|
nsTArray<nsIntPoint> mPoints;
|
|
|
|
nsTArray<nsIntPoint> mPointRadii;
|
|
|
|
nsTArray<int> mPointIndicies;
|
|
|
|
nsTArray<float> mOrientations;
|
|
|
|
nsTArray<float> mPressures;
|
2010-06-03 13:56:36 -07:00
|
|
|
nsIntRect mRect;
|
|
|
|
int mFlags, mMetaState;
|
2013-04-09 15:56:03 -07:00
|
|
|
uint32_t mDomKeyLocation;
|
2013-03-29 07:54:01 -07:00
|
|
|
int mKeyCode, mUnicodeChar, mBaseUnicodeChar;
|
2012-04-19 13:55:33 -07:00
|
|
|
int mRepeatCount;
|
2012-11-01 13:11:02 -07:00
|
|
|
int mCount;
|
|
|
|
int mStart, mEnd;
|
2012-12-06 11:35:59 -08:00
|
|
|
int mRangeType, mRangeStyles, mRangeLineStyle;
|
|
|
|
bool mRangeBoldLine;
|
|
|
|
int mRangeForeColor, mRangeBackColor, mRangeLineColor;
|
2011-06-19 22:36:17 -07:00
|
|
|
double mX, mY, mZ;
|
2012-01-24 16:31:33 -08:00
|
|
|
int mPointerIndex;
|
2013-06-15 14:40:27 -07:00
|
|
|
nsString mCharacters, mCharactersExtra, mData;
|
2010-06-04 14:14:43 -07:00
|
|
|
nsRefPtr<nsGeoPosition> mGeoPosition;
|
2012-01-17 10:40:39 -08:00
|
|
|
double mBandwidth;
|
|
|
|
bool mCanBeMetered;
|
2013-07-11 08:39:36 -07:00
|
|
|
bool mIsWifi;
|
|
|
|
int mDHCPGateway;
|
2012-03-20 06:09:45 -07:00
|
|
|
short mScreenOrientation;
|
2012-06-14 09:08:51 -07:00
|
|
|
nsRefPtr<RefCountedJavaObject> mByteBuffer;
|
2013-03-20 15:45:07 -07:00
|
|
|
int mWidth, mHeight;
|
2013-09-05 12:32:04 -07:00
|
|
|
nsCOMPtr<nsIObserver> mObserver;
|
2013-09-04 06:58:08 -07:00
|
|
|
nsTArray<nsString> mPrefNames;
|
2010-06-03 13:56:36 -07:00
|
|
|
|
2012-01-24 16:31:33 -08:00
|
|
|
void ReadIntArray(nsTArray<int> &aVals,
|
|
|
|
JNIEnv *jenv,
|
|
|
|
jfieldID field,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t count);
|
2012-01-24 16:31:33 -08:00
|
|
|
void ReadFloatArray(nsTArray<float> &aVals,
|
|
|
|
JNIEnv *jenv,
|
|
|
|
jfieldID field,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t count);
|
2012-01-24 16:31:33 -08:00
|
|
|
void ReadPointArray(nsTArray<nsIntPoint> &mPoints,
|
|
|
|
JNIEnv *jenv,
|
|
|
|
jfieldID field,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t count);
|
2013-09-04 06:58:08 -07:00
|
|
|
void ReadStringArray(nsTArray<nsString> &aStrings,
|
|
|
|
JNIEnv *jenv,
|
|
|
|
jfieldID field);
|
2010-06-03 13:56:36 -07:00
|
|
|
void ReadRectField(JNIEnv *jenv);
|
|
|
|
void ReadCharactersField(JNIEnv *jenv);
|
2011-11-14 19:12:14 -08:00
|
|
|
void ReadCharactersExtraField(JNIEnv *jenv);
|
2013-06-15 14:40:27 -07:00
|
|
|
void ReadDataField(JNIEnv *jenv);
|
2013-09-04 06:58:00 -07:00
|
|
|
void ReadStringFromJString(nsString &aString, JNIEnv *jenv, jstring s);
|
2010-06-03 13:56:36 -07:00
|
|
|
|
2013-04-09 15:56:03 -07:00
|
|
|
uint32_t ReadDomKeyLocation(JNIEnv* jenv, jobject jGeckoEventObj);
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
static jclass jGeckoEventClass;
|
|
|
|
static jfieldID jActionField;
|
|
|
|
static jfieldID jTypeField;
|
2013-03-10 15:43:30 -07:00
|
|
|
static jfieldID jAckNeededField;
|
2010-06-03 13:56:36 -07:00
|
|
|
static jfieldID jTimeField;
|
2012-01-24 16:31:33 -08:00
|
|
|
static jfieldID jPoints;
|
|
|
|
static jfieldID jPointIndicies;
|
|
|
|
static jfieldID jOrientations;
|
|
|
|
static jfieldID jPressures;
|
|
|
|
static jfieldID jPointRadii;
|
2011-06-19 22:36:17 -07:00
|
|
|
static jfieldID jXField;
|
|
|
|
static jfieldID jYField;
|
|
|
|
static jfieldID jZField;
|
2011-10-29 03:35:29 -07:00
|
|
|
static jfieldID jDistanceField;
|
2010-06-03 13:56:36 -07:00
|
|
|
static jfieldID jRectField;
|
|
|
|
static jfieldID jNativeWindowField;
|
|
|
|
|
|
|
|
static jfieldID jCharactersField;
|
2011-11-14 19:12:14 -08:00
|
|
|
static jfieldID jCharactersExtraField;
|
2013-06-15 14:40:27 -07:00
|
|
|
static jfieldID jDataField;
|
2010-06-03 13:56:36 -07:00
|
|
|
static jfieldID jKeyCodeField;
|
|
|
|
static jfieldID jMetaStateField;
|
2012-09-12 17:48:29 -07:00
|
|
|
static jfieldID jDomKeyLocationField;
|
2010-06-03 13:56:36 -07:00
|
|
|
static jfieldID jFlagsField;
|
|
|
|
static jfieldID jCountField;
|
2012-11-01 13:11:02 -07:00
|
|
|
static jfieldID jStartField;
|
|
|
|
static jfieldID jEndField;
|
2012-01-24 16:31:33 -08:00
|
|
|
static jfieldID jPointerIndexField;
|
2010-06-03 13:56:36 -07:00
|
|
|
static jfieldID jUnicodeCharField;
|
2013-03-29 07:54:01 -07:00
|
|
|
static jfieldID jBaseUnicodeCharField;
|
2012-04-19 13:55:33 -07:00
|
|
|
static jfieldID jRepeatCountField;
|
2010-08-04 12:47:26 -07:00
|
|
|
static jfieldID jRangeTypeField;
|
|
|
|
static jfieldID jRangeStylesField;
|
2012-12-06 11:35:59 -08:00
|
|
|
static jfieldID jRangeLineStyleField;
|
|
|
|
static jfieldID jRangeBoldLineField;
|
2010-08-04 12:47:26 -07:00
|
|
|
static jfieldID jRangeForeColorField;
|
|
|
|
static jfieldID jRangeBackColorField;
|
2012-12-06 11:35:59 -08:00
|
|
|
static jfieldID jRangeLineColorField;
|
2010-06-04 14:14:43 -07:00
|
|
|
static jfieldID jLocationField;
|
2013-09-04 06:58:08 -07:00
|
|
|
static jfieldID jPrefNamesField;
|
2010-06-03 13:56:36 -07:00
|
|
|
|
2012-01-17 10:40:39 -08:00
|
|
|
static jfieldID jBandwidthField;
|
|
|
|
static jfieldID jCanBeMeteredField;
|
2013-07-11 08:39:36 -07:00
|
|
|
static jfieldID jIsWifiField;
|
|
|
|
static jfieldID jDHCPGatewayField;
|
2012-01-17 10:40:39 -08:00
|
|
|
|
2012-03-20 06:09:45 -07:00
|
|
|
static jfieldID jScreenOrientationField;
|
2012-06-14 09:08:51 -07:00
|
|
|
static jfieldID jByteBufferField;
|
2012-03-20 06:09:45 -07:00
|
|
|
|
2013-03-20 15:45:07 -07:00
|
|
|
static jfieldID jWidthField;
|
|
|
|
static jfieldID jHeightField;
|
|
|
|
|
2013-04-09 15:56:03 -07:00
|
|
|
static jclass jDomKeyLocationClass;
|
|
|
|
static jfieldID jDomKeyLocationValueField;
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
public:
|
|
|
|
enum {
|
|
|
|
NATIVE_POKE = 0,
|
|
|
|
KEY_EVENT = 1,
|
|
|
|
MOTION_EVENT = 2,
|
2012-03-13 16:57:51 -07:00
|
|
|
SENSOR_EVENT = 3,
|
2012-03-20 16:59:24 -07:00
|
|
|
LOCATION_EVENT = 5,
|
|
|
|
IME_EVENT = 6,
|
|
|
|
DRAW = 7,
|
|
|
|
SIZE_CHANGED = 8,
|
2013-03-26 11:05:10 -07:00
|
|
|
APP_BACKGROUNDING = 9,
|
|
|
|
APP_FOREGROUNDING = 10,
|
2012-03-20 16:59:24 -07:00
|
|
|
LOAD_URI = 12,
|
2013-03-10 15:43:30 -07:00
|
|
|
NOOP = 15,
|
2013-01-17 11:16:14 -08:00
|
|
|
FORCED_RESIZE = 16, // used internally in nsAppShell/nsWindow
|
2012-03-20 16:59:24 -07:00
|
|
|
BROADCAST = 19,
|
|
|
|
VIEWPORT = 20,
|
|
|
|
VISITED = 21,
|
|
|
|
NETWORK_CHANGED = 22,
|
2012-12-15 07:43:52 -08:00
|
|
|
THUMBNAIL = 25,
|
2012-03-20 16:59:24 -07:00
|
|
|
SCREENORIENTATION_CHANGED = 27,
|
2013-03-20 15:45:07 -07:00
|
|
|
COMPOSITOR_CREATE = 28,
|
|
|
|
COMPOSITOR_PAUSE = 29,
|
|
|
|
COMPOSITOR_RESUME = 30,
|
|
|
|
NATIVE_GESTURE_EVENT = 31,
|
2013-03-29 07:54:01 -07:00
|
|
|
IME_KEY_EVENT = 32,
|
2013-06-15 14:40:27 -07:00
|
|
|
CALL_OBSERVER = 33,
|
2013-06-19 10:55:35 -07:00
|
|
|
REMOVE_OBSERVER = 34,
|
|
|
|
LOW_MEMORY = 35,
|
|
|
|
NETWORK_LINK_CHANGE = 36,
|
2013-08-15 12:03:47 -07:00
|
|
|
TELEMETRY_HISTOGRAM_ADD = 37,
|
2013-09-05 12:32:04 -07:00
|
|
|
ADD_OBSERVER = 38,
|
2013-09-04 06:58:08 -07:00
|
|
|
PREFERENCES_OBSERVE = 39,
|
|
|
|
PREFERENCES_GET = 40,
|
2013-09-04 06:58:23 -07:00
|
|
|
PREFERENCES_REMOVE_OBSERVERS = 41,
|
2010-06-03 13:56:36 -07:00
|
|
|
dummy_java_enum_list_end
|
|
|
|
};
|
|
|
|
|
2013-06-17 14:09:09 -07:00
|
|
|
enum {
|
|
|
|
// Memory pressue levels, keep in sync with those in MemoryMonitor.java
|
|
|
|
MEMORY_PRESSURE_NONE = 0,
|
|
|
|
MEMORY_PRESSURE_CLEANUP = 1,
|
|
|
|
MEMORY_PRESSURE_LOW = 2,
|
|
|
|
MEMORY_PRESSURE_MEDIUM = 3,
|
|
|
|
MEMORY_PRESSURE_HIGH = 4
|
|
|
|
};
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
enum {
|
2013-03-29 07:54:01 -07:00
|
|
|
// Internal Gecko events
|
|
|
|
IME_FLUSH_CHANGES = -2,
|
|
|
|
IME_UPDATE_CONTEXT = -1,
|
|
|
|
// Events from Java to Gecko
|
2012-11-01 13:11:02 -07:00
|
|
|
IME_SYNCHRONIZE = 0,
|
|
|
|
IME_REPLACE_TEXT = 1,
|
|
|
|
IME_SET_SELECTION = 2,
|
|
|
|
IME_ADD_COMPOSITION_RANGE = 3,
|
|
|
|
IME_UPDATE_COMPOSITION = 4,
|
2012-11-13 14:27:19 -08:00
|
|
|
IME_REMOVE_COMPOSITION = 5,
|
2012-12-05 08:09:56 -08:00
|
|
|
IME_ACKNOWLEDGE_FOCUS = 6,
|
2013-03-29 07:54:01 -07:00
|
|
|
dummy_ime_enum_list_end
|
2010-06-03 13:56:36 -07:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2010-06-14 12:04:16 -07:00
|
|
|
class nsJNIString : public nsString
|
|
|
|
{
|
|
|
|
public:
|
2012-04-16 15:31:05 -07:00
|
|
|
nsJNIString(jstring jstr, JNIEnv *jenv);
|
2010-06-14 12:04:16 -07:00
|
|
|
};
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|