Methods Summary |
---|
public void | cancel()Cancel this request and all pending requests for the WebView that had
the error.
sendMessage(obtainMessage(HANDLE_RESPONSE, 0, 0));
|
synchronized void | clear()Clears SSL error preference table.
mSslPrefTable.clear();
|
void | fastProcessQueuedSslErrors()Processes queued SSL-error confirmation requests in
a tight loop while there is no need to ask the user.
while (processNextLoader());
|
public void | handleMessage(android.os.Message msg)
switch (msg.what) {
case HANDLE_RESPONSE:
handleSslErrorResponse(msg.arg1 == 1);
fastProcessQueuedSslErrors();
break;
}
|
synchronized void | handleSslErrorRequest(LoadListener loader)Handles SSL error(s) on the way up to the user.
if (Config.LOGV) {
Log.v(LOGTAG, "SslErrorHandler.handleSslErrorRequest(): " +
"url=" + loader.url());
}
if (!loader.cancelled()) {
mLoaderQueue.offer(loader);
if (loader == mLoaderQueue.peek()) {
fastProcessQueuedSslErrors();
}
}
|
synchronized void | handleSslErrorResponse(boolean proceed)Handles SSL error(s) on the way down from the user.
LoadListener loader = mLoaderQueue.poll();
if (Config.DEBUG) {
Assert.assertNotNull(loader);
}
if (Config.LOGV) {
Log.v(LOGTAG, "SslErrorHandler.handleSslErrorResponse():"
+ " proceed: " + proceed
+ " url:" + loader.url());
}
if (!loader.cancelled()) {
if (proceed) {
// update the user's SSL error preference table
int primary = loader.sslError().getPrimaryError();
String host = loader.host();
if (Config.DEBUG) {
Assert.assertTrue(host != null && primary != 0);
}
boolean hasKey = mSslPrefTable.containsKey(host);
if (!hasKey ||
primary > mSslPrefTable.getInt(host)) {
mSslPrefTable.putInt(host, new Integer(primary));
}
}
loader.handleSslErrorResponse(proceed);
}
|
public void | proceed()Proceed with the SSL certificate.
sendMessage(obtainMessage(HANDLE_RESPONSE, 1, 0));
|
private synchronized boolean | processNextLoader()Processes the next loader in the queue.
LoadListener loader = mLoaderQueue.peek();
if (loader != null) {
// if this loader has been cancelled
if (loader.cancelled()) {
// go to the following loader in the queue
return true;
}
SslError error = loader.sslError();
if (Config.DEBUG) {
Assert.assertNotNull(error);
}
int primary = error.getPrimaryError();
String host = loader.host();
if (Config.DEBUG) {
Assert.assertTrue(host != null && primary != 0);
}
if (mSslPrefTable.containsKey(host)) {
if (primary <= mSslPrefTable.getInt(host)) {
handleSslErrorResponse(true);
return true;
}
}
// if we do not have information on record, ask
// the user (display a dialog)
CallbackProxy proxy = loader.getFrame().getCallbackProxy();
proxy.onReceivedSslError(this, error);
}
// the queue must be empty, stop
return false;
|
boolean | restoreState(android.os.Bundle inState)Restores this handler's state from a map.
boolean success = (inState != null);
if (success) {
success = inState.containsKey("ssl-error-handler");
if (success) {
mSslPrefTable = inState.getBundle("ssl-error-handler");
}
}
return success;
|
boolean | saveState(android.os.Bundle outState)Saves this handler's state into a map.
boolean success = (outState != null);
if (success) {
// TODO?
outState.putBundle("ssl-error-handler", mSslPrefTable);
}
return success;
|