WebSettings.java revision 4e584df4cee8334bc371c04a67bcd0a32e2f9480
1/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.webkit;
18
19import android.os.Message;
20import android.os.Build;
21
22/**
23 * Manages settings state for a WebView. When a WebView is first created, it
24 * obtains a set of default settings. These default settings will be returned
25 * from any getter call. A WebSettings object obtained from
26 * WebView.getSettings() is tied to the life of the WebView. If a WebView has
27 * been destroyed, any method call on WebSettings will throw an
28 * IllegalStateException.
29 */
30// This is an abstract base class: concrete WebViewProviders must
31// create a class derived from this, and return an instance of it in the
32// WebViewProvider.getWebSettingsProvider() method implementation.
33public abstract class WebSettings {
34    /**
35     * Enum for controlling the layout of html.
36     * <ul>
37     *   <li>NORMAL means no rendering changes.</li>
38     *   <li>SINGLE_COLUMN moves all content into one column that is the width of the
39     *       view.</li>
40     *   <li>NARROW_COLUMNS makes all columns no wider than the screen if possible.</li>
41     * </ul>
42     */
43    // XXX: These must match LayoutAlgorithm in Settings.h in WebCore.
44    public enum LayoutAlgorithm {
45        NORMAL,
46        /**
47         * @deprecated This algorithm is now obsolete.
48         */
49        @Deprecated
50        SINGLE_COLUMN,
51        NARROW_COLUMNS
52    }
53
54    /**
55     * Enum for specifying the text size.
56     * <ul>
57     *   <li>SMALLEST is 50%</li>
58     *   <li>SMALLER is 75%</li>
59     *   <li>NORMAL is 100%</li>
60     *   <li>LARGER is 150%</li>
61     *   <li>LARGEST is 200%</li>
62     * </ul>
63     *
64     * @deprecated Use {@link WebSettings#setTextZoom(int)} and {@link WebSettings#getTextZoom()} instead.
65     */
66    public enum TextSize {
67        SMALLEST(50),
68        SMALLER(75),
69        NORMAL(100),
70        LARGER(150),
71        LARGEST(200);
72        TextSize(int size) {
73            value = size;
74        }
75        int value;
76    }
77
78    /**
79     * Enum for specifying the WebView's desired density.
80     * <ul>
81     *   <li>FAR makes 100% looking like in 240dpi</li>
82     *   <li>MEDIUM makes 100% looking like in 160dpi</li>
83     *   <li>CLOSE makes 100% looking like in 120dpi</li>
84     * </ul>
85     */
86    public enum ZoomDensity {
87        FAR(150),      // 240dpi
88        MEDIUM(100),    // 160dpi
89        CLOSE(75);     // 120dpi
90        ZoomDensity(int size) {
91            value = size;
92        }
93        int value;
94    }
95
96    /**
97     * Default cache usage pattern. Use with {@link #setCacheMode}.
98     */
99    public static final int LOAD_DEFAULT = -1;
100
101    /**
102     * Normal cache usage pattern. Use with {@link #setCacheMode}.
103     */
104    public static final int LOAD_NORMAL = 0;
105
106    /**
107     * Use cache if content is there, even if expired (eg, history nav).
108     * If it is not in the cache, load from network.
109     * Use with {@link #setCacheMode}.
110     */
111    public static final int LOAD_CACHE_ELSE_NETWORK = 1;
112
113    /**
114     * Don't use the cache, load from network.
115     * Use with {@link #setCacheMode}.
116     */
117    public static final int LOAD_NO_CACHE = 2;
118
119    /**
120     * Don't use the network, load from cache only.
121     * Use with {@link #setCacheMode}.
122     */
123    public static final int LOAD_CACHE_ONLY = 3;
124
125    public enum RenderPriority {
126        NORMAL,
127        HIGH,
128        LOW
129    }
130
131    /**
132     * The plugin state effects how plugins are treated on a page. ON means
133     * that any object will be loaded even if a plugin does not exist to handle
134     * the content. ON_DEMAND means that if there is a plugin installed that
135     * can handle the content, a placeholder is shown until the user clicks on
136     * the placeholder. Once clicked, the plugin will be enabled on the page.
137     * OFF means that all plugins will be turned off and any fallback content
138     * will be used.
139     */
140    public enum PluginState {
141        ON,
142        ON_DEMAND,
143        OFF
144    }
145
146    /**
147     * Hidden constructor to prevent clients from creating a new settings
148     * instance or deriving the class.
149     *
150     * @hide
151     */
152    protected WebSettings() {
153    }
154
155    /**
156     * Enables dumping the pages navigation cache to a text file.
157     *
158     * @deprecated This method is now obsolete.
159     */
160    @Deprecated
161    public void setNavDump(boolean enabled) {
162        throw new MustOverrideException();
163    }
164
165    /**
166     * Gets whether dumping the navigation cache is enabled.
167     *
168     * @deprecated This method is now obsolete.
169     */
170    @Deprecated
171    public boolean getNavDump() {
172        throw new MustOverrideException();
173    }
174
175    /**
176     * Sets whether the WebView should support zooming using its on-screen zoom
177     * controls and gestures. The particular zoom mechanisms that should be used
178     * can be set with {@link #setBuiltInZoomControls}. This setting does not
179     * affect zooming performed using the {@link WebView#zoomIn()} and
180     * {@link WebView#zoomOut()} methods. The default is true.
181     *
182     * @param support whether the WebView should support zoom
183     */
184    public void setSupportZoom(boolean support) {
185        throw new MustOverrideException();
186    }
187
188    /**
189     * Gets whether the WebView supports zoom.
190     *
191     * @return true if the WebView supports zoom
192     * @see #setSupportZoom
193     */
194    public boolean supportZoom() {
195        throw new MustOverrideException();
196    }
197
198    /**
199     * Sets whether the WebView should use its built-in zoom mechanisms. The
200     * built-in zoom mechanisms comprise on-screen zoom controls, which are
201     * displayed over the WebView's content, and the use of a pinch gesture to
202     * control zooming. Whether or not these on-screen controls are displayed
203     * can be set with {@link #setDisplayZoomControls}. The default is false.
204     * <p>
205     * The built-in mechanisms are the only currently supported zoom
206     * mechanisms, so it is recommended that this setting is always enabled.
207     *
208     * @param enabled whether the WebView should use its built-in zoom mechanisms
209     */
210    // This method was intended to select between the built-in zoom mechanisms
211    // and the separate zoom controls. The latter were obtained using
212    // {@link WebView#getZoomControls}, which is now hidden.
213    public void setBuiltInZoomControls(boolean enabled) {
214        throw new MustOverrideException();
215    }
216
217    /**
218     * Gets whether the zoom mechanisms built into WebView are being used.
219     *
220     * @return true if the zoom mechanisms built into WebView are being used
221     * @see #setBuiltInZoomControls
222     */
223    public boolean getBuiltInZoomControls() {
224        throw new MustOverrideException();
225    }
226
227    /**
228     * Sets whether the WebView should display on-screen zoom controls when
229     * using the built-in zoom mechanisms. See {@link #setBuiltInZoomControls}.
230     * The default is true.
231     *
232     * @param enabled whether the WebView should display on-screen zoom controls
233     */
234    public void setDisplayZoomControls(boolean enabled) {
235        throw new MustOverrideException();
236    }
237
238    /**
239     * Gets whether the WebView displays on-screen zoom controls when using
240     * the built-in zoom mechanisms.
241     *
242     * @return true if the WebView displays on-screen zoom controls when using
243     *         the built-in zoom mechanisms
244     * @see #setDisplayZoomControls
245     */
246    public boolean getDisplayZoomControls() {
247        throw new MustOverrideException();
248    }
249
250    /**
251     * Enables or disables file access within WebView. File access is enabled by
252     * default.  Note that this enables or disables file system access only.
253     * Assets and resources are still accessible using file:///android_asset and
254     * file:///android_res.
255     */
256    public void setAllowFileAccess(boolean allow) {
257        throw new MustOverrideException();
258    }
259
260    /**
261     * Gets whether this WebView supports file access.
262     *
263     * @see #setAllowFileAccess
264     */
265    public boolean getAllowFileAccess() {
266        throw new MustOverrideException();
267    }
268
269    /**
270     * Enables or disables content URL access within WebView.  Content URL
271     * access allows WebView to load content from a content provider installed
272     * in the system. The default is enabled.
273     */
274    public void setAllowContentAccess(boolean allow) {
275        throw new MustOverrideException();
276    }
277
278    /**
279     * Gets whether this WebView supports content URL access.
280     *
281     * @see #setAllowContentAccess
282     */
283    public boolean getAllowContentAccess() {
284        throw new MustOverrideException();
285    }
286
287    /**
288     * Sets whether the WebView loads a page with overview mode.
289     */
290    public void setLoadWithOverviewMode(boolean overview) {
291        throw new MustOverrideException();
292    }
293
294    /**
295     * Gets whether this WebView loads pages with overview mode.
296     */
297    public boolean getLoadWithOverviewMode() {
298        throw new MustOverrideException();
299    }
300
301    /**
302     * Sets whether the WebView will enable smooth transition while panning or
303     * zooming or while the window hosting the WebView does not have focus.
304     * If it is true, WebView will choose a solution to maximize the performance.
305     * e.g. the WebView's content may not be updated during the transition.
306     * If it is false, WebView will keep its fidelity. The default value is false.
307     */
308    public void setEnableSmoothTransition(boolean enable) {
309        throw new MustOverrideException();
310    }
311
312    /**
313     * Gets whether the WebView enables smooth transition while panning or
314     * zooming.
315     *
316     * @see #setEnableSmoothTransition
317     */
318    public boolean enableSmoothTransition() {
319        throw new MustOverrideException();
320    }
321
322    /**
323     * Sets whether the WebView uses its background for over scroll background.
324     * If true, it will use the WebView's background. If false, it will use an
325     * internal pattern. Default is true.
326     *
327     * @deprecated This method is now obsolete.
328     */
329    @Deprecated
330    public void setUseWebViewBackgroundForOverscrollBackground(boolean view) {
331        throw new MustOverrideException();
332    }
333
334    /**
335     * Gets whether this WebView uses WebView's background instead of
336     * internal pattern for over scroll background.
337     *
338     * @see #setUseWebViewBackgroundForOverscrollBackground
339     * @deprecated This method is now obsolete.
340     */
341    @Deprecated
342    public boolean getUseWebViewBackgroundForOverscrollBackground() {
343        throw new MustOverrideException();
344    }
345
346    /**
347     * Sets whether the WebView is saving form data.
348     */
349    public void setSaveFormData(boolean save) {
350        throw new MustOverrideException();
351    }
352
353    /**
354     * Gets whether the WebView is saving form data and displaying prior
355     * entries/autofill++.  Always false in private browsing mode.
356     */
357    public boolean getSaveFormData() {
358        throw new MustOverrideException();
359    }
360
361    /**
362     * Stores whether the WebView is saving password.
363     */
364    public void setSavePassword(boolean save) {
365        throw new MustOverrideException();
366    }
367
368    /**
369     * Gets whether the WebView is saving password.
370     */
371    public boolean getSavePassword() {
372        throw new MustOverrideException();
373    }
374
375    /**
376     * Sets the text zoom of the page in percent. Default is 100.
377     *
378     * @param textZoom the percent value for increasing or decreasing the text
379     */
380    public synchronized void setTextZoom(int textZoom) {
381        throw new MustOverrideException();
382    }
383
384    /**
385     * Gets the text zoom of the page in percent.
386     *
387     * @return a percent value describing the text zoom
388     * @see #setTextSizeZoom
389     */
390    public synchronized int getTextZoom() {
391        throw new MustOverrideException();
392    }
393
394    /**
395     * Sets the text size of the page.
396     *
397     * @param t the TextSize value for increasing or decreasing the text
398     * @see WebSettings.TextSize
399     * @deprecated Use {@link #setTextZoom(int)} instead.
400     */
401    public synchronized void setTextSize(TextSize t) {
402        throw new MustOverrideException();
403    }
404
405    /**
406     * Gets the text size of the page. If the text size was previously specified
407     * in percent using {@link #setTextZoom(int)}, this will return
408     * the closest matching {@link TextSize}.
409     *
410     * @return a TextSize enum value describing the text size
411     * @see WebSettings.TextSize
412     * @deprecated Use {@link #getTextZoom()} instead.
413     */
414    public synchronized TextSize getTextSize() {
415        throw new MustOverrideException();
416    }
417
418    /**
419     * Sets the default zoom density of the page. This should be called from UI
420     * thread.
421     *
422     * @param zoom a ZoomDensity value
423     * @see WebSettings.ZoomDensity
424     */
425    public void setDefaultZoom(ZoomDensity zoom) {
426        throw new MustOverrideException();
427    }
428
429    /**
430     * Gets the default zoom density of the page. This should be called from UI
431     * thread.
432     * @return a ZoomDensity value
433     * @see WebSettings.ZoomDensity
434     */
435    public ZoomDensity getDefaultZoom() {
436        throw new MustOverrideException();
437    }
438
439    /**
440     * Enables using light touches to make a selection and activate mouseovers.
441     */
442    public void setLightTouchEnabled(boolean enabled) {
443        throw new MustOverrideException();
444    }
445
446    /**
447     * Gets whether light touches are enabled.
448     */
449    public boolean getLightTouchEnabled() {
450        throw new MustOverrideException();
451    }
452
453    /**
454     * Controlled a rendering optimization that is no longer present. Setting
455     * it now has no effect.
456     *
457     * @deprecated This setting now has no effect.
458     */
459    @Deprecated
460    public synchronized void setUseDoubleTree(boolean use) {
461        // Specified to do nothing, so no need for derived classes to override.
462    }
463
464    /**
465     * Controlled a rendering optimization that is no longer present. Setting
466     * it now has no effect.
467     *
468     * @deprecated This setting now has no effect.
469     */
470    @Deprecated
471    public synchronized boolean getUseDoubleTree() {
472        // Returns false unconditionally, so no need for derived classes to override.
473        return false;
474    }
475
476    /**
477     * Tells the WebView about user-agent string.
478     *
479     * @param ua 0 if the WebView should use an Android user-agent string,
480     *           1 if the WebView should use a desktop user-agent string
481     * @deprecated Please use setUserAgentString instead.
482     */
483    @Deprecated
484    public synchronized void setUserAgent(int ua) {
485        throw new MustOverrideException();
486    }
487
488    /**
489     * Gets the user-agent as an int.
490     *
491     * @return 0 if the WebView is using an Android user-agent string,
492     *         1 if the WebView is using a desktop user-agent string,
493     *         -1 if the WebView is using user defined user-agent string
494     * @deprecated Please use getUserAgentString instead.
495     */
496    @Deprecated
497    public synchronized int getUserAgent() {
498        throw new MustOverrideException();
499    }
500
501    /**
502     * Tells the WebView to use the wide viewport.
503     */
504    public synchronized void setUseWideViewPort(boolean use) {
505        throw new MustOverrideException();
506    }
507
508    /**
509     * Gets whether the WebView is using a wide viewport.
510     *
511     * @return true if the WebView is using a wide viewport
512     */
513    public synchronized boolean getUseWideViewPort() {
514        throw new MustOverrideException();
515    }
516
517    /**
518     * Tells the WebView whether it supports multiple windows. TRUE means
519     * that {@link WebChromeClient#onCreateWindow(WebView, boolean,
520     * boolean, Message)} is implemented by the host application.
521     */
522    public synchronized void setSupportMultipleWindows(boolean support) {
523        throw new MustOverrideException();
524    }
525
526    /**
527     * Gets whether the WebView is supporting multiple windows.
528     *
529     * @return true if the WebView is supporting multiple windows. This means
530     *         that {@link WebChromeClient#onCreateWindow(WebView, boolean,
531     *         boolean, Message)} is implemented by the host application.
532     */
533    public synchronized boolean supportMultipleWindows() {
534        throw new MustOverrideException();
535    }
536
537    /**
538     * Sets the underlying layout algorithm. This will cause a relayout of the
539     * WebView. The default is NARROW_COLUMNS.
540     *
541     * @param l a LayoutAlgorithm enum specifying the algorithm to use
542     * @see WebSettings.LayoutAlgorithm
543     */
544    public synchronized void setLayoutAlgorithm(LayoutAlgorithm l) {
545        throw new MustOverrideException();
546    }
547
548    /**
549     * Gets the current layout algorithm.
550     *
551     * @return a LayoutAlgorithm enum value describing the layout algorithm
552     *         being used
553     * @see #setLayoutAlgorithm
554     * @see WebSettings.LayoutAlgorithm
555     */
556    public synchronized LayoutAlgorithm getLayoutAlgorithm() {
557        throw new MustOverrideException();
558    }
559
560    /**
561     * Sets the standard font family name. The default is "sans-serif".
562     *
563     * @param font a font family name
564     */
565    public synchronized void setStandardFontFamily(String font) {
566        throw new MustOverrideException();
567    }
568
569    /**
570     * Gets the standard font family name.
571     *
572     * @return the standard font family name as a string
573     * @see #setStandardFontFamily
574     */
575    public synchronized String getStandardFontFamily() {
576        throw new MustOverrideException();
577    }
578
579    /**
580     * Sets the fixed font family name. The default is "monospace".
581     *
582     * @param font a font family name
583     */
584    public synchronized void setFixedFontFamily(String font) {
585        throw new MustOverrideException();
586    }
587
588    /**
589     * Gets the fixed font family name.
590     *
591     * @return the fixed font family name as a string
592     * @see #setFixedFontFamily
593     */
594    public synchronized String getFixedFontFamily() {
595        throw new MustOverrideException();
596    }
597
598    /**
599     * Sets the sans-serif font family name.
600     *
601     * @param font a font family name
602     */
603    public synchronized void setSansSerifFontFamily(String font) {
604        throw new MustOverrideException();
605    }
606
607    /**
608     * Gets the sans-serif font family name.
609     *
610     * @return the sans-serif font family name as a string
611     */
612    public synchronized String getSansSerifFontFamily() {
613        throw new MustOverrideException();
614    }
615
616    /**
617     * Sets the serif font family name. The default is "sans-serif".
618     *
619     * @param font a font family name
620     */
621    public synchronized void setSerifFontFamily(String font) {
622        throw new MustOverrideException();
623    }
624
625    /**
626     * Gets the serif font family name. The default is "serif".
627     *
628     * @return the serif font family name as a string
629     * @see #setSerifFontFamily
630     */
631    public synchronized String getSerifFontFamily() {
632        throw new MustOverrideException();
633    }
634
635    /**
636     * Sets the cursive font family name. The default is "cursive".
637     *
638     * @param font a font family name
639     */
640    public synchronized void setCursiveFontFamily(String font) {
641        throw new MustOverrideException();
642    }
643
644    /**
645     * Gets the cursive font family name.
646     *
647     * @return the cursive font family name as a string
648     * @see #setCursiveFontFamily
649     */
650    public synchronized String getCursiveFontFamily() {
651        throw new MustOverrideException();
652    }
653
654    /**
655     * Sets the fantasy font family name. The default is "fantasy".
656     *
657     * @param font a font family name
658     */
659    public synchronized void setFantasyFontFamily(String font) {
660        throw new MustOverrideException();
661    }
662
663    /**
664     * Gets the fantasy font family name.
665     *
666     * @return the fantasy font family name as a string
667     * @see #setFantasyFontFamily
668     */
669    public synchronized String getFantasyFontFamily() {
670        throw new MustOverrideException();
671    }
672
673    /**
674     * Sets the minimum font size. The default is 8.
675     *
676     * @param size a non-negative integer between 1 and 72. Any number outside
677     *             the specified range will be pinned.
678     */
679    public synchronized void setMinimumFontSize(int size) {
680        throw new MustOverrideException();
681    }
682
683    /**
684     * Gets the minimum font size.
685     *
686     * @return a non-negative integer between 1 and 72
687     * @see #setMinimumFontSize
688     */
689    public synchronized int getMinimumFontSize() {
690        throw new MustOverrideException();
691    }
692
693    /**
694     * Sets the minimum logical font size. The default is 8.
695     *
696     * @param size a non-negative integer between 1 and 72. Any number outside
697     *             the specified range will be pinned.
698     */
699    public synchronized void setMinimumLogicalFontSize(int size) {
700        throw new MustOverrideException();
701    }
702
703    /**
704     * Gets the minimum logical font size.
705     *
706     * @return a non-negative integer between 1 and 72
707     * @see #setMinimumLogicalFontSize
708     */
709    public synchronized int getMinimumLogicalFontSize() {
710        throw new MustOverrideException();
711    }
712
713    /**
714     * Sets the default font size. The default is 16.
715     *
716     * @param size a non-negative integer between 1 and 72. Any number outside
717     *             the specified range will be pinned.
718     */
719    public synchronized void setDefaultFontSize(int size) {
720        throw new MustOverrideException();
721    }
722
723    /**
724     * Gets the default font size.
725     *
726     * @return a non-negative integer between 1 and 72
727     * @see #setDefaultFontSize
728     */
729    public synchronized int getDefaultFontSize() {
730        throw new MustOverrideException();
731    }
732
733    /**
734     * Sets the default fixed font size. The default is 16.
735     *
736     * @param size a non-negative integer between 1 and 72. Any number outside
737     *             the specified range will be pinned.
738     */
739    public synchronized void setDefaultFixedFontSize(int size) {
740        throw new MustOverrideException();
741    }
742
743    /**
744     * Gets the default fixed font size.
745     *
746     * @return a non-negative integer between 1 and 72
747     * @see #setDefaultFixedFontSize
748     */
749    public synchronized int getDefaultFixedFontSize() {
750        throw new MustOverrideException();
751    }
752
753    /**
754     * Sets whether the WebView should load image resources. Note that this method
755     * controls loading of all images, including those embedded using the data
756     * URI scheme. Use {@link #setBlockNetworkImage} to control loading only
757     * of images specified using network URI schemes. Note that if the value of this
758     * setting is changed from false to true, all images resources referenced
759     * by content currently displayed by the WebView are loaded automatically.
760     * The default is true.
761     *
762     * @param flag whether the WebView should load image resources
763     */
764    public synchronized void setLoadsImagesAutomatically(boolean flag) {
765        throw new MustOverrideException();
766    }
767
768    /**
769     * Gets whether the WebView loads image resources. This includes
770     * images embedded using the data URI scheme.
771     *
772     * @return true if the WebView loads image resources
773     * @see #setLoadsImagesAutomatically
774     */
775    public synchronized boolean getLoadsImagesAutomatically() {
776        throw new MustOverrideException();
777    }
778
779    /**
780     * Sets whether the WebView should not load image resources from the
781     * network (resources accessed via http and https URI schemes).  Note
782     * that this method has no effect unless
783     * {@link #getLoadsImagesAutomatically} returns true. Also note that
784     * disabling all network loads using {@link #setBlockNetworkLoads}
785     * will also prevent network images from loading, even if this flag is set
786     * to false. When the value of this setting is changed from true to false,
787     * network images resources referenced by content currently displayed by
788     * the WebView are fetched automatically. The default is false.
789     *
790     * @param flag whether the WebView should not load image resources from the
791     *             network
792     * @see #setBlockNetworkLoads
793     */
794    public synchronized void setBlockNetworkImage(boolean flag) {
795        throw new MustOverrideException();
796    }
797
798    /**
799     * Gets whether the WebView does not load image resources from the network.
800     *
801     * @return true if the WebView does not load image resources from the network
802     * @see #setBlockNetworkImage
803     */
804    public synchronized boolean getBlockNetworkImage() {
805        throw new MustOverrideException();
806    }
807
808    /**
809     * Sets whether the WebView should not load resources from the network.
810     * Use {@link #setBlockNetworkImage} to only avoid loading
811     * image resources. Note that if the value of this setting is
812     * changed from true to false, network resources referenced by content
813     * currently displayed by the WebView are not fetched until
814     * {@link android.webkit.WebView#reload} is called.
815     * If the application does not have the
816     * {@link android.Manifest.permission#INTERNET} permission, attempts to set
817     * a value of false will cause a {@link java.lang.SecurityException}
818     * to be thrown. The default value is false if the application has the
819     * {@link android.Manifest.permission#INTERNET} permission, otherwise it is
820     * true.
821     *
822     * @param flag whether the WebView should not load any resources from the
823     *             network
824     * @see android.webkit.WebView#reload
825     */
826    public synchronized void setBlockNetworkLoads(boolean flag) {
827        throw new MustOverrideException();
828    }
829
830    /**
831     * Gets whether the WebView does not load any resources from the network.
832     *
833     * @return true if the WebView does not load any resources from the network
834     * @see #setBlockNetworkLoads
835     */
836    public synchronized boolean getBlockNetworkLoads() {
837        throw new MustOverrideException();
838    }
839
840    /**
841     * Tells the WebView to enable JavaScript execution.
842     * <b>The default is false.</b>
843     *
844     * @param flag true if the WebView should execute JavaScript
845     */
846    public synchronized void setJavaScriptEnabled(boolean flag) {
847        throw new MustOverrideException();
848    }
849
850    /**
851     * Configures scripting (such as XmlHttpRequest) access from file scheme URLs
852     * to any origin. Note, calling this method with a true argument value also
853     * implies calling setAllowFileAccessFromFileURLs with a true. The default
854     * value is false for API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN}
855     * and higher and true otherwise.
856     *
857     * @param flag true if the WebView should allow scripting access from file
858     *             scheme URLs to any origin
859     */
860    public abstract void setAllowUniversalAccessFromFileURLs(boolean flag);
861
862    /**
863     * Configures scripting (such as XmlHttpRequest) access from file scheme URLs
864     * to file origin. The default value is false for API level
865     * {@link android.os.Build.VERSION_CODES#JELLY_BEAN} and higher and true
866     * otherwise.
867     *
868     * @param flag true if the WebView should allow scripting access from file
869     *             scheme URLs to file origin
870     */
871    public abstract void setAllowFileAccessFromFileURLs(boolean flag);
872
873    /**
874     * Tells the WebView to enable plugins.
875     *
876     * @param flag true if the WebView should load plugins
877     * @deprecated This method has been deprecated in favor of
878     *             {@link #setPluginState}
879     */
880    @Deprecated
881    public synchronized void setPluginsEnabled(boolean flag) {
882        throw new MustOverrideException();
883    }
884
885    /**
886     * Tells the WebView to enable, disable, or have plugins on demand. On
887     * demand mode means that if a plugin exists that can handle the embedded
888     * content, a placeholder icon will be shown instead of the plugin. When
889     * the placeholder is clicked, the plugin will be enabled.
890     *
891     * @param state a PluginState value
892     */
893    public synchronized void setPluginState(PluginState state) {
894        throw new MustOverrideException();
895    }
896
897    /**
898     * Sets a custom path to plugins used by the WebView. This method is
899     * obsolete since each plugin is now loaded from its own package.
900     *
901     * @param pluginsPath a String path to the directory containing plugins
902     * @deprecated This method is no longer used as plugins are loaded from
903     *             their own APK via the system's package manager.
904     */
905    @Deprecated
906    public synchronized void setPluginsPath(String pluginsPath) {
907        // Specified to do nothing, so no need for derived classes to override.
908    }
909
910    /**
911     * Sets the path to where database storage API databases should be saved.
912     * Note that the WebCore Database Tracker only allows the path to be set once.
913     *
914     * @param databasePath a String path to the directory where databases should
915     *                     be saved. May be the empty string but should never
916     *                     be null.
917     */
918    // This will update WebCore when the Sync runs in the C++ side.
919    public synchronized void setDatabasePath(String databasePath) {
920        throw new MustOverrideException();
921    }
922
923    /**
924     * Sets the path where the Geolocation permissions database should be saved.
925     *
926     * @param databasePath a String path to the directory where the Geolocation
927     *                     permissions database should be saved. May be the
928     *                     empty string but should never be null.
929     */
930    // This will update WebCore when the Sync runs in the C++ side.
931    public synchronized void setGeolocationDatabasePath(String databasePath) {
932        throw new MustOverrideException();
933    }
934
935    /**
936     * Tells the WebView to enable Application Caches API.
937     *
938     * @param flag true if the WebView should enable Application Caches
939     */
940    public synchronized void setAppCacheEnabled(boolean flag) {
941        throw new MustOverrideException();
942    }
943
944    /**
945     * Sets a custom path to the Application Caches files. The client
946     * must ensure it exists before this call.
947     *
948     * @param appCachePath a String path to the directory containing
949     *                     Application Caches files. The appCache path can be
950     *                     the empty string but should not be null. Passing
951     *                     null for this parameter will result in a no-op.
952     */
953    public synchronized void setAppCachePath(String appCachePath) {
954        throw new MustOverrideException();
955    }
956
957    /**
958     * Sets the maximum size for the Application Caches content.
959     *
960     * @param appCacheMaxSize the maximum size in bytes
961     */
962    public synchronized void setAppCacheMaxSize(long appCacheMaxSize) {
963        throw new MustOverrideException();
964    }
965
966    /**
967     * Sets whether the database storage API is enabled.
968     *
969     * @param flag true if the WebView should use the database storage API
970     */
971    public synchronized void setDatabaseEnabled(boolean flag) {
972        throw new MustOverrideException();
973    }
974
975    /**
976     * Sets whether the DOM storage API is enabled.
977     *
978     * @param flag true if the WebView should use the DOM storage API
979     */
980    public synchronized void setDomStorageEnabled(boolean flag) {
981        throw new MustOverrideException();
982    }
983
984    /**
985     * Gets whether the DOM Storage APIs are enabled.
986     *
987     * @return true if the DOM Storage APIs are enabled
988     */
989    public synchronized boolean getDomStorageEnabled() {
990        throw new MustOverrideException();
991    }
992    /**
993     * Gets the path to where database storage API databases are saved for
994     * the current WebView.
995     *
996     * @return the String path to the database storage API databases
997     */
998    public synchronized String getDatabasePath() {
999        throw new MustOverrideException();
1000    }
1001
1002    /**
1003     * Gets whether the database storage API is enabled.
1004     *
1005     * @return true if the database storage API is enabled
1006     */
1007    public synchronized boolean getDatabaseEnabled() {
1008        throw new MustOverrideException();
1009    }
1010
1011    /**
1012     * Sets whether Geolocation is enabled.
1013     *
1014     * @param flag whether Geolocation should be enabled
1015     */
1016    public synchronized void setGeolocationEnabled(boolean flag) {
1017        throw new MustOverrideException();
1018    }
1019
1020    /**
1021     * Gets whether JavaScript is enabled.
1022     *
1023     * @return true if JavaScript is enabled
1024     * @see #setJavaScriptEnabled
1025     */
1026    public synchronized boolean getJavaScriptEnabled() {
1027        throw new MustOverrideException();
1028    }
1029
1030    /**
1031     * Gets whether scripting access {see @setAllowUniversalAccessFromFileURLs} from
1032     * file URLs to any origin is enabled.
1033     *
1034     * @return true if the WebView allows scripting access from file scheme requests
1035     *         to any origin
1036     * @see #setAllowUniversalAccessFromFileURLs
1037     */
1038    public abstract boolean getAllowUniversalAccessFromFileURLs();
1039
1040    /**
1041     * Gets whether scripting access {see @setAllowFileAccessFromFileURLs} from file
1042     * URLs to file origin is enabled.
1043     *
1044     * @return true if the WebView allows scripting access from file scheme requests
1045     *         to file origin
1046     * @see #setAllowFileAccessFromFileURLs
1047     */
1048    public abstract boolean getAllowFileAccessFromFileURLs();
1049
1050    /**
1051     * Gets whether plugins are enabled.
1052     *
1053     * @return true if plugins are enabled
1054     * @deprecated This method has been replaced by {@link #getPluginState}
1055     */
1056    @Deprecated
1057    public synchronized boolean getPluginsEnabled() {
1058        throw new MustOverrideException();
1059    }
1060
1061    /**
1062     * Gets the current plugin state.
1063     *
1064     * @return a value corresponding to the enum PluginState
1065     */
1066    public synchronized PluginState getPluginState() {
1067        throw new MustOverrideException();
1068    }
1069
1070    /**
1071     * Gets the directory that contains the plugin libraries. This method is
1072     * obsolete since each plugin is now loaded from its own package.
1073     *
1074     * @return an empty string
1075     * @deprecated This method is no longer used as plugins are loaded from
1076     * their own APK via the system's package manager.
1077     */
1078    @Deprecated
1079    public synchronized String getPluginsPath() {
1080        // Unconditionally returns empty string, so no need for derived classes to override.
1081        return "";
1082    }
1083
1084    /**
1085     * Tells JavaScript to open windows automatically. This applies to the
1086     * JavaScript function window.open(). The default is false.
1087     *
1088     * @param flag true if JavaScript can open windows automatically
1089     */
1090    public synchronized void setJavaScriptCanOpenWindowsAutomatically(boolean flag) {
1091        throw new MustOverrideException();
1092    }
1093
1094    /**
1095     * Gets whether JavaScript can open windows automatically.
1096     *
1097     * @return true if JavaScript can open windows automatically during
1098     *         window.open()
1099     * @see #setJavaScriptCanOpenWindowsAutomatically
1100     */
1101    public synchronized boolean getJavaScriptCanOpenWindowsAutomatically() {
1102        throw new MustOverrideException();
1103    }
1104    /**
1105     * Sets the default text encoding name to use when decoding html pages.
1106     * The default is "Latin-1".
1107     *
1108     * @param encoding the text encoding name
1109     */
1110    public synchronized void setDefaultTextEncodingName(String encoding) {
1111        throw new MustOverrideException();
1112    }
1113
1114    /**
1115     * Gets the default text encoding name.
1116     *
1117     * @return the default text encoding name as a string
1118     * @see #setDefaultTextEncodingName
1119     */
1120    public synchronized String getDefaultTextEncodingName() {
1121        throw new MustOverrideException();
1122    }
1123
1124    /**
1125     * Sets the WebView's user-agent string. If the string "ua" is null or empty,
1126     * it will use the system default user-agent string.
1127     */
1128    public synchronized void setUserAgentString(String ua) {
1129        throw new MustOverrideException();
1130    }
1131
1132    /**
1133     * Gets the WebView's user-agent string.
1134     */
1135    public synchronized String getUserAgentString() {
1136        throw new MustOverrideException();
1137    }
1138
1139    /**
1140     * Tells the WebView whether it needs to set a node to have focus when
1141     * {@link WebView#requestFocus(int, android.graphics.Rect)} is called.
1142     *
1143     * @param flag whether the WebView needs to set a node
1144     */
1145    public void setNeedInitialFocus(boolean flag) {
1146        throw new MustOverrideException();
1147    }
1148
1149    /**
1150     * Sets the priority of the Render thread. Unlike the other settings, this
1151     * one only needs to be called once per process. The default is NORMAL.
1152     *
1153     * @param priority a RenderPriority
1154     */
1155    public synchronized void setRenderPriority(RenderPriority priority) {
1156        throw new MustOverrideException();
1157    }
1158
1159    /**
1160     * Overrides the way the cache is used. The way the cache is used is based
1161     * on the navigation option. For a normal page load, the cache is checked
1162     * and content is re-validated as needed. When navigating back, content is
1163     * not revalidated, instead the content is just pulled from the cache.
1164     * This function allows the client to override this behavior.
1165     *
1166     * @param mode one of the LOAD_ values
1167     */
1168    public void setCacheMode(int mode) {
1169        throw new MustOverrideException();
1170    }
1171
1172    /**
1173     * Gets the current setting for overriding the cache mode. For a full
1174     * description, see the {@link #setCacheMode(int)} function.
1175     */
1176    public int getCacheMode() {
1177        throw new MustOverrideException();
1178    }
1179}
1180