• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 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 
5 package org.chromium.content.browser;
6 
7 import org.chromium.net.ProxyChangeListener;
8 
9 /**
10  * Implementations of various static methods.
11  */
12 public 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      */
findAddress(String addr)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      * Suspends Webkit timers in all renderers.
31      * New renderers created after this call will be created with the
32      * default options.
33      *
34      * @param suspend true if timers should be suspended.
35      */
setWebKitSharedTimersSuspended(boolean suspend)36     public static void setWebKitSharedTimersSuspended(boolean suspend) {
37         nativeSetWebKitSharedTimersSuspended(suspend);
38     }
39 
40     /**
41      * Enables platform notifications of data state and proxy changes.
42      * Notifications are enabled by default.
43      */
enablePlatformNotifications()44     public static void enablePlatformNotifications() {
45         ProxyChangeListener.setEnabled(true);
46     }
47 
48     /**
49      * Disables platform notifications of data state and proxy changes.
50      * Notifications are enabled by default.
51      */
disablePlatformNotifications()52     public static void disablePlatformNotifications () {
53         ProxyChangeListener.setEnabled(false);
54     }
55 
56     // Native functions
57 
nativeFindAddress(String addr)58     private static native String nativeFindAddress(String addr);
59 
nativeSetWebKitSharedTimersSuspended(boolean suspend)60     private static native void nativeSetWebKitSharedTimersSuspended(boolean suspend);
61 }
62