Search in sources :

Example 1 with PluginData

use of android.webkit.PluginData in project XobotOS by xamarin.

the class UrlInterceptRegistry method getPluginData.

/**
     * Given an url, returns the PluginData of the first
     * UrlInterceptHandler interested, or null if none are or if
     * intercepts are disabled.
     *
     * @return A PluginData instance containing surrogate content.
     *
     * @hide
     * @deprecated This class was intended to be used by Gears. Since Gears was
     * deprecated, so is this class.
     */
@Deprecated
public static synchronized PluginData getPluginData(String url, Map<String, String> headers) {
    if (urlInterceptDisabled()) {
        return null;
    }
    Iterator iter = getHandlers().listIterator();
    while (iter.hasNext()) {
        UrlInterceptHandler handler = (UrlInterceptHandler) iter.next();
        PluginData data = handler.getPluginData(url, headers);
        if (data != null) {
            return data;
        }
    }
    return null;
}
Also used : UrlInterceptHandler(android.webkit.UrlInterceptHandler) PluginData(android.webkit.PluginData) Iterator(java.util.Iterator)

Example 2 with PluginData

use of android.webkit.PluginData in project android_frameworks_base by AOSPA.

the class UrlInterceptRegistry method getPluginData.

/**
     * Given an url, returns the PluginData of the first
     * UrlInterceptHandler interested, or null if none are or if
     * intercepts are disabled.
     *
     * @return A PluginData instance containing surrogate content.
     *
     * @hide
     * @deprecated This class was intended to be used by Gears. Since Gears was
     * deprecated, so is this class.
     */
@Deprecated
public static synchronized PluginData getPluginData(String url, Map<String, String> headers) {
    if (urlInterceptDisabled()) {
        return null;
    }
    Iterator iter = getHandlers().listIterator();
    while (iter.hasNext()) {
        UrlInterceptHandler handler = (UrlInterceptHandler) iter.next();
        PluginData data = handler.getPluginData(url, headers);
        if (data != null) {
            return data;
        }
    }
    return null;
}
Also used : UrlInterceptHandler(android.webkit.UrlInterceptHandler) PluginData(android.webkit.PluginData) Iterator(java.util.Iterator)

Example 3 with PluginData

use of android.webkit.PluginData in project platform_frameworks_base by android.

the class UrlInterceptRegistry method getPluginData.

/**
     * Given an url, returns the PluginData of the first
     * UrlInterceptHandler interested, or null if none are or if
     * intercepts are disabled.
     *
     * @return A PluginData instance containing surrogate content.
     *
     * @hide
     * @deprecated This class was intended to be used by Gears. Since Gears was
     * deprecated, so is this class.
     */
@Deprecated
public static synchronized PluginData getPluginData(String url, Map<String, String> headers) {
    if (urlInterceptDisabled()) {
        return null;
    }
    Iterator iter = getHandlers().listIterator();
    while (iter.hasNext()) {
        UrlInterceptHandler handler = (UrlInterceptHandler) iter.next();
        PluginData data = handler.getPluginData(url, headers);
        if (data != null) {
            return data;
        }
    }
    return null;
}
Also used : UrlInterceptHandler(android.webkit.UrlInterceptHandler) PluginData(android.webkit.PluginData) Iterator(java.util.Iterator)

Example 4 with PluginData

use of android.webkit.PluginData in project android_frameworks_base by ParanoidAndroid.

the class UrlInterceptRegistry method getPluginData.

/**
     * Given an url, returns the PluginData of the first
     * UrlInterceptHandler interested, or null if none are or if
     * intercepts are disabled.
     *
     * @return A PluginData instance containing surrogate content.
     *
     * @hide
     * @deprecated This class was intended to be used by Gears. Since Gears was
     * deprecated, so is this class.
     */
@Deprecated
public static synchronized PluginData getPluginData(String url, Map<String, String> headers) {
    if (urlInterceptDisabled()) {
        return null;
    }
    Iterator iter = getHandlers().listIterator();
    while (iter.hasNext()) {
        UrlInterceptHandler handler = (UrlInterceptHandler) iter.next();
        PluginData data = handler.getPluginData(url, headers);
        if (data != null) {
            return data;
        }
    }
    return null;
}
Also used : UrlInterceptHandler(android.webkit.UrlInterceptHandler) PluginData(android.webkit.PluginData) Iterator(java.util.Iterator)

Example 5 with PluginData

use of android.webkit.PluginData in project android_frameworks_base by ParanoidAndroid.

the class UrlInterceptRegistryTest method testGetPluginData.

public void testGetPluginData() {
    PluginData data = new PluginData(null, 0, null, 200);
    String url = new String("url1");
    MockUrlInterceptHandler handler1 = new MockUrlInterceptHandler(data, url);
    data = new PluginData(null, 0, null, 404);
    url = new String("url2");
    MockUrlInterceptHandler handler2 = new MockUrlInterceptHandler(data, url);
    assertTrue(UrlInterceptRegistry.registerHandler(handler1));
    assertTrue(UrlInterceptRegistry.registerHandler(handler2));
    data = UrlInterceptRegistry.getPluginData("url1", null);
    assertTrue(data != null);
    assertTrue(data.getStatusCode() == 200);
    data = UrlInterceptRegistry.getPluginData("url2", null);
    assertTrue(data != null);
    assertTrue(data.getStatusCode() == 404);
    assertTrue(UrlInterceptRegistry.unregisterHandler(handler1));
    assertTrue(UrlInterceptRegistry.unregisterHandler(handler2));
}
Also used : PluginData(android.webkit.PluginData)

Aggregations

PluginData (android.webkit.PluginData)8 UrlInterceptHandler (android.webkit.UrlInterceptHandler)7 Iterator (java.util.Iterator)7