mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 673969 - System preference for "visible passwords" not followed. r=blassey
This commit is contained in:
parent
625c045adb
commit
86521171b2
@ -599,6 +599,19 @@ ContentParent::RecvGetIconForExtension(const nsCString& aFileExt, const PRUint32
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::RecvGetShowPasswordSetting(PRBool* showPassword)
|
||||
{
|
||||
// default behavior is to show the last password character
|
||||
*showPassword = PR_TRUE;
|
||||
#ifdef ANDROID
|
||||
NS_ASSERTION(AndroidBridge::Bridge() != nsnull, "AndroidBridge is not available");
|
||||
if (AndroidBridge::Bridge() != nsnull)
|
||||
*showPassword = AndroidBridge::Bridge()->GetShowPasswordSetting();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS4(ContentParent,
|
||||
nsIObserver,
|
||||
nsIThreadObserver,
|
||||
|
@ -167,6 +167,7 @@ private:
|
||||
|
||||
virtual bool RecvGetSystemColors(const PRUint32& colorsCount, InfallibleTArray<PRUint32>* colors);
|
||||
virtual bool RecvGetIconForExtension(const nsCString& aFileExt, const PRUint32& aIconSize, InfallibleTArray<PRUint8>* bits);
|
||||
virtual bool RecvGetShowPasswordSetting(PRBool* showPassword);
|
||||
|
||||
virtual bool RecvStartVisitedQuery(const IPC::URI& uri);
|
||||
|
||||
|
@ -205,6 +205,9 @@ parent:
|
||||
sync GetIconForExtension(nsCString aFileExt, PRUint32 aIconSize)
|
||||
returns (PRUint8[] bits);
|
||||
|
||||
sync GetShowPasswordSetting()
|
||||
returns (PRBool showPassword);
|
||||
|
||||
both:
|
||||
AsyncMessage(nsString aMessage, nsString aJSON);
|
||||
|
||||
|
@ -62,6 +62,7 @@ import android.telephony.*;
|
||||
import android.webkit.MimeTypeMap;
|
||||
import android.media.MediaScannerConnection;
|
||||
import android.media.MediaScannerConnection.MediaScannerConnectionClient;
|
||||
import android.provider.Settings;
|
||||
|
||||
import android.util.*;
|
||||
import android.net.Uri;
|
||||
@ -1366,4 +1367,16 @@ public class GeckoAppShell
|
||||
|
||||
return activityInfo.loadIcon(pm);
|
||||
}
|
||||
|
||||
public static boolean getShowPasswordSetting() {
|
||||
try {
|
||||
int showPassword =
|
||||
Settings.System.getInt(GeckoApp.mAppContext.getContentResolver(),
|
||||
Settings.System.TEXT_SHOW_PASSWORD);
|
||||
return (showPassword > 0);
|
||||
}
|
||||
catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -148,6 +148,7 @@ AndroidBridge::Init(JNIEnv *jEnv,
|
||||
jGetSystemColors = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getSystemColors", "()[I");
|
||||
jGetIconForExtension = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getIconForExtension", "(Ljava/lang/String;I)[B");
|
||||
jCreateShortcut = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "createShortcut", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
|
||||
jGetShowPasswordSetting = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getShowPasswordSetting", "()Z");
|
||||
|
||||
jEGLContextClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("javax/microedition/khronos/egl/EGLContext"));
|
||||
jEGL10Class = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("javax/microedition/khronos/egl/EGL10"));
|
||||
@ -755,6 +756,13 @@ AndroidBridge::GetIconForExtension(const nsACString& aFileExt, PRUint32 aIconSiz
|
||||
mJNIEnv->ReleaseByteArrayElements(arr, elements, 0);
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidBridge::GetShowPasswordSetting()
|
||||
{
|
||||
ALOG_BRIDGE("AndroidBridge::GetShowPasswordSetting");
|
||||
return mJNIEnv->CallStaticBooleanMethod(mGeckoAppShellClass, jGetShowPasswordSetting);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::SetSurfaceView(jobject obj)
|
||||
{
|
||||
@ -998,4 +1006,3 @@ AndroidBridge::UnlockBitmap(jobject bitmap)
|
||||
if ((err = AndroidBitmap_unlockPixels(JNI(), bitmap)) != 0)
|
||||
ALOG_BRIDGE("AndroidBitmap_unlockPixels failed! (error %d)", err);
|
||||
}
|
||||
|
||||
|
@ -212,6 +212,8 @@ public:
|
||||
|
||||
void GetIconForExtension(const nsACString& aFileExt, PRUint32 aIconSize, PRUint8 * const aBuf);
|
||||
|
||||
bool GetShowPasswordSetting();
|
||||
|
||||
struct AutoLocalJNIFrame {
|
||||
AutoLocalJNIFrame(int nEntries = 128) : mEntries(nEntries) {
|
||||
// Make sure there is enough space to store a local ref to the
|
||||
@ -322,6 +324,7 @@ protected:
|
||||
jmethodID jGetSystemColors;
|
||||
jmethodID jGetIconForExtension;
|
||||
jmethodID jCreateShortcut;
|
||||
jmethodID jGetShowPasswordSetting;
|
||||
|
||||
// stuff we need for CallEglCreateWindowSurface
|
||||
jclass jEGLSurfaceImplClass;
|
||||
|
@ -45,9 +45,12 @@
|
||||
using namespace mozilla;
|
||||
using mozilla::dom::ContentChild;
|
||||
|
||||
PRBool nsLookAndFeel::mInitialized = PR_FALSE;
|
||||
PRBool nsLookAndFeel::mInitializedSystemColors = PR_FALSE;
|
||||
AndroidSystemColors nsLookAndFeel::mSystemColors;
|
||||
|
||||
PRBool nsLookAndFeel::mInitializedShowPassword = PR_FALSE;
|
||||
PRBool nsLookAndFeel::mShowPassword = PR_TRUE;
|
||||
|
||||
nsLookAndFeel::nsLookAndFeel()
|
||||
: nsXPLookAndFeel()
|
||||
{
|
||||
@ -68,7 +71,7 @@ nsLookAndFeel::~nsLookAndFeel()
|
||||
nsresult
|
||||
nsLookAndFeel::GetSystemColors()
|
||||
{
|
||||
if (mInitialized)
|
||||
if (mInitializedSystemColors)
|
||||
return NS_OK;
|
||||
|
||||
if (!AndroidBridge::Bridge())
|
||||
@ -76,7 +79,7 @@ nsLookAndFeel::GetSystemColors()
|
||||
|
||||
AndroidBridge::Bridge()->GetSystemColors(&mSystemColors);
|
||||
|
||||
mInitialized = PR_TRUE;
|
||||
mInitializedSystemColors = PR_TRUE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -102,7 +105,7 @@ nsLookAndFeel::CallRemoteGetSystemColors()
|
||||
// so just copy the memory block
|
||||
memcpy(&mSystemColors, colors.Elements(), sizeof(nscolor) * colorsCount);
|
||||
|
||||
mInitialized = PR_TRUE;
|
||||
mInitializedSystemColors = PR_TRUE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -112,7 +115,7 @@ nsLookAndFeel::NativeGetColor(const nsColorID aID, nscolor &aColor)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (!mInitialized) {
|
||||
if (!mInitializedSystemColors) {
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default)
|
||||
rv = GetSystemColors();
|
||||
else
|
||||
@ -460,3 +463,20 @@ nsLookAndFeel::GetMetric(const nsMetricFloatID aID,
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*virtual*/
|
||||
PRBool nsLookAndFeel::GetEchoPassword()
|
||||
{
|
||||
if (!mInitializedShowPassword) {
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
if (AndroidBridge::Bridge())
|
||||
mShowPassword = AndroidBridge::Bridge()->GetShowPasswordSetting();
|
||||
else
|
||||
NS_ASSERTION(AndroidBridge::Bridge() != nsnull, "AndroidBridge is not available!");
|
||||
} else {
|
||||
ContentChild::GetSingleton()->SendGetShowPasswordSetting(&mShowPassword);
|
||||
}
|
||||
mInitializedShowPassword = PR_TRUE;
|
||||
}
|
||||
return mShowPassword;
|
||||
}
|
||||
|
@ -51,10 +51,13 @@ public:
|
||||
nsresult NativeGetColor(const nsColorID aID, nscolor &aColor);
|
||||
NS_IMETHOD GetMetric(const nsMetricID aID, PRInt32 & aMetric);
|
||||
NS_IMETHOD GetMetric(const nsMetricFloatID aID, float & aMetric);
|
||||
virtual PRBool GetEchoPassword();
|
||||
|
||||
protected:
|
||||
static PRBool mInitialized;
|
||||
static PRBool mInitializedSystemColors;
|
||||
static mozilla::AndroidSystemColors mSystemColors;
|
||||
static PRBool mInitializedShowPassword;
|
||||
static PRBool mShowPassword;
|
||||
|
||||
nsresult GetSystemColors();
|
||||
nsresult CallRemoteGetSystemColors();
|
||||
|
Loading…
Reference in New Issue
Block a user