OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 import org.chromium.net.ProxyChangeListener; | 7 import org.chromium.net.ProxyChangeListener; |
8 | 8 |
9 /** | 9 /** |
10 * Implementations of various static methods. | 10 * Implementations of various static methods. |
11 */ | 11 */ |
12 public class ContentViewStatics { | 12 public class ContentViewStatics { |
13 | |
14 /** | |
15 * Return the first substring consisting of the address of a physical locati
on. | |
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 /** | 13 /** |
30 * Suspends Webkit timers in all renderers. | 14 * Suspends Webkit timers in all renderers. |
31 * New renderers created after this call will be created with the | 15 * New renderers created after this call will be created with the |
32 * default options. | 16 * default options. |
33 * | 17 * |
34 * @param suspend true if timers should be suspended. | 18 * @param suspend true if timers should be suspended. |
35 */ | 19 */ |
36 public static void setWebKitSharedTimersSuspended(boolean suspend) { | 20 public static void setWebKitSharedTimersSuspended(boolean suspend) { |
37 nativeSetWebKitSharedTimersSuspended(suspend); | 21 nativeSetWebKitSharedTimersSuspended(suspend); |
38 } | 22 } |
39 | 23 |
40 /** | 24 /** |
41 * Enables platform notifications of data state and proxy changes. | 25 * Enables platform notifications of data state and proxy changes. |
42 * Notifications are enabled by default. | 26 * Notifications are enabled by default. |
43 */ | 27 */ |
44 public static void enablePlatformNotifications() { | 28 public static void enablePlatformNotifications() { |
45 ProxyChangeListener.setEnabled(true); | 29 ProxyChangeListener.setEnabled(true); |
46 } | 30 } |
47 | 31 |
48 /** | 32 /** |
49 * Disables platform notifications of data state and proxy changes. | 33 * Disables platform notifications of data state and proxy changes. |
50 * Notifications are enabled by default. | 34 * Notifications are enabled by default. |
51 */ | 35 */ |
52 public static void disablePlatformNotifications() { | 36 public static void disablePlatformNotifications() { |
53 ProxyChangeListener.setEnabled(false); | 37 ProxyChangeListener.setEnabled(false); |
54 } | 38 } |
55 | 39 |
56 // Native functions | 40 // Native functions |
57 | 41 |
58 private static native String nativeFindAddress(String addr); | |
59 | |
60 private static native void nativeSetWebKitSharedTimersSuspended(boolean susp
end); | 42 private static native void nativeSetWebKitSharedTimersSuspended(boolean susp
end); |
61 } | 43 } |
OLD | NEW |