diff options
author | Steve Block <steveblock@google.com> | 2011-10-07 09:53:43 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-10-07 09:53:43 -0700 |
commit | d8b505d50f39a2a8a80eb19578579d1b30762fd2 (patch) | |
tree | 9e8298977e8ce15dd9554b3dda8e1f94d03ba79a | |
parent | 59797e6bece0ac2d649d8d93d02ed81979950145 (diff) | |
parent | fe33a75cc8883dc5d50dd5a2fb0eac702f2a6992 (diff) | |
download | frameworks_base-d8b505d50f39a2a8a80eb19578579d1b30762fd2.zip frameworks_base-d8b505d50f39a2a8a80eb19578579d1b30762fd2.tar.gz frameworks_base-d8b505d50f39a2a8a80eb19578579d1b30762fd2.tar.bz2 |
Merge "Add WebViewClient.onProceededAfterSslError()"
-rw-r--r-- | core/java/android/webkit/BrowserFrame.java | 5 | ||||
-rw-r--r-- | core/java/android/webkit/CallbackProxy.java | 107 | ||||
-rw-r--r-- | core/java/android/webkit/WebViewClient.java | 19 |
3 files changed, 80 insertions, 51 deletions
diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java index 8c22da0..c8b67a8 100644 --- a/core/java/android/webkit/BrowserFrame.java +++ b/core/java/android/webkit/BrowserFrame.java @@ -471,6 +471,7 @@ class BrowserFrame extends Handler { /** * We have received an SSL certificate for the main top-level page. + * Used by the Android HTTP stack only. */ void certificate(SslCertificate certificate) { if (mIsMainFrame) { @@ -1178,6 +1179,7 @@ class BrowserFrame extends Handler { if (SslCertLookupTable.getInstance().isAllowed(sslError)) { nativeSslCertErrorProceed(handle); + mCallbackProxy.onProceededAfterSslError(sslError); return; } @@ -1267,7 +1269,8 @@ class BrowserFrame extends Handler { } /** - * Called by JNI when we load a page over SSL. + * Called by JNI when we recieve a certificate for the page's main resource. + * Used by the Chromium HTTP stack only. */ private void setCertificate(byte cert_der[]) { try { diff --git a/core/java/android/webkit/CallbackProxy.java b/core/java/android/webkit/CallbackProxy.java index 5ee90a4..75ee338 100644 --- a/core/java/android/webkit/CallbackProxy.java +++ b/core/java/android/webkit/CallbackProxy.java @@ -77,53 +77,54 @@ class CallbackProxy extends Handler { // Used to call startActivity during url override. private final Context mContext; - // Message Ids - private static final int PAGE_STARTED = 100; - private static final int RECEIVED_ICON = 101; - private static final int RECEIVED_TITLE = 102; - private static final int OVERRIDE_URL = 103; - private static final int AUTH_REQUEST = 104; - private static final int SSL_ERROR = 105; - private static final int PROGRESS = 106; - private static final int UPDATE_VISITED = 107; - private static final int LOAD_RESOURCE = 108; - private static final int CREATE_WINDOW = 109; - private static final int CLOSE_WINDOW = 110; - private static final int SAVE_PASSWORD = 111; - private static final int JS_ALERT = 112; - private static final int JS_CONFIRM = 113; - private static final int JS_PROMPT = 114; - private static final int JS_UNLOAD = 115; - private static final int ASYNC_KEYEVENTS = 116; - private static final int DOWNLOAD_FILE = 118; - private static final int REPORT_ERROR = 119; - private static final int RESEND_POST_DATA = 120; - private static final int PAGE_FINISHED = 121; - private static final int REQUEST_FOCUS = 122; - private static final int SCALE_CHANGED = 123; - private static final int RECEIVED_CERTIFICATE = 124; - private static final int SWITCH_OUT_HISTORY = 125; - private static final int EXCEEDED_DATABASE_QUOTA = 126; - private static final int REACHED_APPCACHE_MAXSIZE = 127; - private static final int JS_TIMEOUT = 128; - private static final int ADD_MESSAGE_TO_CONSOLE = 129; - private static final int GEOLOCATION_PERMISSIONS_SHOW_PROMPT = 130; - private static final int GEOLOCATION_PERMISSIONS_HIDE_PROMPT = 131; - private static final int RECEIVED_TOUCH_ICON_URL = 132; - private static final int GET_VISITED_HISTORY = 133; - private static final int OPEN_FILE_CHOOSER = 134; - private static final int ADD_HISTORY_ITEM = 135; - private static final int HISTORY_INDEX_CHANGED = 136; - private static final int AUTH_CREDENTIALS = 137; - private static final int SET_INSTALLABLE_WEBAPP = 138; - private static final int NOTIFY_SEARCHBOX_LISTENERS = 139; - private static final int AUTO_LOGIN = 140; - private static final int CLIENT_CERT_REQUEST = 141; - private static final int SEARCHBOX_IS_SUPPORTED_CALLBACK = 142; - private static final int SEARCHBOX_DISPATCH_COMPLETE_CALLBACK= 143; + // Message IDs + private static final int PAGE_STARTED = 100; + private static final int RECEIVED_ICON = 101; + private static final int RECEIVED_TITLE = 102; + private static final int OVERRIDE_URL = 103; + private static final int AUTH_REQUEST = 104; + private static final int SSL_ERROR = 105; + private static final int PROGRESS = 106; + private static final int UPDATE_VISITED = 107; + private static final int LOAD_RESOURCE = 108; + private static final int CREATE_WINDOW = 109; + private static final int CLOSE_WINDOW = 110; + private static final int SAVE_PASSWORD = 111; + private static final int JS_ALERT = 112; + private static final int JS_CONFIRM = 113; + private static final int JS_PROMPT = 114; + private static final int JS_UNLOAD = 115; + private static final int ASYNC_KEYEVENTS = 116; + private static final int DOWNLOAD_FILE = 118; + private static final int REPORT_ERROR = 119; + private static final int RESEND_POST_DATA = 120; + private static final int PAGE_FINISHED = 121; + private static final int REQUEST_FOCUS = 122; + private static final int SCALE_CHANGED = 123; + private static final int RECEIVED_CERTIFICATE = 124; + private static final int SWITCH_OUT_HISTORY = 125; + private static final int EXCEEDED_DATABASE_QUOTA = 126; + private static final int REACHED_APPCACHE_MAXSIZE = 127; + private static final int JS_TIMEOUT = 128; + private static final int ADD_MESSAGE_TO_CONSOLE = 129; + private static final int GEOLOCATION_PERMISSIONS_SHOW_PROMPT = 130; + private static final int GEOLOCATION_PERMISSIONS_HIDE_PROMPT = 131; + private static final int RECEIVED_TOUCH_ICON_URL = 132; + private static final int GET_VISITED_HISTORY = 133; + private static final int OPEN_FILE_CHOOSER = 134; + private static final int ADD_HISTORY_ITEM = 135; + private static final int HISTORY_INDEX_CHANGED = 136; + private static final int AUTH_CREDENTIALS = 137; + private static final int SET_INSTALLABLE_WEBAPP = 138; + private static final int NOTIFY_SEARCHBOX_LISTENERS = 139; + private static final int AUTO_LOGIN = 140; + private static final int CLIENT_CERT_REQUEST = 141; + private static final int SEARCHBOX_IS_SUPPORTED_CALLBACK = 142; + private static final int SEARCHBOX_DISPATCH_COMPLETE_CALLBACK = 143; + private static final int PROCEEDED_AFTER_SSL_ERROR = 144; // Message triggered by the client to resume execution - private static final int NOTIFY = 200; + private static final int NOTIFY = 200; // Result transportation object for returning results across thread // boundaries. @@ -349,6 +350,13 @@ class CallbackProxy extends Handler { } break; + case PROCEEDED_AFTER_SSL_ERROR: + if (mWebViewClient != null) { + mWebViewClient.onProceededAfterSslError(mWebView, + (SslError) msg.obj); + } + break; + case CLIENT_CERT_REQUEST: if (mWebViewClient != null) { HashMap<String, Object> map = @@ -1024,6 +1032,15 @@ class CallbackProxy extends Handler { sendMessage(msg); } + public void onProceededAfterSslError(SslError error) { + if (mWebViewClient == null) { + return; + } + Message msg = obtainMessage(PROCEEDED_AFTER_SSL_ERROR); + msg.obj = error; + sendMessage(msg); + } + public void onReceivedClientCertRequest(ClientCertRequestHandler handler, String host_and_port) { // Do an unsynchronized quick check to avoid posting if no callback has // been set. diff --git a/core/java/android/webkit/WebViewClient.java b/core/java/android/webkit/WebViewClient.java index d3be2bf..81de356 100644 --- a/core/java/android/webkit/WebViewClient.java +++ b/core/java/android/webkit/WebViewClient.java @@ -186,11 +186,11 @@ public class WebViewClient { } /** - * Notify the host application to handle a SSL certificate error request - * (display the error to the user and ask whether to proceed or not). The - * host application has to call either handler.cancel() or handler.proceed() - * as the connection is suspended and waiting for the response. The default - * behavior is to cancel the load. + * Notify the host application that an SSL error occurred while loading a + * resource. The host application must call either handler.cancel() or + * handler.proceed(). Note that the decision may be retained for use in + * response to future SSL errors. The default behavior is to cancel the + * load. * * @param view The WebView that is initiating the callback. * @param handler An SslErrorHandler object that will handle the user's @@ -203,6 +203,15 @@ public class WebViewClient { } /** + * Notify the host application that an SSL error occurred while loading a + * resource, but the WebView but chose to proceed anyway based on a + * decision retained from a previous response to onReceivedSslError(). + * @hide + */ + public void onProceededAfterSslError(WebView view, SslError error) { + } + + /** * Notify the host application to handle a SSL client certificate * request (display the request to the user and ask whether to * proceed with a client certificate or not). The host application |