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