mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 701374 - Add native method to check creation of fixup URIs (r=dougt)
--HG-- extra : rebase_source : fd623dc1db9b110f8f0085ca0377c29697331093
This commit is contained in:
parent
33ff7db957
commit
9e70bdc431
@ -298,6 +298,7 @@ SHELL_WRAPPER0(executeNextRunnable)
|
||||
SHELL_WRAPPER1(cameraCallbackBridge, jbyteArray)
|
||||
SHELL_WRAPPER1(notifyUriVisited, jstring)
|
||||
SHELL_WRAPPER3(notifyBatteryChange, jdouble, jboolean, jdouble);
|
||||
SHELL_WRAPPER1_WITH_RETURN(canCreateFixupURI, bool, jstring);
|
||||
|
||||
static void * xul_handle = NULL;
|
||||
static time_t apk_mtime = 0;
|
||||
@ -702,6 +703,7 @@ loadLibs(const char *apkName)
|
||||
GETFUNC(cameraCallbackBridge);
|
||||
GETFUNC(notifyUriVisited);
|
||||
GETFUNC(notifyBatteryChange);
|
||||
GETFUNC(canCreateFixupURI);
|
||||
#undef GETFUNC
|
||||
sStartupTimeline = (uint64_t *)__wrap_dlsym(xul_handle, "_ZN7mozilla15StartupTimeline16sStartupTimelineE");
|
||||
gettimeofday(&t1, 0);
|
||||
|
@ -50,6 +50,9 @@
|
||||
#include "nsWindow.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIURIFixup.h"
|
||||
#include "nsCDefaultURIFixup.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#define ALOG_BRIDGE(args...) ALOG(args)
|
||||
@ -364,6 +367,8 @@ AndroidBridge::NotifyAppShellReady()
|
||||
{
|
||||
ALOG_BRIDGE("AndroidBridge::NotifyAppShellReady");
|
||||
mJNIEnv->CallStaticVoidMethod(mGeckoAppShellClass, jNotifyAppShellReady);
|
||||
|
||||
mURIFixup = do_GetService(NS_URIFIXUP_CONTRACTID);
|
||||
}
|
||||
|
||||
void
|
||||
@ -580,6 +585,23 @@ AndroidBridge::ClipboardHasText()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidBridge::CanCreateFixupURI(const nsACString& aURIText)
|
||||
{
|
||||
ALOG_BRIDGE("AndroidBridge::CanCreateFixupURI");
|
||||
|
||||
if (!mURIFixup)
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIURI> targetURI;
|
||||
|
||||
mURIFixup->CreateFixupURI(aURIText,
|
||||
nsIURIFixup::FIXUP_FLAG_NONE,
|
||||
getter_AddRefs(targetURI));
|
||||
|
||||
return (targetURI != nsnull);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::EmptyClipboard()
|
||||
{
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsIMIMEInfo.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsIURIFixup.h"
|
||||
|
||||
#include "nsIAndroidBridge.h"
|
||||
|
||||
@ -185,6 +186,8 @@ public:
|
||||
|
||||
bool ClipboardHasText();
|
||||
|
||||
bool CanCreateFixupURI(const nsACString& aURIText);
|
||||
|
||||
void ShowAlertNotification(const nsAString& aImageUrl,
|
||||
const nsAString& aAlertTitle,
|
||||
const nsAString& aAlertText,
|
||||
@ -407,6 +410,9 @@ protected:
|
||||
jclass jEGLContextClass;
|
||||
jclass jEGL10Class;
|
||||
|
||||
// Needed for canCreateFixupURI()
|
||||
nsCOMPtr<nsIURIFixup> mURIFixup;
|
||||
|
||||
// calls we've dlopened from libjnigraphics.so
|
||||
int (* AndroidBitmap_getInfo)(JNIEnv *env, jobject bitmap, void *info);
|
||||
int (* AndroidBitmap_lockPixels)(JNIEnv *env, jobject bitmap, void **buffer);
|
||||
|
@ -82,6 +82,7 @@ extern "C" {
|
||||
NS_EXPORT void JNICALL Java_org_mozilla_gecko_GeckoAppShell_executeNextRunnable(JNIEnv *, jclass);
|
||||
NS_EXPORT void JNICALL Java_org_mozilla_gecko_GeckoAppShell_notifyUriVisited(JNIEnv *, jclass, jstring uri);
|
||||
NS_EXPORT void JNICALL Java_org_mozilla_gecko_GeckoAppShell_notifyBatteryChange(JNIEnv* jenv, jclass, jdouble, jboolean, jdouble);
|
||||
NS_EXPORT bool JNICALL Java_org_mozilla_gecko_GeckoAppShell_canCreateFixupURI(JNIEnv* jenv, jclass, jstring text);
|
||||
}
|
||||
|
||||
|
||||
@ -239,3 +240,14 @@ Java_org_mozilla_gecko_GeckoAppShell_notifyBatteryChange(JNIEnv* jenv, jclass,
|
||||
NS_DispatchToMainThread(runnable);
|
||||
}
|
||||
|
||||
NS_EXPORT bool JNICALL
|
||||
Java_org_mozilla_gecko_GeckoAppShell_canCreateFixupURI(JNIEnv* jenv, jclass, jstring text)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "GeckoJNI", "%s", __PRETTY_FUNCTION__);
|
||||
|
||||
const jchar *textChars = jenv->GetStringChars(text, NULL);
|
||||
NS_ConvertUTF16toUTF8 uriString(textChars);
|
||||
jenv->ReleaseStringChars(text, textChars);
|
||||
|
||||
return AndroidBridge::Bridge()->CanCreateFixupURI(uriString);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user