blob: 19492c25ffc83b25dcaec6ed922ea12434360878 [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
George Mount9f410c52012-08-10 15:29:30 -070019import android.content.Context;
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070020
21/**
22 * Manages settings state for a WebView. When a WebView is first created, it
23 * obtains a set of default settings. These default settings will be returned
24 * from any getter call. A WebSettings object obtained from
25 * WebView.getSettings() is tied to the life of the WebView. If a WebView has
26 * been destroyed, any method call on WebSettings will throw an
27 * IllegalStateException.
28 */
Jonathan Dixond3101b12012-04-12 20:51:51 +010029// This is an abstract base class: concrete WebViewProviders must
Jonathan Dixon3c909522012-02-28 18:45:06 +000030// create a class derived from this, and return an instance of it in the
31// WebViewProvider.getWebSettingsProvider() method implementation.
Selim Gurun0ea6dad2012-03-29 18:19:01 -070032public abstract class WebSettings {
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070033 /**
34 * Enum for controlling the layout of html.
Steve Block4e584df2012-04-24 23:12:47 +010035 * <ul>
36 * <li>NORMAL means no rendering changes.</li>
37 * <li>SINGLE_COLUMN moves all content into one column that is the width of the
38 * view.</li>
39 * <li>NARROW_COLUMNS makes all columns no wider than the screen if possible.</li>
Mikhail Naganov94e0bd32012-12-14 17:01:25 +000040 * <li>TEXT_AUTOSIZING boosts font size of paragraphs based on heuristics to make
41 * the text readable when viewing a wide-viewport layout in the overview mode.
42 * It is recommended to enable zoom support {@link #setSupportZoom} when
43 * using this mode.</li>
Steve Block4e584df2012-04-24 23:12:47 +010044 * </ul>
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070045 */
46 // XXX: These must match LayoutAlgorithm in Settings.h in WebCore.
47 public enum LayoutAlgorithm {
48 NORMAL,
John Reck5a1ef4132011-10-26 10:37:00 -070049 /**
50 * @deprecated This algorithm is now obsolete.
51 */
52 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070053 SINGLE_COLUMN,
Mikhail Naganov94e0bd32012-12-14 17:01:25 +000054 NARROW_COLUMNS,
55 /**
56 * @hide
57 */
58 TEXT_AUTOSIZING
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070059 }
60
61 /**
62 * Enum for specifying the text size.
Steve Block4e584df2012-04-24 23:12:47 +010063 * <ul>
64 * <li>SMALLEST is 50%</li>
65 * <li>SMALLER is 75%</li>
66 * <li>NORMAL is 100%</li>
67 * <li>LARGER is 150%</li>
68 * <li>LARGEST is 200%</li>
69 * </ul>
70 *
John Reckcaeb1202011-06-17 11:50:15 -070071 * @deprecated Use {@link WebSettings#setTextZoom(int)} and {@link WebSettings#getTextZoom()} instead.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070072 */
73 public enum TextSize {
74 SMALLEST(50),
75 SMALLER(75),
76 NORMAL(100),
77 LARGER(150),
78 LARGEST(200);
79 TextSize(int size) {
80 value = size;
81 }
82 int value;
83 }
Grace Kloba0d8b77c2009-06-25 11:20:51 -070084
85 /**
86 * Enum for specifying the WebView's desired density.
Steve Block4e584df2012-04-24 23:12:47 +010087 * <ul>
88 * <li>FAR makes 100% looking like in 240dpi</li>
89 * <li>MEDIUM makes 100% looking like in 160dpi</li>
90 * <li>CLOSE makes 100% looking like in 120dpi</li>
91 * </ul>
Grace Kloba0d8b77c2009-06-25 11:20:51 -070092 */
93 public enum ZoomDensity {
94 FAR(150), // 240dpi
95 MEDIUM(100), // 160dpi
96 CLOSE(75); // 120dpi
97 ZoomDensity(int size) {
98 value = size;
99 }
Mikhail Naganovce76ca52012-07-27 12:00:05 +0100100
101 /**
102 * @hide Only for use by WebViewProvider implementations
103 */
104 public int getValue() {
105 return value;
106 }
107
Grace Kloba0d8b77c2009-06-25 11:20:51 -0700108 int value;
109 }
110
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700111 /**
Mikhail Naganov500b0032012-07-25 13:06:14 +0100112 * Default cache usage mode. If the navigation type doesn't impose any
113 * specific behavior, use cached resources when they are available
114 * and not expired, otherwise load resources from the network.
115 * Use with {@link #setCacheMode}.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700116 */
117 public static final int LOAD_DEFAULT = -1;
118
119 /**
Mikhail Naganov500b0032012-07-25 13:06:14 +0100120 * Normal cache usage mode. Use with {@link #setCacheMode}.
Mikhail Naganov56936a12012-07-25 13:07:18 +0100121 *
122 * @deprecated This value is obsolete, as from API level
123 * {@link android.os.Build.VERSION_CODES#HONEYCOMB} and onwards it has the
124 * same effect as {@link #LOAD_DEFAULT}.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700125 */
Kristian Monsen5cc23512012-08-09 15:33:08 -0400126 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700127 public static final int LOAD_NORMAL = 0;
128
129 /**
Mikhail Naganov500b0032012-07-25 13:06:14 +0100130 * Use cached resources when they are available, even if they have expired.
131 * Otherwise load resources from the network.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700132 * Use with {@link #setCacheMode}.
133 */
134 public static final int LOAD_CACHE_ELSE_NETWORK = 1;
135
136 /**
Mikhail Naganov500b0032012-07-25 13:06:14 +0100137 * Don't use the cache, load from the network.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700138 * Use with {@link #setCacheMode}.
139 */
140 public static final int LOAD_NO_CACHE = 2;
Michael Kolba172e7d2010-06-30 12:35:26 -0700141
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700142 /**
Mikhail Naganov500b0032012-07-25 13:06:14 +0100143 * Don't use the network, load from the cache.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700144 * Use with {@link #setCacheMode}.
145 */
146 public static final int LOAD_CACHE_ONLY = 3;
147
148 public enum RenderPriority {
149 NORMAL,
150 HIGH,
151 LOW
152 }
153
Patrick Scott300f2e92010-03-22 10:20:45 -0400154 /**
155 * The plugin state effects how plugins are treated on a page. ON means
156 * that any object will be loaded even if a plugin does not exist to handle
157 * the content. ON_DEMAND means that if there is a plugin installed that
158 * can handle the content, a placeholder is shown until the user clicks on
159 * the placeholder. Once clicked, the plugin will be enabled on the page.
160 * OFF means that all plugins will be turned off and any fallback content
161 * will be used.
162 */
163 public enum PluginState {
164 ON,
165 ON_DEMAND,
166 OFF
167 }
168
Ben Murdoche9e3ccd2010-10-06 14:33:02 +0100169 /**
Jonathan Dixon3c909522012-02-28 18:45:06 +0000170 * Hidden constructor to prevent clients from creating a new settings
171 * instance or deriving the class.
Steve Block4e584df2012-04-24 23:12:47 +0100172 *
Jonathan Dixon3c909522012-02-28 18:45:06 +0000173 * @hide
Ben Murdoche9e3ccd2010-10-06 14:33:02 +0100174 */
Jonathan Dixon3c909522012-02-28 18:45:06 +0000175 protected WebSettings() {
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800176 }
Michael Kolba172e7d2010-06-30 12:35:26 -0700177
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800178 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100179 * Enables dumping the pages navigation cache to a text file. The default
180 * is false.
Steve Block4e584df2012-04-24 23:12:47 +0100181 *
Kristian Monsenfc771652011-05-10 16:44:05 +0100182 * @deprecated This method is now obsolete.
Kristian Monsenf4912582012-08-16 15:26:24 -0400183 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700184 */
Kristian Monsenfc771652011-05-10 16:44:05 +0100185 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700186 public void setNavDump(boolean enabled) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000187 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700188 }
189
190 /**
Steve Block4e584df2012-04-24 23:12:47 +0100191 * Gets whether dumping the navigation cache is enabled.
192 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100193 * @return whether dumping the navigation cache is enabled
194 * @see #setNavDump
Kristian Monsenfc771652011-05-10 16:44:05 +0100195 * @deprecated This method is now obsolete.
Kristian Monsenf4912582012-08-16 15:26:24 -0400196 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700197 */
Kristian Monsenfc771652011-05-10 16:44:05 +0100198 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700199 public boolean getNavDump() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000200 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700201 }
202
203 /**
Mikhail Naganovb533fb42012-04-05 14:50:02 +0100204 * Sets whether the WebView should support zooming using its on-screen zoom
205 * controls and gestures. The particular zoom mechanisms that should be used
206 * can be set with {@link #setBuiltInZoomControls}. This setting does not
207 * affect zooming performed using the {@link WebView#zoomIn()} and
Steve Block4e584df2012-04-24 23:12:47 +0100208 * {@link WebView#zoomOut()} methods. The default is true.
209 *
210 * @param support whether the WebView should support zoom
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700211 */
212 public void setSupportZoom(boolean support) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000213 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700214 }
215
216 /**
Steve Block4e584df2012-04-24 23:12:47 +0100217 * Gets whether the WebView supports zoom.
218 *
219 * @return true if the WebView supports zoom
220 * @see #setSupportZoom
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700221 */
222 public boolean supportZoom() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000223 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700224 }
225
226 /**
Teng-Hui Zhu0e5b1602012-07-17 17:19:13 -0700227 * Sets whether the WebView requires a user gesture to play media.
228 * The default is true.
229 *
230 * @param require whether the WebView requires a user gesture to play media
231 */
232 public void setMediaPlaybackRequiresUserGesture(boolean require) {
233 throw new MustOverrideException();
234 }
235
236 /**
237 * Gets whether the WebView requires a user gesture to play media.
238 *
239 * @return true if the WebView requires a user gesture to play media
240 * @see #setMediaPlaybackRequiresUserGesture
241 */
242 public boolean getMediaPlaybackRequiresUserGesture() {
243 throw new MustOverrideException();
244 }
245
246 /**
Steve Block06d268e2012-04-16 14:10:54 +0100247 * Sets whether the WebView should use its built-in zoom mechanisms. The
248 * built-in zoom mechanisms comprise on-screen zoom controls, which are
249 * displayed over the WebView's content, and the use of a pinch gesture to
250 * control zooming. Whether or not these on-screen controls are displayed
Steve Block4e584df2012-04-24 23:12:47 +0100251 * can be set with {@link #setDisplayZoomControls}. The default is false.
Steve Block06d268e2012-04-16 14:10:54 +0100252 * <p>
253 * The built-in mechanisms are the only currently supported zoom
254 * mechanisms, so it is recommended that this setting is always enabled.
Steve Block4e584df2012-04-24 23:12:47 +0100255 *
256 * @param enabled whether the WebView should use its built-in zoom mechanisms
The Android Open Source Project10592532009-03-18 17:39:46 -0700257 */
Steve Block06d268e2012-04-16 14:10:54 +0100258 // This method was intended to select between the built-in zoom mechanisms
259 // and the separate zoom controls. The latter were obtained using
260 // {@link WebView#getZoomControls}, which is now hidden.
The Android Open Source Project10592532009-03-18 17:39:46 -0700261 public void setBuiltInZoomControls(boolean enabled) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000262 throw new MustOverrideException();
The Android Open Source Project10592532009-03-18 17:39:46 -0700263 }
Michael Kolba172e7d2010-06-30 12:35:26 -0700264
The Android Open Source Project10592532009-03-18 17:39:46 -0700265 /**
Steve Block4e584df2012-04-24 23:12:47 +0100266 * Gets whether the zoom mechanisms built into WebView are being used.
267 *
268 * @return true if the zoom mechanisms built into WebView are being used
269 * @see #setBuiltInZoomControls
The Android Open Source Project10592532009-03-18 17:39:46 -0700270 */
271 public boolean getBuiltInZoomControls() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000272 throw new MustOverrideException();
The Android Open Source Project10592532009-03-18 17:39:46 -0700273 }
Michael Kolba172e7d2010-06-30 12:35:26 -0700274
The Android Open Source Project10592532009-03-18 17:39:46 -0700275 /**
Mikhail Naganovb533fb42012-04-05 14:50:02 +0100276 * Sets whether the WebView should display on-screen zoom controls when
277 * using the built-in zoom mechanisms. See {@link #setBuiltInZoomControls}.
Steve Block4e584df2012-04-24 23:12:47 +0100278 * The default is true.
279 *
280 * @param enabled whether the WebView should display on-screen zoom controls
Michael Kolb6fe3b422010-08-19 12:41:24 -0700281 */
282 public void setDisplayZoomControls(boolean enabled) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000283 throw new MustOverrideException();
Michael Kolb6fe3b422010-08-19 12:41:24 -0700284 }
285
286 /**
Steve Block4e584df2012-04-24 23:12:47 +0100287 * Gets whether the WebView displays on-screen zoom controls when using
Mikhail Naganovb533fb42012-04-05 14:50:02 +0100288 * the built-in zoom mechanisms.
Steve Block4e584df2012-04-24 23:12:47 +0100289 *
290 * @return true if the WebView displays on-screen zoom controls when using
291 * the built-in zoom mechanisms
292 * @see #setDisplayZoomControls
Michael Kolb6fe3b422010-08-19 12:41:24 -0700293 */
294 public boolean getDisplayZoomControls() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000295 throw new MustOverrideException();
Michael Kolb6fe3b422010-08-19 12:41:24 -0700296 }
297
298 /**
Steve Block4e584df2012-04-24 23:12:47 +0100299 * Enables or disables file access within WebView. File access is enabled by
Patrick Scottd1737ed2011-01-05 11:36:48 -0500300 * default. Note that this enables or disables file system access only.
301 * Assets and resources are still accessible using file:///android_asset and
302 * file:///android_res.
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800303 */
304 public void setAllowFileAccess(boolean allow) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000305 throw new MustOverrideException();
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800306 }
307
308 /**
Steve Block4e584df2012-04-24 23:12:47 +0100309 * Gets whether this WebView supports file access.
310 *
311 * @see #setAllowFileAccess
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800312 */
313 public boolean getAllowFileAccess() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000314 throw new MustOverrideException();
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800315 }
316
317 /**
Steve Block4e584df2012-04-24 23:12:47 +0100318 * Enables or disables content URL access within WebView. Content URL
319 * access allows WebView to load content from a content provider installed
320 * in the system. The default is enabled.
Patrick Scottd1737ed2011-01-05 11:36:48 -0500321 */
322 public void setAllowContentAccess(boolean allow) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000323 throw new MustOverrideException();
Patrick Scottd1737ed2011-01-05 11:36:48 -0500324 }
325
326 /**
Steve Block4e584df2012-04-24 23:12:47 +0100327 * Gets whether this WebView supports content URL access.
328 *
329 * @see #setAllowContentAccess
Patrick Scottd1737ed2011-01-05 11:36:48 -0500330 */
331 public boolean getAllowContentAccess() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000332 throw new MustOverrideException();
Patrick Scottd1737ed2011-01-05 11:36:48 -0500333 }
334
335 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100336 * Sets whether the WebView loads pages in overview mode. The default is
337 * false.
Grace Klobae397a882009-08-06 12:04:14 -0700338 */
339 public void setLoadWithOverviewMode(boolean overview) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000340 throw new MustOverrideException();
Grace Klobae397a882009-08-06 12:04:14 -0700341 }
342
343 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100344 * Gets whether this WebView loads pages in overview mode.
345 *
346 * @return whether this WebView loads pages in overview mode
347 * @see #setLoadWithOverviewMode
Grace Klobae397a882009-08-06 12:04:14 -0700348 */
349 public boolean getLoadWithOverviewMode() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000350 throw new MustOverrideException();
Grace Klobae397a882009-08-06 12:04:14 -0700351 }
352
353 /**
Steve Block4e584df2012-04-24 23:12:47 +0100354 * Sets whether the WebView will enable smooth transition while panning or
Adam Powelle00e8a782011-09-11 17:48:42 -0700355 * zooming or while the window hosting the WebView does not have focus.
356 * If it is true, WebView will choose a solution to maximize the performance.
357 * e.g. the WebView's content may not be updated during the transition.
358 * If it is false, WebView will keep its fidelity. The default value is false.
Kristian Monsen5cc23512012-08-09 15:33:08 -0400359 *
360 * @deprecated This method is now obsolete, and will become a no-op in future.
Grace Klobaf9b731d2010-06-21 19:23:57 -0700361 */
Kristian Monsen5cc23512012-08-09 15:33:08 -0400362 @Deprecated
Grace Klobaf9b731d2010-06-21 19:23:57 -0700363 public void setEnableSmoothTransition(boolean enable) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000364 throw new MustOverrideException();
Grace Klobaf9b731d2010-06-21 19:23:57 -0700365 }
Steve Block4e584df2012-04-24 23:12:47 +0100366
Grace Klobaf9b731d2010-06-21 19:23:57 -0700367 /**
Steve Block4e584df2012-04-24 23:12:47 +0100368 * Gets whether the WebView enables smooth transition while panning or
Grace Klobaf9b731d2010-06-21 19:23:57 -0700369 * zooming.
Steve Block4e584df2012-04-24 23:12:47 +0100370 *
371 * @see #setEnableSmoothTransition
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
Grace Klobaf9b731d2010-06-21 19:23:57 -0700376 public boolean enableSmoothTransition() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000377 throw new MustOverrideException();
Grace Klobaf9b731d2010-06-21 19:23:57 -0700378 }
379
380 /**
Steve Block4e584df2012-04-24 23:12:47 +0100381 * Sets whether the WebView uses its background for over scroll background.
Adam Powell637d3372010-08-25 14:37:03 -0700382 * If true, it will use the WebView's background. If false, it will use an
383 * internal pattern. Default is true.
Steve Block4e584df2012-04-24 23:12:47 +0100384 *
Kristian Monsenfc771652011-05-10 16:44:05 +0100385 * @deprecated This method is now obsolete.
Kristian Monsend0b90d32012-09-24 12:30:45 -0400386 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
Adam Powell637d3372010-08-25 14:37:03 -0700387 */
Kristian Monsenfc771652011-05-10 16:44:05 +0100388 @Deprecated
Adam Powell637d3372010-08-25 14:37:03 -0700389 public void setUseWebViewBackgroundForOverscrollBackground(boolean view) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000390 throw new MustOverrideException();
Adam Powell637d3372010-08-25 14:37:03 -0700391 }
392
393 /**
Steve Block4e584df2012-04-24 23:12:47 +0100394 * Gets whether this WebView uses WebView's background instead of
Adam Powell637d3372010-08-25 14:37:03 -0700395 * internal pattern for over scroll background.
Steve Block4e584df2012-04-24 23:12:47 +0100396 *
397 * @see #setUseWebViewBackgroundForOverscrollBackground
Kristian Monsenfc771652011-05-10 16:44:05 +0100398 * @deprecated This method is now obsolete.
Kristian Monsenf4912582012-08-16 15:26:24 -0400399 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
Adam Powell637d3372010-08-25 14:37:03 -0700400 */
Kristian Monsenfc771652011-05-10 16:44:05 +0100401 @Deprecated
Adam Powell637d3372010-08-25 14:37:03 -0700402 public boolean getUseWebViewBackgroundForOverscrollBackground() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000403 throw new MustOverrideException();
Adam Powell637d3372010-08-25 14:37:03 -0700404 }
405
406 /**
Selim Gurun5c11ef12013-01-04 14:58:36 -0800407 * Sets whether the WebView should save form data. The default is true.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700408 */
409 public void setSaveFormData(boolean save) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000410 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700411 }
412
413 /**
Selim Gurun5c11ef12013-01-04 14:58:36 -0800414 * Gets whether the WebView saves form data.
Steve Blockb0e0f332012-06-13 22:01:11 +0100415 *
416 * @return whether the WebView saves form data
417 * @see #setSaveFormData
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700418 */
419 public boolean getSaveFormData() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000420 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700421 }
422
423 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100424 * Sets whether the WebView should save passwords. The default is true.
Jonathan Dixon835b1fc2013-02-25 12:29:33 -0800425 * @deprecated Saving passwords in WebView will not be supported in future versions.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700426 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -0800427 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700428 public void setSavePassword(boolean save) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000429 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700430 }
431
432 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100433 * Gets whether the WebView saves passwords.
434 *
435 * @return whether the WebView saves passwords
436 * @see #setSavePassword
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
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700440 public boolean getSavePassword() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000441 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700442 }
443
444 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100445 * Sets the text zoom of the page in percent. The default is 100.
Steve Block4e584df2012-04-24 23:12:47 +0100446 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100447 * @param textZoom the text zoom in percent
John Reckff56bcd2011-06-16 17:12:08 -0700448 */
449 public synchronized void setTextZoom(int textZoom) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000450 throw new MustOverrideException();
John Reckff56bcd2011-06-16 17:12:08 -0700451 }
452
453 /**
Steve Block4e584df2012-04-24 23:12:47 +0100454 * Gets the text zoom of the page in percent.
455 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100456 * @return the text zoom of the page in percent
Mikhail Naganov1202d662012-08-07 18:26:52 +0100457 * @see #setTextZoom
John Reckff56bcd2011-06-16 17:12:08 -0700458 */
459 public synchronized int getTextZoom() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000460 throw new MustOverrideException();
John Reckff56bcd2011-06-16 17:12:08 -0700461 }
462
463 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100464 * Sets the text size of the page. The default is {@link TextSize#NORMAL}.
Steve Block4e584df2012-04-24 23:12:47 +0100465 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100466 * @param t the text size as a {@link TextSize} value
467 * @deprecated Use {@link #setTextZoom} instead.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700468 */
469 public synchronized void setTextSize(TextSize t) {
Mikhail Naganov1202d662012-08-07 18:26:52 +0100470 setTextZoom(t.value);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700471 }
472
473 /**
Steve Block4e584df2012-04-24 23:12:47 +0100474 * Gets the text size of the page. If the text size was previously specified
Steve Blockb0e0f332012-06-13 22:01:11 +0100475 * in percent using {@link #setTextZoom}, this will return the closest
476 * matching {@link TextSize}.
Steve Block4e584df2012-04-24 23:12:47 +0100477 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100478 * @return the text size as a {@link TextSize} value
479 * @see #setTextSize
480 * @deprecated Use {@link #getTextZoom} instead.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700481 */
482 public synchronized TextSize getTextSize() {
Mikhail Naganov1202d662012-08-07 18:26:52 +0100483 TextSize closestSize = null;
484 int smallestDelta = Integer.MAX_VALUE;
485 int textSize = getTextZoom();
486 for (TextSize size : TextSize.values()) {
487 int delta = Math.abs(textSize - size.value);
488 if (delta == 0) {
489 return size;
490 }
491 if (delta < smallestDelta) {
492 smallestDelta = delta;
493 closestSize = size;
494 }
495 }
496 return closestSize != null ? closestSize : TextSize.NORMAL;
Mangesh Ghiwareedb528e2011-10-12 14:25:41 -0700497 }
498
499 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100500 * Sets the default zoom density of the page. This must be called from the UI
501 * thread. The default is {@link ZoomDensity#MEDIUM}.
Steve Block4e584df2012-04-24 23:12:47 +0100502 *
Mikhail Naganov8887b2b2013-05-28 10:34:43 +0100503 * This setting is not recommended for use in new applications. If the WebView
504 * is utilized to display mobile-oriented pages, the desired effect can be achieved by
505 * adjusting 'width' and 'initial-scale' attributes of page's 'meta viewport'
506 * tag. For pages lacking the tag, {@link android.webkit.WebView#setInitialScale}
507 * and {@link #setUseWideViewPort} can be used.
508 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100509 * @param zoom the zoom density
Grace Kloba0d8b77c2009-06-25 11:20:51 -0700510 */
511 public void setDefaultZoom(ZoomDensity zoom) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000512 throw new MustOverrideException();
Grace Kloba0d8b77c2009-06-25 11:20:51 -0700513 }
514
515 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100516 * Gets the default zoom density of the page. This should be called from
517 * the UI thread.
518 *
Mikhail Naganov8887b2b2013-05-28 10:34:43 +0100519 * This setting is not recommended for use in new applications.
520 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100521 * @return the zoom density
522 * @see #setDefaultZoom
Grace Kloba0d8b77c2009-06-25 11:20:51 -0700523 */
524 public ZoomDensity getDefaultZoom() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000525 throw new MustOverrideException();
Grace Kloba0d8b77c2009-06-25 11:20:51 -0700526 }
527
528 /**
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700529 * Enables using light touches to make a selection and activate mouseovers.
Jonathan Dixon835b1fc2013-02-25 12:29:33 -0800530 * @deprecated From {@link android.os.Build.VERSION_CODES#JELLY_BEAN} this
531 * setting is obsolete and has no effect.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700532 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -0800533 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700534 public void setLightTouchEnabled(boolean enabled) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000535 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700536 }
537
538 /**
Steve Block4e584df2012-04-24 23:12:47 +0100539 * Gets whether light touches are enabled.
Steve Blockb0e0f332012-06-13 22:01:11 +0100540 * @see #setLightTouchEnabled
Jonathan Dixon98fac172013-02-28 15:32:10 -0800541 * @deprecated This setting is obsolete.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700542 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -0800543 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700544 public boolean getLightTouchEnabled() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000545 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700546 }
547
548 /**
Steve Block4e584df2012-04-24 23:12:47 +0100549 * Controlled a rendering optimization that is no longer present. Setting
550 * it now has no effect.
551 *
552 * @deprecated This setting now has no effect.
Kristian Monsenf4912582012-08-16 15:26:24 -0400553 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700554 */
Mike Hearnadcd2ed2009-01-21 16:44:36 +0100555 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700556 public synchronized void setUseDoubleTree(boolean use) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000557 // Specified to do nothing, so no need for derived classes to override.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700558 }
559
560 /**
Steve Block4e584df2012-04-24 23:12:47 +0100561 * Controlled a rendering optimization that is no longer present. Setting
562 * it now has no effect.
563 *
564 * @deprecated This setting now has no effect.
Kristian Monsenf4912582012-08-16 15:26:24 -0400565 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700566 */
Mike Hearnadcd2ed2009-01-21 16:44:36 +0100567 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700568 public synchronized boolean getUseDoubleTree() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000569 // Returns false unconditionally, so no need for derived classes to override.
Mike Hearnadcd2ed2009-01-21 16:44:36 +0100570 return false;
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700571 }
572
573 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100574 * Sets the user-agent string using an integer code.
575 * <ul>
576 * <li>0 means the WebView should use an Android user-agent string</li>
577 * <li>1 means the WebView should use a desktop user-agent string</li>
578 * </ul>
579 * Other values are ignored. The default is an Android user-agent string,
580 * i.e. code value 0.
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800581 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100582 * @param ua the integer code for the user-agent string
583 * @deprecated Please use {@link #setUserAgentString} instead.
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 */
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800586 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700587 public synchronized void setUserAgent(int ua) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000588 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700589 }
590
591 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100592 * Gets the user-agent as an integer code.
593 * <ul>
594 * <li>-1 means the WebView is using a custom user-agent string set with
595 * {@link #setUserAgentString}</li>
596 * <li>0 means the WebView should use an Android user-agent string</li>
597 * <li>1 means the WebView should use a desktop user-agent string</li>
598 * </ul>
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800599 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100600 * @return the integer code for the user-agent string
601 * @see #setUserAgent
602 * @deprecated Please use {@link #getUserAgentString} 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 */
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800605 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700606 public synchronized int getUserAgent() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000607 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700608 }
609
610 /**
Mikhail Naganovcb000a62013-01-04 18:02:54 +0000611 * Sets whether the WebView should enable support for the &quot;viewport&quot;
612 * HTML meta tag or should use a wide viewport.
613 * When the value of the setting is false, the layout width is always set to the
614 * width of the WebView control in device-independent (CSS) pixels.
615 * When the value is true and the page contains the viewport meta tag, the value
616 * of the width specified in the tag is used. If the page does not contain the tag or
617 * does not provide a width, then a wide viewport will be used.
Steve Blockb0e0f332012-06-13 22:01:11 +0100618 *
Mikhail Naganovcb000a62013-01-04 18:02:54 +0000619 * @param use whether to enable support for the viewport meta tag
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700620 */
621 public synchronized void setUseWideViewPort(boolean use) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000622 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700623 }
624
625 /**
Mikhail Naganovcb000a62013-01-04 18:02:54 +0000626 * Gets whether the WebView supports the &quot;viewport&quot;
627 * HTML meta tag or will use a wide viewport.
Steve Block4e584df2012-04-24 23:12:47 +0100628 *
Mikhail Naganovcb000a62013-01-04 18:02:54 +0000629 * @return true if the WebView supports the viewport meta tag
Steve Blockb0e0f332012-06-13 22:01:11 +0100630 * @see #setUseWideViewPort
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700631 */
632 public synchronized boolean getUseWideViewPort() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000633 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700634 }
635
636 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100637 * Sets whether the WebView whether supports multiple windows. If set to
638 * true, {@link WebChromeClient#onCreateWindow} must be implemented by the
639 * host application. The default is false.
640 *
641 * @param support whether to suport multiple windows
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700642 */
643 public synchronized void setSupportMultipleWindows(boolean support) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000644 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700645 }
646
647 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100648 * Gets whether the WebView supports multiple windows.
Steve Block4e584df2012-04-24 23:12:47 +0100649 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100650 * @return true if the WebView supports multiple windows
651 * @see #setSupportMultipleWindows
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700652 */
653 public synchronized boolean supportMultipleWindows() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000654 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700655 }
656
657 /**
Steve Block4e584df2012-04-24 23:12:47 +0100658 * Sets the underlying layout algorithm. This will cause a relayout of the
Steve Blockb0e0f332012-06-13 22:01:11 +0100659 * WebView. The default is {@link LayoutAlgorithm#NARROW_COLUMNS}.
Steve Block4e584df2012-04-24 23:12:47 +0100660 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100661 * @param l the layout algorithm to use, as a {@link LayoutAlgorithm} value
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700662 */
663 public synchronized void setLayoutAlgorithm(LayoutAlgorithm l) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000664 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700665 }
666
667 /**
Steve Block4e584df2012-04-24 23:12:47 +0100668 * Gets the current layout algorithm.
669 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100670 * @return the layout algorithm in use, as a {@link LayoutAlgorithm} value
Steve Block4e584df2012-04-24 23:12:47 +0100671 * @see #setLayoutAlgorithm
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700672 */
673 public synchronized LayoutAlgorithm getLayoutAlgorithm() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000674 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700675 }
676
677 /**
Steve Block4e584df2012-04-24 23:12:47 +0100678 * Sets the standard font family name. The default is "sans-serif".
679 *
680 * @param font a font family name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700681 */
682 public synchronized void setStandardFontFamily(String font) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000683 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700684 }
685
686 /**
Steve Block4e584df2012-04-24 23:12:47 +0100687 * Gets the standard font family name.
688 *
689 * @return the standard font family name as a string
690 * @see #setStandardFontFamily
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700691 */
692 public synchronized String getStandardFontFamily() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000693 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700694 }
695
696 /**
Steve Block4e584df2012-04-24 23:12:47 +0100697 * Sets the fixed font family name. The default is "monospace".
698 *
699 * @param font a font family name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700700 */
701 public synchronized void setFixedFontFamily(String font) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000702 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700703 }
704
705 /**
Steve Block4e584df2012-04-24 23:12:47 +0100706 * Gets the fixed font family name.
707 *
708 * @return the fixed font family name as a string
709 * @see #setFixedFontFamily
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700710 */
711 public synchronized String getFixedFontFamily() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000712 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700713 }
714
715 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100716 * Sets the sans-serif font family name. The default is "sans-serif".
Steve Block4e584df2012-04-24 23:12:47 +0100717 *
718 * @param font a font family name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700719 */
720 public synchronized void setSansSerifFontFamily(String font) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000721 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700722 }
723
724 /**
Steve Block4e584df2012-04-24 23:12:47 +0100725 * Gets the sans-serif font family name.
726 *
727 * @return the sans-serif font family name as a string
Steve Blockb0e0f332012-06-13 22:01:11 +0100728 * @see #setSansSerifFontFamily
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700729 */
730 public synchronized String getSansSerifFontFamily() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000731 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700732 }
733
734 /**
Steve Block4e584df2012-04-24 23:12:47 +0100735 * Sets the serif font family name. The default is "sans-serif".
736 *
737 * @param font a font family name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700738 */
739 public synchronized void setSerifFontFamily(String font) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000740 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700741 }
742
743 /**
Steve Block4e584df2012-04-24 23:12:47 +0100744 * Gets the serif font family name. The default is "serif".
745 *
746 * @return the serif font family name as a string
747 * @see #setSerifFontFamily
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700748 */
749 public synchronized String getSerifFontFamily() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000750 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700751 }
752
753 /**
Steve Block4e584df2012-04-24 23:12:47 +0100754 * Sets the cursive font family name. The default is "cursive".
755 *
756 * @param font a font family name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700757 */
758 public synchronized void setCursiveFontFamily(String font) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000759 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700760 }
761
762 /**
Steve Block4e584df2012-04-24 23:12:47 +0100763 * Gets the cursive font family name.
764 *
765 * @return the cursive font family name as a string
766 * @see #setCursiveFontFamily
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700767 */
768 public synchronized String getCursiveFontFamily() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000769 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700770 }
771
772 /**
Steve Block4e584df2012-04-24 23:12:47 +0100773 * Sets the fantasy font family name. The default is "fantasy".
774 *
775 * @param font a font family name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700776 */
777 public synchronized void setFantasyFontFamily(String font) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000778 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700779 }
780
781 /**
Steve Block4e584df2012-04-24 23:12:47 +0100782 * Gets the fantasy font family name.
783 *
784 * @return the fantasy font family name as a string
785 * @see #setFantasyFontFamily
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700786 */
787 public synchronized String getFantasyFontFamily() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000788 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700789 }
790
791 /**
Steve Block4e584df2012-04-24 23:12:47 +0100792 * Sets the minimum font size. The default is 8.
793 *
794 * @param size a non-negative integer between 1 and 72. Any number outside
795 * the specified range will be pinned.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700796 */
797 public synchronized void setMinimumFontSize(int size) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000798 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700799 }
800
801 /**
Steve Block4e584df2012-04-24 23:12:47 +0100802 * Gets the minimum font size.
803 *
804 * @return a non-negative integer between 1 and 72
805 * @see #setMinimumFontSize
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700806 */
807 public synchronized int getMinimumFontSize() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000808 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700809 }
810
811 /**
Steve Block4e584df2012-04-24 23:12:47 +0100812 * Sets the minimum logical font size. The default is 8.
813 *
814 * @param size a non-negative integer between 1 and 72. Any number outside
815 * the specified range will be pinned.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700816 */
817 public synchronized void setMinimumLogicalFontSize(int size) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000818 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700819 }
820
821 /**
Steve Block4e584df2012-04-24 23:12:47 +0100822 * Gets the minimum logical font size.
823 *
824 * @return a non-negative integer between 1 and 72
825 * @see #setMinimumLogicalFontSize
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700826 */
827 public synchronized int getMinimumLogicalFontSize() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000828 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700829 }
830
831 /**
Steve Block4e584df2012-04-24 23:12:47 +0100832 * Sets the default font size. The default is 16.
833 *
834 * @param size a non-negative integer between 1 and 72. Any number outside
835 * the specified range will be pinned.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700836 */
837 public synchronized void setDefaultFontSize(int size) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000838 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700839 }
840
841 /**
Steve Block4e584df2012-04-24 23:12:47 +0100842 * Gets the default font size.
843 *
844 * @return a non-negative integer between 1 and 72
845 * @see #setDefaultFontSize
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700846 */
847 public synchronized int getDefaultFontSize() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000848 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700849 }
850
851 /**
Steve Block4e584df2012-04-24 23:12:47 +0100852 * Sets the default fixed font size. The default is 16.
853 *
854 * @param size a non-negative integer between 1 and 72. Any number outside
855 * the specified range will be pinned.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700856 */
857 public synchronized void setDefaultFixedFontSize(int size) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000858 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700859 }
860
861 /**
Steve Block4e584df2012-04-24 23:12:47 +0100862 * Gets the default fixed font size.
863 *
864 * @return a non-negative integer between 1 and 72
865 * @see #setDefaultFixedFontSize
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700866 */
867 public synchronized int getDefaultFixedFontSize() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000868 throw new MustOverrideException();
Grace Kloba097b1e772009-11-24 14:23:18 -0800869 }
870
871 /**
Mikhail Naganov605a4912012-02-03 16:53:10 +0000872 * Sets whether the WebView should load image resources. Note that this method
873 * controls loading of all images, including those embedded using the data
874 * URI scheme. Use {@link #setBlockNetworkImage} to control loading only
875 * of images specified using network URI schemes. Note that if the value of this
876 * setting is changed from false to true, all images resources referenced
877 * by content currently displayed by the WebView are loaded automatically.
Steve Block4e584df2012-04-24 23:12:47 +0100878 * The default is true.
879 *
880 * @param flag whether the WebView should load image resources
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700881 */
882 public synchronized void setLoadsImagesAutomatically(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000883 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700884 }
885
886 /**
Steve Block4e584df2012-04-24 23:12:47 +0100887 * Gets whether the WebView loads image resources. This includes
888 * images embedded using the data URI scheme.
889 *
890 * @return true if the WebView loads image resources
891 * @see #setLoadsImagesAutomatically
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700892 */
893 public synchronized boolean getLoadsImagesAutomatically() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000894 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700895 }
896
897 /**
Mikhail Naganov605a4912012-02-03 16:53:10 +0000898 * Sets whether the WebView should not load image resources from the
899 * network (resources accessed via http and https URI schemes). Note
900 * that this method has no effect unless
901 * {@link #getLoadsImagesAutomatically} returns true. Also note that
902 * disabling all network loads using {@link #setBlockNetworkLoads}
903 * will also prevent network images from loading, even if this flag is set
904 * to false. When the value of this setting is changed from true to false,
905 * network images resources referenced by content currently displayed by
Steve Block4e584df2012-04-24 23:12:47 +0100906 * the WebView are fetched automatically. The default is false.
907 *
908 * @param flag whether the WebView should not load image resources from the
909 * network
Patrick Scottf43113f2010-02-18 09:13:12 -0500910 * @see #setBlockNetworkLoads
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700911 */
912 public synchronized void setBlockNetworkImage(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000913 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700914 }
915
916 /**
Steve Block4e584df2012-04-24 23:12:47 +0100917 * Gets whether the WebView does not load image resources from the network.
918 *
919 * @return true if the WebView does not load image resources from the network
920 * @see #setBlockNetworkImage
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700921 */
922 public synchronized boolean getBlockNetworkImage() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000923 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700924 }
Mike Hearnadcd2ed2009-01-21 16:44:36 +0100925
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800926 /**
Mikhail Naganov605a4912012-02-03 16:53:10 +0000927 * Sets whether the WebView should not load resources from the network.
928 * Use {@link #setBlockNetworkImage} to only avoid loading
929 * image resources. Note that if the value of this setting is
930 * changed from true to false, network resources referenced by content
931 * currently displayed by the WebView are not fetched until
932 * {@link android.webkit.WebView#reload} is called.
933 * If the application does not have the
934 * {@link android.Manifest.permission#INTERNET} permission, attempts to set
935 * a value of false will cause a {@link java.lang.SecurityException}
Steve Block4e584df2012-04-24 23:12:47 +0100936 * to be thrown. The default value is false if the application has the
937 * {@link android.Manifest.permission#INTERNET} permission, otherwise it is
938 * true.
939 *
940 * @param flag whether the WebView should not load any resources from the
941 * network
Patrick Scottf43113f2010-02-18 09:13:12 -0500942 * @see android.webkit.WebView#reload
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800943 */
944 public synchronized void setBlockNetworkLoads(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000945 throw new MustOverrideException();
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800946 }
947
948 /**
Steve Block4e584df2012-04-24 23:12:47 +0100949 * Gets whether the WebView does not load any resources from the network.
950 *
951 * @return true if the WebView does not load any resources from the network
952 * @see #setBlockNetworkLoads
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800953 */
954 public synchronized boolean getBlockNetworkLoads() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000955 throw new MustOverrideException();
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800956 }
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700957
958 /**
Steve Block4e584df2012-04-24 23:12:47 +0100959 * Tells the WebView to enable JavaScript execution.
960 * <b>The default is false.</b>
961 *
962 * @param flag true if the WebView should execute JavaScript
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700963 */
964 public synchronized void setJavaScriptEnabled(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000965 throw new MustOverrideException();
Teng-Hui Zhuda7378e2011-02-16 11:25:03 -0800966 }
967
968 /**
Steve Blockef163152012-04-23 18:08:06 +0100969 * 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 Naganov65e7ace2012-08-07 13:57:42 +0100974 * Note that this setting affects only JavaScript access to file scheme
975 * resources. Other access to such resources, for example, from image HTML
976 * elements, is unaffected.
Steve Blockef163152012-04-23 18:08:06 +0100977 * <p>
978 * The default value is true for API level
979 * {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1} and below,
980 * and false for API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN}
981 * and above.
Selim Gurun0ea6dad2012-03-29 18:19:01 -0700982 *
Steve Blockef163152012-04-23 18:08:06 +0100983 * @param flag whether JavaScript running in the context of a file scheme
984 * URL should be allowed to access content from any origin
Selim Gurun0ea6dad2012-03-29 18:19:01 -0700985 */
986 public abstract void setAllowUniversalAccessFromFileURLs(boolean flag);
987
988 /**
Steve Blockef163152012-04-23 18:08:06 +0100989 * Sets whether JavaScript running in the context of a file scheme URL
990 * should be allowed to access content from other file scheme URLs. To
991 * enable the most restrictive, and therefore secure policy, this setting
992 * should be disabled. Note that the value of this setting is ignored if
993 * the value of {@link #getAllowUniversalAccessFromFileURLs} is true.
Mikhail Naganov65e7ace2012-08-07 13:57:42 +0100994 * Note too, that this setting affects only JavaScript access to file scheme
995 * resources. Other access to such resources, for example, from image HTML
996 * elements, is unaffected.
Steve Blockef163152012-04-23 18:08:06 +0100997 * <p>
998 * The default value is true for API level
999 * {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1} and below,
1000 * and false for API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN}
1001 * and above.
Selim Gurun0ea6dad2012-03-29 18:19:01 -07001002 *
Steve Blockef163152012-04-23 18:08:06 +01001003 * @param flag whether JavaScript running in the context of a file scheme
1004 * URL should be allowed to access content from other file
1005 * scheme URLs
Selim Gurun0ea6dad2012-03-29 18:19:01 -07001006 */
1007 public abstract void setAllowFileAccessFromFileURLs(boolean flag);
1008
1009 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001010 * Sets whether the WebView should enable plugins. The default is false.
Steve Block4e584df2012-04-24 23:12:47 +01001011 *
Steve Blockb0e0f332012-06-13 22:01:11 +01001012 * @param flag true if plugins should be enabled
Patrick Scott300f2e92010-03-22 10:20:45 -04001013 * @deprecated This method has been deprecated in favor of
1014 * {@link #setPluginState}
Jonathan Dixon0bf47812013-03-07 17:20:08 -08001015 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001016 */
Michael Kolba172e7d2010-06-30 12:35:26 -07001017 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001018 public synchronized void setPluginsEnabled(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001019 throw new MustOverrideException();
Patrick Scott300f2e92010-03-22 10:20:45 -04001020 }
1021
1022 /**
Steve Block4e584df2012-04-24 23:12:47 +01001023 * Tells the WebView to enable, disable, or have plugins on demand. On
Patrick Scott300f2e92010-03-22 10:20:45 -04001024 * demand mode means that if a plugin exists that can handle the embedded
1025 * content, a placeholder icon will be shown instead of the plugin. When
Steve Blockb0e0f332012-06-13 22:01:11 +01001026 * the placeholder is clicked, the plugin will be enabled. The default is
1027 * {@link PluginState#OFF}.
Steve Block4e584df2012-04-24 23:12:47 +01001028 *
1029 * @param state a PluginState value
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001030 * @deprecated Plugins will not be supported in future, and should not be used.
Patrick Scott300f2e92010-03-22 10:20:45 -04001031 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001032 @Deprecated
Patrick Scott300f2e92010-03-22 10:20:45 -04001033 public synchronized void setPluginState(PluginState state) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001034 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001035 }
1036
1037 /**
Steve Block4e584df2012-04-24 23:12:47 +01001038 * Sets a custom path to plugins used by the WebView. This method is
Derek Sollenbergerfdbdeb32010-08-12 11:20:13 -04001039 * obsolete since each plugin is now loaded from its own package.
Steve Block4e584df2012-04-24 23:12:47 +01001040 *
1041 * @param pluginsPath a String path to the directory containing plugins
Derek Sollenbergerfdbdeb32010-08-12 11:20:13 -04001042 * @deprecated This method is no longer used as plugins are loaded from
Steve Block4e584df2012-04-24 23:12:47 +01001043 * their own APK via the system's package manager.
Jonathan Dixon0bf47812013-03-07 17:20:08 -08001044 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001045 */
Jason Chen9dc2e752010-09-01 19:11:14 -07001046 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001047 public synchronized void setPluginsPath(String pluginsPath) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001048 // Specified to do nothing, so no need for derived classes to override.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001049 }
1050
1051 /**
Steve Block4e584df2012-04-24 23:12:47 +01001052 * Sets the path to where database storage API databases should be saved.
Steve Block72ca7a42012-06-13 22:00:30 +01001053 * In order for the database storage API to function correctly, this method
1054 * must be called with a path to which the application can write. This
1055 * method should only be called once: repeated calls are ignored.
Steve Block4e584df2012-04-24 23:12:47 +01001056 *
Steve Block72ca7a42012-06-13 22:00:30 +01001057 * @param databasePath a path to the directory where databases should be
1058 * saved.
Ben Murdoch7df19852009-04-22 13:07:58 +01001059 */
Steve Block4e584df2012-04-24 23:12:47 +01001060 // This will update WebCore when the Sync runs in the C++ side.
Steve Block72ca7a42012-06-13 22:00:30 +01001061 // Note that the WebCore Database Tracker only allows the path to be set
1062 // once.
Ben Murdoch7df19852009-04-22 13:07:58 +01001063 public synchronized void setDatabasePath(String databasePath) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001064 throw new MustOverrideException();
Ben Murdoch7df19852009-04-22 13:07:58 +01001065 }
1066
1067 /**
Steve Block72ca7a42012-06-13 22:00:30 +01001068 * Sets the path where the Geolocation databases should be saved. In order
1069 * for Geolocation permissions and cached positions to be persisted, this
1070 * method must be called with a path to which the application can write.
Steve Block4e584df2012-04-24 23:12:47 +01001071 *
Steve Block72ca7a42012-06-13 22:00:30 +01001072 * @param databasePath a path to the directory where databases should be
1073 * saved.
Steve Block9d3273f2009-08-21 13:16:27 +01001074 */
Steve Block4e584df2012-04-24 23:12:47 +01001075 // This will update WebCore when the Sync runs in the C++ side.
Steve Block9d3273f2009-08-21 13:16:27 +01001076 public synchronized void setGeolocationDatabasePath(String databasePath) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001077 throw new MustOverrideException();
Steve Block9d3273f2009-08-21 13:16:27 +01001078 }
1079
1080 /**
Steve Block72ca7a42012-06-13 22:00:30 +01001081 * Sets whether the Application Caches API should be enabled. The default
1082 * is false. Note that in order for the Application Caches API to be
1083 * enabled, a valid database path must also be supplied to
1084 * {@link #setAppCachePath}.
Steve Block4e584df2012-04-24 23:12:47 +01001085 *
1086 * @param flag true if the WebView should enable Application Caches
Andrei Popescu60a9a7d2009-04-17 10:43:42 +01001087 */
1088 public synchronized void setAppCacheEnabled(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001089 throw new MustOverrideException();
Andrei Popescu60a9a7d2009-04-17 10:43:42 +01001090 }
1091
1092 /**
Steve Block72ca7a42012-06-13 22:00:30 +01001093 * 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 Block4e584df2012-04-24 23:12:47 +01001097 *
1098 * @param appCachePath a String path to the directory containing
Steve Block72ca7a42012-06-13 22:00:30 +01001099 * Application Caches files.
Jonathan Dixon47aaba32012-11-30 16:32:17 -08001100 * @see #setAppCacheEnabled
Andrei Popescu60a9a7d2009-04-17 10:43:42 +01001101 */
Jonathan Dixon3c909522012-02-28 18:45:06 +00001102 public synchronized void setAppCachePath(String appCachePath) {
1103 throw new MustOverrideException();
Andrei Popescu60a9a7d2009-04-17 10:43:42 +01001104 }
1105
1106 /**
Selim Gurunb632adf2012-06-28 11:21:05 -07001107 * Sets the maximum size for the Application Cache content. The passed size
1108 * will be rounded to the nearest value that the database can support, so
1109 * this should be viewed as a guide, not a hard limit. Setting the
1110 * size to a value less than current database size does not cause the
Selim Gurunf27ac092012-06-28 11:21:05 -07001111 * database to be trimmed. The default size is {@link Long#MAX_VALUE}.
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001112 * It is recommended to leave the maximum size set to the default value.
Steve Block4e584df2012-04-24 23:12:47 +01001113 *
1114 * @param appCacheMaxSize the maximum size in bytes
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001115 * @deprecated In future quota will be managed automatically.
Andrei Popescu1c829202009-07-22 16:47:52 +01001116 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001117 @Deprecated
Andrei Popescu1c829202009-07-22 16:47:52 +01001118 public synchronized void setAppCacheMaxSize(long appCacheMaxSize) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001119 throw new MustOverrideException();
Andrei Popescu1c829202009-07-22 16:47:52 +01001120 }
1121
1122 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001123 * Sets whether the database storage API is enabled. The default value is
1124 * false. See also {@link #setDatabasePath} for how to correctly set up the
1125 * database storage API.
Steve Block4e584df2012-04-24 23:12:47 +01001126 *
Selim Gurun2bca22b2013-02-28 17:47:21 -08001127 * This setting is global in effect, across all WebView instances in a process.
1128 * Note you should only modify this setting prior to making <b>any</b> WebView
1129 * page load within a given process, as the WebView implementation may ignore
1130 * changes to this setting after that point.
1131 *
Steve Block4e584df2012-04-24 23:12:47 +01001132 * @param flag true if the WebView should use the database storage API
Ben Murdoch7df19852009-04-22 13:07:58 +01001133 */
1134 public synchronized void setDatabaseEnabled(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001135 throw new MustOverrideException();
Ben Murdoch7df19852009-04-22 13:07:58 +01001136 }
1137
1138 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001139 * Sets whether the DOM storage API is enabled. The default value is false.
Steve Block4e584df2012-04-24 23:12:47 +01001140 *
1141 * @param flag true if the WebView should use the DOM storage API
Ben Murdoch274680d2009-05-28 13:44:44 +01001142 */
1143 public synchronized void setDomStorageEnabled(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001144 throw new MustOverrideException();
Ben Murdoch274680d2009-05-28 13:44:44 +01001145 }
1146
1147 /**
Steve Block4e584df2012-04-24 23:12:47 +01001148 * Gets whether the DOM Storage APIs are enabled.
1149 *
1150 * @return true if the DOM Storage APIs are enabled
Steve Blockb0e0f332012-06-13 22:01:11 +01001151 * @see #setDomStorageEnabled
Ben Murdoch274680d2009-05-28 13:44:44 +01001152 */
1153 public synchronized boolean getDomStorageEnabled() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001154 throw new MustOverrideException();
Ben Murdoch274680d2009-05-28 13:44:44 +01001155 }
Ben Murdoch274680d2009-05-28 13:44:44 +01001156 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001157 * Gets the path to where database storage API databases are saved.
Steve Block4e584df2012-04-24 23:12:47 +01001158 *
1159 * @return the String path to the database storage API databases
Steve Blockb0e0f332012-06-13 22:01:11 +01001160 * @see #setDatabasePath
Ben Murdoch7df19852009-04-22 13:07:58 +01001161 */
1162 public synchronized String getDatabasePath() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001163 throw new MustOverrideException();
Ben Murdoch7df19852009-04-22 13:07:58 +01001164 }
1165
1166 /**
Steve Block4e584df2012-04-24 23:12:47 +01001167 * Gets whether the database storage API is enabled.
1168 *
1169 * @return true if the database storage API is enabled
Steve Blockb0e0f332012-06-13 22:01:11 +01001170 * @see #setDatabaseEnabled
Ben Murdoch7df19852009-04-22 13:07:58 +01001171 */
1172 public synchronized boolean getDatabaseEnabled() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001173 throw new MustOverrideException();
Andrei Popescuc27a9ac2009-08-03 15:59:24 +01001174 }
1175
1176 /**
Mikhail Naganov6cb296a2012-08-28 16:57:24 +01001177 * Sets whether Geolocation is enabled. The default is true.
1178 * <p>
1179 * Please note that in order for the Geolocation API to be usable
1180 * by a page in the WebView, the following requirements must be met:
1181 * <ul>
1182 * <li>an application must have permission to access the device location,
1183 * see {@link android.Manifest.permission#ACCESS_COARSE_LOCATION},
1184 * {@link android.Manifest.permission#ACCESS_FINE_LOCATION};
1185 * <li>an application must provide an implementation of the
1186 * {@link WebChromeClient#onGeolocationPermissionsShowPrompt} callback
1187 * to receive notifications that a page is requesting access to location
1188 * via the JavaScript Geolocation API.
1189 * </ul>
1190 * <p>
1191 * As an option, it is possible to store previous locations and web origin
1192 * permissions in a database. See {@link #setGeolocationDatabasePath}.
Steve Block4e584df2012-04-24 23:12:47 +01001193 *
1194 * @param flag whether Geolocation should be enabled
Steve Block06cd7512009-08-21 10:26:37 +01001195 */
1196 public synchronized void setGeolocationEnabled(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001197 throw new MustOverrideException();
Elliott Slaughter5dc0c822010-06-22 11:31:54 -07001198 }
1199
1200 /**
Steve Block4e584df2012-04-24 23:12:47 +01001201 * Gets whether JavaScript is enabled.
1202 *
1203 * @return true if JavaScript is enabled
1204 * @see #setJavaScriptEnabled
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001205 */
1206 public synchronized boolean getJavaScriptEnabled() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001207 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001208 }
1209
1210 /**
Steve Blockef163152012-04-23 18:08:06 +01001211 * Gets whether JavaScript running in the context of a file scheme URL can
1212 * access content from any origin. This includes access to content from
1213 * other file scheme URLs.
Selim Gurun0ea6dad2012-03-29 18:19:01 -07001214 *
Steve Blockef163152012-04-23 18:08:06 +01001215 * @return whether JavaScript running in the context of a file scheme URL
1216 * can access content from any origin
Steve Block4e584df2012-04-24 23:12:47 +01001217 * @see #setAllowUniversalAccessFromFileURLs
Selim Gurun0ea6dad2012-03-29 18:19:01 -07001218 */
1219 public abstract boolean getAllowUniversalAccessFromFileURLs();
1220
1221 /**
Steve Blockef163152012-04-23 18:08:06 +01001222 * Gets whether JavaScript running in the context of a file scheme URL can
1223 * access content from other file scheme URLs.
Selim Gurun0ea6dad2012-03-29 18:19:01 -07001224 *
Steve Blockef163152012-04-23 18:08:06 +01001225 * @return whether JavaScript running in the context of a file scheme URL
1226 * can access content from other file scheme URLs
Steve Block4e584df2012-04-24 23:12:47 +01001227 * @see #setAllowFileAccessFromFileURLs
Selim Gurun0ea6dad2012-03-29 18:19:01 -07001228 */
1229 public abstract boolean getAllowFileAccessFromFileURLs();
1230
1231 /**
Steve Block4e584df2012-04-24 23:12:47 +01001232 * Gets whether plugins are enabled.
1233 *
1234 * @return true if plugins are enabled
Steve Blockb0e0f332012-06-13 22:01:11 +01001235 * @see #setPluginsEnabled
Patrick Scott300f2e92010-03-22 10:20:45 -04001236 * @deprecated This method has been replaced by {@link #getPluginState}
Jonathan Dixon0bf47812013-03-07 17:20:08 -08001237 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001238 */
Michael Kolba172e7d2010-06-30 12:35:26 -07001239 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001240 public synchronized boolean getPluginsEnabled() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001241 throw new MustOverrideException();
Patrick Scott300f2e92010-03-22 10:20:45 -04001242 }
1243
1244 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001245 * Gets the current state regarding whether plugins are enabled.
Steve Block4e584df2012-04-24 23:12:47 +01001246 *
Steve Blockb0e0f332012-06-13 22:01:11 +01001247 * @return the plugin state as a {@link PluginState} value
1248 * @see #setPluginState
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001249 * @deprecated Plugins will not be supported in future, and should not be used.
Patrick Scott300f2e92010-03-22 10:20:45 -04001250 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001251 @Deprecated
Patrick Scott300f2e92010-03-22 10:20:45 -04001252 public synchronized PluginState getPluginState() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001253 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001254 }
1255
1256 /**
Steve Block4e584df2012-04-24 23:12:47 +01001257 * Gets the directory that contains the plugin libraries. This method is
Derek Sollenbergerfdbdeb32010-08-12 11:20:13 -04001258 * obsolete since each plugin is now loaded from its own package.
Steve Block4e584df2012-04-24 23:12:47 +01001259 *
1260 * @return an empty string
Derek Sollenbergerfdbdeb32010-08-12 11:20:13 -04001261 * @deprecated This method is no longer used as plugins are loaded from
1262 * their own APK via the system's package manager.
Jonathan Dixon0bf47812013-03-07 17:20:08 -08001263 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001264 */
Jason Chen9dc2e752010-09-01 19:11:14 -07001265 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001266 public synchronized String getPluginsPath() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001267 // Unconditionally returns empty string, so no need for derived classes to override.
Grace Kloba658ab7d2009-05-14 14:45:26 -07001268 return "";
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001269 }
1270
1271 /**
Steve Block4e584df2012-04-24 23:12:47 +01001272 * Tells JavaScript to open windows automatically. This applies to the
1273 * JavaScript function window.open(). The default is false.
1274 *
1275 * @param flag true if JavaScript can open windows automatically
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001276 */
Jonathan Dixon3c909522012-02-28 18:45:06 +00001277 public synchronized void setJavaScriptCanOpenWindowsAutomatically(boolean flag) {
1278 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001279 }
1280
1281 /**
Steve Block4e584df2012-04-24 23:12:47 +01001282 * Gets whether JavaScript can open windows automatically.
1283 *
1284 * @return true if JavaScript can open windows automatically during
1285 * window.open()
1286 * @see #setJavaScriptCanOpenWindowsAutomatically
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001287 */
1288 public synchronized boolean getJavaScriptCanOpenWindowsAutomatically() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001289 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001290 }
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001291 /**
Steve Block4e584df2012-04-24 23:12:47 +01001292 * Sets the default text encoding name to use when decoding html pages.
1293 * The default is "Latin-1".
1294 *
1295 * @param encoding the text encoding name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001296 */
1297 public synchronized void setDefaultTextEncodingName(String encoding) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001298 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001299 }
1300
1301 /**
Steve Block4e584df2012-04-24 23:12:47 +01001302 * Gets the default text encoding name.
1303 *
1304 * @return the default text encoding name as a string
1305 * @see #setDefaultTextEncodingName
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001306 */
1307 public synchronized String getDefaultTextEncodingName() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001308 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001309 }
1310
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -08001311 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001312 * Sets the WebView's user-agent string. If the string is null or empty,
1313 * the system default value will be used.
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -08001314 */
1315 public synchronized void setUserAgentString(String ua) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001316 throw new MustOverrideException();
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -08001317 }
1318
1319 /**
Steve Block4e584df2012-04-24 23:12:47 +01001320 * Gets the WebView's user-agent string.
Steve Blockb0e0f332012-06-13 22:01:11 +01001321 *
1322 * @return the WebView's user-agent string
1323 * @see #setUserAgentString
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -08001324 */
1325 public synchronized String getUserAgentString() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001326 throw new MustOverrideException();
Shimeng (Simon) Wangc55886a2010-10-28 13:46:02 -07001327 }
1328
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001329 /**
George Mount9f410c52012-08-10 15:29:30 -07001330 * Returns the default User-Agent used by a WebView.
1331 * An instance of WebView could use a different User-Agent if a call
Kristian Monsenf4912582012-08-16 15:26:24 -04001332 * is made to {@link WebSettings#setUserAgentString(String)}.
George Mount9f410c52012-08-10 15:29:30 -07001333 *
1334 * @param context a Context object used to access application assets
1335 */
1336 public static String getDefaultUserAgent(Context context) {
Jonathan Dixond1c4faa2012-08-20 16:37:15 -07001337 return WebViewFactory.getProvider().getStatics().getDefaultUserAgent(context);
George Mount9f410c52012-08-10 15:29:30 -07001338 }
1339
1340 /**
Steve Block4e584df2012-04-24 23:12:47 +01001341 * Tells the WebView whether it needs to set a node to have focus when
Steve Blockb0e0f332012-06-13 22:01:11 +01001342 * {@link WebView#requestFocus(int, android.graphics.Rect)} is called. The
1343 * default value is true.
Michael Kolba172e7d2010-06-30 12:35:26 -07001344 *
Steve Block4e584df2012-04-24 23:12:47 +01001345 * @param flag whether the WebView needs to set a node
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001346 */
1347 public void setNeedInitialFocus(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001348 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001349 }
1350
1351 /**
Steve Block4e584df2012-04-24 23:12:47 +01001352 * Sets the priority of the Render thread. Unlike the other settings, this
Steve Blockb0e0f332012-06-13 22:01:11 +01001353 * one only needs to be called once per process. The default value is
1354 * {@link RenderPriority#NORMAL}.
Mike Hearnadcd2ed2009-01-21 16:44:36 +01001355 *
Steve Blockb0e0f332012-06-13 22:01:11 +01001356 * @param priority the priority
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001357 * @deprecated It is not recommended to adjust thread priorities, and this will
1358 * not be supported in future versions.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001359 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001360 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001361 public synchronized void setRenderPriority(RenderPriority priority) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001362 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001363 }
Michael Kolba172e7d2010-06-30 12:35:26 -07001364
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001365 /**
Steve Block4e584df2012-04-24 23:12:47 +01001366 * Overrides the way the cache is used. The way the cache is used is based
Steve Blockb0e0f332012-06-13 22:01:11 +01001367 * on the navigation type. For a normal page load, the cache is checked
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001368 * and content is re-validated as needed. When navigating back, content is
Steve Blockb0e0f332012-06-13 22:01:11 +01001369 * not revalidated, instead the content is just retrieved from the cache.
1370 * This method allows the client to override this behavior by specifying
Mikhail Naganov56936a12012-07-25 13:07:18 +01001371 * one of {@link #LOAD_DEFAULT},
Steve Blockb0e0f332012-06-13 22:01:11 +01001372 * {@link #LOAD_CACHE_ELSE_NETWORK}, {@link #LOAD_NO_CACHE} or
1373 * {@link #LOAD_CACHE_ONLY}. The default value is {@link #LOAD_DEFAULT}.
Steve Block4e584df2012-04-24 23:12:47 +01001374 *
Steve Blockb0e0f332012-06-13 22:01:11 +01001375 * @param mode the mode to use
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001376 */
1377 public void setCacheMode(int mode) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001378 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001379 }
Michael Kolba172e7d2010-06-30 12:35:26 -07001380
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001381 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001382 * Gets the current setting for overriding the cache mode.
1383 *
1384 * @return the current setting for overriding the cache mode
1385 * @see #setCacheMode
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001386 */
1387 public int getCacheMode() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001388 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001389 }
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001390}