1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 package org.chromium.android_webview;
7 import org.chromium.base.CalledByNative;
8 import org.chromium.base.JNINamespace;
9 import org.chromium.base.ThreadUtils;
11 import java.lang.Runnable;
14 * Implementations of various static methods, and also a home for static
15 * data structures that are meant to be shared between all webviews.
17 @JNINamespace("android_webview")
18 public class AwContentsStatics {
20 private static ClientCertLookupTable sClientCertLookupTable;
23 * Return the client certificate lookup table.
25 public static ClientCertLookupTable getClientCertLookupTable() {
26 ThreadUtils.assertOnUiThread();
27 if (sClientCertLookupTable == null) {
28 sClientCertLookupTable = new ClientCertLookupTable();
30 return sClientCertLookupTable;
34 * Clear client cert lookup table. Should only be called from UI thread.
36 public static void clearClientCertPreferences(Runnable callback) {
37 ThreadUtils.assertOnUiThread();
38 getClientCertLookupTable().clear();
39 nativeClearClientCertPreferences(callback);
43 private static void clientCertificatesCleared(Runnable callback) {
44 if (callback == null) return;
49 * Set Data Reduction Proxy key for authentication.
51 public static void setDataReductionProxyKey(String key) {
52 ThreadUtils.assertOnUiThread();
53 nativeSetDataReductionProxyKey(key);
57 * Enable or disable data reduction proxy.
59 public static void setDataReductionProxyEnabled(boolean enabled) {
60 ThreadUtils.assertOnUiThread();
61 nativeSetDataReductionProxyEnabled(enabled);
64 //--------------------------------------------------------------------------------------------
66 //--------------------------------------------------------------------------------------------
67 private static native void nativeClearClientCertPreferences(Runnable callback);
68 private static native void nativeSetDataReductionProxyKey(String key);
69 private static native void nativeSetDataReductionProxyEnabled(boolean enabled);