ContentViewStatics.java revision 5821806d5e7f356e8fa4b058a389a808ea183019
1// Copyright (c) 2012 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.
4
5package org.chromium.content.browser;
6
7import org.chromium.net.ProxyChangeListener;
8
9/**
10 * Implementations of various static methods.
11 */
12public class ContentViewStatics {
13
14    /**
15     * Return the first substring consisting of the address of a physical location.
16     * @see {@link android.webkit.WebView#findAddress(String)}
17     *
18     * @param addr The string to search for addresses.
19     * @return the address, or if no address is found, return null.
20     */
21    public static String findAddress(String addr) {
22        if (addr == null) {
23            throw new NullPointerException("addr is null");
24        }
25        String result = nativeFindAddress(addr);
26        return result == null || result.isEmpty() ? null : result;
27    }
28
29    /**
30     * Enables platform notifications of data state and proxy changes.
31     * Notifications are enabled by default.
32     */
33    public static void enablePlatformNotifications() {
34        ProxyChangeListener.setEnabled(true);
35    }
36
37    /**
38     * Disables platform notifications of data state and proxy changes.
39     * Notifications are enabled by default.
40     */
41    public static void disablePlatformNotifications () {
42        ProxyChangeListener.setEnabled(false);
43    }
44
45    // Native functions
46
47    private static native String nativeFindAddress(String addr);
48
49}
50