diff options
| author | Huahui Wu <hwu@google.com> | 2010-12-08 15:24:55 -0800 |
|---|---|---|
| committer | Huahui Wu <hwu@google.com> | 2010-12-15 09:38:54 -0800 |
| commit | ad053cebc82cbdd7534fcdef095fe79396da3100 (patch) | |
| tree | 40cdde11666462c9f20427b149b9e7636eb9a357 /core/java/android/webkit/SslCertLookupTable.java | |
| parent | 3be80f2e6cf763fdfeb058d5a4ac8257cdc91135 (diff) | |
b/2864818 Prompt the SSL error dialog to user and proceed or cancel
the request. C++ side cl: https://android-git.corp.google.com/g/#change,84529
Change-Id: I1f4c69c6ddb92324a1ec3c193018e8d703454f56
Diffstat (limited to 'core/java/android/webkit/SslCertLookupTable.java')
| -rw-r--r-- | core/java/android/webkit/SslCertLookupTable.java | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/core/java/android/webkit/SslCertLookupTable.java b/core/java/android/webkit/SslCertLookupTable.java new file mode 100644 index 000000000000..abf612ef866b --- /dev/null +++ b/core/java/android/webkit/SslCertLookupTable.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.webkit; + +import android.os.Bundle; +import android.net.http.SslError; + +/* + * A simple class to store the wrong certificates that user is aware but + * chose to proceed. + */ +class SslCertLookupTable { + private static SslCertLookupTable sTable; + private final Bundle table; + + public static synchronized SslCertLookupTable getInstance() { + if (sTable == null) { + sTable = new SslCertLookupTable(); + } + return sTable; + } + + private SslCertLookupTable() { + table = new Bundle(); + } + + public void Allow(SslError ssl_error) { + table.putBoolean(ssl_error.toString(), true); + } + + public void Deny(SslError ssl_error) { + table.putBoolean(ssl_error.toString(), false); + } + + public boolean IsAllowed(SslError ssl_error) { + return table.getBoolean(ssl_error.toString()); + } +} |
