am fbd26467: Merge "DO NOT MERGE" into gingerbread
Merge commit 'fbd2646705c52c111f041b16d7cb34cb922a2a64' into gingerbread-plus-aosp * commit 'fbd2646705c52c111f041b16d7cb34cb922a2a64': DO NOT MERGE
This commit is contained in:
committed by
Android Git Automerger
commit
4de4f09e8e
@@ -20,6 +20,8 @@ import android.os.Handler;
|
|||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
final class JWebCoreJavaBridge extends Handler {
|
final class JWebCoreJavaBridge extends Handler {
|
||||||
@@ -44,7 +46,8 @@ final class JWebCoreJavaBridge extends Handler {
|
|||||||
|
|
||||||
// keep track of the main WebView attached to the current window so that we
|
// keep track of the main WebView attached to the current window so that we
|
||||||
// can get the proper Context.
|
// can get the proper Context.
|
||||||
private WebView mCurrentMainWebView;
|
private static WeakReference<WebView> sCurrentMainWebView =
|
||||||
|
new WeakReference<WebView>(null);
|
||||||
|
|
||||||
/* package */
|
/* package */
|
||||||
static final int REFRESH_PLUGINS = 100;
|
static final int REFRESH_PLUGINS = 100;
|
||||||
@@ -62,20 +65,20 @@ final class JWebCoreJavaBridge extends Handler {
|
|||||||
nativeFinalize();
|
nativeFinalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized void setActiveWebView(WebView webview) {
|
static synchronized void setActiveWebView(WebView webview) {
|
||||||
if (mCurrentMainWebView != null) {
|
if (sCurrentMainWebView.get() != null) {
|
||||||
// it is possible if there is a sub-WebView. Do nothing.
|
// it is possible if there is a sub-WebView. Do nothing.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mCurrentMainWebView = webview;
|
sCurrentMainWebView = new WeakReference<WebView>(webview);
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized void removeActiveWebView(WebView webview) {
|
static synchronized void removeActiveWebView(WebView webview) {
|
||||||
if (mCurrentMainWebView != webview) {
|
if (sCurrentMainWebView.get() != webview) {
|
||||||
// it is possible if there is a sub-WebView. Do nothing.
|
// it is possible if there is a sub-WebView. Do nothing.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mCurrentMainWebView = null;
|
sCurrentMainWebView.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -256,11 +259,12 @@ final class JWebCoreJavaBridge extends Handler {
|
|||||||
|
|
||||||
synchronized private String getSignedPublicKey(int index, String challenge,
|
synchronized private String getSignedPublicKey(int index, String challenge,
|
||||||
String url) {
|
String url) {
|
||||||
if (mCurrentMainWebView != null) {
|
WebView current = sCurrentMainWebView.get();
|
||||||
|
if (current != null) {
|
||||||
// generateKeyPair expects organizations which we don't have. Ignore
|
// generateKeyPair expects organizations which we don't have. Ignore
|
||||||
// url.
|
// url.
|
||||||
return CertTool.getSignedPublicKey(
|
return CertTool.getSignedPublicKey(
|
||||||
mCurrentMainWebView.getContext(), index, challenge);
|
current.getContext(), index, challenge);
|
||||||
} else {
|
} else {
|
||||||
Log.e(LOGTAG, "There is no active WebView for getSignedPublicKey");
|
Log.e(LOGTAG, "There is no active WebView for getSignedPublicKey");
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -4512,9 +4512,9 @@ public class WebView extends AbsoluteLayout
|
|||||||
public void onWindowFocusChanged(boolean hasWindowFocus) {
|
public void onWindowFocusChanged(boolean hasWindowFocus) {
|
||||||
setActive(hasWindowFocus);
|
setActive(hasWindowFocus);
|
||||||
if (hasWindowFocus) {
|
if (hasWindowFocus) {
|
||||||
BrowserFrame.sJavaBridge.setActiveWebView(this);
|
JWebCoreJavaBridge.setActiveWebView(this);
|
||||||
} else {
|
} else {
|
||||||
BrowserFrame.sJavaBridge.removeActiveWebView(this);
|
JWebCoreJavaBridge.removeActiveWebView(this);
|
||||||
}
|
}
|
||||||
super.onWindowFocusChanged(hasWindowFocus);
|
super.onWindowFocusChanged(hasWindowFocus);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user