blob: 8ae00210eea526c546131cbb887e2e1773b6b908 [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 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100503 * @param zoom the zoom density
Grace Kloba0d8b77c2009-06-25 11:20:51 -0700504 */
505 public void setDefaultZoom(ZoomDensity zoom) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000506 throw new MustOverrideException();
Grace Kloba0d8b77c2009-06-25 11:20:51 -0700507 }
508
509 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100510 * Gets the default zoom density of the page. This should be called from
511 * the UI thread.
512 *
513 * @return the zoom density
514 * @see #setDefaultZoom
Grace Kloba0d8b77c2009-06-25 11:20:51 -0700515 */
516 public ZoomDensity getDefaultZoom() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000517 throw new MustOverrideException();
Grace Kloba0d8b77c2009-06-25 11:20:51 -0700518 }
519
520 /**
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700521 * Enables using light touches to make a selection and activate mouseovers.
Jonathan Dixon835b1fc2013-02-25 12:29:33 -0800522 * @deprecated From {@link android.os.Build.VERSION_CODES#JELLY_BEAN} this
523 * setting is obsolete and has no effect.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700524 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -0800525 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700526 public void setLightTouchEnabled(boolean enabled) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000527 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700528 }
529
530 /**
Steve Block4e584df2012-04-24 23:12:47 +0100531 * Gets whether light touches are enabled.
Steve Blockb0e0f332012-06-13 22:01:11 +0100532 * @see #setLightTouchEnabled
Jonathan Dixon98fac172013-02-28 15:32:10 -0800533 * @deprecated This setting is obsolete.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700534 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -0800535 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700536 public boolean getLightTouchEnabled() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000537 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700538 }
539
540 /**
Steve Block4e584df2012-04-24 23:12:47 +0100541 * Controlled a rendering optimization that is no longer present. Setting
542 * it now has no effect.
543 *
544 * @deprecated This setting now has no effect.
Kristian Monsenf4912582012-08-16 15:26:24 -0400545 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700546 */
Mike Hearnadcd2ed2009-01-21 16:44:36 +0100547 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700548 public synchronized void setUseDoubleTree(boolean use) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000549 // Specified to do nothing, so no need for derived classes to override.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700550 }
551
552 /**
Steve Block4e584df2012-04-24 23:12:47 +0100553 * Controlled a rendering optimization that is no longer present. Setting
554 * it now has no effect.
555 *
556 * @deprecated This setting now has no effect.
Kristian Monsenf4912582012-08-16 15:26:24 -0400557 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700558 */
Mike Hearnadcd2ed2009-01-21 16:44:36 +0100559 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700560 public synchronized boolean getUseDoubleTree() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000561 // Returns false unconditionally, so no need for derived classes to override.
Mike Hearnadcd2ed2009-01-21 16:44:36 +0100562 return false;
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700563 }
564
565 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100566 * Sets the user-agent string using an integer code.
567 * <ul>
568 * <li>0 means the WebView should use an Android user-agent string</li>
569 * <li>1 means the WebView should use a desktop user-agent string</li>
570 * </ul>
571 * Other values are ignored. The default is an Android user-agent string,
572 * i.e. code value 0.
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800573 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100574 * @param ua the integer code for the user-agent string
575 * @deprecated Please use {@link #setUserAgentString} instead.
Kristian Monsenf4912582012-08-16 15:26:24 -0400576 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700577 */
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800578 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700579 public synchronized void setUserAgent(int ua) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000580 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700581 }
582
583 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100584 * Gets the user-agent as an integer code.
585 * <ul>
586 * <li>-1 means the WebView is using a custom user-agent string set with
587 * {@link #setUserAgentString}</li>
588 * <li>0 means the WebView should use an Android user-agent string</li>
589 * <li>1 means the WebView should use a desktop user-agent string</li>
590 * </ul>
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800591 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100592 * @return the integer code for the user-agent string
593 * @see #setUserAgent
594 * @deprecated Please use {@link #getUserAgentString} instead.
Kristian Monsenf4912582012-08-16 15:26:24 -0400595 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700596 */
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800597 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700598 public synchronized int getUserAgent() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000599 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700600 }
601
602 /**
Mikhail Naganovcb000a62013-01-04 18:02:54 +0000603 * Sets whether the WebView should enable support for the &quot;viewport&quot;
604 * HTML meta tag or should use a wide viewport.
605 * When the value of the setting is false, the layout width is always set to the
606 * width of the WebView control in device-independent (CSS) pixels.
607 * When the value is true and the page contains the viewport meta tag, the value
608 * of the width specified in the tag is used. If the page does not contain the tag or
609 * does not provide a width, then a wide viewport will be used.
Steve Blockb0e0f332012-06-13 22:01:11 +0100610 *
Mikhail Naganovcb000a62013-01-04 18:02:54 +0000611 * @param use whether to enable support for the viewport meta tag
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700612 */
613 public synchronized void setUseWideViewPort(boolean use) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000614 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700615 }
616
617 /**
Mikhail Naganovcb000a62013-01-04 18:02:54 +0000618 * Gets whether the WebView supports the &quot;viewport&quot;
619 * HTML meta tag or will use a wide viewport.
Steve Block4e584df2012-04-24 23:12:47 +0100620 *
Mikhail Naganovcb000a62013-01-04 18:02:54 +0000621 * @return true if the WebView supports the viewport meta tag
Steve Blockb0e0f332012-06-13 22:01:11 +0100622 * @see #setUseWideViewPort
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700623 */
624 public synchronized boolean getUseWideViewPort() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000625 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700626 }
627
628 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100629 * Sets whether the WebView whether supports multiple windows. If set to
630 * true, {@link WebChromeClient#onCreateWindow} must be implemented by the
631 * host application. The default is false.
632 *
633 * @param support whether to suport multiple windows
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700634 */
635 public synchronized void setSupportMultipleWindows(boolean support) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000636 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700637 }
638
639 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100640 * Gets whether the WebView supports multiple windows.
Steve Block4e584df2012-04-24 23:12:47 +0100641 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100642 * @return true if the WebView supports multiple windows
643 * @see #setSupportMultipleWindows
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700644 */
645 public synchronized boolean supportMultipleWindows() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000646 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700647 }
648
649 /**
Steve Block4e584df2012-04-24 23:12:47 +0100650 * Sets the underlying layout algorithm. This will cause a relayout of the
Steve Blockb0e0f332012-06-13 22:01:11 +0100651 * WebView. The default is {@link LayoutAlgorithm#NARROW_COLUMNS}.
Steve Block4e584df2012-04-24 23:12:47 +0100652 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100653 * @param l the layout algorithm to use, as a {@link LayoutAlgorithm} value
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700654 */
655 public synchronized void setLayoutAlgorithm(LayoutAlgorithm l) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000656 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700657 }
658
659 /**
Steve Block4e584df2012-04-24 23:12:47 +0100660 * Gets the current layout algorithm.
661 *
Steve Blockb0e0f332012-06-13 22:01:11 +0100662 * @return the layout algorithm in use, as a {@link LayoutAlgorithm} value
Steve Block4e584df2012-04-24 23:12:47 +0100663 * @see #setLayoutAlgorithm
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700664 */
665 public synchronized LayoutAlgorithm getLayoutAlgorithm() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000666 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700667 }
668
669 /**
Steve Block4e584df2012-04-24 23:12:47 +0100670 * Sets the standard font family name. The default is "sans-serif".
671 *
672 * @param font a font family name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700673 */
674 public synchronized void setStandardFontFamily(String font) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000675 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700676 }
677
678 /**
Steve Block4e584df2012-04-24 23:12:47 +0100679 * Gets the standard font family name.
680 *
681 * @return the standard font family name as a string
682 * @see #setStandardFontFamily
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700683 */
684 public synchronized String getStandardFontFamily() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000685 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700686 }
687
688 /**
Steve Block4e584df2012-04-24 23:12:47 +0100689 * Sets the fixed font family name. The default is "monospace".
690 *
691 * @param font a font family name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700692 */
693 public synchronized void setFixedFontFamily(String font) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000694 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700695 }
696
697 /**
Steve Block4e584df2012-04-24 23:12:47 +0100698 * Gets the fixed font family name.
699 *
700 * @return the fixed font family name as a string
701 * @see #setFixedFontFamily
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700702 */
703 public synchronized String getFixedFontFamily() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000704 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700705 }
706
707 /**
Steve Blockb0e0f332012-06-13 22:01:11 +0100708 * Sets the sans-serif font family name. The default is "sans-serif".
Steve Block4e584df2012-04-24 23:12:47 +0100709 *
710 * @param font a font family name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700711 */
712 public synchronized void setSansSerifFontFamily(String font) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000713 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700714 }
715
716 /**
Steve Block4e584df2012-04-24 23:12:47 +0100717 * Gets the sans-serif font family name.
718 *
719 * @return the sans-serif font family name as a string
Steve Blockb0e0f332012-06-13 22:01:11 +0100720 * @see #setSansSerifFontFamily
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700721 */
722 public synchronized String getSansSerifFontFamily() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000723 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700724 }
725
726 /**
Steve Block4e584df2012-04-24 23:12:47 +0100727 * Sets the serif font family name. The default is "sans-serif".
728 *
729 * @param font a font family name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700730 */
731 public synchronized void setSerifFontFamily(String font) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000732 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700733 }
734
735 /**
Steve Block4e584df2012-04-24 23:12:47 +0100736 * Gets the serif font family name. The default is "serif".
737 *
738 * @return the serif font family name as a string
739 * @see #setSerifFontFamily
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700740 */
741 public synchronized String getSerifFontFamily() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000742 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700743 }
744
745 /**
Steve Block4e584df2012-04-24 23:12:47 +0100746 * Sets the cursive font family name. The default is "cursive".
747 *
748 * @param font a font family name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700749 */
750 public synchronized void setCursiveFontFamily(String font) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000751 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700752 }
753
754 /**
Steve Block4e584df2012-04-24 23:12:47 +0100755 * Gets the cursive font family name.
756 *
757 * @return the cursive font family name as a string
758 * @see #setCursiveFontFamily
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700759 */
760 public synchronized String getCursiveFontFamily() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000761 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700762 }
763
764 /**
Steve Block4e584df2012-04-24 23:12:47 +0100765 * Sets the fantasy font family name. The default is "fantasy".
766 *
767 * @param font a font family name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700768 */
769 public synchronized void setFantasyFontFamily(String font) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000770 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700771 }
772
773 /**
Steve Block4e584df2012-04-24 23:12:47 +0100774 * Gets the fantasy font family name.
775 *
776 * @return the fantasy font family name as a string
777 * @see #setFantasyFontFamily
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700778 */
779 public synchronized String getFantasyFontFamily() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000780 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700781 }
782
783 /**
Steve Block4e584df2012-04-24 23:12:47 +0100784 * Sets the minimum font size. The default is 8.
785 *
786 * @param size a non-negative integer between 1 and 72. Any number outside
787 * the specified range will be pinned.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700788 */
789 public synchronized void setMinimumFontSize(int size) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000790 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700791 }
792
793 /**
Steve Block4e584df2012-04-24 23:12:47 +0100794 * Gets the minimum font size.
795 *
796 * @return a non-negative integer between 1 and 72
797 * @see #setMinimumFontSize
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700798 */
799 public synchronized int getMinimumFontSize() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000800 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700801 }
802
803 /**
Steve Block4e584df2012-04-24 23:12:47 +0100804 * Sets the minimum logical font size. The default is 8.
805 *
806 * @param size a non-negative integer between 1 and 72. Any number outside
807 * the specified range will be pinned.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700808 */
809 public synchronized void setMinimumLogicalFontSize(int size) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000810 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700811 }
812
813 /**
Steve Block4e584df2012-04-24 23:12:47 +0100814 * Gets the minimum logical font size.
815 *
816 * @return a non-negative integer between 1 and 72
817 * @see #setMinimumLogicalFontSize
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700818 */
819 public synchronized int getMinimumLogicalFontSize() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000820 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700821 }
822
823 /**
Steve Block4e584df2012-04-24 23:12:47 +0100824 * Sets the default font size. The default is 16.
825 *
826 * @param size a non-negative integer between 1 and 72. Any number outside
827 * the specified range will be pinned.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700828 */
829 public synchronized void setDefaultFontSize(int size) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000830 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700831 }
832
833 /**
Steve Block4e584df2012-04-24 23:12:47 +0100834 * Gets the default font size.
835 *
836 * @return a non-negative integer between 1 and 72
837 * @see #setDefaultFontSize
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700838 */
839 public synchronized int getDefaultFontSize() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000840 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700841 }
842
843 /**
Steve Block4e584df2012-04-24 23:12:47 +0100844 * Sets the default fixed font size. The default is 16.
845 *
846 * @param size a non-negative integer between 1 and 72. Any number outside
847 * the specified range will be pinned.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700848 */
849 public synchronized void setDefaultFixedFontSize(int size) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000850 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700851 }
852
853 /**
Steve Block4e584df2012-04-24 23:12:47 +0100854 * Gets the default fixed font size.
855 *
856 * @return a non-negative integer between 1 and 72
857 * @see #setDefaultFixedFontSize
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700858 */
859 public synchronized int getDefaultFixedFontSize() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000860 throw new MustOverrideException();
Grace Kloba097b1e772009-11-24 14:23:18 -0800861 }
862
863 /**
Mikhail Naganov605a4912012-02-03 16:53:10 +0000864 * Sets whether the WebView should load image resources. Note that this method
865 * controls loading of all images, including those embedded using the data
866 * URI scheme. Use {@link #setBlockNetworkImage} to control loading only
867 * of images specified using network URI schemes. Note that if the value of this
868 * setting is changed from false to true, all images resources referenced
869 * by content currently displayed by the WebView are loaded automatically.
Steve Block4e584df2012-04-24 23:12:47 +0100870 * The default is true.
871 *
872 * @param flag whether the WebView should load image resources
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700873 */
874 public synchronized void setLoadsImagesAutomatically(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000875 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700876 }
877
878 /**
Steve Block4e584df2012-04-24 23:12:47 +0100879 * Gets whether the WebView loads image resources. This includes
880 * images embedded using the data URI scheme.
881 *
882 * @return true if the WebView loads image resources
883 * @see #setLoadsImagesAutomatically
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700884 */
885 public synchronized boolean getLoadsImagesAutomatically() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000886 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700887 }
888
889 /**
Mikhail Naganov605a4912012-02-03 16:53:10 +0000890 * Sets whether the WebView should not load image resources from the
891 * network (resources accessed via http and https URI schemes). Note
892 * that this method has no effect unless
893 * {@link #getLoadsImagesAutomatically} returns true. Also note that
894 * disabling all network loads using {@link #setBlockNetworkLoads}
895 * will also prevent network images from loading, even if this flag is set
896 * to false. When the value of this setting is changed from true to false,
897 * network images resources referenced by content currently displayed by
Steve Block4e584df2012-04-24 23:12:47 +0100898 * the WebView are fetched automatically. The default is false.
899 *
900 * @param flag whether the WebView should not load image resources from the
901 * network
Patrick Scottf43113f2010-02-18 09:13:12 -0500902 * @see #setBlockNetworkLoads
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700903 */
904 public synchronized void setBlockNetworkImage(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000905 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700906 }
907
908 /**
Steve Block4e584df2012-04-24 23:12:47 +0100909 * Gets whether the WebView does not load image resources from the network.
910 *
911 * @return true if the WebView does not load image resources from the network
912 * @see #setBlockNetworkImage
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700913 */
914 public synchronized boolean getBlockNetworkImage() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000915 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700916 }
Mike Hearnadcd2ed2009-01-21 16:44:36 +0100917
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800918 /**
Mikhail Naganov605a4912012-02-03 16:53:10 +0000919 * Sets whether the WebView should not load resources from the network.
920 * Use {@link #setBlockNetworkImage} to only avoid loading
921 * image resources. Note that if the value of this setting is
922 * changed from true to false, network resources referenced by content
923 * currently displayed by the WebView are not fetched until
924 * {@link android.webkit.WebView#reload} is called.
925 * If the application does not have the
926 * {@link android.Manifest.permission#INTERNET} permission, attempts to set
927 * a value of false will cause a {@link java.lang.SecurityException}
Steve Block4e584df2012-04-24 23:12:47 +0100928 * to be thrown. The default value is false if the application has the
929 * {@link android.Manifest.permission#INTERNET} permission, otherwise it is
930 * true.
931 *
932 * @param flag whether the WebView should not load any resources from the
933 * network
Patrick Scottf43113f2010-02-18 09:13:12 -0500934 * @see android.webkit.WebView#reload
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800935 */
936 public synchronized void setBlockNetworkLoads(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000937 throw new MustOverrideException();
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800938 }
939
940 /**
Steve Block4e584df2012-04-24 23:12:47 +0100941 * Gets whether the WebView does not load any resources from the network.
942 *
943 * @return true if the WebView does not load any resources from the network
944 * @see #setBlockNetworkLoads
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800945 */
946 public synchronized boolean getBlockNetworkLoads() {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000947 throw new MustOverrideException();
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -0800948 }
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700949
950 /**
Steve Block4e584df2012-04-24 23:12:47 +0100951 * Tells the WebView to enable JavaScript execution.
952 * <b>The default is false.</b>
953 *
954 * @param flag true if the WebView should execute JavaScript
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -0700955 */
956 public synchronized void setJavaScriptEnabled(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +0000957 throw new MustOverrideException();
Teng-Hui Zhuda7378e2011-02-16 11:25:03 -0800958 }
959
960 /**
Steve Blockef163152012-04-23 18:08:06 +0100961 * Sets whether JavaScript running in the context of a file scheme URL
962 * should be allowed to access content from any origin. This includes
963 * access to content from other file scheme URLs. See
964 * {@link #setAllowFileAccessFromFileURLs}. To enable the most restrictive,
965 * and therefore secure policy, this setting should be disabled.
Mikhail Naganov65e7ace2012-08-07 13:57:42 +0100966 * Note that this setting affects only JavaScript access to file scheme
967 * resources. Other access to such resources, for example, from image HTML
968 * elements, is unaffected.
Steve Blockef163152012-04-23 18:08:06 +0100969 * <p>
970 * The default value is true for API level
971 * {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1} and below,
972 * and false for API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN}
973 * and above.
Selim Gurun0ea6dad2012-03-29 18:19:01 -0700974 *
Steve Blockef163152012-04-23 18:08:06 +0100975 * @param flag whether JavaScript running in the context of a file scheme
976 * URL should be allowed to access content from any origin
Selim Gurun0ea6dad2012-03-29 18:19:01 -0700977 */
978 public abstract void setAllowUniversalAccessFromFileURLs(boolean flag);
979
980 /**
Steve Blockef163152012-04-23 18:08:06 +0100981 * Sets whether JavaScript running in the context of a file scheme URL
982 * should be allowed to access content from other file scheme URLs. To
983 * enable the most restrictive, and therefore secure policy, this setting
984 * should be disabled. Note that the value of this setting is ignored if
985 * the value of {@link #getAllowUniversalAccessFromFileURLs} is true.
Mikhail Naganov65e7ace2012-08-07 13:57:42 +0100986 * Note too, that this setting affects only JavaScript access to file scheme
987 * resources. Other access to such resources, for example, from image HTML
988 * elements, is unaffected.
Steve Blockef163152012-04-23 18:08:06 +0100989 * <p>
990 * The default value is true for API level
991 * {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1} and below,
992 * and false for API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN}
993 * and above.
Selim Gurun0ea6dad2012-03-29 18:19:01 -0700994 *
Steve Blockef163152012-04-23 18:08:06 +0100995 * @param flag whether JavaScript running in the context of a file scheme
996 * URL should be allowed to access content from other file
997 * scheme URLs
Selim Gurun0ea6dad2012-03-29 18:19:01 -0700998 */
999 public abstract void setAllowFileAccessFromFileURLs(boolean flag);
1000
1001 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001002 * Sets whether the WebView should enable plugins. The default is false.
Steve Block4e584df2012-04-24 23:12:47 +01001003 *
Steve Blockb0e0f332012-06-13 22:01:11 +01001004 * @param flag true if plugins should be enabled
Patrick Scott300f2e92010-03-22 10:20:45 -04001005 * @deprecated This method has been deprecated in favor of
1006 * {@link #setPluginState}
Jonathan Dixon0bf47812013-03-07 17:20:08 -08001007 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001008 */
Michael Kolba172e7d2010-06-30 12:35:26 -07001009 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001010 public synchronized void setPluginsEnabled(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001011 throw new MustOverrideException();
Patrick Scott300f2e92010-03-22 10:20:45 -04001012 }
1013
1014 /**
Steve Block4e584df2012-04-24 23:12:47 +01001015 * Tells the WebView to enable, disable, or have plugins on demand. On
Patrick Scott300f2e92010-03-22 10:20:45 -04001016 * demand mode means that if a plugin exists that can handle the embedded
1017 * content, a placeholder icon will be shown instead of the plugin. When
Steve Blockb0e0f332012-06-13 22:01:11 +01001018 * the placeholder is clicked, the plugin will be enabled. The default is
1019 * {@link PluginState#OFF}.
Steve Block4e584df2012-04-24 23:12:47 +01001020 *
1021 * @param state a PluginState value
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001022 * @deprecated Plugins will not be supported in future, and should not be used.
Patrick Scott300f2e92010-03-22 10:20:45 -04001023 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001024 @Deprecated
Patrick Scott300f2e92010-03-22 10:20:45 -04001025 public synchronized void setPluginState(PluginState state) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001026 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001027 }
1028
1029 /**
Steve Block4e584df2012-04-24 23:12:47 +01001030 * Sets a custom path to plugins used by the WebView. This method is
Derek Sollenbergerfdbdeb32010-08-12 11:20:13 -04001031 * obsolete since each plugin is now loaded from its own package.
Steve Block4e584df2012-04-24 23:12:47 +01001032 *
1033 * @param pluginsPath a String path to the directory containing plugins
Derek Sollenbergerfdbdeb32010-08-12 11:20:13 -04001034 * @deprecated This method is no longer used as plugins are loaded from
Steve Block4e584df2012-04-24 23:12:47 +01001035 * their own APK via the system's package manager.
Jonathan Dixon0bf47812013-03-07 17:20:08 -08001036 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001037 */
Jason Chen9dc2e752010-09-01 19:11:14 -07001038 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001039 public synchronized void setPluginsPath(String pluginsPath) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001040 // Specified to do nothing, so no need for derived classes to override.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001041 }
1042
1043 /**
Steve Block4e584df2012-04-24 23:12:47 +01001044 * Sets the path to where database storage API databases should be saved.
Steve Block72ca7a42012-06-13 22:00:30 +01001045 * In order for the database storage API to function correctly, this method
1046 * must be called with a path to which the application can write. This
1047 * method should only be called once: repeated calls are ignored.
Steve Block4e584df2012-04-24 23:12:47 +01001048 *
Steve Block72ca7a42012-06-13 22:00:30 +01001049 * @param databasePath a path to the directory where databases should be
1050 * saved.
Ben Murdoch7df19852009-04-22 13:07:58 +01001051 */
Steve Block4e584df2012-04-24 23:12:47 +01001052 // This will update WebCore when the Sync runs in the C++ side.
Steve Block72ca7a42012-06-13 22:00:30 +01001053 // Note that the WebCore Database Tracker only allows the path to be set
1054 // once.
Ben Murdoch7df19852009-04-22 13:07:58 +01001055 public synchronized void setDatabasePath(String databasePath) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001056 throw new MustOverrideException();
Ben Murdoch7df19852009-04-22 13:07:58 +01001057 }
1058
1059 /**
Steve Block72ca7a42012-06-13 22:00:30 +01001060 * Sets the path where the Geolocation databases should be saved. In order
1061 * for Geolocation permissions and cached positions to be persisted, this
1062 * method must be called with a path to which the application can write.
Steve Block4e584df2012-04-24 23:12:47 +01001063 *
Steve Block72ca7a42012-06-13 22:00:30 +01001064 * @param databasePath a path to the directory where databases should be
1065 * saved.
Steve Block9d3273f2009-08-21 13:16:27 +01001066 */
Steve Block4e584df2012-04-24 23:12:47 +01001067 // This will update WebCore when the Sync runs in the C++ side.
Steve Block9d3273f2009-08-21 13:16:27 +01001068 public synchronized void setGeolocationDatabasePath(String databasePath) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001069 throw new MustOverrideException();
Steve Block9d3273f2009-08-21 13:16:27 +01001070 }
1071
1072 /**
Steve Block72ca7a42012-06-13 22:00:30 +01001073 * Sets whether the Application Caches API should be enabled. The default
1074 * is false. Note that in order for the Application Caches API to be
1075 * enabled, a valid database path must also be supplied to
1076 * {@link #setAppCachePath}.
Steve Block4e584df2012-04-24 23:12:47 +01001077 *
1078 * @param flag true if the WebView should enable Application Caches
Andrei Popescu60a9a7d2009-04-17 10:43:42 +01001079 */
1080 public synchronized void setAppCacheEnabled(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001081 throw new MustOverrideException();
Andrei Popescu60a9a7d2009-04-17 10:43:42 +01001082 }
1083
1084 /**
Steve Block72ca7a42012-06-13 22:00:30 +01001085 * Sets the path to the Application Caches files. In order for the
1086 * Application Caches API to be enabled, this method must be called with a
1087 * path to which the application can write. This method should only be
1088 * called once: repeated calls are ignored.
Steve Block4e584df2012-04-24 23:12:47 +01001089 *
1090 * @param appCachePath a String path to the directory containing
Steve Block72ca7a42012-06-13 22:00:30 +01001091 * Application Caches files.
Jonathan Dixon47aaba32012-11-30 16:32:17 -08001092 * @see #setAppCacheEnabled
Andrei Popescu60a9a7d2009-04-17 10:43:42 +01001093 */
Jonathan Dixon3c909522012-02-28 18:45:06 +00001094 public synchronized void setAppCachePath(String appCachePath) {
1095 throw new MustOverrideException();
Andrei Popescu60a9a7d2009-04-17 10:43:42 +01001096 }
1097
1098 /**
Selim Gurunb632adf2012-06-28 11:21:05 -07001099 * Sets the maximum size for the Application Cache content. The passed size
1100 * will be rounded to the nearest value that the database can support, so
1101 * this should be viewed as a guide, not a hard limit. Setting the
1102 * size to a value less than current database size does not cause the
Selim Gurunf27ac092012-06-28 11:21:05 -07001103 * database to be trimmed. The default size is {@link Long#MAX_VALUE}.
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001104 * It is recommended to leave the maximum size set to the default value.
Steve Block4e584df2012-04-24 23:12:47 +01001105 *
1106 * @param appCacheMaxSize the maximum size in bytes
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001107 * @deprecated In future quota will be managed automatically.
Andrei Popescu1c829202009-07-22 16:47:52 +01001108 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001109 @Deprecated
Andrei Popescu1c829202009-07-22 16:47:52 +01001110 public synchronized void setAppCacheMaxSize(long appCacheMaxSize) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001111 throw new MustOverrideException();
Andrei Popescu1c829202009-07-22 16:47:52 +01001112 }
1113
1114 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001115 * Sets whether the database storage API is enabled. The default value is
1116 * false. See also {@link #setDatabasePath} for how to correctly set up the
1117 * database storage API.
Steve Block4e584df2012-04-24 23:12:47 +01001118 *
Selim Gurun2bca22b2013-02-28 17:47:21 -08001119 * This setting is global in effect, across all WebView instances in a process.
1120 * Note you should only modify this setting prior to making <b>any</b> WebView
1121 * page load within a given process, as the WebView implementation may ignore
1122 * changes to this setting after that point.
1123 *
Steve Block4e584df2012-04-24 23:12:47 +01001124 * @param flag true if the WebView should use the database storage API
Ben Murdoch7df19852009-04-22 13:07:58 +01001125 */
1126 public synchronized void setDatabaseEnabled(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001127 throw new MustOverrideException();
Ben Murdoch7df19852009-04-22 13:07:58 +01001128 }
1129
1130 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001131 * Sets whether the DOM storage API is enabled. The default value is false.
Steve Block4e584df2012-04-24 23:12:47 +01001132 *
1133 * @param flag true if the WebView should use the DOM storage API
Ben Murdoch274680d2009-05-28 13:44:44 +01001134 */
1135 public synchronized void setDomStorageEnabled(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001136 throw new MustOverrideException();
Ben Murdoch274680d2009-05-28 13:44:44 +01001137 }
1138
1139 /**
Steve Block4e584df2012-04-24 23:12:47 +01001140 * Gets whether the DOM Storage APIs are enabled.
1141 *
1142 * @return true if the DOM Storage APIs are enabled
Steve Blockb0e0f332012-06-13 22:01:11 +01001143 * @see #setDomStorageEnabled
Ben Murdoch274680d2009-05-28 13:44:44 +01001144 */
1145 public synchronized boolean getDomStorageEnabled() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001146 throw new MustOverrideException();
Ben Murdoch274680d2009-05-28 13:44:44 +01001147 }
Ben Murdoch274680d2009-05-28 13:44:44 +01001148 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001149 * Gets the path to where database storage API databases are saved.
Steve Block4e584df2012-04-24 23:12:47 +01001150 *
1151 * @return the String path to the database storage API databases
Steve Blockb0e0f332012-06-13 22:01:11 +01001152 * @see #setDatabasePath
Ben Murdoch7df19852009-04-22 13:07:58 +01001153 */
1154 public synchronized String getDatabasePath() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001155 throw new MustOverrideException();
Ben Murdoch7df19852009-04-22 13:07:58 +01001156 }
1157
1158 /**
Steve Block4e584df2012-04-24 23:12:47 +01001159 * Gets whether the database storage API is enabled.
1160 *
1161 * @return true if the database storage API is enabled
Steve Blockb0e0f332012-06-13 22:01:11 +01001162 * @see #setDatabaseEnabled
Ben Murdoch7df19852009-04-22 13:07:58 +01001163 */
1164 public synchronized boolean getDatabaseEnabled() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001165 throw new MustOverrideException();
Andrei Popescuc27a9ac2009-08-03 15:59:24 +01001166 }
1167
1168 /**
Mikhail Naganov6cb296a2012-08-28 16:57:24 +01001169 * Sets whether Geolocation is enabled. The default is true.
1170 * <p>
1171 * Please note that in order for the Geolocation API to be usable
1172 * by a page in the WebView, the following requirements must be met:
1173 * <ul>
1174 * <li>an application must have permission to access the device location,
1175 * see {@link android.Manifest.permission#ACCESS_COARSE_LOCATION},
1176 * {@link android.Manifest.permission#ACCESS_FINE_LOCATION};
1177 * <li>an application must provide an implementation of the
1178 * {@link WebChromeClient#onGeolocationPermissionsShowPrompt} callback
1179 * to receive notifications that a page is requesting access to location
1180 * via the JavaScript Geolocation API.
1181 * </ul>
1182 * <p>
1183 * As an option, it is possible to store previous locations and web origin
1184 * permissions in a database. See {@link #setGeolocationDatabasePath}.
Steve Block4e584df2012-04-24 23:12:47 +01001185 *
1186 * @param flag whether Geolocation should be enabled
Steve Block06cd7512009-08-21 10:26:37 +01001187 */
1188 public synchronized void setGeolocationEnabled(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001189 throw new MustOverrideException();
Elliott Slaughter5dc0c822010-06-22 11:31:54 -07001190 }
1191
1192 /**
Steve Block4e584df2012-04-24 23:12:47 +01001193 * Gets whether JavaScript is enabled.
1194 *
1195 * @return true if JavaScript is enabled
1196 * @see #setJavaScriptEnabled
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001197 */
1198 public synchronized boolean getJavaScriptEnabled() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001199 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001200 }
1201
1202 /**
Steve Blockef163152012-04-23 18:08:06 +01001203 * Gets whether JavaScript running in the context of a file scheme URL can
1204 * access content from any origin. This includes access to content from
1205 * other file scheme URLs.
Selim Gurun0ea6dad2012-03-29 18:19:01 -07001206 *
Steve Blockef163152012-04-23 18:08:06 +01001207 * @return whether JavaScript running in the context of a file scheme URL
1208 * can access content from any origin
Steve Block4e584df2012-04-24 23:12:47 +01001209 * @see #setAllowUniversalAccessFromFileURLs
Selim Gurun0ea6dad2012-03-29 18:19:01 -07001210 */
1211 public abstract boolean getAllowUniversalAccessFromFileURLs();
1212
1213 /**
Steve Blockef163152012-04-23 18:08:06 +01001214 * Gets whether JavaScript running in the context of a file scheme URL can
1215 * access content from other file scheme URLs.
Selim Gurun0ea6dad2012-03-29 18:19:01 -07001216 *
Steve Blockef163152012-04-23 18:08:06 +01001217 * @return whether JavaScript running in the context of a file scheme URL
1218 * can access content from other file scheme URLs
Steve Block4e584df2012-04-24 23:12:47 +01001219 * @see #setAllowFileAccessFromFileURLs
Selim Gurun0ea6dad2012-03-29 18:19:01 -07001220 */
1221 public abstract boolean getAllowFileAccessFromFileURLs();
1222
1223 /**
Steve Block4e584df2012-04-24 23:12:47 +01001224 * Gets whether plugins are enabled.
1225 *
1226 * @return true if plugins are enabled
Steve Blockb0e0f332012-06-13 22:01:11 +01001227 * @see #setPluginsEnabled
Patrick Scott300f2e92010-03-22 10:20:45 -04001228 * @deprecated This method has been replaced by {@link #getPluginState}
Jonathan Dixon0bf47812013-03-07 17:20:08 -08001229 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001230 */
Michael Kolba172e7d2010-06-30 12:35:26 -07001231 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001232 public synchronized boolean getPluginsEnabled() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001233 throw new MustOverrideException();
Patrick Scott300f2e92010-03-22 10:20:45 -04001234 }
1235
1236 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001237 * Gets the current state regarding whether plugins are enabled.
Steve Block4e584df2012-04-24 23:12:47 +01001238 *
Steve Blockb0e0f332012-06-13 22:01:11 +01001239 * @return the plugin state as a {@link PluginState} value
1240 * @see #setPluginState
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001241 * @deprecated Plugins will not be supported in future, and should not be used.
Patrick Scott300f2e92010-03-22 10:20:45 -04001242 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001243 @Deprecated
Patrick Scott300f2e92010-03-22 10:20:45 -04001244 public synchronized PluginState getPluginState() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001245 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001246 }
1247
1248 /**
Steve Block4e584df2012-04-24 23:12:47 +01001249 * Gets the directory that contains the plugin libraries. This method is
Derek Sollenbergerfdbdeb32010-08-12 11:20:13 -04001250 * obsolete since each plugin is now loaded from its own package.
Steve Block4e584df2012-04-24 23:12:47 +01001251 *
1252 * @return an empty string
Derek Sollenbergerfdbdeb32010-08-12 11:20:13 -04001253 * @deprecated This method is no longer used as plugins are loaded from
1254 * their own APK via the system's package manager.
Jonathan Dixon0bf47812013-03-07 17:20:08 -08001255 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001256 */
Jason Chen9dc2e752010-09-01 19:11:14 -07001257 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001258 public synchronized String getPluginsPath() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001259 // Unconditionally returns empty string, so no need for derived classes to override.
Grace Kloba658ab7d2009-05-14 14:45:26 -07001260 return "";
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001261 }
1262
1263 /**
Steve Block4e584df2012-04-24 23:12:47 +01001264 * Tells JavaScript to open windows automatically. This applies to the
1265 * JavaScript function window.open(). The default is false.
1266 *
1267 * @param flag true if JavaScript can open windows automatically
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001268 */
Jonathan Dixon3c909522012-02-28 18:45:06 +00001269 public synchronized void setJavaScriptCanOpenWindowsAutomatically(boolean flag) {
1270 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001271 }
1272
1273 /**
Steve Block4e584df2012-04-24 23:12:47 +01001274 * Gets whether JavaScript can open windows automatically.
1275 *
1276 * @return true if JavaScript can open windows automatically during
1277 * window.open()
1278 * @see #setJavaScriptCanOpenWindowsAutomatically
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001279 */
1280 public synchronized boolean getJavaScriptCanOpenWindowsAutomatically() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001281 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001282 }
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001283 /**
Steve Block4e584df2012-04-24 23:12:47 +01001284 * Sets the default text encoding name to use when decoding html pages.
1285 * The default is "Latin-1".
1286 *
1287 * @param encoding the text encoding name
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001288 */
1289 public synchronized void setDefaultTextEncodingName(String encoding) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001290 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001291 }
1292
1293 /**
Steve Block4e584df2012-04-24 23:12:47 +01001294 * Gets the default text encoding name.
1295 *
1296 * @return the default text encoding name as a string
1297 * @see #setDefaultTextEncodingName
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001298 */
1299 public synchronized String getDefaultTextEncodingName() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001300 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001301 }
1302
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -08001303 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001304 * Sets the WebView's user-agent string. If the string is null or empty,
1305 * the system default value will be used.
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -08001306 */
1307 public synchronized void setUserAgentString(String ua) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001308 throw new MustOverrideException();
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -08001309 }
1310
1311 /**
Steve Block4e584df2012-04-24 23:12:47 +01001312 * Gets the WebView's user-agent string.
Steve Blockb0e0f332012-06-13 22:01:11 +01001313 *
1314 * @return the WebView's user-agent string
1315 * @see #setUserAgentString
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -08001316 */
1317 public synchronized String getUserAgentString() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001318 throw new MustOverrideException();
Shimeng (Simon) Wangc55886a2010-10-28 13:46:02 -07001319 }
1320
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001321 /**
George Mount9f410c52012-08-10 15:29:30 -07001322 * Returns the default User-Agent used by a WebView.
1323 * An instance of WebView could use a different User-Agent if a call
Kristian Monsenf4912582012-08-16 15:26:24 -04001324 * is made to {@link WebSettings#setUserAgentString(String)}.
George Mount9f410c52012-08-10 15:29:30 -07001325 *
1326 * @param context a Context object used to access application assets
1327 */
1328 public static String getDefaultUserAgent(Context context) {
Jonathan Dixond1c4faa2012-08-20 16:37:15 -07001329 return WebViewFactory.getProvider().getStatics().getDefaultUserAgent(context);
George Mount9f410c52012-08-10 15:29:30 -07001330 }
1331
1332 /**
Steve Block4e584df2012-04-24 23:12:47 +01001333 * Tells the WebView whether it needs to set a node to have focus when
Steve Blockb0e0f332012-06-13 22:01:11 +01001334 * {@link WebView#requestFocus(int, android.graphics.Rect)} is called. The
1335 * default value is true.
Michael Kolba172e7d2010-06-30 12:35:26 -07001336 *
Steve Block4e584df2012-04-24 23:12:47 +01001337 * @param flag whether the WebView needs to set a node
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001338 */
1339 public void setNeedInitialFocus(boolean flag) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001340 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001341 }
1342
1343 /**
Steve Block4e584df2012-04-24 23:12:47 +01001344 * Sets the priority of the Render thread. Unlike the other settings, this
Steve Blockb0e0f332012-06-13 22:01:11 +01001345 * one only needs to be called once per process. The default value is
1346 * {@link RenderPriority#NORMAL}.
Mike Hearnadcd2ed2009-01-21 16:44:36 +01001347 *
Steve Blockb0e0f332012-06-13 22:01:11 +01001348 * @param priority the priority
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001349 * @deprecated It is not recommended to adjust thread priorities, and this will
1350 * not be supported in future versions.
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001351 */
Jonathan Dixon835b1fc2013-02-25 12:29:33 -08001352 @Deprecated
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001353 public synchronized void setRenderPriority(RenderPriority priority) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001354 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001355 }
Michael Kolba172e7d2010-06-30 12:35:26 -07001356
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001357 /**
Steve Block4e584df2012-04-24 23:12:47 +01001358 * Overrides the way the cache is used. The way the cache is used is based
Steve Blockb0e0f332012-06-13 22:01:11 +01001359 * on the navigation type. For a normal page load, the cache is checked
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001360 * and content is re-validated as needed. When navigating back, content is
Steve Blockb0e0f332012-06-13 22:01:11 +01001361 * not revalidated, instead the content is just retrieved from the cache.
1362 * This method allows the client to override this behavior by specifying
Mikhail Naganov56936a12012-07-25 13:07:18 +01001363 * one of {@link #LOAD_DEFAULT},
Steve Blockb0e0f332012-06-13 22:01:11 +01001364 * {@link #LOAD_CACHE_ELSE_NETWORK}, {@link #LOAD_NO_CACHE} or
1365 * {@link #LOAD_CACHE_ONLY}. The default value is {@link #LOAD_DEFAULT}.
Steve Block4e584df2012-04-24 23:12:47 +01001366 *
Steve Blockb0e0f332012-06-13 22:01:11 +01001367 * @param mode the mode to use
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001368 */
1369 public void setCacheMode(int mode) {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001370 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001371 }
Michael Kolba172e7d2010-06-30 12:35:26 -07001372
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001373 /**
Steve Blockb0e0f332012-06-13 22:01:11 +01001374 * Gets the current setting for overriding the cache mode.
1375 *
1376 * @return the current setting for overriding the cache mode
1377 * @see #setCacheMode
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001378 */
1379 public int getCacheMode() {
Jonathan Dixon3c909522012-02-28 18:45:06 +00001380 throw new MustOverrideException();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001381 }
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001382}