WebSettings.java revision 0e5b160418dad25b9e7125d2533cc8770b1cd9c6
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. The default
157     * is false.
158     *
159     * @deprecated This method is now obsolete.
160     */
161    @Deprecated
162    public void setNavDump(boolean enabled) {
163        throw new MustOverrideException();
164    }
165
166    /**
167     * Gets whether dumping the navigation cache is enabled.
168     *
169     * @return whether dumping the navigation cache is enabled
170     * @see #setNavDump
171     * @deprecated This method is now obsolete.
172     */
173    @Deprecated
174    public boolean getNavDump() {
175        throw new MustOverrideException();
176    }
177
178    /**
179     * Sets whether the WebView should support zooming using its on-screen zoom
180     * controls and gestures. The particular zoom mechanisms that should be used
181     * can be set with {@link #setBuiltInZoomControls}. This setting does not
182     * affect zooming performed using the {@link WebView#zoomIn()} and
183     * {@link WebView#zoomOut()} methods. The default is true.
184     *
185     * @param support whether the WebView should support zoom
186     */
187    public void setSupportZoom(boolean support) {
188        throw new MustOverrideException();
189    }
190
191    /**
192     * Gets whether the WebView supports zoom.
193     *
194     * @return true if the WebView supports zoom
195     * @see #setSupportZoom
196     */
197    public boolean supportZoom() {
198        throw new MustOverrideException();
199    }
200
201    /**
202     * Sets whether the WebView requires a user gesture to play media.
203     * The default is true.
204     *
205     * @param require whether the WebView requires a user gesture to play media
206     */
207    public void setMediaPlaybackRequiresUserGesture(boolean require) {
208        throw new MustOverrideException();
209    }
210
211    /**
212     * Gets whether the WebView requires a user gesture to play media.
213     *
214     * @return true if the WebView requires a user gesture to play media
215     * @see #setMediaPlaybackRequiresUserGesture
216     */
217    public boolean getMediaPlaybackRequiresUserGesture() {
218        throw new MustOverrideException();
219    }
220
221    /**
222     * Sets whether the WebView should use its built-in zoom mechanisms. The
223     * built-in zoom mechanisms comprise on-screen zoom controls, which are
224     * displayed over the WebView's content, and the use of a pinch gesture to
225     * control zooming. Whether or not these on-screen controls are displayed
226     * can be set with {@link #setDisplayZoomControls}. The default is false.
227     * <p>
228     * The built-in mechanisms are the only currently supported zoom
229     * mechanisms, so it is recommended that this setting is always enabled.
230     *
231     * @param enabled whether the WebView should use its built-in zoom mechanisms
232     */
233    // This method was intended to select between the built-in zoom mechanisms
234    // and the separate zoom controls. The latter were obtained using
235    // {@link WebView#getZoomControls}, which is now hidden.
236    public void setBuiltInZoomControls(boolean enabled) {
237        throw new MustOverrideException();
238    }
239
240    /**
241     * Gets whether the zoom mechanisms built into WebView are being used.
242     *
243     * @return true if the zoom mechanisms built into WebView are being used
244     * @see #setBuiltInZoomControls
245     */
246    public boolean getBuiltInZoomControls() {
247        throw new MustOverrideException();
248    }
249
250    /**
251     * Sets whether the WebView should display on-screen zoom controls when
252     * using the built-in zoom mechanisms. See {@link #setBuiltInZoomControls}.
253     * The default is true.
254     *
255     * @param enabled whether the WebView should display on-screen zoom controls
256     */
257    public void setDisplayZoomControls(boolean enabled) {
258        throw new MustOverrideException();
259    }
260
261    /**
262     * Gets whether the WebView displays on-screen zoom controls when using
263     * the built-in zoom mechanisms.
264     *
265     * @return true if the WebView displays on-screen zoom controls when using
266     *         the built-in zoom mechanisms
267     * @see #setDisplayZoomControls
268     */
269    public boolean getDisplayZoomControls() {
270        throw new MustOverrideException();
271    }
272
273    /**
274     * Enables or disables file access within WebView. File access is enabled by
275     * default.  Note that this enables or disables file system access only.
276     * Assets and resources are still accessible using file:///android_asset and
277     * file:///android_res.
278     */
279    public void setAllowFileAccess(boolean allow) {
280        throw new MustOverrideException();
281    }
282
283    /**
284     * Gets whether this WebView supports file access.
285     *
286     * @see #setAllowFileAccess
287     */
288    public boolean getAllowFileAccess() {
289        throw new MustOverrideException();
290    }
291
292    /**
293     * Enables or disables content URL access within WebView.  Content URL
294     * access allows WebView to load content from a content provider installed
295     * in the system. The default is enabled.
296     */
297    public void setAllowContentAccess(boolean allow) {
298        throw new MustOverrideException();
299    }
300
301    /**
302     * Gets whether this WebView supports content URL access.
303     *
304     * @see #setAllowContentAccess
305     */
306    public boolean getAllowContentAccess() {
307        throw new MustOverrideException();
308    }
309
310    /**
311     * Sets whether the WebView loads pages in overview mode. The default is
312     * false.
313     */
314    public void setLoadWithOverviewMode(boolean overview) {
315        throw new MustOverrideException();
316    }
317
318    /**
319     * Gets whether this WebView loads pages in overview mode.
320     *
321     * @return whether this WebView loads pages in overview mode
322     * @see #setLoadWithOverviewMode
323     */
324    public boolean getLoadWithOverviewMode() {
325        throw new MustOverrideException();
326    }
327
328    /**
329     * Sets whether the WebView will enable smooth transition while panning or
330     * zooming or while the window hosting the WebView does not have focus.
331     * If it is true, WebView will choose a solution to maximize the performance.
332     * e.g. the WebView's content may not be updated during the transition.
333     * If it is false, WebView will keep its fidelity. The default value is false.
334     */
335    public void setEnableSmoothTransition(boolean enable) {
336        throw new MustOverrideException();
337    }
338
339    /**
340     * Gets whether the WebView enables smooth transition while panning or
341     * zooming.
342     *
343     * @see #setEnableSmoothTransition
344     */
345    public boolean enableSmoothTransition() {
346        throw new MustOverrideException();
347    }
348
349    /**
350     * Sets whether the WebView uses its background for over scroll background.
351     * If true, it will use the WebView's background. If false, it will use an
352     * internal pattern. Default is true.
353     *
354     * @deprecated This method is now obsolete.
355     */
356    @Deprecated
357    public void setUseWebViewBackgroundForOverscrollBackground(boolean view) {
358        throw new MustOverrideException();
359    }
360
361    /**
362     * Gets whether this WebView uses WebView's background instead of
363     * internal pattern for over scroll background.
364     *
365     * @see #setUseWebViewBackgroundForOverscrollBackground
366     * @deprecated This method is now obsolete.
367     */
368    @Deprecated
369    public boolean getUseWebViewBackgroundForOverscrollBackground() {
370        throw new MustOverrideException();
371    }
372
373    /**
374     * Sets whether the WebView should save form data. The default is true,
375     * unless in private browsing mode, when the value is always false.
376     */
377    public void setSaveFormData(boolean save) {
378        throw new MustOverrideException();
379    }
380
381    /**
382     * Gets whether the WebView saves form data. Always false in private
383     * browsing mode.
384     *
385     * @return whether the WebView saves form data
386     * @see #setSaveFormData
387     */
388    public boolean getSaveFormData() {
389        throw new MustOverrideException();
390    }
391
392    /**
393     * Sets whether the WebView should save passwords. The default is true.
394     */
395    public void setSavePassword(boolean save) {
396        throw new MustOverrideException();
397    }
398
399    /**
400     * Gets whether the WebView saves passwords.
401     *
402     * @return whether the WebView saves passwords
403     * @see #setSavePassword
404     */
405    public boolean getSavePassword() {
406        throw new MustOverrideException();
407    }
408
409    /**
410     * Sets the text zoom of the page in percent. The default is 100.
411     *
412     * @param textZoom the text zoom in percent
413     */
414    public synchronized void setTextZoom(int textZoom) {
415        throw new MustOverrideException();
416    }
417
418    /**
419     * Gets the text zoom of the page in percent.
420     *
421     * @return the text zoom of the page in percent
422     * @see #setTextSizeZoom
423     */
424    public synchronized int getTextZoom() {
425        throw new MustOverrideException();
426    }
427
428    /**
429     * Sets the text size of the page. The default is {@link TextSize#NORMAL}.
430     *
431     * @param t the text size as a {@link TextSize} value
432     * @deprecated Use {@link #setTextZoom} instead.
433     */
434    public synchronized void setTextSize(TextSize t) {
435        throw new MustOverrideException();
436    }
437
438    /**
439     * Gets the text size of the page. If the text size was previously specified
440     * in percent using {@link #setTextZoom}, this will return the closest
441     * matching {@link TextSize}.
442     *
443     * @return the text size as a {@link TextSize} value
444     * @see #setTextSize
445     * @deprecated Use {@link #getTextZoom} instead.
446     */
447    public synchronized TextSize getTextSize() {
448        throw new MustOverrideException();
449    }
450
451    /**
452     * Sets the default zoom density of the page. This must be called from the UI
453     * thread. The default is {@link ZoomDensity#MEDIUM}.
454     *
455     * @param zoom the zoom density
456     */
457    public void setDefaultZoom(ZoomDensity zoom) {
458        throw new MustOverrideException();
459    }
460
461    /**
462     * Gets the default zoom density of the page. This should be called from
463     * the UI thread.
464     *
465     * @return the zoom density
466     * @see #setDefaultZoom
467     */
468    public ZoomDensity getDefaultZoom() {
469        throw new MustOverrideException();
470    }
471
472    /**
473     * Enables using light touches to make a selection and activate mouseovers.
474     * The default is false.
475     */
476    public void setLightTouchEnabled(boolean enabled) {
477        throw new MustOverrideException();
478    }
479
480    /**
481     * Gets whether light touches are enabled.
482     *
483     * @return whether light touches are enabled
484     * @see #setLightTouchEnabled
485     */
486    public boolean getLightTouchEnabled() {
487        throw new MustOverrideException();
488    }
489
490    /**
491     * Controlled a rendering optimization that is no longer present. Setting
492     * it now has no effect.
493     *
494     * @deprecated This setting now has no effect.
495     */
496    @Deprecated
497    public synchronized void setUseDoubleTree(boolean use) {
498        // Specified to do nothing, so no need for derived classes to override.
499    }
500
501    /**
502     * Controlled a rendering optimization that is no longer present. Setting
503     * it now has no effect.
504     *
505     * @deprecated This setting now has no effect.
506     */
507    @Deprecated
508    public synchronized boolean getUseDoubleTree() {
509        // Returns false unconditionally, so no need for derived classes to override.
510        return false;
511    }
512
513    /**
514     * Sets the user-agent string using an integer code.
515     * <ul>
516     *   <li>0 means the WebView should use an Android user-agent string</li>
517     *   <li>1 means the WebView should use a desktop user-agent string</li>
518     * </ul>
519     * Other values are ignored. The default is an Android user-agent string,
520     * i.e. code value 0.
521     *
522     * @param ua the integer code for the user-agent string
523     * @deprecated Please use {@link #setUserAgentString} instead.
524     */
525    @Deprecated
526    public synchronized void setUserAgent(int ua) {
527        throw new MustOverrideException();
528    }
529
530    /**
531     * Gets the user-agent as an integer code.
532     * <ul>
533     *   <li>-1 means the WebView is using a custom user-agent string set with
534     *   {@link #setUserAgentString}</li>
535     *   <li>0 means the WebView should use an Android user-agent string</li>
536     *   <li>1 means the WebView should use a desktop user-agent string</li>
537     * </ul>
538     *
539     * @return the integer code for the user-agent string
540     * @see #setUserAgent
541     * @deprecated Please use {@link #getUserAgentString} instead.
542     */
543    @Deprecated
544    public synchronized int getUserAgent() {
545        throw new MustOverrideException();
546    }
547
548    /**
549     * Tells the WebView to use a wide viewport. The default is false.
550     *
551     * @param use whether to use a wide viewport
552     */
553    public synchronized void setUseWideViewPort(boolean use) {
554        throw new MustOverrideException();
555    }
556
557    /**
558     * Gets whether the WebView is using a wide viewport.
559     *
560     * @return true if the WebView is using a wide viewport
561     * @see #setUseWideViewPort
562     */
563    public synchronized boolean getUseWideViewPort() {
564        throw new MustOverrideException();
565    }
566
567    /**
568     * Sets whether the WebView whether supports multiple windows. If set to
569     * true, {@link WebChromeClient#onCreateWindow} must be implemented by the
570     * host application. The default is false.
571     *
572     * @param support whether to suport multiple windows
573     */
574    public synchronized void setSupportMultipleWindows(boolean support) {
575        throw new MustOverrideException();
576    }
577
578    /**
579     * Gets whether the WebView supports multiple windows.
580     *
581     * @return true if the WebView supports multiple windows
582     * @see #setSupportMultipleWindows
583     */
584    public synchronized boolean supportMultipleWindows() {
585        throw new MustOverrideException();
586    }
587
588    /**
589     * Sets the underlying layout algorithm. This will cause a relayout of the
590     * WebView. The default is {@link LayoutAlgorithm#NARROW_COLUMNS}.
591     *
592     * @param l the layout algorithm to use, as a {@link LayoutAlgorithm} value
593     */
594    public synchronized void setLayoutAlgorithm(LayoutAlgorithm l) {
595        throw new MustOverrideException();
596    }
597
598    /**
599     * Gets the current layout algorithm.
600     *
601     * @return the layout algorithm in use, as a {@link LayoutAlgorithm} value
602     * @see #setLayoutAlgorithm
603     */
604    public synchronized LayoutAlgorithm getLayoutAlgorithm() {
605        throw new MustOverrideException();
606    }
607
608    /**
609     * Sets the standard font family name. The default is "sans-serif".
610     *
611     * @param font a font family name
612     */
613    public synchronized void setStandardFontFamily(String font) {
614        throw new MustOverrideException();
615    }
616
617    /**
618     * Gets the standard font family name.
619     *
620     * @return the standard font family name as a string
621     * @see #setStandardFontFamily
622     */
623    public synchronized String getStandardFontFamily() {
624        throw new MustOverrideException();
625    }
626
627    /**
628     * Sets the fixed font family name. The default is "monospace".
629     *
630     * @param font a font family name
631     */
632    public synchronized void setFixedFontFamily(String font) {
633        throw new MustOverrideException();
634    }
635
636    /**
637     * Gets the fixed font family name.
638     *
639     * @return the fixed font family name as a string
640     * @see #setFixedFontFamily
641     */
642    public synchronized String getFixedFontFamily() {
643        throw new MustOverrideException();
644    }
645
646    /**
647     * Sets the sans-serif font family name. The default is "sans-serif".
648     *
649     * @param font a font family name
650     */
651    public synchronized void setSansSerifFontFamily(String font) {
652        throw new MustOverrideException();
653    }
654
655    /**
656     * Gets the sans-serif font family name.
657     *
658     * @return the sans-serif font family name as a string
659     * @see #setSansSerifFontFamily
660     */
661    public synchronized String getSansSerifFontFamily() {
662        throw new MustOverrideException();
663    }
664
665    /**
666     * Sets the serif font family name. The default is "sans-serif".
667     *
668     * @param font a font family name
669     */
670    public synchronized void setSerifFontFamily(String font) {
671        throw new MustOverrideException();
672    }
673
674    /**
675     * Gets the serif font family name. The default is "serif".
676     *
677     * @return the serif font family name as a string
678     * @see #setSerifFontFamily
679     */
680    public synchronized String getSerifFontFamily() {
681        throw new MustOverrideException();
682    }
683
684    /**
685     * Sets the cursive font family name. The default is "cursive".
686     *
687     * @param font a font family name
688     */
689    public synchronized void setCursiveFontFamily(String font) {
690        throw new MustOverrideException();
691    }
692
693    /**
694     * Gets the cursive font family name.
695     *
696     * @return the cursive font family name as a string
697     * @see #setCursiveFontFamily
698     */
699    public synchronized String getCursiveFontFamily() {
700        throw new MustOverrideException();
701    }
702
703    /**
704     * Sets the fantasy font family name. The default is "fantasy".
705     *
706     * @param font a font family name
707     */
708    public synchronized void setFantasyFontFamily(String font) {
709        throw new MustOverrideException();
710    }
711
712    /**
713     * Gets the fantasy font family name.
714     *
715     * @return the fantasy font family name as a string
716     * @see #setFantasyFontFamily
717     */
718    public synchronized String getFantasyFontFamily() {
719        throw new MustOverrideException();
720    }
721
722    /**
723     * Sets the minimum font size. The default is 8.
724     *
725     * @param size a non-negative integer between 1 and 72. Any number outside
726     *             the specified range will be pinned.
727     */
728    public synchronized void setMinimumFontSize(int size) {
729        throw new MustOverrideException();
730    }
731
732    /**
733     * Gets the minimum font size.
734     *
735     * @return a non-negative integer between 1 and 72
736     * @see #setMinimumFontSize
737     */
738    public synchronized int getMinimumFontSize() {
739        throw new MustOverrideException();
740    }
741
742    /**
743     * Sets the minimum logical font size. The default is 8.
744     *
745     * @param size a non-negative integer between 1 and 72. Any number outside
746     *             the specified range will be pinned.
747     */
748    public synchronized void setMinimumLogicalFontSize(int size) {
749        throw new MustOverrideException();
750    }
751
752    /**
753     * Gets the minimum logical font size.
754     *
755     * @return a non-negative integer between 1 and 72
756     * @see #setMinimumLogicalFontSize
757     */
758    public synchronized int getMinimumLogicalFontSize() {
759        throw new MustOverrideException();
760    }
761
762    /**
763     * Sets the default font size. The default is 16.
764     *
765     * @param size a non-negative integer between 1 and 72. Any number outside
766     *             the specified range will be pinned.
767     */
768    public synchronized void setDefaultFontSize(int size) {
769        throw new MustOverrideException();
770    }
771
772    /**
773     * Gets the default font size.
774     *
775     * @return a non-negative integer between 1 and 72
776     * @see #setDefaultFontSize
777     */
778    public synchronized int getDefaultFontSize() {
779        throw new MustOverrideException();
780    }
781
782    /**
783     * Sets the default fixed font size. The default is 16.
784     *
785     * @param size a non-negative integer between 1 and 72. Any number outside
786     *             the specified range will be pinned.
787     */
788    public synchronized void setDefaultFixedFontSize(int size) {
789        throw new MustOverrideException();
790    }
791
792    /**
793     * Gets the default fixed font size.
794     *
795     * @return a non-negative integer between 1 and 72
796     * @see #setDefaultFixedFontSize
797     */
798    public synchronized int getDefaultFixedFontSize() {
799        throw new MustOverrideException();
800    }
801
802    /**
803     * Sets whether the WebView should load image resources. Note that this method
804     * controls loading of all images, including those embedded using the data
805     * URI scheme. Use {@link #setBlockNetworkImage} to control loading only
806     * of images specified using network URI schemes. Note that if the value of this
807     * setting is changed from false to true, all images resources referenced
808     * by content currently displayed by the WebView are loaded automatically.
809     * The default is true.
810     *
811     * @param flag whether the WebView should load image resources
812     */
813    public synchronized void setLoadsImagesAutomatically(boolean flag) {
814        throw new MustOverrideException();
815    }
816
817    /**
818     * Gets whether the WebView loads image resources. This includes
819     * images embedded using the data URI scheme.
820     *
821     * @return true if the WebView loads image resources
822     * @see #setLoadsImagesAutomatically
823     */
824    public synchronized boolean getLoadsImagesAutomatically() {
825        throw new MustOverrideException();
826    }
827
828    /**
829     * Sets whether the WebView should not load image resources from the
830     * network (resources accessed via http and https URI schemes).  Note
831     * that this method has no effect unless
832     * {@link #getLoadsImagesAutomatically} returns true. Also note that
833     * disabling all network loads using {@link #setBlockNetworkLoads}
834     * will also prevent network images from loading, even if this flag is set
835     * to false. When the value of this setting is changed from true to false,
836     * network images resources referenced by content currently displayed by
837     * the WebView are fetched automatically. The default is false.
838     *
839     * @param flag whether the WebView should not load image resources from the
840     *             network
841     * @see #setBlockNetworkLoads
842     */
843    public synchronized void setBlockNetworkImage(boolean flag) {
844        throw new MustOverrideException();
845    }
846
847    /**
848     * Gets whether the WebView does not load image resources from the network.
849     *
850     * @return true if the WebView does not load image resources from the network
851     * @see #setBlockNetworkImage
852     */
853    public synchronized boolean getBlockNetworkImage() {
854        throw new MustOverrideException();
855    }
856
857    /**
858     * Sets whether the WebView should not load resources from the network.
859     * Use {@link #setBlockNetworkImage} to only avoid loading
860     * image resources. Note that if the value of this setting is
861     * changed from true to false, network resources referenced by content
862     * currently displayed by the WebView are not fetched until
863     * {@link android.webkit.WebView#reload} is called.
864     * If the application does not have the
865     * {@link android.Manifest.permission#INTERNET} permission, attempts to set
866     * a value of false will cause a {@link java.lang.SecurityException}
867     * to be thrown. The default value is false if the application has the
868     * {@link android.Manifest.permission#INTERNET} permission, otherwise it is
869     * true.
870     *
871     * @param flag whether the WebView should not load any resources from the
872     *             network
873     * @see android.webkit.WebView#reload
874     */
875    public synchronized void setBlockNetworkLoads(boolean flag) {
876        throw new MustOverrideException();
877    }
878
879    /**
880     * Gets whether the WebView does not load any resources from the network.
881     *
882     * @return true if the WebView does not load any resources from the network
883     * @see #setBlockNetworkLoads
884     */
885    public synchronized boolean getBlockNetworkLoads() {
886        throw new MustOverrideException();
887    }
888
889    /**
890     * Tells the WebView to enable JavaScript execution.
891     * <b>The default is false.</b>
892     *
893     * @param flag true if the WebView should execute JavaScript
894     */
895    public synchronized void setJavaScriptEnabled(boolean flag) {
896        throw new MustOverrideException();
897    }
898
899    /**
900     * Sets whether JavaScript running in the context of a file scheme URL
901     * should be allowed to access content from any origin. This includes
902     * access to content from other file scheme URLs. See
903     * {@link #setAllowFileAccessFromFileURLs}. To enable the most restrictive,
904     * and therefore secure policy, this setting should be disabled.
905     * <p>
906     * The default value is true for API level
907     * {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1} and below,
908     * and false for API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN}
909     * and above.
910     *
911     * @param flag whether JavaScript running in the context of a file scheme
912     *             URL should be allowed to access content from any origin
913     */
914    public abstract void setAllowUniversalAccessFromFileURLs(boolean flag);
915
916    /**
917     * Sets whether JavaScript running in the context of a file scheme URL
918     * should be allowed to access content from other file scheme URLs. To
919     * enable the most restrictive, and therefore secure policy, this setting
920     * should be disabled. Note that the value of this setting is ignored if
921     * the value of {@link #getAllowUniversalAccessFromFileURLs} is true.
922     * <p>
923     * The default value is true for API level
924     * {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1} and below,
925     * and false for API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN}
926     * and above.
927     *
928     * @param flag whether JavaScript running in the context of a file scheme
929     *             URL should be allowed to access content from other file
930     *             scheme URLs
931     */
932    public abstract void setAllowFileAccessFromFileURLs(boolean flag);
933
934    /**
935     * Sets whether the WebView should enable plugins. The default is false.
936     *
937     * @param flag true if plugins should be enabled
938     * @deprecated This method has been deprecated in favor of
939     *             {@link #setPluginState}
940     */
941    @Deprecated
942    public synchronized void setPluginsEnabled(boolean flag) {
943        throw new MustOverrideException();
944    }
945
946    /**
947     * Tells the WebView to enable, disable, or have plugins on demand. On
948     * demand mode means that if a plugin exists that can handle the embedded
949     * content, a placeholder icon will be shown instead of the plugin. When
950     * the placeholder is clicked, the plugin will be enabled. The default is
951     * {@link PluginState#OFF}.
952     *
953     * @param state a PluginState value
954     */
955    public synchronized void setPluginState(PluginState state) {
956        throw new MustOverrideException();
957    }
958
959    /**
960     * Sets a custom path to plugins used by the WebView. This method is
961     * obsolete since each plugin is now loaded from its own package.
962     *
963     * @param pluginsPath a String path to the directory containing plugins
964     * @deprecated This method is no longer used as plugins are loaded from
965     *             their own APK via the system's package manager.
966     */
967    @Deprecated
968    public synchronized void setPluginsPath(String pluginsPath) {
969        // Specified to do nothing, so no need for derived classes to override.
970    }
971
972    /**
973     * Sets the path to where database storage API databases should be saved.
974     * In order for the database storage API to function correctly, this method
975     * must be called with a path to which the application can write. This
976     * method should only be called once: repeated calls are ignored.
977     *
978     * @param databasePath a path to the directory where databases should be
979     *                     saved.
980     */
981    // This will update WebCore when the Sync runs in the C++ side.
982    // Note that the WebCore Database Tracker only allows the path to be set
983    // once.
984    public synchronized void setDatabasePath(String databasePath) {
985        throw new MustOverrideException();
986    }
987
988    /**
989     * Sets the path where the Geolocation databases should be saved. In order
990     * for Geolocation permissions and cached positions to be persisted, this
991     * method must be called with a path to which the application can write.
992     *
993     * @param databasePath a path to the directory where databases should be
994     *                     saved.
995     */
996    // This will update WebCore when the Sync runs in the C++ side.
997    public synchronized void setGeolocationDatabasePath(String databasePath) {
998        throw new MustOverrideException();
999    }
1000
1001    /**
1002     * Sets whether the Application Caches API should be enabled. The default
1003     * is false. Note that in order for the Application Caches API to be
1004     * enabled, a valid database path must also be supplied to
1005     * {@link #setAppCachePath}.
1006     *
1007     * @param flag true if the WebView should enable Application Caches
1008     */
1009    public synchronized void setAppCacheEnabled(boolean flag) {
1010        throw new MustOverrideException();
1011    }
1012
1013    /**
1014     * Sets the path to the Application Caches files. In order for the
1015     * Application Caches API to be enabled, this method must be called with a
1016     * path to which the application can write. This method should only be
1017     * called once: repeated calls are ignored.
1018     *
1019     * @param appCachePath a String path to the directory containing
1020     *                     Application Caches files.
1021     * @see setAppCacheEnabled
1022     */
1023    public synchronized void setAppCachePath(String appCachePath) {
1024        throw new MustOverrideException();
1025    }
1026
1027    /**
1028     * Sets the maximum size for the Application Cache content. The passed size
1029     * will be rounded to the nearest value that the database can support, so
1030     * this should be viewed as a guide, not a hard limit. Setting the
1031     * size to a value less than current database size does not cause the
1032     * database to be trimmed. The default size is {@link Long#MAX_VALUE}.
1033     *
1034     * @param appCacheMaxSize the maximum size in bytes
1035     */
1036    public synchronized void setAppCacheMaxSize(long appCacheMaxSize) {
1037        throw new MustOverrideException();
1038    }
1039
1040    /**
1041     * Sets whether the database storage API is enabled. The default value is
1042     * false. See also {@link #setDatabasePath} for how to correctly set up the
1043     * database storage API.
1044     *
1045     * @param flag true if the WebView should use the database storage API
1046     */
1047    public synchronized void setDatabaseEnabled(boolean flag) {
1048        throw new MustOverrideException();
1049    }
1050
1051    /**
1052     * Sets whether the DOM storage API is enabled. The default value is false.
1053     *
1054     * @param flag true if the WebView should use the DOM storage API
1055     */
1056    public synchronized void setDomStorageEnabled(boolean flag) {
1057        throw new MustOverrideException();
1058    }
1059
1060    /**
1061     * Gets whether the DOM Storage APIs are enabled.
1062     *
1063     * @return true if the DOM Storage APIs are enabled
1064     * @see #setDomStorageEnabled
1065     */
1066    public synchronized boolean getDomStorageEnabled() {
1067        throw new MustOverrideException();
1068    }
1069    /**
1070     * Gets the path to where database storage API databases are saved.
1071     *
1072     * @return the String path to the database storage API databases
1073     * @see #setDatabasePath
1074     */
1075    public synchronized String getDatabasePath() {
1076        throw new MustOverrideException();
1077    }
1078
1079    /**
1080     * Gets whether the database storage API is enabled.
1081     *
1082     * @return true if the database storage API is enabled
1083     * @see #setDatabaseEnabled
1084     */
1085    public synchronized boolean getDatabaseEnabled() {
1086        throw new MustOverrideException();
1087    }
1088
1089    /**
1090     * Sets whether Geolocation is enabled. The default is true. See also
1091     * {@link #setGeolocationDatabasePath} for how to correctly set up
1092     * Geolocation.
1093     *
1094     * @param flag whether Geolocation should be enabled
1095     */
1096    public synchronized void setGeolocationEnabled(boolean flag) {
1097        throw new MustOverrideException();
1098    }
1099
1100    /**
1101     * Gets whether JavaScript is enabled.
1102     *
1103     * @return true if JavaScript is enabled
1104     * @see #setJavaScriptEnabled
1105     */
1106    public synchronized boolean getJavaScriptEnabled() {
1107        throw new MustOverrideException();
1108    }
1109
1110    /**
1111     * Gets whether JavaScript running in the context of a file scheme URL can
1112     * access content from any origin. This includes access to content from
1113     * other file scheme URLs.
1114     *
1115     * @return whether JavaScript running in the context of a file scheme URL
1116     *         can access content from any origin
1117     * @see #setAllowUniversalAccessFromFileURLs
1118     */
1119    public abstract boolean getAllowUniversalAccessFromFileURLs();
1120
1121    /**
1122     * Gets whether JavaScript running in the context of a file scheme URL can
1123     * access content from other file scheme URLs.
1124     *
1125     * @return whether JavaScript running in the context of a file scheme URL
1126     *         can access content from other file scheme URLs
1127     * @see #setAllowFileAccessFromFileURLs
1128     */
1129    public abstract boolean getAllowFileAccessFromFileURLs();
1130
1131    /**
1132     * Gets whether plugins are enabled.
1133     *
1134     * @return true if plugins are enabled
1135     * @see #setPluginsEnabled
1136     * @deprecated This method has been replaced by {@link #getPluginState}
1137     */
1138    @Deprecated
1139    public synchronized boolean getPluginsEnabled() {
1140        throw new MustOverrideException();
1141    }
1142
1143    /**
1144     * Gets the current state regarding whether plugins are enabled.
1145     *
1146     * @return the plugin state as a {@link PluginState} value
1147     * @see #setPluginState
1148     */
1149    public synchronized PluginState getPluginState() {
1150        throw new MustOverrideException();
1151    }
1152
1153    /**
1154     * Gets the directory that contains the plugin libraries. This method is
1155     * obsolete since each plugin is now loaded from its own package.
1156     *
1157     * @return an empty string
1158     * @deprecated This method is no longer used as plugins are loaded from
1159     * their own APK via the system's package manager.
1160     */
1161    @Deprecated
1162    public synchronized String getPluginsPath() {
1163        // Unconditionally returns empty string, so no need for derived classes to override.
1164        return "";
1165    }
1166
1167    /**
1168     * Tells JavaScript to open windows automatically. This applies to the
1169     * JavaScript function window.open(). The default is false.
1170     *
1171     * @param flag true if JavaScript can open windows automatically
1172     */
1173    public synchronized void setJavaScriptCanOpenWindowsAutomatically(boolean flag) {
1174        throw new MustOverrideException();
1175    }
1176
1177    /**
1178     * Gets whether JavaScript can open windows automatically.
1179     *
1180     * @return true if JavaScript can open windows automatically during
1181     *         window.open()
1182     * @see #setJavaScriptCanOpenWindowsAutomatically
1183     */
1184    public synchronized boolean getJavaScriptCanOpenWindowsAutomatically() {
1185        throw new MustOverrideException();
1186    }
1187    /**
1188     * Sets the default text encoding name to use when decoding html pages.
1189     * The default is "Latin-1".
1190     *
1191     * @param encoding the text encoding name
1192     */
1193    public synchronized void setDefaultTextEncodingName(String encoding) {
1194        throw new MustOverrideException();
1195    }
1196
1197    /**
1198     * Gets the default text encoding name.
1199     *
1200     * @return the default text encoding name as a string
1201     * @see #setDefaultTextEncodingName
1202     */
1203    public synchronized String getDefaultTextEncodingName() {
1204        throw new MustOverrideException();
1205    }
1206
1207    /**
1208     * Sets the WebView's user-agent string. If the string is null or empty,
1209     * the system default value will be used.
1210     */
1211    public synchronized void setUserAgentString(String ua) {
1212        throw new MustOverrideException();
1213    }
1214
1215    /**
1216     * Gets the WebView's user-agent string.
1217     *
1218     * @return the WebView's user-agent string
1219     * @see #setUserAgentString
1220     */
1221    public synchronized String getUserAgentString() {
1222        throw new MustOverrideException();
1223    }
1224
1225    /**
1226     * Tells the WebView whether it needs to set a node to have focus when
1227     * {@link WebView#requestFocus(int, android.graphics.Rect)} is called. The
1228     * default value is true.
1229     *
1230     * @param flag whether the WebView needs to set a node
1231     */
1232    public void setNeedInitialFocus(boolean flag) {
1233        throw new MustOverrideException();
1234    }
1235
1236    /**
1237     * Sets the priority of the Render thread. Unlike the other settings, this
1238     * one only needs to be called once per process. The default value is
1239     * {@link RenderPriority#NORMAL}.
1240     *
1241     * @param priority the priority
1242     */
1243    public synchronized void setRenderPriority(RenderPriority priority) {
1244        throw new MustOverrideException();
1245    }
1246
1247    /**
1248     * Overrides the way the cache is used. The way the cache is used is based
1249     * on the navigation type. For a normal page load, the cache is checked
1250     * and content is re-validated as needed. When navigating back, content is
1251     * not revalidated, instead the content is just retrieved from the cache.
1252     * This method allows the client to override this behavior by specifying
1253     * one of {@link #LOAD_DEFAULT}, {@link #LOAD_NORMAL},
1254     * {@link #LOAD_CACHE_ELSE_NETWORK}, {@link #LOAD_NO_CACHE} or
1255     * {@link #LOAD_CACHE_ONLY}. The default value is {@link #LOAD_DEFAULT}.
1256     *
1257     * @param mode the mode to use
1258     */
1259    public void setCacheMode(int mode) {
1260        throw new MustOverrideException();
1261    }
1262
1263    /**
1264     * Gets the current setting for overriding the cache mode.
1265     *
1266     * @return the current setting for overriding the cache mode
1267     * @see #setCacheMode
1268     */
1269    public int getCacheMode() {
1270        throw new MustOverrideException();
1271    }
1272}
1273