OSDN Git Service

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