The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.webkit; |
| 18 | |
Hui Shu | 539b077 | 2016-04-20 15:21:37 -0700 | [diff] [blame] | 19 | import android.annotation.IntDef; |
Nate Fischer | 3442c74 | 2017-09-08 17:02:00 -0700 | [diff] [blame] | 20 | import android.annotation.Nullable; |
Yuncheol Heo | eeba025 | 2014-07-08 19:43:00 +0900 | [diff] [blame] | 21 | import android.annotation.SystemApi; |
George Mount | 9f410c5 | 2012-08-10 15:29:30 -0700 | [diff] [blame] | 22 | import android.content.Context; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 23 | |
Hui Shu | 539b077 | 2016-04-20 15:21:37 -0700 | [diff] [blame] | 24 | import java.lang.annotation.ElementType; |
| 25 | import java.lang.annotation.Retention; |
| 26 | import java.lang.annotation.RetentionPolicy; |
| 27 | import java.lang.annotation.Target; |
| 28 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 29 | /** |
| 30 | * Manages settings state for a WebView. When a WebView is first created, it |
| 31 | * obtains a set of default settings. These default settings will be returned |
Nate Fischer | 4ea9240 | 2017-11-17 18:48:13 -0800 | [diff] [blame] | 32 | * from any getter call. A {@code WebSettings} object obtained from |
| 33 | * {@link WebView#getSettings()} is tied to the life of the WebView. If a WebView has |
| 34 | * been destroyed, any method call on {@code WebSettings} will throw an |
| 35 | * {@link IllegalStateException}. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 36 | */ |
Jonathan Dixon | d3101b1 | 2012-04-12 20:51:51 +0100 | [diff] [blame] | 37 | // This is an abstract base class: concrete WebViewProviders must |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 38 | // create a class derived from this, and return an instance of it in the |
| 39 | // WebViewProvider.getWebSettingsProvider() method implementation. |
Selim Gurun | 0ea6dad | 2012-03-29 18:19:01 -0700 | [diff] [blame] | 40 | public abstract class WebSettings { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 41 | /** |
| 42 | * Enum for controlling the layout of html. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 43 | * <ul> |
Nate Fischer | 4ea9240 | 2017-11-17 18:48:13 -0800 | [diff] [blame] | 44 | * <li>{@code NORMAL} means no rendering changes. This is the recommended choice for maximum |
Jonathan Dixon | 5545d08 | 2013-08-31 22:43:11 -0700 | [diff] [blame] | 45 | * compatibility across different platforms and Android versions.</li> |
Nate Fischer | 4ea9240 | 2017-11-17 18:48:13 -0800 | [diff] [blame] | 46 | * <li>{@code SINGLE_COLUMN} moves all content into one column that is the width of the |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 47 | * view.</li> |
Nate Fischer | 4ea9240 | 2017-11-17 18:48:13 -0800 | [diff] [blame] | 48 | * <li>{@code NARROW_COLUMNS} makes all columns no wider than the screen if possible. Only use |
Jonathan Dixon | 5545d08 | 2013-08-31 22:43:11 -0700 | [diff] [blame] | 49 | * this for API levels prior to {@link android.os.Build.VERSION_CODES#KITKAT}.</li> |
Nate Fischer | 4ea9240 | 2017-11-17 18:48:13 -0800 | [diff] [blame] | 50 | * <li>{@code TEXT_AUTOSIZING} boosts font size of paragraphs based on heuristics to make |
Mikhail Naganov | 94e0bd3 | 2012-12-14 17:01:25 +0000 | [diff] [blame] | 51 | * the text readable when viewing a wide-viewport layout in the overview mode. |
| 52 | * It is recommended to enable zoom support {@link #setSupportZoom} when |
Jonathan Dixon | 5545d08 | 2013-08-31 22:43:11 -0700 | [diff] [blame] | 53 | * using this mode. Supported from API level |
| 54 | * {@link android.os.Build.VERSION_CODES#KITKAT}</li> |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 55 | * </ul> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 56 | */ |
| 57 | // XXX: These must match LayoutAlgorithm in Settings.h in WebCore. |
| 58 | public enum LayoutAlgorithm { |
| 59 | NORMAL, |
John Reck | 5a1ef413 | 2011-10-26 10:37:00 -0700 | [diff] [blame] | 60 | /** |
| 61 | * @deprecated This algorithm is now obsolete. |
| 62 | */ |
| 63 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 64 | SINGLE_COLUMN, |
Mikhail Naganov | 94e0bd3 | 2012-12-14 17:01:25 +0000 | [diff] [blame] | 65 | /** |
Jonathan Dixon | 5545d08 | 2013-08-31 22:43:11 -0700 | [diff] [blame] | 66 | * @deprecated This algorithm is now obsolete. |
Mikhail Naganov | 94e0bd3 | 2012-12-14 17:01:25 +0000 | [diff] [blame] | 67 | */ |
Jonathan Dixon | 5545d08 | 2013-08-31 22:43:11 -0700 | [diff] [blame] | 68 | @Deprecated |
| 69 | NARROW_COLUMNS, |
Mikhail Naganov | 94e0bd3 | 2012-12-14 17:01:25 +0000 | [diff] [blame] | 70 | TEXT_AUTOSIZING |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Enum for specifying the text size. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 75 | * <ul> |
| 76 | * <li>SMALLEST is 50%</li> |
| 77 | * <li>SMALLER is 75%</li> |
| 78 | * <li>NORMAL is 100%</li> |
| 79 | * <li>LARGER is 150%</li> |
| 80 | * <li>LARGEST is 200%</li> |
| 81 | * </ul> |
| 82 | * |
John Reck | caeb120 | 2011-06-17 11:50:15 -0700 | [diff] [blame] | 83 | * @deprecated Use {@link WebSettings#setTextZoom(int)} and {@link WebSettings#getTextZoom()} instead. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 84 | */ |
Aurimas Liutikas | 514c5ef | 2016-05-24 15:22:55 -0700 | [diff] [blame] | 85 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 86 | public enum TextSize { |
| 87 | SMALLEST(50), |
| 88 | SMALLER(75), |
| 89 | NORMAL(100), |
| 90 | LARGER(150), |
| 91 | LARGEST(200); |
| 92 | TextSize(int size) { |
| 93 | value = size; |
| 94 | } |
| 95 | int value; |
| 96 | } |
Grace Kloba | 0d8b77c | 2009-06-25 11:20:51 -0700 | [diff] [blame] | 97 | |
| 98 | /** |
| 99 | * Enum for specifying the WebView's desired density. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 100 | * <ul> |
Nate Fischer | 4ea9240 | 2017-11-17 18:48:13 -0800 | [diff] [blame] | 101 | * <li>{@code FAR} makes 100% looking like in 240dpi</li> |
| 102 | * <li>{@code MEDIUM} makes 100% looking like in 160dpi</li> |
| 103 | * <li>{@code CLOSE} makes 100% looking like in 120dpi</li> |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 104 | * </ul> |
Grace Kloba | 0d8b77c | 2009-06-25 11:20:51 -0700 | [diff] [blame] | 105 | */ |
| 106 | public enum ZoomDensity { |
| 107 | FAR(150), // 240dpi |
| 108 | MEDIUM(100), // 160dpi |
| 109 | CLOSE(75); // 120dpi |
| 110 | ZoomDensity(int size) { |
| 111 | value = size; |
| 112 | } |
Mikhail Naganov | ce76ca5 | 2012-07-27 12:00:05 +0100 | [diff] [blame] | 113 | |
| 114 | /** |
| 115 | * @hide Only for use by WebViewProvider implementations |
| 116 | */ |
| 117 | public int getValue() { |
| 118 | return value; |
| 119 | } |
| 120 | |
Grace Kloba | 0d8b77c | 2009-06-25 11:20:51 -0700 | [diff] [blame] | 121 | int value; |
| 122 | } |
| 123 | |
Tim Volodine | b90f538 | 2016-04-29 12:44:41 +0100 | [diff] [blame] | 124 | /** @hide */ |
Jeff Sharkey | ce8db99 | 2017-12-13 20:05:05 -0700 | [diff] [blame] | 125 | @IntDef(prefix = { "LOAD_" }, value = { |
| 126 | LOAD_DEFAULT, |
| 127 | LOAD_NORMAL, |
| 128 | LOAD_CACHE_ELSE_NETWORK, |
| 129 | LOAD_NO_CACHE, |
| 130 | LOAD_CACHE_ONLY |
| 131 | }) |
Tim Volodine | b90f538 | 2016-04-29 12:44:41 +0100 | [diff] [blame] | 132 | @Retention(RetentionPolicy.SOURCE) |
| 133 | public @interface CacheMode {} |
| 134 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 135 | /** |
Mikhail Naganov | 500b003 | 2012-07-25 13:06:14 +0100 | [diff] [blame] | 136 | * Default cache usage mode. If the navigation type doesn't impose any |
| 137 | * specific behavior, use cached resources when they are available |
| 138 | * and not expired, otherwise load resources from the network. |
| 139 | * Use with {@link #setCacheMode}. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 140 | */ |
| 141 | public static final int LOAD_DEFAULT = -1; |
| 142 | |
| 143 | /** |
Mikhail Naganov | 500b003 | 2012-07-25 13:06:14 +0100 | [diff] [blame] | 144 | * Normal cache usage mode. Use with {@link #setCacheMode}. |
Mikhail Naganov | 56936a1 | 2012-07-25 13:07:18 +0100 | [diff] [blame] | 145 | * |
| 146 | * @deprecated This value is obsolete, as from API level |
| 147 | * {@link android.os.Build.VERSION_CODES#HONEYCOMB} and onwards it has the |
| 148 | * same effect as {@link #LOAD_DEFAULT}. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 149 | */ |
Kristian Monsen | 5cc2351 | 2012-08-09 15:33:08 -0400 | [diff] [blame] | 150 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 151 | public static final int LOAD_NORMAL = 0; |
| 152 | |
| 153 | /** |
Mikhail Naganov | 500b003 | 2012-07-25 13:06:14 +0100 | [diff] [blame] | 154 | * Use cached resources when they are available, even if they have expired. |
| 155 | * Otherwise load resources from the network. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 156 | * Use with {@link #setCacheMode}. |
| 157 | */ |
| 158 | public static final int LOAD_CACHE_ELSE_NETWORK = 1; |
| 159 | |
| 160 | /** |
Mikhail Naganov | 500b003 | 2012-07-25 13:06:14 +0100 | [diff] [blame] | 161 | * Don't use the cache, load from the network. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 162 | * Use with {@link #setCacheMode}. |
| 163 | */ |
| 164 | public static final int LOAD_NO_CACHE = 2; |
Michael Kolb | a172e7d | 2010-06-30 12:35:26 -0700 | [diff] [blame] | 165 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 166 | /** |
Mikhail Naganov | 500b003 | 2012-07-25 13:06:14 +0100 | [diff] [blame] | 167 | * Don't use the network, load from the cache. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 168 | * Use with {@link #setCacheMode}. |
| 169 | */ |
| 170 | public static final int LOAD_CACHE_ONLY = 3; |
| 171 | |
| 172 | public enum RenderPriority { |
| 173 | NORMAL, |
| 174 | HIGH, |
| 175 | LOW |
| 176 | } |
| 177 | |
Patrick Scott | 300f2e9 | 2010-03-22 10:20:45 -0400 | [diff] [blame] | 178 | /** |
| 179 | * The plugin state effects how plugins are treated on a page. ON means |
| 180 | * that any object will be loaded even if a plugin does not exist to handle |
| 181 | * the content. ON_DEMAND means that if there is a plugin installed that |
| 182 | * can handle the content, a placeholder is shown until the user clicks on |
| 183 | * the placeholder. Once clicked, the plugin will be enabled on the page. |
| 184 | * OFF means that all plugins will be turned off and any fallback content |
| 185 | * will be used. |
| 186 | */ |
| 187 | public enum PluginState { |
| 188 | ON, |
| 189 | ON_DEMAND, |
| 190 | OFF |
| 191 | } |
| 192 | |
Ben Murdoch | e9e3ccd | 2010-10-06 14:33:02 +0100 | [diff] [blame] | 193 | /** |
Ben Murdoch | fe9fc3d | 2014-04-10 15:31:06 +0100 | [diff] [blame] | 194 | * Used with {@link #setMixedContentMode} |
| 195 | * |
| 196 | * In this mode, the WebView will allow a secure origin to load content from any other origin, |
| 197 | * even if that origin is insecure. This is the least secure mode of operation for the WebView, |
| 198 | * and where possible apps should not set this mode. |
| 199 | */ |
| 200 | public static final int MIXED_CONTENT_ALWAYS_ALLOW = 0; |
| 201 | |
| 202 | /** |
| 203 | * Used with {@link #setMixedContentMode} |
| 204 | * |
| 205 | * In this mode, the WebView will not allow a secure origin to load content from an insecure |
| 206 | * origin. This is the preferred and most secure mode of operation for the WebView and apps are |
| 207 | * strongly advised to use this mode. |
| 208 | */ |
| 209 | public static final int MIXED_CONTENT_NEVER_ALLOW = 1; |
| 210 | |
| 211 | /** |
| 212 | * Used with {@link #setMixedContentMode} |
| 213 | * |
| 214 | * In this mode, the WebView will attempt to be compatible with the approach of a modern web |
| 215 | * browser with regard to mixed content. Some insecure content may be allowed to be loaded by |
| 216 | * a secure origin and other types of content will be blocked. The types of content are allowed |
| 217 | * or blocked may change release to release and are not explicitly defined. |
| 218 | * |
| 219 | * This mode is intended to be used by apps that are not in control of the content that they |
| 220 | * render but desire to operate in a reasonably secure environment. For highest security, apps |
| 221 | * are recommended to use {@link #MIXED_CONTENT_NEVER_ALLOW}. |
| 222 | */ |
| 223 | public static final int MIXED_CONTENT_COMPATIBILITY_MODE = 2; |
| 224 | |
| 225 | /** |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 226 | * Enables dumping the pages navigation cache to a text file. The default |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 227 | * is {@code false}. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 228 | * |
Kristian Monsen | fc77165 | 2011-05-10 16:44:05 +0100 | [diff] [blame] | 229 | * @deprecated This method is now obsolete. |
Kristian Monsen | f491258 | 2012-08-16 15:26:24 -0400 | [diff] [blame] | 230 | * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 231 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 232 | @SystemApi |
Kristian Monsen | fc77165 | 2011-05-10 16:44:05 +0100 | [diff] [blame] | 233 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 234 | public abstract void setNavDump(boolean enabled); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 235 | |
| 236 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 237 | * Gets whether dumping the navigation cache is enabled. |
| 238 | * |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 239 | * @return whether dumping the navigation cache is enabled |
| 240 | * @see #setNavDump |
Kristian Monsen | fc77165 | 2011-05-10 16:44:05 +0100 | [diff] [blame] | 241 | * @deprecated This method is now obsolete. |
Kristian Monsen | f491258 | 2012-08-16 15:26:24 -0400 | [diff] [blame] | 242 | * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 243 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 244 | @SystemApi |
Kristian Monsen | fc77165 | 2011-05-10 16:44:05 +0100 | [diff] [blame] | 245 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 246 | public abstract boolean getNavDump(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 247 | |
| 248 | /** |
Mikhail Naganov | b533fb4 | 2012-04-05 14:50:02 +0100 | [diff] [blame] | 249 | * Sets whether the WebView should support zooming using its on-screen zoom |
| 250 | * controls and gestures. The particular zoom mechanisms that should be used |
| 251 | * can be set with {@link #setBuiltInZoomControls}. This setting does not |
| 252 | * affect zooming performed using the {@link WebView#zoomIn()} and |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 253 | * {@link WebView#zoomOut()} methods. The default is {@code true}. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 254 | * |
| 255 | * @param support whether the WebView should support zoom |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 256 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 257 | public abstract void setSupportZoom(boolean support); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 258 | |
| 259 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 260 | * Gets whether the WebView supports zoom. |
| 261 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 262 | * @return {@code true} if the WebView supports zoom |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 263 | * @see #setSupportZoom |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 264 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 265 | public abstract boolean supportZoom(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 266 | |
| 267 | /** |
Teng-Hui Zhu | 0e5b160 | 2012-07-17 17:19:13 -0700 | [diff] [blame] | 268 | * Sets whether the WebView requires a user gesture to play media. |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 269 | * The default is {@code true}. |
Teng-Hui Zhu | 0e5b160 | 2012-07-17 17:19:13 -0700 | [diff] [blame] | 270 | * |
| 271 | * @param require whether the WebView requires a user gesture to play media |
| 272 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 273 | public abstract void setMediaPlaybackRequiresUserGesture(boolean require); |
Teng-Hui Zhu | 0e5b160 | 2012-07-17 17:19:13 -0700 | [diff] [blame] | 274 | |
| 275 | /** |
| 276 | * Gets whether the WebView requires a user gesture to play media. |
| 277 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 278 | * @return {@code true} if the WebView requires a user gesture to play media |
Teng-Hui Zhu | 0e5b160 | 2012-07-17 17:19:13 -0700 | [diff] [blame] | 279 | * @see #setMediaPlaybackRequiresUserGesture |
| 280 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 281 | public abstract boolean getMediaPlaybackRequiresUserGesture(); |
Teng-Hui Zhu | 0e5b160 | 2012-07-17 17:19:13 -0700 | [diff] [blame] | 282 | |
| 283 | /** |
Steve Block | 06d268e | 2012-04-16 14:10:54 +0100 | [diff] [blame] | 284 | * Sets whether the WebView should use its built-in zoom mechanisms. The |
| 285 | * built-in zoom mechanisms comprise on-screen zoom controls, which are |
| 286 | * displayed over the WebView's content, and the use of a pinch gesture to |
| 287 | * control zooming. Whether or not these on-screen controls are displayed |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 288 | * can be set with {@link #setDisplayZoomControls}. The default is {@code false}. |
Steve Block | 06d268e | 2012-04-16 14:10:54 +0100 | [diff] [blame] | 289 | * <p> |
| 290 | * The built-in mechanisms are the only currently supported zoom |
| 291 | * mechanisms, so it is recommended that this setting is always enabled. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 292 | * |
| 293 | * @param enabled whether the WebView should use its built-in zoom mechanisms |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 294 | */ |
Steve Block | 06d268e | 2012-04-16 14:10:54 +0100 | [diff] [blame] | 295 | // This method was intended to select between the built-in zoom mechanisms |
| 296 | // and the separate zoom controls. The latter were obtained using |
| 297 | // {@link WebView#getZoomControls}, which is now hidden. |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 298 | public abstract void setBuiltInZoomControls(boolean enabled); |
Michael Kolb | a172e7d | 2010-06-30 12:35:26 -0700 | [diff] [blame] | 299 | |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 300 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 301 | * Gets whether the zoom mechanisms built into WebView are being used. |
| 302 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 303 | * @return {@code true} if the zoom mechanisms built into WebView are being used |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 304 | * @see #setBuiltInZoomControls |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 305 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 306 | public abstract boolean getBuiltInZoomControls(); |
Michael Kolb | a172e7d | 2010-06-30 12:35:26 -0700 | [diff] [blame] | 307 | |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 308 | /** |
Mikhail Naganov | b533fb4 | 2012-04-05 14:50:02 +0100 | [diff] [blame] | 309 | * Sets whether the WebView should display on-screen zoom controls when |
| 310 | * using the built-in zoom mechanisms. See {@link #setBuiltInZoomControls}. |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 311 | * The default is {@code true}. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 312 | * |
| 313 | * @param enabled whether the WebView should display on-screen zoom controls |
Michael Kolb | 6fe3b42 | 2010-08-19 12:41:24 -0700 | [diff] [blame] | 314 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 315 | public abstract void setDisplayZoomControls(boolean enabled); |
Michael Kolb | 6fe3b42 | 2010-08-19 12:41:24 -0700 | [diff] [blame] | 316 | |
| 317 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 318 | * Gets whether the WebView displays on-screen zoom controls when using |
Mikhail Naganov | b533fb4 | 2012-04-05 14:50:02 +0100 | [diff] [blame] | 319 | * the built-in zoom mechanisms. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 320 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 321 | * @return {@code true} if the WebView displays on-screen zoom controls when using |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 322 | * the built-in zoom mechanisms |
| 323 | * @see #setDisplayZoomControls |
Michael Kolb | 6fe3b42 | 2010-08-19 12:41:24 -0700 | [diff] [blame] | 324 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 325 | public abstract boolean getDisplayZoomControls(); |
Michael Kolb | 6fe3b42 | 2010-08-19 12:41:24 -0700 | [diff] [blame] | 326 | |
| 327 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 328 | * Enables or disables file access within WebView. File access is enabled by |
Patrick Scott | d1737ed | 2011-01-05 11:36:48 -0500 | [diff] [blame] | 329 | * default. Note that this enables or disables file system access only. |
| 330 | * Assets and resources are still accessible using file:///android_asset and |
| 331 | * file:///android_res. |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 332 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 333 | public abstract void setAllowFileAccess(boolean allow); |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 334 | |
| 335 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 336 | * Gets whether this WebView supports file access. |
| 337 | * |
| 338 | * @see #setAllowFileAccess |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 339 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 340 | public abstract boolean getAllowFileAccess(); |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 341 | |
| 342 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 343 | * Enables or disables content URL access within WebView. Content URL |
| 344 | * access allows WebView to load content from a content provider installed |
| 345 | * in the system. The default is enabled. |
Patrick Scott | d1737ed | 2011-01-05 11:36:48 -0500 | [diff] [blame] | 346 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 347 | public abstract void setAllowContentAccess(boolean allow); |
Patrick Scott | d1737ed | 2011-01-05 11:36:48 -0500 | [diff] [blame] | 348 | |
| 349 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 350 | * Gets whether this WebView supports content URL access. |
| 351 | * |
| 352 | * @see #setAllowContentAccess |
Patrick Scott | d1737ed | 2011-01-05 11:36:48 -0500 | [diff] [blame] | 353 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 354 | public abstract boolean getAllowContentAccess(); |
Patrick Scott | d1737ed | 2011-01-05 11:36:48 -0500 | [diff] [blame] | 355 | |
| 356 | /** |
Mikhail Naganov | 0030336 | 2013-09-02 10:57:04 +0100 | [diff] [blame] | 357 | * Sets whether the WebView loads pages in overview mode, that is, |
| 358 | * zooms out the content to fit on screen by width. This setting is |
| 359 | * taken into account when the content width is greater than the width |
| 360 | * of the WebView control, for example, when {@link #getUseWideViewPort} |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 361 | * is enabled. The default is {@code false}. |
Grace Kloba | e397a88 | 2009-08-06 12:04:14 -0700 | [diff] [blame] | 362 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 363 | public abstract void setLoadWithOverviewMode(boolean overview); |
Grace Kloba | e397a88 | 2009-08-06 12:04:14 -0700 | [diff] [blame] | 364 | |
| 365 | /** |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 366 | * Gets whether this WebView loads pages in overview mode. |
| 367 | * |
| 368 | * @return whether this WebView loads pages in overview mode |
| 369 | * @see #setLoadWithOverviewMode |
Grace Kloba | e397a88 | 2009-08-06 12:04:14 -0700 | [diff] [blame] | 370 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 371 | public abstract boolean getLoadWithOverviewMode(); |
Grace Kloba | e397a88 | 2009-08-06 12:04:14 -0700 | [diff] [blame] | 372 | |
| 373 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 374 | * Sets whether the WebView will enable smooth transition while panning or |
Adam Powell | e00e8a78 | 2011-09-11 17:48:42 -0700 | [diff] [blame] | 375 | * zooming or while the window hosting the WebView does not have focus. |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 376 | * If it is {@code true}, WebView will choose a solution to maximize the performance. |
Adam Powell | e00e8a78 | 2011-09-11 17:48:42 -0700 | [diff] [blame] | 377 | * e.g. the WebView's content may not be updated during the transition. |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 378 | * If it is false, WebView will keep its fidelity. The default value is {@code false}. |
Kristian Monsen | 5cc2351 | 2012-08-09 15:33:08 -0400 | [diff] [blame] | 379 | * |
| 380 | * @deprecated This method is now obsolete, and will become a no-op in future. |
Grace Kloba | f9b731d | 2010-06-21 19:23:57 -0700 | [diff] [blame] | 381 | */ |
Kristian Monsen | 5cc2351 | 2012-08-09 15:33:08 -0400 | [diff] [blame] | 382 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 383 | public abstract void setEnableSmoothTransition(boolean enable); |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 384 | |
Grace Kloba | f9b731d | 2010-06-21 19:23:57 -0700 | [diff] [blame] | 385 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 386 | * Gets whether the WebView enables smooth transition while panning or |
Grace Kloba | f9b731d | 2010-06-21 19:23:57 -0700 | [diff] [blame] | 387 | * zooming. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 388 | * |
| 389 | * @see #setEnableSmoothTransition |
Kristian Monsen | 5cc2351 | 2012-08-09 15:33:08 -0400 | [diff] [blame] | 390 | * |
| 391 | * @deprecated This method is now obsolete, and will become a no-op in future. |
Grace Kloba | f9b731d | 2010-06-21 19:23:57 -0700 | [diff] [blame] | 392 | */ |
Kristian Monsen | 5cc2351 | 2012-08-09 15:33:08 -0400 | [diff] [blame] | 393 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 394 | public abstract boolean enableSmoothTransition(); |
Grace Kloba | f9b731d | 2010-06-21 19:23:57 -0700 | [diff] [blame] | 395 | |
| 396 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 397 | * Sets whether the WebView uses its background for over scroll background. |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 398 | * If {@code true}, it will use the WebView's background. If {@code false}, it will use an |
| 399 | * internal pattern. Default is {@code true}. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 400 | * |
Kristian Monsen | fc77165 | 2011-05-10 16:44:05 +0100 | [diff] [blame] | 401 | * @deprecated This method is now obsolete. |
Kristian Monsen | d0b90d3 | 2012-09-24 12:30:45 -0400 | [diff] [blame] | 402 | * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} |
Adam Powell | 637d337 | 2010-08-25 14:37:03 -0700 | [diff] [blame] | 403 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 404 | @SystemApi |
Kristian Monsen | fc77165 | 2011-05-10 16:44:05 +0100 | [diff] [blame] | 405 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 406 | public abstract void setUseWebViewBackgroundForOverscrollBackground(boolean view); |
Adam Powell | 637d337 | 2010-08-25 14:37:03 -0700 | [diff] [blame] | 407 | |
| 408 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 409 | * Gets whether this WebView uses WebView's background instead of |
Adam Powell | 637d337 | 2010-08-25 14:37:03 -0700 | [diff] [blame] | 410 | * internal pattern for over scroll background. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 411 | * |
| 412 | * @see #setUseWebViewBackgroundForOverscrollBackground |
Kristian Monsen | fc77165 | 2011-05-10 16:44:05 +0100 | [diff] [blame] | 413 | * @deprecated This method is now obsolete. |
Kristian Monsen | f491258 | 2012-08-16 15:26:24 -0400 | [diff] [blame] | 414 | * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} |
Adam Powell | 637d337 | 2010-08-25 14:37:03 -0700 | [diff] [blame] | 415 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 416 | @SystemApi |
Kristian Monsen | fc77165 | 2011-05-10 16:44:05 +0100 | [diff] [blame] | 417 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 418 | public abstract boolean getUseWebViewBackgroundForOverscrollBackground(); |
Adam Powell | 637d337 | 2010-08-25 14:37:03 -0700 | [diff] [blame] | 419 | |
| 420 | /** |
Selim Gurun | 13e5b0b | 2017-04-03 14:29:14 -0700 | [diff] [blame] | 421 | * Sets whether the WebView should save form data. In Android O, the |
| 422 | * platform has implemented a fully functional Autofill feature to store |
| 423 | * form data. Therefore, the Webview form data save feature is disabled. |
| 424 | * |
| 425 | * Note that the feature will continue to be supported on older versions of |
| 426 | * Android as before. |
| 427 | * |
| 428 | * This function does not have any effect. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 429 | */ |
Selim Gurun | 13e5b0b | 2017-04-03 14:29:14 -0700 | [diff] [blame] | 430 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 431 | public abstract void setSaveFormData(boolean save); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 432 | |
| 433 | /** |
Selim Gurun | 5c11ef1 | 2013-01-04 14:58:36 -0800 | [diff] [blame] | 434 | * Gets whether the WebView saves form data. |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 435 | * |
| 436 | * @return whether the WebView saves form data |
| 437 | * @see #setSaveFormData |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 438 | */ |
Selim Gurun | 13e5b0b | 2017-04-03 14:29:14 -0700 | [diff] [blame] | 439 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 440 | public abstract boolean getSaveFormData(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 441 | |
| 442 | /** |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 443 | * Sets whether the WebView should save passwords. The default is {@code true}. |
Jonathan Dixon | 835b1fc | 2013-02-25 12:29:33 -0800 | [diff] [blame] | 444 | * @deprecated Saving passwords in WebView will not be supported in future versions. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 445 | */ |
Jonathan Dixon | 835b1fc | 2013-02-25 12:29:33 -0800 | [diff] [blame] | 446 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 447 | public abstract void setSavePassword(boolean save); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 448 | |
| 449 | /** |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 450 | * Gets whether the WebView saves passwords. |
| 451 | * |
| 452 | * @return whether the WebView saves passwords |
| 453 | * @see #setSavePassword |
Jonathan Dixon | 835b1fc | 2013-02-25 12:29:33 -0800 | [diff] [blame] | 454 | * @deprecated Saving passwords in WebView will not be supported in future versions. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 455 | */ |
Jonathan Dixon | 835b1fc | 2013-02-25 12:29:33 -0800 | [diff] [blame] | 456 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 457 | public abstract boolean getSavePassword(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 458 | |
| 459 | /** |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 460 | * Sets the text zoom of the page in percent. The default is 100. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 461 | * |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 462 | * @param textZoom the text zoom in percent |
John Reck | ff56bcd | 2011-06-16 17:12:08 -0700 | [diff] [blame] | 463 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 464 | public abstract void setTextZoom(int textZoom); |
John Reck | ff56bcd | 2011-06-16 17:12:08 -0700 | [diff] [blame] | 465 | |
| 466 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 467 | * Gets the text zoom of the page in percent. |
| 468 | * |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 469 | * @return the text zoom of the page in percent |
Mikhail Naganov | 1202d66 | 2012-08-07 18:26:52 +0100 | [diff] [blame] | 470 | * @see #setTextZoom |
John Reck | ff56bcd | 2011-06-16 17:12:08 -0700 | [diff] [blame] | 471 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 472 | public abstract int getTextZoom(); |
John Reck | ff56bcd | 2011-06-16 17:12:08 -0700 | [diff] [blame] | 473 | |
| 474 | /** |
Hector Dearman | fc9a27a | 2014-06-05 13:45:28 +0100 | [diff] [blame] | 475 | * Sets policy for third party cookies. |
| 476 | * Developers should access this via {@link CookieManager#setShouldAcceptThirdPartyCookies}. |
| 477 | * @hide Internal API. |
| 478 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 479 | @SystemApi |
| 480 | public abstract void setAcceptThirdPartyCookies(boolean accept); |
Hector Dearman | fc9a27a | 2014-06-05 13:45:28 +0100 | [diff] [blame] | 481 | |
| 482 | /** |
| 483 | * Gets policy for third party cookies. |
| 484 | * Developers should access this via {@link CookieManager#getShouldAcceptThirdPartyCookies}. |
| 485 | * @hide Internal API |
| 486 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 487 | @SystemApi |
| 488 | public abstract boolean getAcceptThirdPartyCookies(); |
Hector Dearman | fc9a27a | 2014-06-05 13:45:28 +0100 | [diff] [blame] | 489 | |
| 490 | /** |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 491 | * Sets the text size of the page. The default is {@link TextSize#NORMAL}. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 492 | * |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 493 | * @param t the text size as a {@link TextSize} value |
| 494 | * @deprecated Use {@link #setTextZoom} instead. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 495 | */ |
Aurimas Liutikas | 514c5ef | 2016-05-24 15:22:55 -0700 | [diff] [blame] | 496 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 497 | public synchronized void setTextSize(TextSize t) { |
Mikhail Naganov | 1202d66 | 2012-08-07 18:26:52 +0100 | [diff] [blame] | 498 | setTextZoom(t.value); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 499 | } |
| 500 | |
| 501 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 502 | * Gets the text size of the page. If the text size was previously specified |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 503 | * in percent using {@link #setTextZoom}, this will return the closest |
| 504 | * matching {@link TextSize}. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 505 | * |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 506 | * @return the text size as a {@link TextSize} value |
| 507 | * @see #setTextSize |
| 508 | * @deprecated Use {@link #getTextZoom} instead. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 509 | */ |
Aurimas Liutikas | 514c5ef | 2016-05-24 15:22:55 -0700 | [diff] [blame] | 510 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 511 | public synchronized TextSize getTextSize() { |
Mikhail Naganov | 1202d66 | 2012-08-07 18:26:52 +0100 | [diff] [blame] | 512 | TextSize closestSize = null; |
| 513 | int smallestDelta = Integer.MAX_VALUE; |
| 514 | int textSize = getTextZoom(); |
| 515 | for (TextSize size : TextSize.values()) { |
| 516 | int delta = Math.abs(textSize - size.value); |
| 517 | if (delta == 0) { |
| 518 | return size; |
| 519 | } |
| 520 | if (delta < smallestDelta) { |
| 521 | smallestDelta = delta; |
| 522 | closestSize = size; |
| 523 | } |
| 524 | } |
| 525 | return closestSize != null ? closestSize : TextSize.NORMAL; |
Mangesh Ghiware | edb528e | 2011-10-12 14:25:41 -0700 | [diff] [blame] | 526 | } |
| 527 | |
| 528 | /** |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 529 | * Sets the default zoom density of the page. This must be called from the UI |
| 530 | * thread. The default is {@link ZoomDensity#MEDIUM}. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 531 | * |
Mikhail Naganov | 8887b2b | 2013-05-28 10:34:43 +0100 | [diff] [blame] | 532 | * This setting is not recommended for use in new applications. If the WebView |
| 533 | * is utilized to display mobile-oriented pages, the desired effect can be achieved by |
| 534 | * adjusting 'width' and 'initial-scale' attributes of page's 'meta viewport' |
| 535 | * tag. For pages lacking the tag, {@link android.webkit.WebView#setInitialScale} |
| 536 | * and {@link #setUseWideViewPort} can be used. |
| 537 | * |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 538 | * @param zoom the zoom density |
Jonathan Dixon | 5545d08 | 2013-08-31 22:43:11 -0700 | [diff] [blame] | 539 | * @deprecated This method is no longer supported, see the function documentation for |
| 540 | * recommended alternatives. |
Grace Kloba | 0d8b77c | 2009-06-25 11:20:51 -0700 | [diff] [blame] | 541 | */ |
Jonathan Dixon | 5545d08 | 2013-08-31 22:43:11 -0700 | [diff] [blame] | 542 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 543 | public abstract void setDefaultZoom(ZoomDensity zoom); |
Grace Kloba | 0d8b77c | 2009-06-25 11:20:51 -0700 | [diff] [blame] | 544 | |
| 545 | /** |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 546 | * Gets the default zoom density of the page. This should be called from |
| 547 | * the UI thread. |
| 548 | * |
Mikhail Naganov | 8887b2b | 2013-05-28 10:34:43 +0100 | [diff] [blame] | 549 | * This setting is not recommended for use in new applications. |
| 550 | * |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 551 | * @return the zoom density |
| 552 | * @see #setDefaultZoom |
Jonathan Dixon | 5545d08 | 2013-08-31 22:43:11 -0700 | [diff] [blame] | 553 | * @deprecated Will only return the default value. |
Grace Kloba | 0d8b77c | 2009-06-25 11:20:51 -0700 | [diff] [blame] | 554 | */ |
Aurimas Liutikas | 514c5ef | 2016-05-24 15:22:55 -0700 | [diff] [blame] | 555 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 556 | public abstract ZoomDensity getDefaultZoom(); |
Grace Kloba | 0d8b77c | 2009-06-25 11:20:51 -0700 | [diff] [blame] | 557 | |
| 558 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 559 | * Enables using light touches to make a selection and activate mouseovers. |
Jonathan Dixon | 835b1fc | 2013-02-25 12:29:33 -0800 | [diff] [blame] | 560 | * @deprecated From {@link android.os.Build.VERSION_CODES#JELLY_BEAN} this |
| 561 | * setting is obsolete and has no effect. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 562 | */ |
Jonathan Dixon | 835b1fc | 2013-02-25 12:29:33 -0800 | [diff] [blame] | 563 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 564 | public abstract void setLightTouchEnabled(boolean enabled); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 565 | |
| 566 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 567 | * Gets whether light touches are enabled. |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 568 | * @see #setLightTouchEnabled |
Jonathan Dixon | 98fac17 | 2013-02-28 15:32:10 -0800 | [diff] [blame] | 569 | * @deprecated This setting is obsolete. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 570 | */ |
Jonathan Dixon | 835b1fc | 2013-02-25 12:29:33 -0800 | [diff] [blame] | 571 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 572 | public abstract boolean getLightTouchEnabled(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 573 | |
| 574 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 575 | * Controlled a rendering optimization that is no longer present. Setting |
| 576 | * it now has no effect. |
| 577 | * |
| 578 | * @deprecated This setting now has no effect. |
Kristian Monsen | f491258 | 2012-08-16 15:26:24 -0400 | [diff] [blame] | 579 | * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 580 | */ |
Mike Hearn | adcd2ed | 2009-01-21 16:44:36 +0100 | [diff] [blame] | 581 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 582 | public void setUseDoubleTree(boolean use) { |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 583 | // Specified to do nothing, so no need for derived classes to override. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 584 | } |
| 585 | |
| 586 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 587 | * Controlled a rendering optimization that is no longer present. Setting |
| 588 | * it now has no effect. |
| 589 | * |
| 590 | * @deprecated This setting now has no effect. |
Kristian Monsen | f491258 | 2012-08-16 15:26:24 -0400 | [diff] [blame] | 591 | * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 592 | */ |
Mike Hearn | adcd2ed | 2009-01-21 16:44:36 +0100 | [diff] [blame] | 593 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 594 | public boolean getUseDoubleTree() { |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 595 | // Returns false unconditionally, so no need for derived classes to override. |
Mike Hearn | adcd2ed | 2009-01-21 16:44:36 +0100 | [diff] [blame] | 596 | return false; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 597 | } |
| 598 | |
| 599 | /** |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 600 | * Sets the user-agent string using an integer code. |
| 601 | * <ul> |
| 602 | * <li>0 means the WebView should use an Android user-agent string</li> |
| 603 | * <li>1 means the WebView should use a desktop user-agent string</li> |
| 604 | * </ul> |
| 605 | * Other values are ignored. The default is an Android user-agent string, |
| 606 | * i.e. code value 0. |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 607 | * |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 608 | * @param ua the integer code for the user-agent string |
| 609 | * @deprecated Please use {@link #setUserAgentString} instead. |
Kristian Monsen | f491258 | 2012-08-16 15:26:24 -0400 | [diff] [blame] | 610 | * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 611 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 612 | @SystemApi |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 613 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 614 | public abstract void setUserAgent(int ua); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 615 | |
| 616 | /** |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 617 | * Gets the user-agent as an integer code. |
| 618 | * <ul> |
| 619 | * <li>-1 means the WebView is using a custom user-agent string set with |
| 620 | * {@link #setUserAgentString}</li> |
| 621 | * <li>0 means the WebView should use an Android user-agent string</li> |
| 622 | * <li>1 means the WebView should use a desktop user-agent string</li> |
| 623 | * </ul> |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 624 | * |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 625 | * @return the integer code for the user-agent string |
| 626 | * @see #setUserAgent |
| 627 | * @deprecated Please use {@link #getUserAgentString} instead. |
Kristian Monsen | f491258 | 2012-08-16 15:26:24 -0400 | [diff] [blame] | 628 | * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 629 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 630 | @SystemApi |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 631 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 632 | public abstract int getUserAgent(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 633 | |
| 634 | /** |
Mikhail Naganov | cb000a6 | 2013-01-04 18:02:54 +0000 | [diff] [blame] | 635 | * Sets whether the WebView should enable support for the "viewport" |
| 636 | * HTML meta tag or should use a wide viewport. |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 637 | * When the value of the setting is {@code false}, the layout width is always set to the |
Mikhail Naganov | cb000a6 | 2013-01-04 18:02:54 +0000 | [diff] [blame] | 638 | * width of the WebView control in device-independent (CSS) pixels. |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 639 | * When the value is {@code true} and the page contains the viewport meta tag, the value |
Mikhail Naganov | cb000a6 | 2013-01-04 18:02:54 +0000 | [diff] [blame] | 640 | * of the width specified in the tag is used. If the page does not contain the tag or |
| 641 | * does not provide a width, then a wide viewport will be used. |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 642 | * |
Mikhail Naganov | cb000a6 | 2013-01-04 18:02:54 +0000 | [diff] [blame] | 643 | * @param use whether to enable support for the viewport meta tag |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 644 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 645 | public abstract void setUseWideViewPort(boolean use); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 646 | |
| 647 | /** |
Mikhail Naganov | cb000a6 | 2013-01-04 18:02:54 +0000 | [diff] [blame] | 648 | * Gets whether the WebView supports the "viewport" |
| 649 | * HTML meta tag or will use a wide viewport. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 650 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 651 | * @return {@code true} if the WebView supports the viewport meta tag |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 652 | * @see #setUseWideViewPort |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 653 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 654 | public abstract boolean getUseWideViewPort(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 655 | |
| 656 | /** |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 657 | * Sets whether the WebView whether supports multiple windows. If set to |
| 658 | * true, {@link WebChromeClient#onCreateWindow} must be implemented by the |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 659 | * host application. The default is {@code false}. |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 660 | * |
Nate Fischer | 4ea9240 | 2017-11-17 18:48:13 -0800 | [diff] [blame] | 661 | * @param support whether to support multiple windows |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 662 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 663 | public abstract void setSupportMultipleWindows(boolean support); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 664 | |
| 665 | /** |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 666 | * Gets whether the WebView supports multiple windows. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 667 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 668 | * @return {@code true} if the WebView supports multiple windows |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 669 | * @see #setSupportMultipleWindows |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 670 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 671 | public abstract boolean supportMultipleWindows(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 672 | |
| 673 | /** |
Nate Fischer | 4ea9240 | 2017-11-17 18:48:13 -0800 | [diff] [blame] | 674 | * Sets the underlying layout algorithm. This will cause a re-layout of the |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 675 | * WebView. The default is {@link LayoutAlgorithm#NARROW_COLUMNS}. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 676 | * |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 677 | * @param l the layout algorithm to use, as a {@link LayoutAlgorithm} value |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 678 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 679 | public abstract void setLayoutAlgorithm(LayoutAlgorithm l); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 680 | |
| 681 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 682 | * Gets the current layout algorithm. |
| 683 | * |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 684 | * @return the layout algorithm in use, as a {@link LayoutAlgorithm} value |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 685 | * @see #setLayoutAlgorithm |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 686 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 687 | public abstract LayoutAlgorithm getLayoutAlgorithm(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 688 | |
| 689 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 690 | * Sets the standard font family name. The default is "sans-serif". |
| 691 | * |
| 692 | * @param font a font family name |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 693 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 694 | public abstract void setStandardFontFamily(String font); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 695 | |
| 696 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 697 | * Gets the standard font family name. |
| 698 | * |
| 699 | * @return the standard font family name as a string |
| 700 | * @see #setStandardFontFamily |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 701 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 702 | public abstract String getStandardFontFamily(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 703 | |
| 704 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 705 | * Sets the fixed font family name. The default is "monospace". |
| 706 | * |
| 707 | * @param font a font family name |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 708 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 709 | public abstract void setFixedFontFamily(String font); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 710 | |
| 711 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 712 | * Gets the fixed font family name. |
| 713 | * |
| 714 | * @return the fixed font family name as a string |
| 715 | * @see #setFixedFontFamily |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 716 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 717 | public abstract String getFixedFontFamily(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 718 | |
| 719 | /** |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 720 | * Sets the sans-serif font family name. The default is "sans-serif". |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 721 | * |
| 722 | * @param font a font family name |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 723 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 724 | public abstract void setSansSerifFontFamily(String font); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 725 | |
| 726 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 727 | * Gets the sans-serif font family name. |
| 728 | * |
| 729 | * @return the sans-serif font family name as a string |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 730 | * @see #setSansSerifFontFamily |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 731 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 732 | public abstract String getSansSerifFontFamily(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 733 | |
| 734 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 735 | * Sets the serif font family name. The default is "sans-serif". |
| 736 | * |
| 737 | * @param font a font family name |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 738 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 739 | public abstract void setSerifFontFamily(String font); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 740 | |
| 741 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 742 | * Gets the serif font family name. The default is "serif". |
| 743 | * |
| 744 | * @return the serif font family name as a string |
| 745 | * @see #setSerifFontFamily |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 746 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 747 | public abstract String getSerifFontFamily(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 748 | |
| 749 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 750 | * Sets the cursive font family name. The default is "cursive". |
| 751 | * |
| 752 | * @param font a font family name |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 753 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 754 | public abstract void setCursiveFontFamily(String font); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 755 | |
| 756 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 757 | * Gets the cursive font family name. |
| 758 | * |
| 759 | * @return the cursive font family name as a string |
| 760 | * @see #setCursiveFontFamily |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 761 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 762 | public abstract String getCursiveFontFamily(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 763 | |
| 764 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 765 | * Sets the fantasy font family name. The default is "fantasy". |
| 766 | * |
| 767 | * @param font a font family name |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 768 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 769 | public abstract void setFantasyFontFamily(String font); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 770 | |
| 771 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 772 | * Gets the fantasy font family name. |
| 773 | * |
| 774 | * @return the fantasy font family name as a string |
| 775 | * @see #setFantasyFontFamily |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 776 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 777 | public abstract String getFantasyFontFamily(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 778 | |
| 779 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 780 | * Sets the minimum font size. The default is 8. |
| 781 | * |
| 782 | * @param size a non-negative integer between 1 and 72. Any number outside |
| 783 | * the specified range will be pinned. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 784 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 785 | public abstract void setMinimumFontSize(int size); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 786 | |
| 787 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 788 | * Gets the minimum font size. |
| 789 | * |
| 790 | * @return a non-negative integer between 1 and 72 |
| 791 | * @see #setMinimumFontSize |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 792 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 793 | public abstract int getMinimumFontSize(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 794 | |
| 795 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 796 | * Sets the minimum logical font size. The default is 8. |
| 797 | * |
| 798 | * @param size a non-negative integer between 1 and 72. Any number outside |
| 799 | * the specified range will be pinned. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 800 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 801 | public abstract void setMinimumLogicalFontSize(int size); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 802 | |
| 803 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 804 | * Gets the minimum logical font size. |
| 805 | * |
| 806 | * @return a non-negative integer between 1 and 72 |
| 807 | * @see #setMinimumLogicalFontSize |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 808 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 809 | public abstract int getMinimumLogicalFontSize(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 810 | |
| 811 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 812 | * Sets the default font size. The default is 16. |
| 813 | * |
| 814 | * @param size a non-negative integer between 1 and 72. Any number outside |
| 815 | * the specified range will be pinned. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 816 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 817 | public abstract void setDefaultFontSize(int size); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 818 | |
| 819 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 820 | * Gets the default font size. |
| 821 | * |
| 822 | * @return a non-negative integer between 1 and 72 |
| 823 | * @see #setDefaultFontSize |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 824 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 825 | public abstract int getDefaultFontSize(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 826 | |
| 827 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 828 | * Sets the default fixed font size. The default is 16. |
| 829 | * |
| 830 | * @param size a non-negative integer between 1 and 72. Any number outside |
| 831 | * the specified range will be pinned. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 832 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 833 | public abstract void setDefaultFixedFontSize(int size); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 834 | |
| 835 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 836 | * Gets the default fixed font size. |
| 837 | * |
| 838 | * @return a non-negative integer between 1 and 72 |
| 839 | * @see #setDefaultFixedFontSize |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 840 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 841 | public abstract int getDefaultFixedFontSize(); |
Grace Kloba | 097b1e77 | 2009-11-24 14:23:18 -0800 | [diff] [blame] | 842 | |
| 843 | /** |
Mikhail Naganov | 605a491 | 2012-02-03 16:53:10 +0000 | [diff] [blame] | 844 | * Sets whether the WebView should load image resources. Note that this method |
| 845 | * controls loading of all images, including those embedded using the data |
| 846 | * URI scheme. Use {@link #setBlockNetworkImage} to control loading only |
| 847 | * of images specified using network URI schemes. Note that if the value of this |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 848 | * setting is changed from {@code false} to {@code true}, all images resources referenced |
Mikhail Naganov | 605a491 | 2012-02-03 16:53:10 +0000 | [diff] [blame] | 849 | * by content currently displayed by the WebView are loaded automatically. |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 850 | * The default is {@code true}. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 851 | * |
| 852 | * @param flag whether the WebView should load image resources |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 853 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 854 | public abstract void setLoadsImagesAutomatically(boolean flag); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 855 | |
| 856 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 857 | * Gets whether the WebView loads image resources. This includes |
| 858 | * images embedded using the data URI scheme. |
| 859 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 860 | * @return {@code true} if the WebView loads image resources |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 861 | * @see #setLoadsImagesAutomatically |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 862 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 863 | public abstract boolean getLoadsImagesAutomatically(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 864 | |
| 865 | /** |
Mikhail Naganov | 605a491 | 2012-02-03 16:53:10 +0000 | [diff] [blame] | 866 | * Sets whether the WebView should not load image resources from the |
| 867 | * network (resources accessed via http and https URI schemes). Note |
| 868 | * that this method has no effect unless |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 869 | * {@link #getLoadsImagesAutomatically} returns {@code true}. Also note that |
Mikhail Naganov | 605a491 | 2012-02-03 16:53:10 +0000 | [diff] [blame] | 870 | * disabling all network loads using {@link #setBlockNetworkLoads} |
| 871 | * will also prevent network images from loading, even if this flag is set |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 872 | * to false. When the value of this setting is changed from {@code true} to {@code false}, |
Mikhail Naganov | 605a491 | 2012-02-03 16:53:10 +0000 | [diff] [blame] | 873 | * network images resources referenced by content currently displayed by |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 874 | * the WebView are fetched automatically. The default is {@code false}. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 875 | * |
| 876 | * @param flag whether the WebView should not load image resources from the |
| 877 | * network |
Patrick Scott | f43113f | 2010-02-18 09:13:12 -0500 | [diff] [blame] | 878 | * @see #setBlockNetworkLoads |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 879 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 880 | public abstract void setBlockNetworkImage(boolean flag); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 881 | |
| 882 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 883 | * Gets whether the WebView does not load image resources from the network. |
| 884 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 885 | * @return {@code true} if the WebView does not load image resources from the network |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 886 | * @see #setBlockNetworkImage |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 887 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 888 | public abstract boolean getBlockNetworkImage(); |
Mike Hearn | adcd2ed | 2009-01-21 16:44:36 +0100 | [diff] [blame] | 889 | |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 890 | /** |
Mikhail Naganov | 605a491 | 2012-02-03 16:53:10 +0000 | [diff] [blame] | 891 | * Sets whether the WebView should not load resources from the network. |
| 892 | * Use {@link #setBlockNetworkImage} to only avoid loading |
| 893 | * image resources. Note that if the value of this setting is |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 894 | * changed from {@code true} to {@code false}, network resources referenced by content |
Mikhail Naganov | 605a491 | 2012-02-03 16:53:10 +0000 | [diff] [blame] | 895 | * currently displayed by the WebView are not fetched until |
| 896 | * {@link android.webkit.WebView#reload} is called. |
| 897 | * If the application does not have the |
| 898 | * {@link android.Manifest.permission#INTERNET} permission, attempts to set |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 899 | * a value of {@code false} will cause a {@link java.lang.SecurityException} |
| 900 | * to be thrown. The default value is {@code false} if the application has the |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 901 | * {@link android.Manifest.permission#INTERNET} permission, otherwise it is |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 902 | * {@code true}. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 903 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 904 | * @param flag {@code true} means block network loads by the WebView |
Patrick Scott | f43113f | 2010-02-18 09:13:12 -0500 | [diff] [blame] | 905 | * @see android.webkit.WebView#reload |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 906 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 907 | public abstract void setBlockNetworkLoads(boolean flag); |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 908 | |
| 909 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 910 | * Gets whether the WebView does not load any resources from the network. |
| 911 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 912 | * @return {@code true} if the WebView does not load any resources from the network |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 913 | * @see #setBlockNetworkLoads |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 914 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 915 | public abstract boolean getBlockNetworkLoads(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 916 | |
| 917 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 918 | * Tells the WebView to enable JavaScript execution. |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 919 | * <b>The default is {@code false}.</b> |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 920 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 921 | * @param flag {@code true} if the WebView should execute JavaScript |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 922 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 923 | public abstract void setJavaScriptEnabled(boolean flag); |
Teng-Hui Zhu | da7378e | 2011-02-16 11:25:03 -0800 | [diff] [blame] | 924 | |
| 925 | /** |
Steve Block | ef16315 | 2012-04-23 18:08:06 +0100 | [diff] [blame] | 926 | * Sets whether JavaScript running in the context of a file scheme URL |
| 927 | * should be allowed to access content from any origin. This includes |
| 928 | * access to content from other file scheme URLs. See |
| 929 | * {@link #setAllowFileAccessFromFileURLs}. To enable the most restrictive, |
| 930 | * and therefore secure policy, this setting should be disabled. |
Mikhail Naganov | 65e7ace | 2012-08-07 13:57:42 +0100 | [diff] [blame] | 931 | * Note that this setting affects only JavaScript access to file scheme |
| 932 | * resources. Other access to such resources, for example, from image HTML |
Joe Fernandez | 22b5ba8 | 2015-04-22 17:29:12 -0700 | [diff] [blame] | 933 | * elements, is unaffected. To prevent possible violation of same domain policy |
Nate Fischer | 8cc1536 | 2018-01-23 16:51:30 -0800 | [diff] [blame] | 934 | * when targeting {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1} and earlier, |
| 935 | * you should explicitly set this value to {@code false}. |
Steve Block | ef16315 | 2012-04-23 18:08:06 +0100 | [diff] [blame] | 936 | * <p> |
Nate Fischer | 8cc1536 | 2018-01-23 16:51:30 -0800 | [diff] [blame] | 937 | * The default value is {@code true} for apps targeting |
Steve Block | ef16315 | 2012-04-23 18:08:06 +0100 | [diff] [blame] | 938 | * {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1} and below, |
Nate Fischer | 8cc1536 | 2018-01-23 16:51:30 -0800 | [diff] [blame] | 939 | * and {@code false} when targeting {@link android.os.Build.VERSION_CODES#JELLY_BEAN} |
Steve Block | ef16315 | 2012-04-23 18:08:06 +0100 | [diff] [blame] | 940 | * and above. |
Selim Gurun | 0ea6dad | 2012-03-29 18:19:01 -0700 | [diff] [blame] | 941 | * |
Steve Block | ef16315 | 2012-04-23 18:08:06 +0100 | [diff] [blame] | 942 | * @param flag whether JavaScript running in the context of a file scheme |
| 943 | * URL should be allowed to access content from any origin |
Selim Gurun | 0ea6dad | 2012-03-29 18:19:01 -0700 | [diff] [blame] | 944 | */ |
| 945 | public abstract void setAllowUniversalAccessFromFileURLs(boolean flag); |
| 946 | |
| 947 | /** |
Steve Block | ef16315 | 2012-04-23 18:08:06 +0100 | [diff] [blame] | 948 | * Sets whether JavaScript running in the context of a file scheme URL |
| 949 | * should be allowed to access content from other file scheme URLs. To |
Nate Fischer | 8cc1536 | 2018-01-23 16:51:30 -0800 | [diff] [blame] | 950 | * enable the most restrictive, and therefore secure, policy this setting |
Steve Block | ef16315 | 2012-04-23 18:08:06 +0100 | [diff] [blame] | 951 | * should be disabled. Note that the value of this setting is ignored if |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 952 | * the value of {@link #getAllowUniversalAccessFromFileURLs} is {@code true}. |
Mikhail Naganov | 65e7ace | 2012-08-07 13:57:42 +0100 | [diff] [blame] | 953 | * Note too, that this setting affects only JavaScript access to file scheme |
| 954 | * resources. Other access to such resources, for example, from image HTML |
Joe Fernandez | 22b5ba8 | 2015-04-22 17:29:12 -0700 | [diff] [blame] | 955 | * elements, is unaffected. To prevent possible violation of same domain policy |
Nate Fischer | 8cc1536 | 2018-01-23 16:51:30 -0800 | [diff] [blame] | 956 | * when targeting {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1} and earlier, |
| 957 | * you should explicitly set this value to {@code false}. |
Steve Block | ef16315 | 2012-04-23 18:08:06 +0100 | [diff] [blame] | 958 | * <p> |
Nate Fischer | 8cc1536 | 2018-01-23 16:51:30 -0800 | [diff] [blame] | 959 | * The default value is {@code true} for apps targeting |
Steve Block | ef16315 | 2012-04-23 18:08:06 +0100 | [diff] [blame] | 960 | * {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1} and below, |
Nate Fischer | 8cc1536 | 2018-01-23 16:51:30 -0800 | [diff] [blame] | 961 | * and {@code false} when targeting {@link android.os.Build.VERSION_CODES#JELLY_BEAN} |
Steve Block | ef16315 | 2012-04-23 18:08:06 +0100 | [diff] [blame] | 962 | * and above. |
Selim Gurun | 0ea6dad | 2012-03-29 18:19:01 -0700 | [diff] [blame] | 963 | * |
Steve Block | ef16315 | 2012-04-23 18:08:06 +0100 | [diff] [blame] | 964 | * @param flag whether JavaScript running in the context of a file scheme |
| 965 | * URL should be allowed to access content from other file |
| 966 | * scheme URLs |
Selim Gurun | 0ea6dad | 2012-03-29 18:19:01 -0700 | [diff] [blame] | 967 | */ |
| 968 | public abstract void setAllowFileAccessFromFileURLs(boolean flag); |
| 969 | |
| 970 | /** |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 971 | * Sets whether the WebView should enable plugins. The default is {@code false}. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 972 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 973 | * @param flag {@code true} if plugins should be enabled |
Patrick Scott | 300f2e9 | 2010-03-22 10:20:45 -0400 | [diff] [blame] | 974 | * @deprecated This method has been deprecated in favor of |
| 975 | * {@link #setPluginState} |
Jonathan Dixon | 0bf4781 | 2013-03-07 17:20:08 -0800 | [diff] [blame] | 976 | * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 977 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 978 | @SystemApi |
Michael Kolb | a172e7d | 2010-06-30 12:35:26 -0700 | [diff] [blame] | 979 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 980 | public abstract void setPluginsEnabled(boolean flag); |
Patrick Scott | 300f2e9 | 2010-03-22 10:20:45 -0400 | [diff] [blame] | 981 | |
| 982 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 983 | * Tells the WebView to enable, disable, or have plugins on demand. On |
Patrick Scott | 300f2e9 | 2010-03-22 10:20:45 -0400 | [diff] [blame] | 984 | * demand mode means that if a plugin exists that can handle the embedded |
| 985 | * content, a placeholder icon will be shown instead of the plugin. When |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 986 | * the placeholder is clicked, the plugin will be enabled. The default is |
| 987 | * {@link PluginState#OFF}. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 988 | * |
| 989 | * @param state a PluginState value |
Jonathan Dixon | 835b1fc | 2013-02-25 12:29:33 -0800 | [diff] [blame] | 990 | * @deprecated Plugins will not be supported in future, and should not be used. |
Patrick Scott | 300f2e9 | 2010-03-22 10:20:45 -0400 | [diff] [blame] | 991 | */ |
Jonathan Dixon | 835b1fc | 2013-02-25 12:29:33 -0800 | [diff] [blame] | 992 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 993 | public abstract void setPluginState(PluginState state); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 994 | |
| 995 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 996 | * Sets a custom path to plugins used by the WebView. This method is |
Derek Sollenberger | fdbdeb3 | 2010-08-12 11:20:13 -0400 | [diff] [blame] | 997 | * obsolete since each plugin is now loaded from its own package. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 998 | * |
| 999 | * @param pluginsPath a String path to the directory containing plugins |
Derek Sollenberger | fdbdeb3 | 2010-08-12 11:20:13 -0400 | [diff] [blame] | 1000 | * @deprecated This method is no longer used as plugins are loaded from |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1001 | * their own APK via the system's package manager. |
Jonathan Dixon | 0bf4781 | 2013-03-07 17:20:08 -0800 | [diff] [blame] | 1002 | * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1003 | */ |
Jason Chen | 9dc2e75 | 2010-09-01 19:11:14 -0700 | [diff] [blame] | 1004 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1005 | public void setPluginsPath(String pluginsPath) { |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 1006 | // Specified to do nothing, so no need for derived classes to override. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1007 | } |
| 1008 | |
| 1009 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1010 | * Sets the path to where database storage API databases should be saved. |
Steve Block | 72ca7a4 | 2012-06-13 22:00:30 +0100 | [diff] [blame] | 1011 | * In order for the database storage API to function correctly, this method |
| 1012 | * must be called with a path to which the application can write. This |
| 1013 | * method should only be called once: repeated calls are ignored. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1014 | * |
Steve Block | 72ca7a4 | 2012-06-13 22:00:30 +0100 | [diff] [blame] | 1015 | * @param databasePath a path to the directory where databases should be |
| 1016 | * saved. |
Jonathan Dixon | 5545d08 | 2013-08-31 22:43:11 -0700 | [diff] [blame] | 1017 | * @deprecated Database paths are managed by the implementation and calling this method |
| 1018 | * will have no effect. |
Ben Murdoch | 7df1985 | 2009-04-22 13:07:58 +0100 | [diff] [blame] | 1019 | */ |
Jonathan Dixon | 5545d08 | 2013-08-31 22:43:11 -0700 | [diff] [blame] | 1020 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1021 | public abstract void setDatabasePath(String databasePath); |
Ben Murdoch | 7df1985 | 2009-04-22 13:07:58 +0100 | [diff] [blame] | 1022 | |
| 1023 | /** |
Steve Block | 72ca7a4 | 2012-06-13 22:00:30 +0100 | [diff] [blame] | 1024 | * Sets the path where the Geolocation databases should be saved. In order |
| 1025 | * for Geolocation permissions and cached positions to be persisted, this |
| 1026 | * method must be called with a path to which the application can write. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1027 | * |
Steve Block | 72ca7a4 | 2012-06-13 22:00:30 +0100 | [diff] [blame] | 1028 | * @param databasePath a path to the directory where databases should be |
| 1029 | * saved. |
Hui Shu | 89eb9b4 | 2016-01-07 11:32:23 -0800 | [diff] [blame] | 1030 | * @deprecated Geolocation database are managed by the implementation and calling this method |
| 1031 | * will have no effect. |
Steve Block | 9d3273f | 2009-08-21 13:16:27 +0100 | [diff] [blame] | 1032 | */ |
Hui Shu | 89eb9b4 | 2016-01-07 11:32:23 -0800 | [diff] [blame] | 1033 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1034 | public abstract void setGeolocationDatabasePath(String databasePath); |
Steve Block | 9d3273f | 2009-08-21 13:16:27 +0100 | [diff] [blame] | 1035 | |
| 1036 | /** |
Steve Block | 72ca7a4 | 2012-06-13 22:00:30 +0100 | [diff] [blame] | 1037 | * Sets whether the Application Caches API should be enabled. The default |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 1038 | * is {@code false}. Note that in order for the Application Caches API to be |
Steve Block | 72ca7a4 | 2012-06-13 22:00:30 +0100 | [diff] [blame] | 1039 | * enabled, a valid database path must also be supplied to |
| 1040 | * {@link #setAppCachePath}. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1041 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 1042 | * @param flag {@code true} if the WebView should enable Application Caches |
Andrei Popescu | 60a9a7d | 2009-04-17 10:43:42 +0100 | [diff] [blame] | 1043 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1044 | public abstract void setAppCacheEnabled(boolean flag); |
Andrei Popescu | 60a9a7d | 2009-04-17 10:43:42 +0100 | [diff] [blame] | 1045 | |
| 1046 | /** |
Steve Block | 72ca7a4 | 2012-06-13 22:00:30 +0100 | [diff] [blame] | 1047 | * Sets the path to the Application Caches files. In order for the |
| 1048 | * Application Caches API to be enabled, this method must be called with a |
| 1049 | * path to which the application can write. This method should only be |
| 1050 | * called once: repeated calls are ignored. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1051 | * |
| 1052 | * @param appCachePath a String path to the directory containing |
Steve Block | 72ca7a4 | 2012-06-13 22:00:30 +0100 | [diff] [blame] | 1053 | * Application Caches files. |
Jonathan Dixon | 47aaba3 | 2012-11-30 16:32:17 -0800 | [diff] [blame] | 1054 | * @see #setAppCacheEnabled |
Andrei Popescu | 60a9a7d | 2009-04-17 10:43:42 +0100 | [diff] [blame] | 1055 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1056 | public abstract void setAppCachePath(String appCachePath); |
Andrei Popescu | 60a9a7d | 2009-04-17 10:43:42 +0100 | [diff] [blame] | 1057 | |
| 1058 | /** |
Selim Gurun | b632adf | 2012-06-28 11:21:05 -0700 | [diff] [blame] | 1059 | * Sets the maximum size for the Application Cache content. The passed size |
| 1060 | * will be rounded to the nearest value that the database can support, so |
| 1061 | * this should be viewed as a guide, not a hard limit. Setting the |
| 1062 | * size to a value less than current database size does not cause the |
Selim Gurun | f27ac09 | 2012-06-28 11:21:05 -0700 | [diff] [blame] | 1063 | * database to be trimmed. The default size is {@link Long#MAX_VALUE}. |
Jonathan Dixon | 835b1fc | 2013-02-25 12:29:33 -0800 | [diff] [blame] | 1064 | * It is recommended to leave the maximum size set to the default value. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1065 | * |
| 1066 | * @param appCacheMaxSize the maximum size in bytes |
Jonathan Dixon | 835b1fc | 2013-02-25 12:29:33 -0800 | [diff] [blame] | 1067 | * @deprecated In future quota will be managed automatically. |
Andrei Popescu | 1c82920 | 2009-07-22 16:47:52 +0100 | [diff] [blame] | 1068 | */ |
Jonathan Dixon | 835b1fc | 2013-02-25 12:29:33 -0800 | [diff] [blame] | 1069 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1070 | public abstract void setAppCacheMaxSize(long appCacheMaxSize); |
Andrei Popescu | 1c82920 | 2009-07-22 16:47:52 +0100 | [diff] [blame] | 1071 | |
| 1072 | /** |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 1073 | * Sets whether the database storage API is enabled. The default value is |
| 1074 | * false. See also {@link #setDatabasePath} for how to correctly set up the |
| 1075 | * database storage API. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1076 | * |
Selim Gurun | 2bca22b | 2013-02-28 17:47:21 -0800 | [diff] [blame] | 1077 | * This setting is global in effect, across all WebView instances in a process. |
| 1078 | * Note you should only modify this setting prior to making <b>any</b> WebView |
| 1079 | * page load within a given process, as the WebView implementation may ignore |
| 1080 | * changes to this setting after that point. |
| 1081 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 1082 | * @param flag {@code true} if the WebView should use the database storage API |
Ben Murdoch | 7df1985 | 2009-04-22 13:07:58 +0100 | [diff] [blame] | 1083 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1084 | public abstract void setDatabaseEnabled(boolean flag); |
Ben Murdoch | 7df1985 | 2009-04-22 13:07:58 +0100 | [diff] [blame] | 1085 | |
| 1086 | /** |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 1087 | * Sets whether the DOM storage API is enabled. The default value is {@code false}. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1088 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 1089 | * @param flag {@code true} if the WebView should use the DOM storage API |
Ben Murdoch | 274680d | 2009-05-28 13:44:44 +0100 | [diff] [blame] | 1090 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1091 | public abstract void setDomStorageEnabled(boolean flag); |
Ben Murdoch | 274680d | 2009-05-28 13:44:44 +0100 | [diff] [blame] | 1092 | |
| 1093 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1094 | * Gets whether the DOM Storage APIs are enabled. |
| 1095 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 1096 | * @return {@code true} if the DOM Storage APIs are enabled |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 1097 | * @see #setDomStorageEnabled |
Ben Murdoch | 274680d | 2009-05-28 13:44:44 +0100 | [diff] [blame] | 1098 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1099 | public abstract boolean getDomStorageEnabled(); |
| 1100 | |
Ben Murdoch | 274680d | 2009-05-28 13:44:44 +0100 | [diff] [blame] | 1101 | /** |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 1102 | * Gets the path to where database storage API databases are saved. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1103 | * |
| 1104 | * @return the String path to the database storage API databases |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 1105 | * @see #setDatabasePath |
Jonathan Dixon | 5545d08 | 2013-08-31 22:43:11 -0700 | [diff] [blame] | 1106 | * @deprecated Database paths are managed by the implementation this method is obsolete. |
Ben Murdoch | 7df1985 | 2009-04-22 13:07:58 +0100 | [diff] [blame] | 1107 | */ |
Jonathan Dixon | 5545d08 | 2013-08-31 22:43:11 -0700 | [diff] [blame] | 1108 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1109 | public abstract String getDatabasePath(); |
Ben Murdoch | 7df1985 | 2009-04-22 13:07:58 +0100 | [diff] [blame] | 1110 | |
| 1111 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1112 | * Gets whether the database storage API is enabled. |
| 1113 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 1114 | * @return {@code true} if the database storage API is enabled |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 1115 | * @see #setDatabaseEnabled |
Ben Murdoch | 7df1985 | 2009-04-22 13:07:58 +0100 | [diff] [blame] | 1116 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1117 | public abstract boolean getDatabaseEnabled(); |
Andrei Popescu | c27a9ac | 2009-08-03 15:59:24 +0100 | [diff] [blame] | 1118 | |
| 1119 | /** |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 1120 | * Sets whether Geolocation is enabled. The default is {@code true}. |
Mikhail Naganov | 6cb296a | 2012-08-28 16:57:24 +0100 | [diff] [blame] | 1121 | * <p> |
| 1122 | * Please note that in order for the Geolocation API to be usable |
| 1123 | * by a page in the WebView, the following requirements must be met: |
| 1124 | * <ul> |
| 1125 | * <li>an application must have permission to access the device location, |
| 1126 | * see {@link android.Manifest.permission#ACCESS_COARSE_LOCATION}, |
| 1127 | * {@link android.Manifest.permission#ACCESS_FINE_LOCATION}; |
| 1128 | * <li>an application must provide an implementation of the |
| 1129 | * {@link WebChromeClient#onGeolocationPermissionsShowPrompt} callback |
| 1130 | * to receive notifications that a page is requesting access to location |
| 1131 | * via the JavaScript Geolocation API. |
| 1132 | * </ul> |
| 1133 | * <p> |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1134 | * |
| 1135 | * @param flag whether Geolocation should be enabled |
Steve Block | 06cd751 | 2009-08-21 10:26:37 +0100 | [diff] [blame] | 1136 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1137 | public abstract void setGeolocationEnabled(boolean flag); |
Elliott Slaughter | 5dc0c82 | 2010-06-22 11:31:54 -0700 | [diff] [blame] | 1138 | |
| 1139 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1140 | * Gets whether JavaScript is enabled. |
| 1141 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 1142 | * @return {@code true} if JavaScript is enabled |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1143 | * @see #setJavaScriptEnabled |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1144 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1145 | public abstract boolean getJavaScriptEnabled(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1146 | |
| 1147 | /** |
Steve Block | ef16315 | 2012-04-23 18:08:06 +0100 | [diff] [blame] | 1148 | * Gets whether JavaScript running in the context of a file scheme URL can |
| 1149 | * access content from any origin. This includes access to content from |
| 1150 | * other file scheme URLs. |
Selim Gurun | 0ea6dad | 2012-03-29 18:19:01 -0700 | [diff] [blame] | 1151 | * |
Steve Block | ef16315 | 2012-04-23 18:08:06 +0100 | [diff] [blame] | 1152 | * @return whether JavaScript running in the context of a file scheme URL |
| 1153 | * can access content from any origin |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1154 | * @see #setAllowUniversalAccessFromFileURLs |
Selim Gurun | 0ea6dad | 2012-03-29 18:19:01 -0700 | [diff] [blame] | 1155 | */ |
| 1156 | public abstract boolean getAllowUniversalAccessFromFileURLs(); |
| 1157 | |
| 1158 | /** |
Steve Block | ef16315 | 2012-04-23 18:08:06 +0100 | [diff] [blame] | 1159 | * Gets whether JavaScript running in the context of a file scheme URL can |
| 1160 | * access content from other file scheme URLs. |
Selim Gurun | 0ea6dad | 2012-03-29 18:19:01 -0700 | [diff] [blame] | 1161 | * |
Steve Block | ef16315 | 2012-04-23 18:08:06 +0100 | [diff] [blame] | 1162 | * @return whether JavaScript running in the context of a file scheme URL |
| 1163 | * can access content from other file scheme URLs |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1164 | * @see #setAllowFileAccessFromFileURLs |
Selim Gurun | 0ea6dad | 2012-03-29 18:19:01 -0700 | [diff] [blame] | 1165 | */ |
| 1166 | public abstract boolean getAllowFileAccessFromFileURLs(); |
| 1167 | |
| 1168 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1169 | * Gets whether plugins are enabled. |
| 1170 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 1171 | * @return {@code true} if plugins are enabled |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 1172 | * @see #setPluginsEnabled |
Patrick Scott | 300f2e9 | 2010-03-22 10:20:45 -0400 | [diff] [blame] | 1173 | * @deprecated This method has been replaced by {@link #getPluginState} |
Jonathan Dixon | 0bf4781 | 2013-03-07 17:20:08 -0800 | [diff] [blame] | 1174 | * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1175 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1176 | @SystemApi |
Michael Kolb | a172e7d | 2010-06-30 12:35:26 -0700 | [diff] [blame] | 1177 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1178 | public abstract boolean getPluginsEnabled(); |
Patrick Scott | 300f2e9 | 2010-03-22 10:20:45 -0400 | [diff] [blame] | 1179 | |
| 1180 | /** |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 1181 | * Gets the current state regarding whether plugins are enabled. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1182 | * |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 1183 | * @return the plugin state as a {@link PluginState} value |
| 1184 | * @see #setPluginState |
Jonathan Dixon | 835b1fc | 2013-02-25 12:29:33 -0800 | [diff] [blame] | 1185 | * @deprecated Plugins will not be supported in future, and should not be used. |
Patrick Scott | 300f2e9 | 2010-03-22 10:20:45 -0400 | [diff] [blame] | 1186 | */ |
Jonathan Dixon | 835b1fc | 2013-02-25 12:29:33 -0800 | [diff] [blame] | 1187 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1188 | public abstract PluginState getPluginState(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1189 | |
| 1190 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1191 | * Gets the directory that contains the plugin libraries. This method is |
Derek Sollenberger | fdbdeb3 | 2010-08-12 11:20:13 -0400 | [diff] [blame] | 1192 | * obsolete since each plugin is now loaded from its own package. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1193 | * |
| 1194 | * @return an empty string |
Derek Sollenberger | fdbdeb3 | 2010-08-12 11:20:13 -0400 | [diff] [blame] | 1195 | * @deprecated This method is no longer used as plugins are loaded from |
| 1196 | * their own APK via the system's package manager. |
Jonathan Dixon | 0bf4781 | 2013-03-07 17:20:08 -0800 | [diff] [blame] | 1197 | * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1198 | */ |
Jason Chen | 9dc2e75 | 2010-09-01 19:11:14 -0700 | [diff] [blame] | 1199 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1200 | public String getPluginsPath() { |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 1201 | // Unconditionally returns empty string, so no need for derived classes to override. |
Grace Kloba | 658ab7d | 2009-05-14 14:45:26 -0700 | [diff] [blame] | 1202 | return ""; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1203 | } |
| 1204 | |
| 1205 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1206 | * Tells JavaScript to open windows automatically. This applies to the |
Nate Fischer | 4ea9240 | 2017-11-17 18:48:13 -0800 | [diff] [blame] | 1207 | * JavaScript function {@code window.open()}. The default is {@code false}. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1208 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 1209 | * @param flag {@code true} if JavaScript can open windows automatically |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1210 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1211 | public abstract void setJavaScriptCanOpenWindowsAutomatically(boolean flag); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1212 | |
| 1213 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1214 | * Gets whether JavaScript can open windows automatically. |
| 1215 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 1216 | * @return {@code true} if JavaScript can open windows automatically during |
Nate Fischer | 4ea9240 | 2017-11-17 18:48:13 -0800 | [diff] [blame] | 1217 | * {@code window.open()} |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1218 | * @see #setJavaScriptCanOpenWindowsAutomatically |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1219 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1220 | public abstract boolean getJavaScriptCanOpenWindowsAutomatically(); |
Marcin Kosiba | fd1ac83 | 2014-10-10 17:12:49 +0100 | [diff] [blame] | 1221 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1222 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1223 | * Sets the default text encoding name to use when decoding html pages. |
Marcin Kosiba | fd1ac83 | 2014-10-10 17:12:49 +0100 | [diff] [blame] | 1224 | * The default is "UTF-8". |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1225 | * |
| 1226 | * @param encoding the text encoding name |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1227 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1228 | public abstract void setDefaultTextEncodingName(String encoding); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1229 | |
| 1230 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1231 | * Gets the default text encoding name. |
| 1232 | * |
| 1233 | * @return the default text encoding name as a string |
| 1234 | * @see #setDefaultTextEncodingName |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1235 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1236 | public abstract String getDefaultTextEncodingName(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1237 | |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 1238 | /** |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 1239 | * Sets the WebView's user-agent string. If the string is {@code null} or empty, |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 1240 | * the system default value will be used. |
Mikhail Naganov | 550f621 | 2015-07-07 13:39:31 -0700 | [diff] [blame] | 1241 | * |
| 1242 | * Note that starting from {@link android.os.Build.VERSION_CODES#KITKAT} Android |
| 1243 | * version, changing the user-agent while loading a web page causes WebView |
| 1244 | * to initiate loading once again. |
| 1245 | * |
| 1246 | * @param ua new user-agent string |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 1247 | */ |
Nate Fischer | 3442c74 | 2017-09-08 17:02:00 -0700 | [diff] [blame] | 1248 | public abstract void setUserAgentString(@Nullable String ua); |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 1249 | |
| 1250 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1251 | * Gets the WebView's user-agent string. |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 1252 | * |
| 1253 | * @return the WebView's user-agent string |
| 1254 | * @see #setUserAgentString |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 1255 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1256 | public abstract String getUserAgentString(); |
Shimeng (Simon) Wang | c55886a | 2010-10-28 13:46:02 -0700 | [diff] [blame] | 1257 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1258 | /** |
George Mount | 9f410c5 | 2012-08-10 15:29:30 -0700 | [diff] [blame] | 1259 | * Returns the default User-Agent used by a WebView. |
| 1260 | * An instance of WebView could use a different User-Agent if a call |
Kristian Monsen | f491258 | 2012-08-16 15:26:24 -0400 | [diff] [blame] | 1261 | * is made to {@link WebSettings#setUserAgentString(String)}. |
George Mount | 9f410c5 | 2012-08-10 15:29:30 -0700 | [diff] [blame] | 1262 | * |
| 1263 | * @param context a Context object used to access application assets |
| 1264 | */ |
| 1265 | public static String getDefaultUserAgent(Context context) { |
Jonathan Dixon | d1c4faa | 2012-08-20 16:37:15 -0700 | [diff] [blame] | 1266 | return WebViewFactory.getProvider().getStatics().getDefaultUserAgent(context); |
George Mount | 9f410c5 | 2012-08-10 15:29:30 -0700 | [diff] [blame] | 1267 | } |
| 1268 | |
| 1269 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1270 | * Tells the WebView whether it needs to set a node to have focus when |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 1271 | * {@link WebView#requestFocus(int, android.graphics.Rect)} is called. The |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 1272 | * default value is {@code true}. |
Michael Kolb | a172e7d | 2010-06-30 12:35:26 -0700 | [diff] [blame] | 1273 | * |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1274 | * @param flag whether the WebView needs to set a node |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1275 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1276 | public abstract void setNeedInitialFocus(boolean flag); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1277 | |
| 1278 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1279 | * Sets the priority of the Render thread. Unlike the other settings, this |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 1280 | * one only needs to be called once per process. The default value is |
| 1281 | * {@link RenderPriority#NORMAL}. |
Mike Hearn | adcd2ed | 2009-01-21 16:44:36 +0100 | [diff] [blame] | 1282 | * |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 1283 | * @param priority the priority |
Jonathan Dixon | 835b1fc | 2013-02-25 12:29:33 -0800 | [diff] [blame] | 1284 | * @deprecated It is not recommended to adjust thread priorities, and this will |
| 1285 | * not be supported in future versions. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1286 | */ |
Jonathan Dixon | 835b1fc | 2013-02-25 12:29:33 -0800 | [diff] [blame] | 1287 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1288 | public abstract void setRenderPriority(RenderPriority priority); |
Michael Kolb | a172e7d | 2010-06-30 12:35:26 -0700 | [diff] [blame] | 1289 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1290 | /** |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1291 | * Overrides the way the cache is used. The way the cache is used is based |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 1292 | * on the navigation type. For a normal page load, the cache is checked |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1293 | * and content is re-validated as needed. When navigating back, content is |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 1294 | * not revalidated, instead the content is just retrieved from the cache. |
| 1295 | * This method allows the client to override this behavior by specifying |
Mikhail Naganov | 56936a1 | 2012-07-25 13:07:18 +0100 | [diff] [blame] | 1296 | * one of {@link #LOAD_DEFAULT}, |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 1297 | * {@link #LOAD_CACHE_ELSE_NETWORK}, {@link #LOAD_NO_CACHE} or |
| 1298 | * {@link #LOAD_CACHE_ONLY}. The default value is {@link #LOAD_DEFAULT}. |
Steve Block | 4e584df | 2012-04-24 23:12:47 +0100 | [diff] [blame] | 1299 | * |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 1300 | * @param mode the mode to use |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1301 | */ |
Tim Volodine | b90f538 | 2016-04-29 12:44:41 +0100 | [diff] [blame] | 1302 | public abstract void setCacheMode(@CacheMode int mode); |
Michael Kolb | a172e7d | 2010-06-30 12:35:26 -0700 | [diff] [blame] | 1303 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1304 | /** |
Steve Block | b0e0f33 | 2012-06-13 22:01:11 +0100 | [diff] [blame] | 1305 | * Gets the current setting for overriding the cache mode. |
| 1306 | * |
| 1307 | * @return the current setting for overriding the cache mode |
| 1308 | * @see #setCacheMode |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1309 | */ |
Tim Volodine | b90f538 | 2016-04-29 12:44:41 +0100 | [diff] [blame] | 1310 | @CacheMode |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 1311 | public abstract int getCacheMode(); |
Ben Murdoch | fe9fc3d | 2014-04-10 15:31:06 +0100 | [diff] [blame] | 1312 | |
| 1313 | /** |
| 1314 | * Configures the WebView's behavior when a secure origin attempts to load a resource from an |
| 1315 | * insecure origin. |
| 1316 | * |
| 1317 | * By default, apps that target {@link android.os.Build.VERSION_CODES#KITKAT} or below default |
| 1318 | * to {@link #MIXED_CONTENT_ALWAYS_ALLOW}. Apps targeting |
Dianne Hackborn | 955d8d6 | 2014-10-07 20:17:19 -0700 | [diff] [blame] | 1319 | * {@link android.os.Build.VERSION_CODES#LOLLIPOP} default to {@link #MIXED_CONTENT_NEVER_ALLOW}. |
Ben Murdoch | fe9fc3d | 2014-04-10 15:31:06 +0100 | [diff] [blame] | 1320 | * |
| 1321 | * The preferred and most secure mode of operation for the WebView is |
| 1322 | * {@link #MIXED_CONTENT_NEVER_ALLOW} and use of {@link #MIXED_CONTENT_ALWAYS_ALLOW} is |
| 1323 | * strongly discouraged. |
| 1324 | * |
| 1325 | * @param mode The mixed content mode to use. One of {@link #MIXED_CONTENT_NEVER_ALLOW}, |
Torne (Richard Coles) | 2b666c9 | 2015-03-06 14:20:00 +0000 | [diff] [blame] | 1326 | * {@link #MIXED_CONTENT_ALWAYS_ALLOW} or {@link #MIXED_CONTENT_COMPATIBILITY_MODE}. |
Ben Murdoch | fe9fc3d | 2014-04-10 15:31:06 +0100 | [diff] [blame] | 1327 | */ |
| 1328 | public abstract void setMixedContentMode(int mode); |
| 1329 | |
| 1330 | /** |
| 1331 | * Gets the current behavior of the WebView with regard to loading insecure content from a |
| 1332 | * secure origin. |
| 1333 | * @return The current setting, one of {@link #MIXED_CONTENT_NEVER_ALLOW}, |
Torne (Richard Coles) | 2b666c9 | 2015-03-06 14:20:00 +0000 | [diff] [blame] | 1334 | * {@link #MIXED_CONTENT_ALWAYS_ALLOW} or {@link #MIXED_CONTENT_COMPATIBILITY_MODE}. |
Ben Murdoch | fe9fc3d | 2014-04-10 15:31:06 +0100 | [diff] [blame] | 1335 | */ |
| 1336 | public abstract int getMixedContentMode(); |
Yuncheol Heo | 4d07c48 | 2014-05-07 17:29:35 +0900 | [diff] [blame] | 1337 | |
| 1338 | /** |
| 1339 | * Sets whether to use a video overlay for embedded encrypted video. |
Dianne Hackborn | 955d8d6 | 2014-10-07 20:17:19 -0700 | [diff] [blame] | 1340 | * In API levels prior to {@link android.os.Build.VERSION_CODES#LOLLIPOP}, encrypted video can |
Yuncheol Heo | 4d07c48 | 2014-05-07 17:29:35 +0900 | [diff] [blame] | 1341 | * only be rendered directly on a secure video surface, so it had been a hard problem to play |
| 1342 | * encrypted video in HTML. When this flag is on, WebView can play encrypted video (MSE/EME) |
| 1343 | * by using a video overlay (aka hole-punching) for videos embedded using HTML <video> |
| 1344 | * tag.<br> |
| 1345 | * Caution: This setting is intended for use only in a narrow set of circumstances and apps |
| 1346 | * should only enable it if they require playback of encrypted video content. It will impose |
| 1347 | * the following limitations on the WebView: |
| 1348 | * <ul> |
| 1349 | * <li> Only one video overlay can be played at a time. |
| 1350 | * <li> Changes made to position or dimensions of a video element may be propagated to the |
| 1351 | * corresponding video overlay with a noticeable delay. |
| 1352 | * <li> The video overlay is not visible to web APIs and as such may not interact with |
| 1353 | * script or styling. For example, CSS styles applied to the <video> tag may be ignored. |
| 1354 | * </ul> |
| 1355 | * This is not an exhaustive set of constraints and it may vary with new versions of the |
| 1356 | * WebView. |
| 1357 | * @hide |
| 1358 | */ |
Yuncheol Heo | eeba025 | 2014-07-08 19:43:00 +0900 | [diff] [blame] | 1359 | @SystemApi |
Yuncheol Heo | 4d07c48 | 2014-05-07 17:29:35 +0900 | [diff] [blame] | 1360 | public abstract void setVideoOverlayForEmbeddedEncryptedVideoEnabled(boolean flag); |
| 1361 | |
| 1362 | /** |
| 1363 | * Gets whether a video overlay will be used for embedded encrypted video. |
| 1364 | * |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 1365 | * @return {@code true} if WebView uses a video overlay for embedded encrypted video. |
Yuncheol Heo | 4d07c48 | 2014-05-07 17:29:35 +0900 | [diff] [blame] | 1366 | * @see #setVideoOverlayForEmbeddedEncryptedVideoEnabled |
| 1367 | * @hide |
| 1368 | */ |
Yuncheol Heo | eeba025 | 2014-07-08 19:43:00 +0900 | [diff] [blame] | 1369 | @SystemApi |
Yuncheol Heo | 4d07c48 | 2014-05-07 17:29:35 +0900 | [diff] [blame] | 1370 | public abstract boolean getVideoOverlayForEmbeddedEncryptedVideoEnabled(); |
Hui Shu | b1ee70b | 2015-03-03 11:38:41 -0800 | [diff] [blame] | 1371 | |
| 1372 | /** |
| 1373 | * Sets whether this WebView should raster tiles when it is |
| 1374 | * offscreen but attached to a window. Turning this on can avoid |
| 1375 | * rendering artifacts when animating an offscreen WebView on-screen. |
| 1376 | * Offscreen WebViews in this mode use more memory. The default value is |
Hui Shu | d377c0f | 2015-05-13 12:01:42 -0700 | [diff] [blame] | 1377 | * false.<br> |
Hui Shu | b1ee70b | 2015-03-03 11:38:41 -0800 | [diff] [blame] | 1378 | * Please follow these guidelines to limit memory usage: |
Hui Shu | d377c0f | 2015-05-13 12:01:42 -0700 | [diff] [blame] | 1379 | * <ul> |
| 1380 | * <li> WebView size should be not be larger than the device screen size. |
| 1381 | * <li> Limit use of this mode to a small number of WebViews. Use it for |
Hui Shu | b1ee70b | 2015-03-03 11:38:41 -0800 | [diff] [blame] | 1382 | * visible WebViews and WebViews about to be animated to visible. |
Hui Shu | d377c0f | 2015-05-13 12:01:42 -0700 | [diff] [blame] | 1383 | * </ul> |
Hui Shu | b1ee70b | 2015-03-03 11:38:41 -0800 | [diff] [blame] | 1384 | */ |
| 1385 | public abstract void setOffscreenPreRaster(boolean enabled); |
| 1386 | |
| 1387 | /** |
| 1388 | * Gets whether this WebView should raster tiles when it is |
| 1389 | * offscreen but attached to a window. |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 1390 | * @return {@code true} if this WebView will raster tiles when it is |
Hui Shu | b1ee70b | 2015-03-03 11:38:41 -0800 | [diff] [blame] | 1391 | * offscreen but attached to a window. |
| 1392 | */ |
| 1393 | public abstract boolean getOffscreenPreRaster(); |
Hui Shu | 227a8c1 | 2015-10-22 14:57:51 -0700 | [diff] [blame] | 1394 | |
Selim Gurun | ec0a1f2 | 2017-04-07 18:21:46 -0700 | [diff] [blame] | 1395 | |
| 1396 | /** |
Nate Fischer | fb92ee1 | 2018-01-18 12:01:19 -0800 | [diff] [blame] | 1397 | * Sets whether Safe Browsing is enabled. Safe Browsing allows WebView to |
Selim Gurun | ec0a1f2 | 2017-04-07 18:21:46 -0700 | [diff] [blame] | 1398 | * protect against malware and phishing attacks by verifying the links. |
| 1399 | * |
Selim Gurun | ec0a1f2 | 2017-04-07 18:21:46 -0700 | [diff] [blame] | 1400 | * <p> |
Nate Fischer | fb92ee1 | 2018-01-18 12:01:19 -0800 | [diff] [blame] | 1401 | * Safe Browsing can be disabled for all WebViews using a manifest tag (read <a |
| 1402 | * href="{@docRoot}reference/android/webkit/WebView.html">general Safe Browsing info</a>). The |
| 1403 | * manifest tag has a lower precedence than this API. |
Selim Gurun | ec0a1f2 | 2017-04-07 18:21:46 -0700 | [diff] [blame] | 1404 | * |
Nate Fischer | 471891d | 2017-07-18 19:15:52 -0700 | [diff] [blame] | 1405 | * <p> |
Nate Fischer | fb92ee1 | 2018-01-18 12:01:19 -0800 | [diff] [blame] | 1406 | * Safe Browsing is enabled by default for devices which support it. |
Selim Gurun | ec0a1f2 | 2017-04-07 18:21:46 -0700 | [diff] [blame] | 1407 | * |
Nate Fischer | fb92ee1 | 2018-01-18 12:01:19 -0800 | [diff] [blame] | 1408 | * @param enabled Whether Safe Browsing is enabled. |
Selim Gurun | ec0a1f2 | 2017-04-07 18:21:46 -0700 | [diff] [blame] | 1409 | */ |
| 1410 | public abstract void setSafeBrowsingEnabled(boolean enabled); |
| 1411 | |
| 1412 | /** |
Nate Fischer | fb92ee1 | 2018-01-18 12:01:19 -0800 | [diff] [blame] | 1413 | * Gets whether Safe Browsing is enabled. |
Selim Gurun | ec0a1f2 | 2017-04-07 18:21:46 -0700 | [diff] [blame] | 1414 | * See {@link #setSafeBrowsingEnabled}. |
| 1415 | * |
Nate Fischer | fb92ee1 | 2018-01-18 12:01:19 -0800 | [diff] [blame] | 1416 | * @return {@code true} if Safe Browsing is enabled and {@code false} otherwise. |
Selim Gurun | ec0a1f2 | 2017-04-07 18:21:46 -0700 | [diff] [blame] | 1417 | */ |
| 1418 | public abstract boolean getSafeBrowsingEnabled(); |
| 1419 | |
| 1420 | |
Hui Shu | 227a8c1 | 2015-10-22 14:57:51 -0700 | [diff] [blame] | 1421 | /** |
Hui Shu | 539b077 | 2016-04-20 15:21:37 -0700 | [diff] [blame] | 1422 | * @hide |
| 1423 | */ |
Jeff Sharkey | ce8db99 | 2017-12-13 20:05:05 -0700 | [diff] [blame] | 1424 | @IntDef(flag = true, prefix = { "MENU_ITEM_" }, value = { |
| 1425 | MENU_ITEM_NONE, |
| 1426 | MENU_ITEM_SHARE, |
| 1427 | MENU_ITEM_WEB_SEARCH, |
| 1428 | MENU_ITEM_PROCESS_TEXT |
| 1429 | }) |
Hui Shu | 539b077 | 2016-04-20 15:21:37 -0700 | [diff] [blame] | 1430 | @Retention(RetentionPolicy.SOURCE) |
| 1431 | @Target({ElementType.PARAMETER, ElementType.METHOD}) |
| 1432 | private @interface MenuItemFlags {} |
| 1433 | |
| 1434 | /** |
Hui Shu | 227a8c1 | 2015-10-22 14:57:51 -0700 | [diff] [blame] | 1435 | * Disables the action mode menu items according to {@code menuItems} flag. |
| 1436 | * @param menuItems an integer field flag for the menu items to be disabled. |
| 1437 | */ |
Hui Shu | 539b077 | 2016-04-20 15:21:37 -0700 | [diff] [blame] | 1438 | public abstract void setDisabledActionModeMenuItems(@MenuItemFlags int menuItems); |
Hui Shu | 227a8c1 | 2015-10-22 14:57:51 -0700 | [diff] [blame] | 1439 | |
| 1440 | /** |
| 1441 | * Gets the action mode menu items that are disabled, expressed in an integer field flag. |
| 1442 | * The default value is {@link #MENU_ITEM_NONE} |
| 1443 | * |
Hui Shu | 539b077 | 2016-04-20 15:21:37 -0700 | [diff] [blame] | 1444 | * @return all the disabled menu item flags combined with bitwise OR. |
Hui Shu | 227a8c1 | 2015-10-22 14:57:51 -0700 | [diff] [blame] | 1445 | */ |
Hui Shu | 539b077 | 2016-04-20 15:21:37 -0700 | [diff] [blame] | 1446 | public abstract @MenuItemFlags int getDisabledActionModeMenuItems(); |
Hui Shu | 227a8c1 | 2015-10-22 14:57:51 -0700 | [diff] [blame] | 1447 | |
| 1448 | /** |
| 1449 | * Used with {@link #setDisabledActionModeMenuItems}. |
| 1450 | * |
| 1451 | * No menu items should be disabled. |
| 1452 | */ |
| 1453 | public static final int MENU_ITEM_NONE = 0; |
| 1454 | |
| 1455 | /** |
| 1456 | * Used with {@link #setDisabledActionModeMenuItems}. |
| 1457 | * |
| 1458 | * Disable menu item "Share". |
| 1459 | */ |
| 1460 | public static final int MENU_ITEM_SHARE = 1 << 0; |
| 1461 | |
| 1462 | /** |
| 1463 | * Used with {@link #setDisabledActionModeMenuItems}. |
| 1464 | * |
| 1465 | * Disable menu item "Web Search". |
| 1466 | */ |
| 1467 | public static final int MENU_ITEM_WEB_SEARCH = 1 << 1; |
| 1468 | |
| 1469 | /** |
| 1470 | * Used with {@link #setDisabledActionModeMenuItems}. |
| 1471 | * |
| 1472 | * Disable all the action mode menu items for text processing. |
| 1473 | * By default WebView searches for activities that are able to handle |
| 1474 | * {@link android.content.Intent#ACTION_PROCESS_TEXT} and show them in the |
| 1475 | * action mode menu. If this flag is set via {@link |
| 1476 | * #setDisabledActionModeMenuItems}, these menu items will be disabled. |
| 1477 | */ |
| 1478 | public static final int MENU_ITEM_PROCESS_TEXT = 1 << 2; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1479 | } |