blob: b1b10f509f2b66557958c02879c2951a6c5b3a3f [file] [log] [blame]
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001/*
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
17package android.webkit;
18
Hui Shu539b0772016-04-20 15:21:37 -070019import android.annotation.IntDef;
Yuncheol Heoeeba0252014-07-08 19:43:00 +090020import android.annotation.SystemApi;
George Mount9f410c52012-08-10 15:29:30 -070021import android.content.Context;
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070022
Hui Shu539b0772016-04-20 15:21:37 -070023import java.lang.annotation.ElementType;
24import java.lang.annotation.Retention;
25import java.lang.annotation.RetentionPolicy;
26import java.lang.annotation.Target;
27
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070028/**
29 * Manages settings state for a WebView. When a WebView is first created, it
30 * obtains a set of default settings. These default settings will be returned
31 * from any getter call. A WebSettings object obtained from
32 * WebView.getSettings() is tied to the life of the WebView. If a WebView has
33 * been destroyed, any method call on WebSettings will throw an
34 * IllegalStateException.
35 */
Jonathan Dixond3101b12012-04-12 20:51:51 +010036// This is an abstract base class: concrete WebViewProviders must
Jonathan Dixon3c909522012-02-28 18:45:06 +000037// create a class derived from this, and return an instance of it in the
38// WebViewProvider.getWebSettingsProvider() method implementation.
Selim Gurun0ea6dad2012-03-29 18:19:01 -070039public abstract class WebSettings {
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070040 /**
41 * Enum for controlling the layout of html.
Steve Block4e584df2012-04-24 23:12:47 +010042 * <ul>
Jonathan Dixon5545d082013-08-31 22:43:11 -070043 * <li>NORMAL means no rendering changes. This is the recommended choice for maximum
44 * compatibility across different platforms and Android versions.</li>
Steve Block4e584df2012-04-24 23:12:47 +010045 * <li>SINGLE_COLUMN moves all content into one column that is the width of the
46 * view.</li>
Jonathan Dixon5545d082013-08-31 22:43:11 -070047 * <li>NARROW_COLUMNS makes all columns no wider than the screen if possible. Only use
48 * this for API levels prior to {@link android.os.Build.VERSION_CODES#KITKAT}.</li>
Mikhail Naganov94e0bd32012-12-14 17:01:25 +000049 * <li>TEXT_AUTOSIZING boosts font size of paragraphs based on heuristics to make
50 * the text readable when viewing a wide-viewport layout in the overview mode.
51 * It is recommended to enable zoom support {@link #setSupportZoom} when
Jonathan Dixon5545d082013-08-31 22:43:11 -070052 * using this mode. Supported from API level
53 * {@link android.os.Build.VERSION_CODES#KITKAT}</li>
Steve Block4e584df2012-04-24 23:12:47 +010054 * </ul>
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070055 */
56 // XXX: These must match LayoutAlgorithm in Settings.h in WebCore.
57 public enum LayoutAlgorithm {
58 NORMAL,
John Reck5a1ef4132011-10-26 10:37:00 -070059 /**
60 * @deprecated This algorithm is now obsolete.
61 */
62 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070063 SINGLE_COLUMN,
Mikhail Naganov94e0bd32012-12-14 17:01:25 +000064 /**
Jonathan Dixon5545d082013-08-31 22:43:11 -070065 * @deprecated This algorithm is now obsolete.
Mikhail Naganov94e0bd32012-12-14 17:01:25 +000066 */
Jonathan Dixon5545d082013-08-31 22:43:11 -070067 @Deprecated
68 NARROW_COLUMNS,
Mikhail Naganov94e0bd32012-12-14 17:01:25 +000069 TEXT_AUTOSIZING
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070070 }
71
72 /**
73 * Enum for specifying the text size.
Steve Block4e584df2012-04-24 23:12:47 +010074 * <ul>
75 * <li>SMALLEST is 50%</li>
76 * <li>SMALLER is 75%</li>
77 * <li>NORMAL is 100%</li>
78 * <li>LARGER is 150%</li>
79 * <li>LARGEST is 200%</li>
80 * </ul>
81 *
John Reckcaeb1202011-06-17 11:50:15 -070082 * @deprecated Use {@link WebSettings#setTextZoom(int)} and {@link WebSettings#getTextZoom()} instead.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070083 */
Aurimas Liutikas514c5ef2016-05-24 15:22:55 -070084 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070085 public enum TextSize {
86 SMALLEST(50),
87 SMALLER(75),
88 NORMAL(100),
89 LARGER(150),
90 LARGEST(200);
91 TextSize(int size) {
92 value = size;
93 }
94 int value;
95 }
Grace Kloba0d8b77c2009-06-25 11:20:51 -070096
97 /**
98 * Enum for specifying the WebView's desired density.
Steve Block4e584df2012-04-24 23:12:47 +010099 * <ul>
100 * <li>FAR makes 100% looking like in 240dpi</li>
101 * <li>MEDIUM makes 100% looking like in 160dpi</li>
102 * <li>CLOSE makes 100% looking like in 120dpi</li>
103 * </ul>
Grace Kloba0d8b77c2009-06-25 11:20:51 -0700104 */
105 public enum ZoomDensity {
106 FAR(150), // 240dpi
107 MEDIUM(100), // 160dpi
108 CLOSE(75); // 120dpi
109 ZoomDensity(int size) {
110 value = size;
111 }
Mikhail Naganovce76ca52012-07-27 12:00:05 +0100112
113 /**
114 * @hide Only for use by WebViewProvider implementations
115 */
116 public int getValue() {
117 return value;
118 }
119
Grace Kloba0d8b77c2009-06-25 11:20:51 -0700120 int value;
121 }
122
Tim Volodineb90f5382016-04-29 12:44:41 +0100123 /** @hide */
124 @IntDef({LOAD_DEFAULT, LOAD_NORMAL, LOAD_CACHE_ELSE_NETWORK, LOAD_NO_CACHE, LOAD_CACHE_ONLY})
125 @Retention(RetentionPolicy.SOURCE)
126 public @interface CacheMode {}
127
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700128 /**
Mikhail Naganov500b0032012-07-25 13:06:14 +0100129 * Default cache usage mode. If the navigation type doesn't impose any
130 * specific behavior, use cached resources when they are available
131 * and not expired, otherwise load resources from the network.
132 * Use with {@link #setCacheMode}.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700133 */
134 public static final int LOAD_DEFAULT = -1;
135
136 /**
Mikhail Naganov500b0032012-07-25 13:06:14 +0100137 * Normal cache usage mode. Use with {@link #setCacheMode}.
Mikhail Naganov56936a12012-07-25 13:07:18 +0100138 *
139 * @deprecated This value is obsolete, as from API level
140 * {@link android.os.Build.VERSION_CODES#HONEYCOMB} and onwards it has the
141 * same effect as {@link #LOAD_DEFAULT}.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700142 */
Kristian Monsen5cc23512012-08-09 15:33:08 -0400143 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700144 public static final int LOAD_NORMAL = 0;
145
146 /**
Mikhail Naganov500b0032012-07-25 13:06:14 +0100147 * Use cached resources when they are available, even if they have expired.
148 * Otherwise load resources from the network.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700149 * Use with {@link #setCacheMode}.
150 */
151 public static final int LOAD_CACHE_ELSE_NETWORK = 1;
152
153 /**
Mikhail Naganov500b0032012-07-25 13:06:14 +0100154 * Don't use the cache, load from the network.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700155 * Use with {@link #setCacheMode}.
156 */
157 public static final int LOAD_NO_CACHE = 2;
Michael Kolba172e7d2010-06-30 12:35:26 -0700158
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700159 /**
Mikhail Naganov500b0032012-07-25 13:06:14 +0100160 * Don't use the network, load from the cache.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700161 * Use with {@link #setCacheMode}.
162 */
163 public static final int LOAD_CACHE_ONLY = 3;
164
165 public enum RenderPriority {
166 NORMAL,
167 HIGH,
168 LOW
169 }
170
Patrick Scott300f2e92010-03-22 10:20:45 -0400171 /**
172 * The plugin state effects how plugins are treated on a page. ON means
173 * that any object will be loaded even if a plugin does not exist to handle
174 * the content. ON_DEMAND means that if there is a plugin installed that
175 * can handle the content, a placeholder is shown until the user clicks on
176 * the placeholder. Once clicked, the plugin will be enabled on the page.
177 * OFF means that all plugins will be turned off and any fallback content
178 * will be used.
179 */
180 public enum PluginState {
181 ON,
182 ON_DEMAND,
183 OFF
184 }
185
Ben Murdoche9e3ccd2010-10-06 14:33:02 +0100186 /**
Ben Murdochfe9fc3d2014-04-10 15:31:06 +0100187 * Used with {@link #setMixedContentMode}
188 *
189 * In this mode, the WebView will allow a secure origin to load content from any other origin,
190 * even if that origin is insecure. This is the least secure mode of operation for the WebView,
191 * and where possible apps should not set this mode.
192 */
193 public static final int MIXED_CONTENT_ALWAYS_ALLOW = 0;
194
195 /**
196 * Used with {@link #setMixedContentMode}
197 *
198 * In this mode, the WebView will not allow a secure origin to load content from an insecure
199 * origin. This is the preferred and most secure mode of operation for the WebView and apps are
200 * strongly advised to use this mode.
201 */
202 public static final int MIXED_CONTENT_NEVER_ALLOW = 1;
203
204 /**
205 * Used with {@link #setMixedContentMode}
206 *
207 * In this mode, the WebView will attempt to be compatible with the approach of a modern web
208 * browser with regard to mixed content. Some insecure content may be allowed to be loaded by
209 * a secure origin and other types of content will be blocked. The types of content are allowed
210 * or blocked may change release to release and are not explicitly defined.
211 *
212 * This mode is intended to be used by apps that are not in control of the content that they
213 * render but desire to operate in a reasonably secure environment. For highest security, apps
214 * are recommended to use {@link #MIXED_CONTENT_NEVER_ALLOW}.
215 */
216 public static final int MIXED_CONTENT_COMPATIBILITY_MODE = 2;
217
218 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100219 * Enables dumping the pages navigation cache to a text file. The default
220 * is false.
Steve Block4e584df2012-04-24 23:12:47 +0100221 *
Kristian Monsenfc771652011-05-10 16:44:05 +0100222 * @deprecated This method is now obsolete.
Kristian Monsenf4912582012-08-16 15:26:24 -0400223 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700224 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000225 @SystemApi
Kristian Monsenfc771652011-05-10 16:44:05 +0100226 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000227 public abstract void setNavDump(boolean enabled);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700228
229 /**
Steve Block4e584df2012-04-24 23:12:47 +0100230 * Gets whether dumping the navigation cache is enabled.
231 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100232 * @return whether dumping the navigation cache is enabled
233 * @see #setNavDump
Kristian Monsenfc771652011-05-10 16:44:05 +0100234 * @deprecated This method is now obsolete.
Kristian Monsenf4912582012-08-16 15:26:24 -0400235 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700236 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000237 @SystemApi
Kristian Monsenfc771652011-05-10 16:44:05 +0100238 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000239 public abstract boolean getNavDump();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700240
241 /**
Mikhail Naganovb533fb42012-04-05 14:50:02 +0100242 * Sets whether the WebView should support zooming using its on-screen zoom
243 * controls and gestures. The particular zoom mechanisms that should be used
244 * can be set with {@link #setBuiltInZoomControls}. This setting does not
245 * affect zooming performed using the {@link WebView#zoomIn()} and
Steve Block4e584df2012-04-24 23:12:47 +0100246 * {@link WebView#zoomOut()} methods. The default is true.
247 *
248 * @param support whether the WebView should support zoom
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700249 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000250 public abstract void setSupportZoom(boolean support);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700251
252 /**
Steve Block4e584df2012-04-24 23:12:47 +0100253 * Gets whether the WebView supports zoom.
254 *
255 * @return true if the WebView supports zoom
256 * @see #setSupportZoom
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700257 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000258 public abstract boolean supportZoom();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700259
260 /**
Teng-Hui Zhu0e5b1602012-07-17 17:19:13 -0700261 * Sets whether the WebView requires a user gesture to play media.
262 * The default is true.
263 *
264 * @param require whether the WebView requires a user gesture to play media
265 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000266 public abstract void setMediaPlaybackRequiresUserGesture(boolean require);
Teng-Hui Zhu0e5b1602012-07-17 17:19:13 -0700267
268 /**
269 * Gets whether the WebView requires a user gesture to play media.
270 *
271 * @return true if the WebView requires a user gesture to play media
272 * @see #setMediaPlaybackRequiresUserGesture
273 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000274 public abstract boolean getMediaPlaybackRequiresUserGesture();
Teng-Hui Zhu0e5b1602012-07-17 17:19:13 -0700275
276 /**
Steve Block06d268e2012-04-16 14:10:54 +0100277 * Sets whether the WebView should use its built-in zoom mechanisms. The
278 * built-in zoom mechanisms comprise on-screen zoom controls, which are
279 * displayed over the WebView's content, and the use of a pinch gesture to
280 * control zooming. Whether or not these on-screen controls are displayed
Steve Block4e584df2012-04-24 23:12:47 +0100281 * can be set with {@link #setDisplayZoomControls}. The default is false.
Steve Block06d268e2012-04-16 14:10:54 +0100282 * <p>
283 * The built-in mechanisms are the only currently supported zoom
284 * mechanisms, so it is recommended that this setting is always enabled.
Steve Block4e584df2012-04-24 23:12:47 +0100285 *
286 * @param enabled whether the WebView should use its built-in zoom mechanisms
The Android Open Source Project10592532009-03-18 17:39:46 -0700287 */
Steve Block06d268e2012-04-16 14:10:54 +0100288 // This method was intended to select between the built-in zoom mechanisms
289 // and the separate zoom controls. The latter were obtained using
290 // {@link WebView#getZoomControls}, which is now hidden.
Ignacio Solla451e3382014-11-10 10:35:54 +0000291 public abstract void setBuiltInZoomControls(boolean enabled);
Michael Kolba172e7d2010-06-30 12:35:26 -0700292
The Android Open Source Project10592532009-03-18 17:39:46 -0700293 /**
Steve Block4e584df2012-04-24 23:12:47 +0100294 * Gets whether the zoom mechanisms built into WebView are being used.
295 *
296 * @return true if the zoom mechanisms built into WebView are being used
297 * @see #setBuiltInZoomControls
The Android Open Source Project10592532009-03-18 17:39:46 -0700298 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000299 public abstract boolean getBuiltInZoomControls();
Michael Kolba172e7d2010-06-30 12:35:26 -0700300
The Android Open Source Project10592532009-03-18 17:39:46 -0700301 /**
Mikhail Naganovb533fb42012-04-05 14:50:02 +0100302 * Sets whether the WebView should display on-screen zoom controls when
303 * using the built-in zoom mechanisms. See {@link #setBuiltInZoomControls}.
Steve Block4e584df2012-04-24 23:12:47 +0100304 * The default is true.
305 *
306 * @param enabled whether the WebView should display on-screen zoom controls
Michael Kolb6fe3b422010-08-19 12:41:24 -0700307 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000308 public abstract void setDisplayZoomControls(boolean enabled);
Michael Kolb6fe3b422010-08-19 12:41:24 -0700309
310 /**
Steve Block4e584df2012-04-24 23:12:47 +0100311 * Gets whether the WebView displays on-screen zoom controls when using
Mikhail Naganovb533fb42012-04-05 14:50:02 +0100312 * the built-in zoom mechanisms.
Steve Block4e584df2012-04-24 23:12:47 +0100313 *
314 * @return true if the WebView displays on-screen zoom controls when using
315 * the built-in zoom mechanisms
316 * @see #setDisplayZoomControls
Michael Kolb6fe3b422010-08-19 12:41:24 -0700317 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000318 public abstract boolean getDisplayZoomControls();
Michael Kolb6fe3b422010-08-19 12:41:24 -0700319
320 /**
Steve Block4e584df2012-04-24 23:12:47 +0100321 * Enables or disables file access within WebView. File access is enabled by
Patrick Scottd1737ed2011-01-05 11:36:48 -0500322 * default. Note that this enables or disables file system access only.
323 * Assets and resources are still accessible using file:///android_asset and
324 * file:///android_res.
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800325 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000326 public abstract void setAllowFileAccess(boolean allow);
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800327
328 /**
Steve Block4e584df2012-04-24 23:12:47 +0100329 * Gets whether this WebView supports file access.
330 *
331 * @see #setAllowFileAccess
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800332 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000333 public abstract boolean getAllowFileAccess();
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800334
335 /**
Steve Block4e584df2012-04-24 23:12:47 +0100336 * Enables or disables content URL access within WebView. Content URL
337 * access allows WebView to load content from a content provider installed
338 * in the system. The default is enabled.
Patrick Scottd1737ed2011-01-05 11:36:48 -0500339 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000340 public abstract void setAllowContentAccess(boolean allow);
Patrick Scottd1737ed2011-01-05 11:36:48 -0500341
342 /**
Steve Block4e584df2012-04-24 23:12:47 +0100343 * Gets whether this WebView supports content URL access.
344 *
345 * @see #setAllowContentAccess
Patrick Scottd1737ed2011-01-05 11:36:48 -0500346 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000347 public abstract boolean getAllowContentAccess();
Patrick Scottd1737ed2011-01-05 11:36:48 -0500348
349 /**
Mikhail Naganov00303362013-09-02 10:57:04 +0100350 * Sets whether the WebView loads pages in overview mode, that is,
351 * zooms out the content to fit on screen by width. This setting is
352 * taken into account when the content width is greater than the width
353 * of the WebView control, for example, when {@link #getUseWideViewPort}
354 * is enabled. The default is false.
Grace Klobae397a882009-08-06 12:04:14 -0700355 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000356 public abstract void setLoadWithOverviewMode(boolean overview);
Grace Klobae397a882009-08-06 12:04:14 -0700357
358 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100359 * Gets whether this WebView loads pages in overview mode.
360 *
361 * @return whether this WebView loads pages in overview mode
362 * @see #setLoadWithOverviewMode
Grace Klobae397a882009-08-06 12:04:14 -0700363 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000364 public abstract boolean getLoadWithOverviewMode();
Grace Klobae397a882009-08-06 12:04:14 -0700365
366 /**
Steve Block4e584df2012-04-24 23:12:47 +0100367 * Sets whether the WebView will enable smooth transition while panning or
Adam Powelle00e8a782011-09-11 17:48:42 -0700368 * zooming or while the window hosting the WebView does not have focus.
369 * If it is true, WebView will choose a solution to maximize the performance.
370 * e.g. the WebView's content may not be updated during the transition.
371 * If it is false, WebView will keep its fidelity. The default value is false.
Kristian Monsen5cc23512012-08-09 15:33:08 -0400372 *
373 * @deprecated This method is now obsolete, and will become a no-op in future.
Grace Klobaf9b731d2010-06-21 19:23:57 -0700374 */
Kristian Monsen5cc23512012-08-09 15:33:08 -0400375 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000376 public abstract void setEnableSmoothTransition(boolean enable);
Steve Block4e584df2012-04-24 23:12:47 +0100377
Grace Klobaf9b731d2010-06-21 19:23:57 -0700378 /**
Steve Block4e584df2012-04-24 23:12:47 +0100379 * Gets whether the WebView enables smooth transition while panning or
Grace Klobaf9b731d2010-06-21 19:23:57 -0700380 * zooming.
Steve Block4e584df2012-04-24 23:12:47 +0100381 *
382 * @see #setEnableSmoothTransition
Kristian Monsen5cc23512012-08-09 15:33:08 -0400383 *
384 * @deprecated This method is now obsolete, and will become a no-op in future.
Grace Klobaf9b731d2010-06-21 19:23:57 -0700385 */
Kristian Monsen5cc23512012-08-09 15:33:08 -0400386 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000387 public abstract boolean enableSmoothTransition();
Grace Klobaf9b731d2010-06-21 19:23:57 -0700388
389 /**
Steve Block4e584df2012-04-24 23:12:47 +0100390 * Sets whether the WebView uses its background for over scroll background.
Adam Powell637d3372010-08-25 14:37:03 -0700391 * If true, it will use the WebView's background. If false, it will use an
392 * internal pattern. Default is true.
Steve Block4e584df2012-04-24 23:12:47 +0100393 *
Kristian Monsenfc771652011-05-10 16:44:05 +0100394 * @deprecated This method is now obsolete.
Kristian Monsend0b90d32012-09-24 12:30:45 -0400395 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
Adam Powell637d3372010-08-25 14:37:03 -0700396 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000397 @SystemApi
Kristian Monsenfc771652011-05-10 16:44:05 +0100398 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000399 public abstract void setUseWebViewBackgroundForOverscrollBackground(boolean view);
Adam Powell637d3372010-08-25 14:37:03 -0700400
401 /**
Steve Block4e584df2012-04-24 23:12:47 +0100402 * Gets whether this WebView uses WebView's background instead of
Adam Powell637d3372010-08-25 14:37:03 -0700403 * internal pattern for over scroll background.
Steve Block4e584df2012-04-24 23:12:47 +0100404 *
405 * @see #setUseWebViewBackgroundForOverscrollBackground
Kristian Monsenfc771652011-05-10 16:44:05 +0100406 * @deprecated This method is now obsolete.
Kristian Monsenf4912582012-08-16 15:26:24 -0400407 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
Adam Powell637d3372010-08-25 14:37:03 -0700408 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000409 @SystemApi
Kristian Monsenfc771652011-05-10 16:44:05 +0100410 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000411 public abstract boolean getUseWebViewBackgroundForOverscrollBackground();
Adam Powell637d3372010-08-25 14:37:03 -0700412
413 /**
Selim Gurun13e5b0b2017-04-03 14:29:14 -0700414 * Sets whether the WebView should save form data. In Android O, the
415 * platform has implemented a fully functional Autofill feature to store
416 * form data. Therefore, the Webview form data save feature is disabled.
417 *
418 * Note that the feature will continue to be supported on older versions of
419 * Android as before.
420 *
421 * This function does not have any effect.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700422 */
Selim Gurun13e5b0b2017-04-03 14:29:14 -0700423 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000424 public abstract void setSaveFormData(boolean save);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700425
426 /**
Selim Gurun5c11ef12013-01-04 14:58:36 -0800427 * Gets whether the WebView saves form data.
Steve Blockb0e0f332012-06-13 22:01:11 +0100428 *
429 * @return whether the WebView saves form data
430 * @see #setSaveFormData
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700431 */
Selim Gurun13e5b0b2017-04-03 14:29:14 -0700432 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000433 public abstract boolean getSaveFormData();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700434
435 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100436 * Sets whether the WebView should save passwords. The default is true.
Jonathan Dixon835b1fc2013-02-25 12:29:33 -0800437 * @deprecated Saving passwords in WebView will not be supported in future versions.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700438 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -0800439 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000440 public abstract void setSavePassword(boolean save);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700441
442 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100443 * Gets whether the WebView saves passwords.
444 *
445 * @return whether the WebView saves passwords
446 * @see #setSavePassword
Jonathan Dixon835b1fc2013-02-25 12:29:33 -0800447 * @deprecated Saving passwords in WebView will not be supported in future versions.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700448 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -0800449 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000450 public abstract boolean getSavePassword();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700451
452 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100453 * Sets the text zoom of the page in percent. The default is 100.
Steve Block4e584df2012-04-24 23:12:47 +0100454 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100455 * @param textZoom the text zoom in percent
John Reckff56bcd2011-06-16 17:12:08 -0700456 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000457 public abstract void setTextZoom(int textZoom);
John Reckff56bcd2011-06-16 17:12:08 -0700458
459 /**
Steve Block4e584df2012-04-24 23:12:47 +0100460 * Gets the text zoom of the page in percent.
461 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100462 * @return the text zoom of the page in percent
Mikhail Naganov1202d662012-08-07 18:26:52 +0100463 * @see #setTextZoom
John Reckff56bcd2011-06-16 17:12:08 -0700464 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000465 public abstract int getTextZoom();
John Reckff56bcd2011-06-16 17:12:08 -0700466
467 /**
Hector Dearmanfc9a27a2014-06-05 13:45:28 +0100468 * Sets policy for third party cookies.
469 * Developers should access this via {@link CookieManager#setShouldAcceptThirdPartyCookies}.
470 * @hide Internal API.
471 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000472 @SystemApi
473 public abstract void setAcceptThirdPartyCookies(boolean accept);
Hector Dearmanfc9a27a2014-06-05 13:45:28 +0100474
475 /**
476 * Gets policy for third party cookies.
477 * Developers should access this via {@link CookieManager#getShouldAcceptThirdPartyCookies}.
478 * @hide Internal API
479 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000480 @SystemApi
481 public abstract boolean getAcceptThirdPartyCookies();
Hector Dearmanfc9a27a2014-06-05 13:45:28 +0100482
483 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100484 * Sets the text size of the page. The default is {@link TextSize#NORMAL}.
Steve Block4e584df2012-04-24 23:12:47 +0100485 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100486 * @param t the text size as a {@link TextSize} value
487 * @deprecated Use {@link #setTextZoom} instead.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700488 */
Aurimas Liutikas514c5ef2016-05-24 15:22:55 -0700489 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700490 public synchronized void setTextSize(TextSize t) {
Mikhail Naganov1202d662012-08-07 18:26:52 +0100491 setTextZoom(t.value);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700492 }
493
494 /**
Steve Block4e584df2012-04-24 23:12:47 +0100495 * Gets the text size of the page. If the text size was previously specified
Steve Blockb0e0f332012-06-13 22:01:11 +0100496 * in percent using {@link #setTextZoom}, this will return the closest
497 * matching {@link TextSize}.
Steve Block4e584df2012-04-24 23:12:47 +0100498 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100499 * @return the text size as a {@link TextSize} value
500 * @see #setTextSize
501 * @deprecated Use {@link #getTextZoom} instead.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700502 */
Aurimas Liutikas514c5ef2016-05-24 15:22:55 -0700503 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700504 public synchronized TextSize getTextSize() {
Mikhail Naganov1202d662012-08-07 18:26:52 +0100505 TextSize closestSize = null;
506 int smallestDelta = Integer.MAX_VALUE;
507 int textSize = getTextZoom();
508 for (TextSize size : TextSize.values()) {
509 int delta = Math.abs(textSize - size.value);
510 if (delta == 0) {
511 return size;
512 }
513 if (delta < smallestDelta) {
514 smallestDelta = delta;
515 closestSize = size;
516 }
517 }
518 return closestSize != null ? closestSize : TextSize.NORMAL;
Mangesh Ghiwareedb528e2011-10-12 14:25:41 -0700519 }
520
521 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100522 * Sets the default zoom density of the page. This must be called from the UI
523 * thread. The default is {@link ZoomDensity#MEDIUM}.
Steve Block4e584df2012-04-24 23:12:47 +0100524 *
Mikhail Naganov8887b2b2013-05-28 10:34:43 +0100525 * This setting is not recommended for use in new applications. If the WebView
526 * is utilized to display mobile-oriented pages, the desired effect can be achieved by
527 * adjusting 'width' and 'initial-scale' attributes of page's 'meta viewport'
528 * tag. For pages lacking the tag, {@link android.webkit.WebView#setInitialScale}
529 * and {@link #setUseWideViewPort} can be used.
530 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100531 * @param zoom the zoom density
Jonathan Dixon5545d082013-08-31 22:43:11 -0700532 * @deprecated This method is no longer supported, see the function documentation for
533 * recommended alternatives.
Grace Kloba0d8b77c2009-06-25 11:20:51 -0700534 */
Jonathan Dixon5545d082013-08-31 22:43:11 -0700535 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000536 public abstract void setDefaultZoom(ZoomDensity zoom);
Grace Kloba0d8b77c2009-06-25 11:20:51 -0700537
538 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100539 * Gets the default zoom density of the page. This should be called from
540 * the UI thread.
541 *
Mikhail Naganov8887b2b2013-05-28 10:34:43 +0100542 * This setting is not recommended for use in new applications.
543 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100544 * @return the zoom density
545 * @see #setDefaultZoom
Jonathan Dixon5545d082013-08-31 22:43:11 -0700546 * @deprecated Will only return the default value.
Grace Kloba0d8b77c2009-06-25 11:20:51 -0700547 */
Aurimas Liutikas514c5ef2016-05-24 15:22:55 -0700548 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000549 public abstract ZoomDensity getDefaultZoom();
Grace Kloba0d8b77c2009-06-25 11:20:51 -0700550
551 /**
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700552 * Enables using light touches to make a selection and activate mouseovers.
Jonathan Dixon835b1fc2013-02-25 12:29:33 -0800553 * @deprecated From {@link android.os.Build.VERSION_CODES#JELLY_BEAN} this
554 * setting is obsolete and has no effect.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700555 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -0800556 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000557 public abstract void setLightTouchEnabled(boolean enabled);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700558
559 /**
Steve Block4e584df2012-04-24 23:12:47 +0100560 * Gets whether light touches are enabled.
Steve Blockb0e0f332012-06-13 22:01:11 +0100561 * @see #setLightTouchEnabled
Jonathan Dixon98fac172013-02-28 15:32:10 -0800562 * @deprecated This setting is obsolete.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700563 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -0800564 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000565 public abstract boolean getLightTouchEnabled();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700566
567 /**
Steve Block4e584df2012-04-24 23:12:47 +0100568 * Controlled a rendering optimization that is no longer present. Setting
569 * it now has no effect.
570 *
571 * @deprecated This setting now has no effect.
Kristian Monsenf4912582012-08-16 15:26:24 -0400572 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700573 */
Mike Hearnadcd2ed2009-01-21 16:44:36 +0100574 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000575 public void setUseDoubleTree(boolean use) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000576 // Specified to do nothing, so no need for derived classes to override.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700577 }
578
579 /**
Steve Block4e584df2012-04-24 23:12:47 +0100580 * Controlled a rendering optimization that is no longer present. Setting
581 * it now has no effect.
582 *
583 * @deprecated This setting now has no effect.
Kristian Monsenf4912582012-08-16 15:26:24 -0400584 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700585 */
Mike Hearnadcd2ed2009-01-21 16:44:36 +0100586 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000587 public boolean getUseDoubleTree() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000588 // Returns false unconditionally, so no need for derived classes to override.
Mike Hearnadcd2ed2009-01-21 16:44:36 +0100589 return false;
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700590 }
591
592 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100593 * Sets the user-agent string using an integer code.
594 * <ul>
595 * <li>0 means the WebView should use an Android user-agent string</li>
596 * <li>1 means the WebView should use a desktop user-agent string</li>
597 * </ul>
598 * Other values are ignored. The default is an Android user-agent string,
599 * i.e. code value 0.
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800600 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100601 * @param ua the integer code for the user-agent string
602 * @deprecated Please use {@link #setUserAgentString} instead.
Kristian Monsenf4912582012-08-16 15:26:24 -0400603 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700604 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000605 @SystemApi
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800606 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000607 public abstract void setUserAgent(int ua);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700608
609 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100610 * Gets the user-agent as an integer code.
611 * <ul>
612 * <li>-1 means the WebView is using a custom user-agent string set with
613 * {@link #setUserAgentString}</li>
614 * <li>0 means the WebView should use an Android user-agent string</li>
615 * <li>1 means the WebView should use a desktop user-agent string</li>
616 * </ul>
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800617 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100618 * @return the integer code for the user-agent string
619 * @see #setUserAgent
620 * @deprecated Please use {@link #getUserAgentString} instead.
Kristian Monsenf4912582012-08-16 15:26:24 -0400621 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700622 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000623 @SystemApi
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800624 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000625 public abstract int getUserAgent();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700626
627 /**
Mikhail Naganovcb000a62013-01-04 18:02:54 +0000628 * Sets whether the WebView should enable support for the &quot;viewport&quot;
629 * HTML meta tag or should use a wide viewport.
630 * When the value of the setting is false, the layout width is always set to the
631 * width of the WebView control in device-independent (CSS) pixels.
632 * When the value is true and the page contains the viewport meta tag, the value
633 * of the width specified in the tag is used. If the page does not contain the tag or
634 * does not provide a width, then a wide viewport will be used.
Steve Blockb0e0f332012-06-13 22:01:11 +0100635 *
Mikhail Naganovcb000a62013-01-04 18:02:54 +0000636 * @param use whether to enable support for the viewport meta tag
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700637 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000638 public abstract void setUseWideViewPort(boolean use);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700639
640 /**
Mikhail Naganovcb000a62013-01-04 18:02:54 +0000641 * Gets whether the WebView supports the &quot;viewport&quot;
642 * HTML meta tag or will use a wide viewport.
Steve Block4e584df2012-04-24 23:12:47 +0100643 *
Mikhail Naganovcb000a62013-01-04 18:02:54 +0000644 * @return true if the WebView supports the viewport meta tag
Steve Blockb0e0f332012-06-13 22:01:11 +0100645 * @see #setUseWideViewPort
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700646 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000647 public abstract boolean getUseWideViewPort();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700648
649 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100650 * Sets whether the WebView whether supports multiple windows. If set to
651 * true, {@link WebChromeClient#onCreateWindow} must be implemented by the
652 * host application. The default is false.
653 *
654 * @param support whether to suport multiple windows
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700655 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000656 public abstract void setSupportMultipleWindows(boolean support);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700657
658 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100659 * Gets whether the WebView supports multiple windows.
Steve Block4e584df2012-04-24 23:12:47 +0100660 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100661 * @return true if the WebView supports multiple windows
662 * @see #setSupportMultipleWindows
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700663 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000664 public abstract boolean supportMultipleWindows();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700665
666 /**
Steve Block4e584df2012-04-24 23:12:47 +0100667 * Sets the underlying layout algorithm. This will cause a relayout of the
Steve Blockb0e0f332012-06-13 22:01:11 +0100668 * WebView. The default is {@link LayoutAlgorithm#NARROW_COLUMNS}.
Steve Block4e584df2012-04-24 23:12:47 +0100669 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100670 * @param l the layout algorithm to use, as a {@link LayoutAlgorithm} value
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700671 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000672 public abstract void setLayoutAlgorithm(LayoutAlgorithm l);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700673
674 /**
Steve Block4e584df2012-04-24 23:12:47 +0100675 * Gets the current layout algorithm.
676 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100677 * @return the layout algorithm in use, as a {@link LayoutAlgorithm} value
Steve Block4e584df2012-04-24 23:12:47 +0100678 * @see #setLayoutAlgorithm
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700679 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000680 public abstract LayoutAlgorithm getLayoutAlgorithm();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700681
682 /**
Steve Block4e584df2012-04-24 23:12:47 +0100683 * Sets the standard font family name. The default is "sans-serif".
684 *
685 * @param font a font family name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700686 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000687 public abstract void setStandardFontFamily(String font);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700688
689 /**
Steve Block4e584df2012-04-24 23:12:47 +0100690 * Gets the standard font family name.
691 *
692 * @return the standard font family name as a string
693 * @see #setStandardFontFamily
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700694 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000695 public abstract String getStandardFontFamily();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700696
697 /**
Steve Block4e584df2012-04-24 23:12:47 +0100698 * Sets the fixed font family name. The default is "monospace".
699 *
700 * @param font a font family name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700701 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000702 public abstract void setFixedFontFamily(String font);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700703
704 /**
Steve Block4e584df2012-04-24 23:12:47 +0100705 * Gets the fixed font family name.
706 *
707 * @return the fixed font family name as a string
708 * @see #setFixedFontFamily
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700709 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000710 public abstract String getFixedFontFamily();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700711
712 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100713 * Sets the sans-serif font family name. The default is "sans-serif".
Steve Block4e584df2012-04-24 23:12:47 +0100714 *
715 * @param font a font family name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700716 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000717 public abstract void setSansSerifFontFamily(String font);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700718
719 /**
Steve Block4e584df2012-04-24 23:12:47 +0100720 * Gets the sans-serif font family name.
721 *
722 * @return the sans-serif font family name as a string
Steve Blockb0e0f332012-06-13 22:01:11 +0100723 * @see #setSansSerifFontFamily
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700724 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000725 public abstract String getSansSerifFontFamily();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700726
727 /**
Steve Block4e584df2012-04-24 23:12:47 +0100728 * Sets the serif font family name. The default is "sans-serif".
729 *
730 * @param font a font family name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700731 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000732 public abstract void setSerifFontFamily(String font);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700733
734 /**
Steve Block4e584df2012-04-24 23:12:47 +0100735 * Gets the serif font family name. The default is "serif".
736 *
737 * @return the serif font family name as a string
738 * @see #setSerifFontFamily
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700739 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000740 public abstract String getSerifFontFamily();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700741
742 /**
Steve Block4e584df2012-04-24 23:12:47 +0100743 * Sets the cursive font family name. The default is "cursive".
744 *
745 * @param font a font family name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700746 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000747 public abstract void setCursiveFontFamily(String font);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700748
749 /**
Steve Block4e584df2012-04-24 23:12:47 +0100750 * Gets the cursive font family name.
751 *
752 * @return the cursive font family name as a string
753 * @see #setCursiveFontFamily
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700754 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000755 public abstract String getCursiveFontFamily();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700756
757 /**
Steve Block4e584df2012-04-24 23:12:47 +0100758 * Sets the fantasy font family name. The default is "fantasy".
759 *
760 * @param font a font family name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700761 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000762 public abstract void setFantasyFontFamily(String font);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700763
764 /**
Steve Block4e584df2012-04-24 23:12:47 +0100765 * Gets the fantasy font family name.
766 *
767 * @return the fantasy font family name as a string
768 * @see #setFantasyFontFamily
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700769 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000770 public abstract String getFantasyFontFamily();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700771
772 /**
Steve Block4e584df2012-04-24 23:12:47 +0100773 * Sets the minimum font size. The default is 8.
774 *
775 * @param size a non-negative integer between 1 and 72. Any number outside
776 * the specified range will be pinned.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700777 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000778 public abstract void setMinimumFontSize(int size);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700779
780 /**
Steve Block4e584df2012-04-24 23:12:47 +0100781 * Gets the minimum font size.
782 *
783 * @return a non-negative integer between 1 and 72
784 * @see #setMinimumFontSize
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700785 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000786 public abstract int getMinimumFontSize();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700787
788 /**
Steve Block4e584df2012-04-24 23:12:47 +0100789 * Sets the minimum logical font size. The default is 8.
790 *
791 * @param size a non-negative integer between 1 and 72. Any number outside
792 * the specified range will be pinned.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700793 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000794 public abstract void setMinimumLogicalFontSize(int size);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700795
796 /**
Steve Block4e584df2012-04-24 23:12:47 +0100797 * Gets the minimum logical font size.
798 *
799 * @return a non-negative integer between 1 and 72
800 * @see #setMinimumLogicalFontSize
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700801 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000802 public abstract int getMinimumLogicalFontSize();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700803
804 /**
Steve Block4e584df2012-04-24 23:12:47 +0100805 * Sets the default font size. The default is 16.
806 *
807 * @param size a non-negative integer between 1 and 72. Any number outside
808 * the specified range will be pinned.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700809 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000810 public abstract void setDefaultFontSize(int size);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700811
812 /**
Steve Block4e584df2012-04-24 23:12:47 +0100813 * Gets the default font size.
814 *
815 * @return a non-negative integer between 1 and 72
816 * @see #setDefaultFontSize
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700817 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000818 public abstract int getDefaultFontSize();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700819
820 /**
Steve Block4e584df2012-04-24 23:12:47 +0100821 * Sets the default fixed font size. The default is 16.
822 *
823 * @param size a non-negative integer between 1 and 72. Any number outside
824 * the specified range will be pinned.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700825 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000826 public abstract void setDefaultFixedFontSize(int size);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700827
828 /**
Steve Block4e584df2012-04-24 23:12:47 +0100829 * Gets the default fixed font size.
830 *
831 * @return a non-negative integer between 1 and 72
832 * @see #setDefaultFixedFontSize
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700833 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000834 public abstract int getDefaultFixedFontSize();
Grace Kloba097b1e772009-11-24 14:23:18 -0800835
836 /**
Mikhail Naganov605a4912012-02-03 16:53:10 +0000837 * Sets whether the WebView should load image resources. Note that this method
838 * controls loading of all images, including those embedded using the data
839 * URI scheme. Use {@link #setBlockNetworkImage} to control loading only
840 * of images specified using network URI schemes. Note that if the value of this
841 * setting is changed from false to true, all images resources referenced
842 * by content currently displayed by the WebView are loaded automatically.
Steve Block4e584df2012-04-24 23:12:47 +0100843 * The default is true.
844 *
845 * @param flag whether the WebView should load image resources
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700846 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000847 public abstract void setLoadsImagesAutomatically(boolean flag);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700848
849 /**
Steve Block4e584df2012-04-24 23:12:47 +0100850 * Gets whether the WebView loads image resources. This includes
851 * images embedded using the data URI scheme.
852 *
853 * @return true if the WebView loads image resources
854 * @see #setLoadsImagesAutomatically
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700855 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000856 public abstract boolean getLoadsImagesAutomatically();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700857
858 /**
Mikhail Naganov605a4912012-02-03 16:53:10 +0000859 * Sets whether the WebView should not load image resources from the
860 * network (resources accessed via http and https URI schemes). Note
861 * that this method has no effect unless
862 * {@link #getLoadsImagesAutomatically} returns true. Also note that
863 * disabling all network loads using {@link #setBlockNetworkLoads}
864 * will also prevent network images from loading, even if this flag is set
865 * to false. When the value of this setting is changed from true to false,
866 * network images resources referenced by content currently displayed by
Steve Block4e584df2012-04-24 23:12:47 +0100867 * the WebView are fetched automatically. The default is false.
868 *
869 * @param flag whether the WebView should not load image resources from the
870 * network
Patrick Scottf43113f2010-02-18 09:13:12 -0500871 * @see #setBlockNetworkLoads
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700872 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000873 public abstract void setBlockNetworkImage(boolean flag);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700874
875 /**
Steve Block4e584df2012-04-24 23:12:47 +0100876 * Gets whether the WebView does not load image resources from the network.
877 *
878 * @return true if the WebView does not load image resources from the network
879 * @see #setBlockNetworkImage
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700880 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000881 public abstract boolean getBlockNetworkImage();
Mike Hearnadcd2ed2009-01-21 16:44:36 +0100882
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800883 /**
Mikhail Naganov605a4912012-02-03 16:53:10 +0000884 * Sets whether the WebView should not load resources from the network.
885 * Use {@link #setBlockNetworkImage} to only avoid loading
886 * image resources. Note that if the value of this setting is
887 * changed from true to false, network resources referenced by content
888 * currently displayed by the WebView are not fetched until
889 * {@link android.webkit.WebView#reload} is called.
890 * If the application does not have the
891 * {@link android.Manifest.permission#INTERNET} permission, attempts to set
892 * a value of false will cause a {@link java.lang.SecurityException}
Steve Block4e584df2012-04-24 23:12:47 +0100893 * to be thrown. The default value is false if the application has the
894 * {@link android.Manifest.permission#INTERNET} permission, otherwise it is
895 * true.
896 *
Tim Volodineb90f5382016-04-29 12:44:41 +0100897 * @param flag true means block network loads by the WebView
Patrick Scottf43113f2010-02-18 09:13:12 -0500898 * @see android.webkit.WebView#reload
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800899 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000900 public abstract void setBlockNetworkLoads(boolean flag);
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800901
902 /**
Steve Block4e584df2012-04-24 23:12:47 +0100903 * Gets whether the WebView does not load any resources from the network.
904 *
905 * @return true if the WebView does not load any resources from the network
906 * @see #setBlockNetworkLoads
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800907 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000908 public abstract boolean getBlockNetworkLoads();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700909
910 /**
Steve Block4e584df2012-04-24 23:12:47 +0100911 * Tells the WebView to enable JavaScript execution.
912 * <b>The default is false.</b>
913 *
914 * @param flag true if the WebView should execute JavaScript
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700915 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000916 public abstract void setJavaScriptEnabled(boolean flag);
Teng-Hui Zhuda7378e2011-02-16 11:25:03 -0800917
918 /**
Steve Blockef163152012-04-23 18:08:06 +0100919 * Sets whether JavaScript running in the context of a file scheme URL
920 * should be allowed to access content from any origin. This includes
921 * access to content from other file scheme URLs. See
922 * {@link #setAllowFileAccessFromFileURLs}. To enable the most restrictive,
923 * and therefore secure policy, this setting should be disabled.
Mikhail Naganov65e7ace2012-08-07 13:57:42 +0100924 * Note that this setting affects only JavaScript access to file scheme
925 * resources. Other access to such resources, for example, from image HTML
Joe Fernandez22b5ba82015-04-22 17:29:12 -0700926 * elements, is unaffected. To prevent possible violation of same domain policy
927 * on {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH} and earlier
928 * devices, you should explicitly set this value to {@code false}.
Steve Blockef163152012-04-23 18:08:06 +0100929 * <p>
930 * The default value is true for API level
931 * {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1} and below,
932 * and false for API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN}
933 * and above.
Selim Gurun0ea6dad2012-03-29 18:19:01 -0700934 *
Steve Blockef163152012-04-23 18:08:06 +0100935 * @param flag whether JavaScript running in the context of a file scheme
936 * URL should be allowed to access content from any origin
Selim Gurun0ea6dad2012-03-29 18:19:01 -0700937 */
938 public abstract void setAllowUniversalAccessFromFileURLs(boolean flag);
939
940 /**
Steve Blockef163152012-04-23 18:08:06 +0100941 * Sets whether JavaScript running in the context of a file scheme URL
942 * should be allowed to access content from other file scheme URLs. To
943 * enable the most restrictive, and therefore secure policy, this setting
944 * should be disabled. Note that the value of this setting is ignored if
945 * the value of {@link #getAllowUniversalAccessFromFileURLs} is true.
Mikhail Naganov65e7ace2012-08-07 13:57:42 +0100946 * Note too, that this setting affects only JavaScript access to file scheme
947 * resources. Other access to such resources, for example, from image HTML
Joe Fernandez22b5ba82015-04-22 17:29:12 -0700948 * elements, is unaffected. To prevent possible violation of same domain policy
949 * on {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH} and earlier
950 * devices, you should explicitly set this value to {@code false}.
Steve Blockef163152012-04-23 18:08:06 +0100951 * <p>
952 * The default value is true for API level
953 * {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1} and below,
954 * and false for API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN}
955 * and above.
Selim Gurun0ea6dad2012-03-29 18:19:01 -0700956 *
Steve Blockef163152012-04-23 18:08:06 +0100957 * @param flag whether JavaScript running in the context of a file scheme
958 * URL should be allowed to access content from other file
959 * scheme URLs
Selim Gurun0ea6dad2012-03-29 18:19:01 -0700960 */
961 public abstract void setAllowFileAccessFromFileURLs(boolean flag);
962
963 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100964 * Sets whether the WebView should enable plugins. The default is false.
Steve Block4e584df2012-04-24 23:12:47 +0100965 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100966 * @param flag true if plugins should be enabled
Patrick Scott300f2e92010-03-22 10:20:45 -0400967 * @deprecated This method has been deprecated in favor of
968 * {@link #setPluginState}
Jonathan Dixon0bf47812013-03-07 17:20:08 -0800969 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700970 */
Ignacio Solla451e3382014-11-10 10:35:54 +0000971 @SystemApi
Michael Kolba172e7d2010-06-30 12:35:26 -0700972 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000973 public abstract void setPluginsEnabled(boolean flag);
Patrick Scott300f2e92010-03-22 10:20:45 -0400974
975 /**
Steve Block4e584df2012-04-24 23:12:47 +0100976 * Tells the WebView to enable, disable, or have plugins on demand. On
Patrick Scott300f2e92010-03-22 10:20:45 -0400977 * demand mode means that if a plugin exists that can handle the embedded
978 * content, a placeholder icon will be shown instead of the plugin. When
Steve Blockb0e0f332012-06-13 22:01:11 +0100979 * the placeholder is clicked, the plugin will be enabled. The default is
980 * {@link PluginState#OFF}.
Steve Block4e584df2012-04-24 23:12:47 +0100981 *
982 * @param state a PluginState value
Jonathan Dixon835b1fc2013-02-25 12:29:33 -0800983 * @deprecated Plugins will not be supported in future, and should not be used.
Patrick Scott300f2e92010-03-22 10:20:45 -0400984 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -0800985 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000986 public abstract void setPluginState(PluginState state);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700987
988 /**
Steve Block4e584df2012-04-24 23:12:47 +0100989 * Sets a custom path to plugins used by the WebView. This method is
Derek Sollenbergerfdbdeb32010-08-12 11:20:13 -0400990 * obsolete since each plugin is now loaded from its own package.
Steve Block4e584df2012-04-24 23:12:47 +0100991 *
992 * @param pluginsPath a String path to the directory containing plugins
Derek Sollenbergerfdbdeb32010-08-12 11:20:13 -0400993 * @deprecated This method is no longer used as plugins are loaded from
Steve Block4e584df2012-04-24 23:12:47 +0100994 * their own APK via the system's package manager.
Jonathan Dixon0bf47812013-03-07 17:20:08 -0800995 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700996 */
Jason Chen9dc2e752010-09-01 19:11:14 -0700997 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +0000998 public void setPluginsPath(String pluginsPath) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000999 // Specified to do nothing, so no need for derived classes to override.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001000 }
1001
1002 /**
Steve Block4e584df2012-04-24 23:12:47 +01001003 * Sets the path to where database storage API databases should be saved.
Steve Block72ca7a42012-06-13 22:00:30 +01001004 * In order for the database storage API to function correctly, this method
1005 * must be called with a path to which the application can write. This
1006 * method should only be called once: repeated calls are ignored.
Steve Block4e584df2012-04-24 23:12:47 +01001007 *
Steve Block72ca7a42012-06-13 22:00:30 +01001008 * @param databasePath a path to the directory where databases should be
1009 * saved.
Jonathan Dixon5545d082013-08-31 22:43:11 -07001010 * @deprecated Database paths are managed by the implementation and calling this method
1011 * will have no effect.
Ben Murdoch7df19852009-04-22 13:07:58 +01001012 */
Jonathan Dixon5545d082013-08-31 22:43:11 -07001013 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +00001014 public abstract void setDatabasePath(String databasePath);
Ben Murdoch7df19852009-04-22 13:07:58 +01001015
1016 /**
Steve Block72ca7a42012-06-13 22:00:30 +01001017 * Sets the path where the Geolocation databases should be saved. In order
1018 * for Geolocation permissions and cached positions to be persisted, this
1019 * method must be called with a path to which the application can write.
Steve Block4e584df2012-04-24 23:12:47 +01001020 *
Steve Block72ca7a42012-06-13 22:00:30 +01001021 * @param databasePath a path to the directory where databases should be
1022 * saved.
Hui Shu89eb9b42016-01-07 11:32:23 -08001023 * @deprecated Geolocation database are managed by the implementation and calling this method
1024 * will have no effect.
Steve Block9d3273f2009-08-21 13:16:27 +01001025 */
Hui Shu89eb9b42016-01-07 11:32:23 -08001026 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +00001027 public abstract void setGeolocationDatabasePath(String databasePath);
Steve Block9d3273f2009-08-21 13:16:27 +01001028
1029 /**
Steve Block72ca7a42012-06-13 22:00:30 +01001030 * Sets whether the Application Caches API should be enabled. The default
1031 * is false. Note that in order for the Application Caches API to be
1032 * enabled, a valid database path must also be supplied to
1033 * {@link #setAppCachePath}.
Steve Block4e584df2012-04-24 23:12:47 +01001034 *
1035 * @param flag true if the WebView should enable Application Caches
Andrei Popescu60a9a7d2009-04-17 10:43:42 +01001036 */
Ignacio Solla451e3382014-11-10 10:35:54 +00001037 public abstract void setAppCacheEnabled(boolean flag);
Andrei Popescu60a9a7d2009-04-17 10:43:42 +01001038
1039 /**
Steve Block72ca7a42012-06-13 22:00:30 +01001040 * Sets the path to the Application Caches files. In order for the
1041 * Application Caches API to be enabled, this method must be called with a
1042 * path to which the application can write. This method should only be
1043 * called once: repeated calls are ignored.
Steve Block4e584df2012-04-24 23:12:47 +01001044 *
1045 * @param appCachePath a String path to the directory containing
Steve Block72ca7a42012-06-13 22:00:30 +01001046 * Application Caches files.
Jonathan Dixon47aaba32012-11-30 16:32:17 -08001047 * @see #setAppCacheEnabled
Andrei Popescu60a9a7d2009-04-17 10:43:42 +01001048 */
Ignacio Solla451e3382014-11-10 10:35:54 +00001049 public abstract void setAppCachePath(String appCachePath);
Andrei Popescu60a9a7d2009-04-17 10:43:42 +01001050
1051 /**
Selim Gurunb632adf2012-06-28 11:21:05 -07001052 * Sets the maximum size for the Application Cache content. The passed size
1053 * will be rounded to the nearest value that the database can support, so
1054 * this should be viewed as a guide, not a hard limit. Setting the
1055 * size to a value less than current database size does not cause the
Selim Gurunf27ac092012-06-28 11:21:05 -07001056 * database to be trimmed. The default size is {@link Long#MAX_VALUE}.
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001057 * It is recommended to leave the maximum size set to the default value.
Steve Block4e584df2012-04-24 23:12:47 +01001058 *
1059 * @param appCacheMaxSize the maximum size in bytes
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001060 * @deprecated In future quota will be managed automatically.
Andrei Popescu1c829202009-07-22 16:47:52 +01001061 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001062 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +00001063 public abstract void setAppCacheMaxSize(long appCacheMaxSize);
Andrei Popescu1c829202009-07-22 16:47:52 +01001064
1065 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001066 * Sets whether the database storage API is enabled. The default value is
1067 * false. See also {@link #setDatabasePath} for how to correctly set up the
1068 * database storage API.
Steve Block4e584df2012-04-24 23:12:47 +01001069 *
Selim Gurun2bca22b2013-02-28 17:47:21 -08001070 * This setting is global in effect, across all WebView instances in a process.
1071 * Note you should only modify this setting prior to making <b>any</b> WebView
1072 * page load within a given process, as the WebView implementation may ignore
1073 * changes to this setting after that point.
1074 *
Steve Block4e584df2012-04-24 23:12:47 +01001075 * @param flag true if the WebView should use the database storage API
Ben Murdoch7df19852009-04-22 13:07:58 +01001076 */
Ignacio Solla451e3382014-11-10 10:35:54 +00001077 public abstract void setDatabaseEnabled(boolean flag);
Ben Murdoch7df19852009-04-22 13:07:58 +01001078
1079 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001080 * Sets whether the DOM storage API is enabled. The default value is false.
Steve Block4e584df2012-04-24 23:12:47 +01001081 *
1082 * @param flag true if the WebView should use the DOM storage API
Ben Murdoch274680d2009-05-28 13:44:44 +01001083 */
Ignacio Solla451e3382014-11-10 10:35:54 +00001084 public abstract void setDomStorageEnabled(boolean flag);
Ben Murdoch274680d2009-05-28 13:44:44 +01001085
1086 /**
Steve Block4e584df2012-04-24 23:12:47 +01001087 * Gets whether the DOM Storage APIs are enabled.
1088 *
1089 * @return true if the DOM Storage APIs are enabled
Steve Blockb0e0f332012-06-13 22:01:11 +01001090 * @see #setDomStorageEnabled
Ben Murdoch274680d2009-05-28 13:44:44 +01001091 */
Ignacio Solla451e3382014-11-10 10:35:54 +00001092 public abstract boolean getDomStorageEnabled();
1093
Ben Murdoch274680d2009-05-28 13:44:44 +01001094 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001095 * Gets the path to where database storage API databases are saved.
Steve Block4e584df2012-04-24 23:12:47 +01001096 *
1097 * @return the String path to the database storage API databases
Steve Blockb0e0f332012-06-13 22:01:11 +01001098 * @see #setDatabasePath
Jonathan Dixon5545d082013-08-31 22:43:11 -07001099 * @deprecated Database paths are managed by the implementation this method is obsolete.
Ben Murdoch7df19852009-04-22 13:07:58 +01001100 */
Jonathan Dixon5545d082013-08-31 22:43:11 -07001101 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +00001102 public abstract String getDatabasePath();
Ben Murdoch7df19852009-04-22 13:07:58 +01001103
1104 /**
Steve Block4e584df2012-04-24 23:12:47 +01001105 * Gets whether the database storage API is enabled.
1106 *
1107 * @return true if the database storage API is enabled
Steve Blockb0e0f332012-06-13 22:01:11 +01001108 * @see #setDatabaseEnabled
Ben Murdoch7df19852009-04-22 13:07:58 +01001109 */
Ignacio Solla451e3382014-11-10 10:35:54 +00001110 public abstract boolean getDatabaseEnabled();
Andrei Popescuc27a9ac2009-08-03 15:59:24 +01001111
1112 /**
Mikhail Naganov6cb296a2012-08-28 16:57:24 +01001113 * Sets whether Geolocation is enabled. The default is true.
1114 * <p>
1115 * Please note that in order for the Geolocation API to be usable
1116 * by a page in the WebView, the following requirements must be met:
1117 * <ul>
1118 * <li>an application must have permission to access the device location,
1119 * see {@link android.Manifest.permission#ACCESS_COARSE_LOCATION},
1120 * {@link android.Manifest.permission#ACCESS_FINE_LOCATION};
1121 * <li>an application must provide an implementation of the
1122 * {@link WebChromeClient#onGeolocationPermissionsShowPrompt} callback
1123 * to receive notifications that a page is requesting access to location
1124 * via the JavaScript Geolocation API.
1125 * </ul>
1126 * <p>
Steve Block4e584df2012-04-24 23:12:47 +01001127 *
1128 * @param flag whether Geolocation should be enabled
Steve Block06cd7512009-08-21 10:26:37 +01001129 */
Ignacio Solla451e3382014-11-10 10:35:54 +00001130 public abstract void setGeolocationEnabled(boolean flag);
Elliott Slaughter5dc0c822010-06-22 11:31:54 -07001131
1132 /**
Steve Block4e584df2012-04-24 23:12:47 +01001133 * Gets whether JavaScript is enabled.
1134 *
1135 * @return true if JavaScript is enabled
1136 * @see #setJavaScriptEnabled
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001137 */
Ignacio Solla451e3382014-11-10 10:35:54 +00001138 public abstract boolean getJavaScriptEnabled();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001139
1140 /**
Steve Blockef163152012-04-23 18:08:06 +01001141 * Gets whether JavaScript running in the context of a file scheme URL can
1142 * access content from any origin. This includes access to content from
1143 * other file scheme URLs.
Selim Gurun0ea6dad2012-03-29 18:19:01 -07001144 *
Steve Blockef163152012-04-23 18:08:06 +01001145 * @return whether JavaScript running in the context of a file scheme URL
1146 * can access content from any origin
Steve Block4e584df2012-04-24 23:12:47 +01001147 * @see #setAllowUniversalAccessFromFileURLs
Selim Gurun0ea6dad2012-03-29 18:19:01 -07001148 */
1149 public abstract boolean getAllowUniversalAccessFromFileURLs();
1150
1151 /**
Steve Blockef163152012-04-23 18:08:06 +01001152 * Gets whether JavaScript running in the context of a file scheme URL can
1153 * access content from other file scheme URLs.
Selim Gurun0ea6dad2012-03-29 18:19:01 -07001154 *
Steve Blockef163152012-04-23 18:08:06 +01001155 * @return whether JavaScript running in the context of a file scheme URL
1156 * can access content from other file scheme URLs
Steve Block4e584df2012-04-24 23:12:47 +01001157 * @see #setAllowFileAccessFromFileURLs
Selim Gurun0ea6dad2012-03-29 18:19:01 -07001158 */
1159 public abstract boolean getAllowFileAccessFromFileURLs();
1160
1161 /**
Steve Block4e584df2012-04-24 23:12:47 +01001162 * Gets whether plugins are enabled.
1163 *
1164 * @return true if plugins are enabled
Steve Blockb0e0f332012-06-13 22:01:11 +01001165 * @see #setPluginsEnabled
Patrick Scott300f2e92010-03-22 10:20:45 -04001166 * @deprecated This method has been replaced by {@link #getPluginState}
Jonathan Dixon0bf47812013-03-07 17:20:08 -08001167 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001168 */
Ignacio Solla451e3382014-11-10 10:35:54 +00001169 @SystemApi
Michael Kolba172e7d2010-06-30 12:35:26 -07001170 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +00001171 public abstract boolean getPluginsEnabled();
Patrick Scott300f2e92010-03-22 10:20:45 -04001172
1173 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001174 * Gets the current state regarding whether plugins are enabled.
Steve Block4e584df2012-04-24 23:12:47 +01001175 *
Steve Blockb0e0f332012-06-13 22:01:11 +01001176 * @return the plugin state as a {@link PluginState} value
1177 * @see #setPluginState
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001178 * @deprecated Plugins will not be supported in future, and should not be used.
Patrick Scott300f2e92010-03-22 10:20:45 -04001179 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001180 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +00001181 public abstract PluginState getPluginState();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001182
1183 /**
Steve Block4e584df2012-04-24 23:12:47 +01001184 * Gets the directory that contains the plugin libraries. This method is
Derek Sollenbergerfdbdeb32010-08-12 11:20:13 -04001185 * obsolete since each plugin is now loaded from its own package.
Steve Block4e584df2012-04-24 23:12:47 +01001186 *
1187 * @return an empty string
Derek Sollenbergerfdbdeb32010-08-12 11:20:13 -04001188 * @deprecated This method is no longer used as plugins are loaded from
1189 * their own APK via the system's package manager.
Jonathan Dixon0bf47812013-03-07 17:20:08 -08001190 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001191 */
Jason Chen9dc2e752010-09-01 19:11:14 -07001192 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +00001193 public String getPluginsPath() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001194 // Unconditionally returns empty string, so no need for derived classes to override.
Grace Kloba658ab7d2009-05-14 14:45:26 -07001195 return "";
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001196 }
1197
1198 /**
Steve Block4e584df2012-04-24 23:12:47 +01001199 * Tells JavaScript to open windows automatically. This applies to the
1200 * JavaScript function window.open(). The default is false.
1201 *
1202 * @param flag true if JavaScript can open windows automatically
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001203 */
Ignacio Solla451e3382014-11-10 10:35:54 +00001204 public abstract void setJavaScriptCanOpenWindowsAutomatically(boolean flag);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001205
1206 /**
Steve Block4e584df2012-04-24 23:12:47 +01001207 * Gets whether JavaScript can open windows automatically.
1208 *
1209 * @return true if JavaScript can open windows automatically during
1210 * window.open()
1211 * @see #setJavaScriptCanOpenWindowsAutomatically
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001212 */
Ignacio Solla451e3382014-11-10 10:35:54 +00001213 public abstract boolean getJavaScriptCanOpenWindowsAutomatically();
Marcin Kosibafd1ac832014-10-10 17:12:49 +01001214
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001215 /**
Steve Block4e584df2012-04-24 23:12:47 +01001216 * Sets the default text encoding name to use when decoding html pages.
Marcin Kosibafd1ac832014-10-10 17:12:49 +01001217 * The default is "UTF-8".
Steve Block4e584df2012-04-24 23:12:47 +01001218 *
1219 * @param encoding the text encoding name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001220 */
Ignacio Solla451e3382014-11-10 10:35:54 +00001221 public abstract void setDefaultTextEncodingName(String encoding);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001222
1223 /**
Steve Block4e584df2012-04-24 23:12:47 +01001224 * Gets the default text encoding name.
1225 *
1226 * @return the default text encoding name as a string
1227 * @see #setDefaultTextEncodingName
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001228 */
Ignacio Solla451e3382014-11-10 10:35:54 +00001229 public abstract String getDefaultTextEncodingName();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001230
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -08001231 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001232 * Sets the WebView's user-agent string. If the string is null or empty,
1233 * the system default value will be used.
Mikhail Naganov550f6212015-07-07 13:39:31 -07001234 *
1235 * Note that starting from {@link android.os.Build.VERSION_CODES#KITKAT} Android
1236 * version, changing the user-agent while loading a web page causes WebView
1237 * to initiate loading once again.
1238 *
1239 * @param ua new user-agent string
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -08001240 */
Ignacio Solla451e3382014-11-10 10:35:54 +00001241 public abstract void setUserAgentString(String ua);
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -08001242
1243 /**
Steve Block4e584df2012-04-24 23:12:47 +01001244 * Gets the WebView's user-agent string.
Steve Blockb0e0f332012-06-13 22:01:11 +01001245 *
1246 * @return the WebView's user-agent string
1247 * @see #setUserAgentString
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -08001248 */
Ignacio Solla451e3382014-11-10 10:35:54 +00001249 public abstract String getUserAgentString();
Shimeng (Simon) Wangc55886a2010-10-28 13:46:02 -07001250
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001251 /**
George Mount9f410c52012-08-10 15:29:30 -07001252 * Returns the default User-Agent used by a WebView.
1253 * An instance of WebView could use a different User-Agent if a call
Kristian Monsenf4912582012-08-16 15:26:24 -04001254 * is made to {@link WebSettings#setUserAgentString(String)}.
George Mount9f410c52012-08-10 15:29:30 -07001255 *
1256 * @param context a Context object used to access application assets
1257 */
1258 public static String getDefaultUserAgent(Context context) {
Jonathan Dixond1c4faa2012-08-20 16:37:15 -07001259 return WebViewFactory.getProvider().getStatics().getDefaultUserAgent(context);
George Mount9f410c52012-08-10 15:29:30 -07001260 }
1261
1262 /**
Steve Block4e584df2012-04-24 23:12:47 +01001263 * Tells the WebView whether it needs to set a node to have focus when
Steve Blockb0e0f332012-06-13 22:01:11 +01001264 * {@link WebView#requestFocus(int, android.graphics.Rect)} is called. The
1265 * default value is true.
Michael Kolba172e7d2010-06-30 12:35:26 -07001266 *
Steve Block4e584df2012-04-24 23:12:47 +01001267 * @param flag whether the WebView needs to set a node
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001268 */
Ignacio Solla451e3382014-11-10 10:35:54 +00001269 public abstract void setNeedInitialFocus(boolean flag);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001270
1271 /**
Steve Block4e584df2012-04-24 23:12:47 +01001272 * Sets the priority of the Render thread. Unlike the other settings, this
Steve Blockb0e0f332012-06-13 22:01:11 +01001273 * one only needs to be called once per process. The default value is
1274 * {@link RenderPriority#NORMAL}.
Mike Hearnadcd2ed2009-01-21 16:44:36 +01001275 *
Steve Blockb0e0f332012-06-13 22:01:11 +01001276 * @param priority the priority
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001277 * @deprecated It is not recommended to adjust thread priorities, and this will
1278 * not be supported in future versions.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001279 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001280 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +00001281 public abstract void setRenderPriority(RenderPriority priority);
Michael Kolba172e7d2010-06-30 12:35:26 -07001282
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001283 /**
Steve Block4e584df2012-04-24 23:12:47 +01001284 * Overrides the way the cache is used. The way the cache is used is based
Steve Blockb0e0f332012-06-13 22:01:11 +01001285 * on the navigation type. For a normal page load, the cache is checked
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001286 * and content is re-validated as needed. When navigating back, content is
Steve Blockb0e0f332012-06-13 22:01:11 +01001287 * not revalidated, instead the content is just retrieved from the cache.
1288 * This method allows the client to override this behavior by specifying
Mikhail Naganov56936a12012-07-25 13:07:18 +01001289 * one of {@link #LOAD_DEFAULT},
Steve Blockb0e0f332012-06-13 22:01:11 +01001290 * {@link #LOAD_CACHE_ELSE_NETWORK}, {@link #LOAD_NO_CACHE} or
1291 * {@link #LOAD_CACHE_ONLY}. The default value is {@link #LOAD_DEFAULT}.
Steve Block4e584df2012-04-24 23:12:47 +01001292 *
Steve Blockb0e0f332012-06-13 22:01:11 +01001293 * @param mode the mode to use
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001294 */
Tim Volodineb90f5382016-04-29 12:44:41 +01001295 public abstract void setCacheMode(@CacheMode int mode);
Michael Kolba172e7d2010-06-30 12:35:26 -07001296
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001297 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001298 * Gets the current setting for overriding the cache mode.
1299 *
1300 * @return the current setting for overriding the cache mode
1301 * @see #setCacheMode
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001302 */
Tim Volodineb90f5382016-04-29 12:44:41 +01001303 @CacheMode
Ignacio Solla451e3382014-11-10 10:35:54 +00001304 public abstract int getCacheMode();
Ben Murdochfe9fc3d2014-04-10 15:31:06 +01001305
1306 /**
1307 * Configures the WebView's behavior when a secure origin attempts to load a resource from an
1308 * insecure origin.
1309 *
1310 * By default, apps that target {@link android.os.Build.VERSION_CODES#KITKAT} or below default
1311 * to {@link #MIXED_CONTENT_ALWAYS_ALLOW}. Apps targeting
Dianne Hackborn955d8d62014-10-07 20:17:19 -07001312 * {@link android.os.Build.VERSION_CODES#LOLLIPOP} default to {@link #MIXED_CONTENT_NEVER_ALLOW}.
Ben Murdochfe9fc3d2014-04-10 15:31:06 +01001313 *
1314 * The preferred and most secure mode of operation for the WebView is
1315 * {@link #MIXED_CONTENT_NEVER_ALLOW} and use of {@link #MIXED_CONTENT_ALWAYS_ALLOW} is
1316 * strongly discouraged.
1317 *
1318 * @param mode The mixed content mode to use. One of {@link #MIXED_CONTENT_NEVER_ALLOW},
Torne (Richard Coles)2b666c92015-03-06 14:20:00 +00001319 * {@link #MIXED_CONTENT_ALWAYS_ALLOW} or {@link #MIXED_CONTENT_COMPATIBILITY_MODE}.
Ben Murdochfe9fc3d2014-04-10 15:31:06 +01001320 */
1321 public abstract void setMixedContentMode(int mode);
1322
1323 /**
1324 * Gets the current behavior of the WebView with regard to loading insecure content from a
1325 * secure origin.
1326 * @return The current setting, one of {@link #MIXED_CONTENT_NEVER_ALLOW},
Torne (Richard Coles)2b666c92015-03-06 14:20:00 +00001327 * {@link #MIXED_CONTENT_ALWAYS_ALLOW} or {@link #MIXED_CONTENT_COMPATIBILITY_MODE}.
Ben Murdochfe9fc3d2014-04-10 15:31:06 +01001328 */
1329 public abstract int getMixedContentMode();
Yuncheol Heo4d07c482014-05-07 17:29:35 +09001330
1331 /**
1332 * Sets whether to use a video overlay for embedded encrypted video.
Dianne Hackborn955d8d62014-10-07 20:17:19 -07001333 * In API levels prior to {@link android.os.Build.VERSION_CODES#LOLLIPOP}, encrypted video can
Yuncheol Heo4d07c482014-05-07 17:29:35 +09001334 * only be rendered directly on a secure video surface, so it had been a hard problem to play
1335 * encrypted video in HTML. When this flag is on, WebView can play encrypted video (MSE/EME)
1336 * by using a video overlay (aka hole-punching) for videos embedded using HTML &lt;video&gt;
1337 * tag.<br>
1338 * Caution: This setting is intended for use only in a narrow set of circumstances and apps
1339 * should only enable it if they require playback of encrypted video content. It will impose
1340 * the following limitations on the WebView:
1341 * <ul>
1342 * <li> Only one video overlay can be played at a time.
1343 * <li> Changes made to position or dimensions of a video element may be propagated to the
1344 * corresponding video overlay with a noticeable delay.
1345 * <li> The video overlay is not visible to web APIs and as such may not interact with
1346 * script or styling. For example, CSS styles applied to the &lt;video&gt; tag may be ignored.
1347 * </ul>
1348 * This is not an exhaustive set of constraints and it may vary with new versions of the
1349 * WebView.
1350 * @hide
1351 */
Yuncheol Heoeeba0252014-07-08 19:43:00 +09001352 @SystemApi
Yuncheol Heo4d07c482014-05-07 17:29:35 +09001353 public abstract void setVideoOverlayForEmbeddedEncryptedVideoEnabled(boolean flag);
1354
1355 /**
1356 * Gets whether a video overlay will be used for embedded encrypted video.
1357 *
1358 * @return true if WebView uses a video overlay for embedded encrypted video.
1359 * @see #setVideoOverlayForEmbeddedEncryptedVideoEnabled
1360 * @hide
1361 */
Yuncheol Heoeeba0252014-07-08 19:43:00 +09001362 @SystemApi
Yuncheol Heo4d07c482014-05-07 17:29:35 +09001363 public abstract boolean getVideoOverlayForEmbeddedEncryptedVideoEnabled();
Hui Shub1ee70b2015-03-03 11:38:41 -08001364
1365 /**
1366 * Sets whether this WebView should raster tiles when it is
1367 * offscreen but attached to a window. Turning this on can avoid
1368 * rendering artifacts when animating an offscreen WebView on-screen.
1369 * Offscreen WebViews in this mode use more memory. The default value is
Hui Shud377c0f2015-05-13 12:01:42 -07001370 * false.<br>
Hui Shub1ee70b2015-03-03 11:38:41 -08001371 * Please follow these guidelines to limit memory usage:
Hui Shud377c0f2015-05-13 12:01:42 -07001372 * <ul>
1373 * <li> WebView size should be not be larger than the device screen size.
1374 * <li> Limit use of this mode to a small number of WebViews. Use it for
Hui Shub1ee70b2015-03-03 11:38:41 -08001375 * visible WebViews and WebViews about to be animated to visible.
Hui Shud377c0f2015-05-13 12:01:42 -07001376 * </ul>
Hui Shub1ee70b2015-03-03 11:38:41 -08001377 */
1378 public abstract void setOffscreenPreRaster(boolean enabled);
1379
1380 /**
1381 * Gets whether this WebView should raster tiles when it is
1382 * offscreen but attached to a window.
1383 * @return true if this WebView will raster tiles when it is
1384 * offscreen but attached to a window.
1385 */
1386 public abstract boolean getOffscreenPreRaster();
Hui Shu227a8c12015-10-22 14:57:51 -07001387
Selim Gurunec0a1f22017-04-07 18:21:46 -07001388
1389 /**
1390 * Sets whether Safe Browsing is enabled. Safe browsing allows WebView to
1391 * protect against malware and phishing attacks by verifying the links.
1392 *
Selim Gurunec0a1f22017-04-07 18:21:46 -07001393 * <p>
Nate Fischer471891d2017-07-18 19:15:52 -07001394 * Safe browsing is disabled by default. The recommended way to enable Safe browsing is using a
1395 * manifest tag to change the default value to enabled for all WebViews (read <a
1396 * href="{@docRoot}reference/android/webkit/WebView.html">general Safe Browsing info</a>).
Selim Gurunec0a1f22017-04-07 18:21:46 -07001397 *
Nate Fischer471891d2017-07-18 19:15:52 -07001398 * <p>
Selim Gurunec0a1f22017-04-07 18:21:46 -07001399 * This API overrides the manifest tag value for this WebView.
1400 *
1401 * @param enabled Whether Safe browsing is enabled.
1402 */
1403 public abstract void setSafeBrowsingEnabled(boolean enabled);
1404
1405 /**
1406 * Gets whether Safe browsing is enabled.
1407 * See {@link #setSafeBrowsingEnabled}.
1408 *
1409 * @return true if Safe browsing is enabled and false otherwise.
1410 */
1411 public abstract boolean getSafeBrowsingEnabled();
1412
1413
Hui Shu227a8c12015-10-22 14:57:51 -07001414 /**
Hui Shu539b0772016-04-20 15:21:37 -07001415 * @hide
1416 */
1417 @IntDef(flag = true,
1418 value = {
1419 MENU_ITEM_NONE,
1420 MENU_ITEM_SHARE,
1421 MENU_ITEM_WEB_SEARCH,
1422 MENU_ITEM_PROCESS_TEXT
1423 })
1424 @Retention(RetentionPolicy.SOURCE)
1425 @Target({ElementType.PARAMETER, ElementType.METHOD})
1426 private @interface MenuItemFlags {}
1427
1428 /**
Hui Shu227a8c12015-10-22 14:57:51 -07001429 * Disables the action mode menu items according to {@code menuItems} flag.
1430 * @param menuItems an integer field flag for the menu items to be disabled.
1431 */
Hui Shu539b0772016-04-20 15:21:37 -07001432 public abstract void setDisabledActionModeMenuItems(@MenuItemFlags int menuItems);
Hui Shu227a8c12015-10-22 14:57:51 -07001433
1434 /**
1435 * Gets the action mode menu items that are disabled, expressed in an integer field flag.
1436 * The default value is {@link #MENU_ITEM_NONE}
1437 *
Hui Shu539b0772016-04-20 15:21:37 -07001438 * @return all the disabled menu item flags combined with bitwise OR.
Hui Shu227a8c12015-10-22 14:57:51 -07001439 */
Hui Shu539b0772016-04-20 15:21:37 -07001440 public abstract @MenuItemFlags int getDisabledActionModeMenuItems();
Hui Shu227a8c12015-10-22 14:57:51 -07001441
1442 /**
1443 * Used with {@link #setDisabledActionModeMenuItems}.
1444 *
1445 * No menu items should be disabled.
1446 */
1447 public static final int MENU_ITEM_NONE = 0;
1448
1449 /**
1450 * Used with {@link #setDisabledActionModeMenuItems}.
1451 *
1452 * Disable menu item "Share".
1453 */
1454 public static final int MENU_ITEM_SHARE = 1 << 0;
1455
1456 /**
1457 * Used with {@link #setDisabledActionModeMenuItems}.
1458 *
1459 * Disable menu item "Web Search".
1460 */
1461 public static final int MENU_ITEM_WEB_SEARCH = 1 << 1;
1462
1463 /**
1464 * Used with {@link #setDisabledActionModeMenuItems}.
1465 *
1466 * Disable all the action mode menu items for text processing.
1467 * By default WebView searches for activities that are able to handle
1468 * {@link android.content.Intent#ACTION_PROCESS_TEXT} and show them in the
1469 * action mode menu. If this flag is set via {@link
1470 * #setDisabledActionModeMenuItems}, these menu items will be disabled.
1471 */
1472 public static final int MENU_ITEM_PROCESS_TEXT = 1 << 2;
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001473}