WebSettings.java revision fd1ac83f6339a608967ae478240f1ad6a0fa01ef
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.annotation.SystemApi;
20import android.content.Context;
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. This is the recommended choice for maximum
38     *       compatibility across different platforms and Android versions.</li>
39     *   <li>SINGLE_COLUMN moves all content into one column that is the width of the
40     *       view.</li>
41     *   <li>NARROW_COLUMNS makes all columns no wider than the screen if possible. Only use
42     *       this for API levels prior to {@link android.os.Build.VERSION_CODES#KITKAT}.</li>
43     *   <li>TEXT_AUTOSIZING boosts font size of paragraphs based on heuristics to make
44     *       the text readable when viewing a wide-viewport layout in the overview mode.
45     *       It is recommended to enable zoom support {@link #setSupportZoom} when
46     *       using this mode. Supported from API level
47     *       {@link android.os.Build.VERSION_CODES#KITKAT}</li>
48     * </ul>
49     */
50    // XXX: These must match LayoutAlgorithm in Settings.h in WebCore.
51    public enum LayoutAlgorithm {
52        NORMAL,
53        /**
54         * @deprecated This algorithm is now obsolete.
55         */
56        @Deprecated
57        SINGLE_COLUMN,
58        /**
59         * @deprecated This algorithm is now obsolete.
60         */
61        @Deprecated
62        NARROW_COLUMNS,
63        TEXT_AUTOSIZING
64    }
65
66    /**
67     * Enum for specifying the text size.
68     * <ul>
69     *   <li>SMALLEST is 50%</li>
70     *   <li>SMALLER is 75%</li>
71     *   <li>NORMAL is 100%</li>
72     *   <li>LARGER is 150%</li>
73     *   <li>LARGEST is 200%</li>
74     * </ul>
75     *
76     * @deprecated Use {@link WebSettings#setTextZoom(int)} and {@link WebSettings#getTextZoom()} instead.
77     */
78    public enum TextSize {
79        SMALLEST(50),
80        SMALLER(75),
81        NORMAL(100),
82        LARGER(150),
83        LARGEST(200);
84        TextSize(int size) {
85            value = size;
86        }
87        int value;
88    }
89
90    /**
91     * Enum for specifying the WebView's desired density.
92     * <ul>
93     *   <li>FAR makes 100% looking like in 240dpi</li>
94     *   <li>MEDIUM makes 100% looking like in 160dpi</li>
95     *   <li>CLOSE makes 100% looking like in 120dpi</li>
96     * </ul>
97     */
98    public enum ZoomDensity {
99        FAR(150),      // 240dpi
100        MEDIUM(100),    // 160dpi
101        CLOSE(75);     // 120dpi
102        ZoomDensity(int size) {
103            value = size;
104        }
105
106        /**
107         * @hide Only for use by WebViewProvider implementations
108         */
109        public int getValue() {
110            return value;
111        }
112
113        int value;
114    }
115
116    /**
117     * Default cache usage mode. If the navigation type doesn't impose any
118     * specific behavior, use cached resources when they are available
119     * and not expired, otherwise load resources from the network.
120     * Use with {@link #setCacheMode}.
121     */
122    public static final int LOAD_DEFAULT = -1;
123
124    /**
125     * Normal cache usage mode. Use with {@link #setCacheMode}.
126     *
127     * @deprecated This value is obsolete, as from API level
128     * {@link android.os.Build.VERSION_CODES#HONEYCOMB} and onwards it has the
129     * same effect as {@link #LOAD_DEFAULT}.
130     */
131    @Deprecated
132    public static final int LOAD_NORMAL = 0;
133
134    /**
135     * Use cached resources when they are available, even if they have expired.
136     * Otherwise load resources from the network.
137     * Use with {@link #setCacheMode}.
138     */
139    public static final int LOAD_CACHE_ELSE_NETWORK = 1;
140
141    /**
142     * Don't use the cache, load from the network.
143     * Use with {@link #setCacheMode}.
144     */
145    public static final int LOAD_NO_CACHE = 2;
146
147    /**
148     * Don't use the network, load from the cache.
149     * Use with {@link #setCacheMode}.
150     */
151    public static final int LOAD_CACHE_ONLY = 3;
152
153    public enum RenderPriority {
154        NORMAL,
155        HIGH,
156        LOW
157    }
158
159    /**
160     * The plugin state effects how plugins are treated on a page. ON means
161     * that any object will be loaded even if a plugin does not exist to handle
162     * the content. ON_DEMAND means that if there is a plugin installed that
163     * can handle the content, a placeholder is shown until the user clicks on
164     * the placeholder. Once clicked, the plugin will be enabled on the page.
165     * OFF means that all plugins will be turned off and any fallback content
166     * will be used.
167     */
168    public enum PluginState {
169        ON,
170        ON_DEMAND,
171        OFF
172    }
173
174    /**
175     * Used with {@link #setMixedContentMode}
176     *
177     * In this mode, the WebView will allow a secure origin to load content from any other origin,
178     * even if that origin is insecure. This is the least secure mode of operation for the WebView,
179     * and where possible apps should not set this mode.
180     */
181    public static final int MIXED_CONTENT_ALWAYS_ALLOW = 0;
182
183    /**
184     * Used with {@link #setMixedContentMode}
185     *
186     * In this mode, the WebView will not allow a secure origin to load content from an insecure
187     * origin. This is the preferred and most secure mode of operation for the WebView and apps are
188     * strongly advised to use this mode.
189     */
190    public static final int MIXED_CONTENT_NEVER_ALLOW = 1;
191
192    /**
193     * Used with {@link #setMixedContentMode}
194     *
195     * In this mode, the WebView will attempt to be compatible with the approach of a modern web
196     * browser with regard to mixed content. Some insecure content may be allowed to be loaded by
197     * a secure origin and other types of content will be blocked. The types of content are allowed
198     * or blocked may change release to release and are not explicitly defined.
199     *
200     * This mode is intended to be used by apps that are not in control of the content that they
201     * render but desire to operate in a reasonably secure environment. For highest security, apps
202     * are recommended to use {@link #MIXED_CONTENT_NEVER_ALLOW}.
203     */
204    public static final int MIXED_CONTENT_COMPATIBILITY_MODE = 2;
205
206    /**
207     * Hidden constructor to prevent clients from creating a new settings
208     * instance or deriving the class.
209     *
210     * @hide
211     */
212    protected WebSettings() {
213    }
214
215    /**
216     * Enables dumping the pages navigation cache to a text file. The default
217     * is false.
218     *
219     * @deprecated This method is now obsolete.
220     * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
221     */
222    @Deprecated
223    public void setNavDump(boolean enabled) {
224        throw new MustOverrideException();
225    }
226
227    /**
228     * Gets whether dumping the navigation cache is enabled.
229     *
230     * @return whether dumping the navigation cache is enabled
231     * @see #setNavDump
232     * @deprecated This method is now obsolete.
233     * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
234     */
235    @Deprecated
236    public boolean getNavDump() {
237        throw new MustOverrideException();
238    }
239
240    /**
241     * Sets whether the WebView should support zooming using its on-screen zoom
242     * controls and gestures. The particular zoom mechanisms that should be used
243     * can be set with {@link #setBuiltInZoomControls}. This setting does not
244     * affect zooming performed using the {@link WebView#zoomIn()} and
245     * {@link WebView#zoomOut()} methods. The default is true.
246     *
247     * @param support whether the WebView should support zoom
248     */
249    public void setSupportZoom(boolean support) {
250        throw new MustOverrideException();
251    }
252
253    /**
254     * Gets whether the WebView supports zoom.
255     *
256     * @return true if the WebView supports zoom
257     * @see #setSupportZoom
258     */
259    public boolean supportZoom() {
260        throw new MustOverrideException();
261    }
262
263    /**
264     * Sets whether the WebView requires a user gesture to play media.
265     * The default is true.
266     *
267     * @param require whether the WebView requires a user gesture to play media
268     */
269    public void setMediaPlaybackRequiresUserGesture(boolean require) {
270        throw new MustOverrideException();
271    }
272
273    /**
274     * Gets whether the WebView requires a user gesture to play media.
275     *
276     * @return true if the WebView requires a user gesture to play media
277     * @see #setMediaPlaybackRequiresUserGesture
278     */
279    public boolean getMediaPlaybackRequiresUserGesture() {
280        throw new MustOverrideException();
281    }
282
283    /**
284     * Sets whether the WebView should use its built-in zoom mechanisms. The
285     * built-in zoom mechanisms comprise on-screen zoom controls, which are
286     * displayed over the WebView's content, and the use of a pinch gesture to
287     * control zooming. Whether or not these on-screen controls are displayed
288     * can be set with {@link #setDisplayZoomControls}. The default is false.
289     * <p>
290     * The built-in mechanisms are the only currently supported zoom
291     * mechanisms, so it is recommended that this setting is always enabled.
292     *
293     * @param enabled whether the WebView should use its built-in zoom mechanisms
294     */
295    // This method was intended to select between the built-in zoom mechanisms
296    // and the separate zoom controls. The latter were obtained using
297    // {@link WebView#getZoomControls}, which is now hidden.
298    public void setBuiltInZoomControls(boolean enabled) {
299        throw new MustOverrideException();
300    }
301
302    /**
303     * Gets whether the zoom mechanisms built into WebView are being used.
304     *
305     * @return true if the zoom mechanisms built into WebView are being used
306     * @see #setBuiltInZoomControls
307     */
308    public boolean getBuiltInZoomControls() {
309        throw new MustOverrideException();
310    }
311
312    /**
313     * Sets whether the WebView should display on-screen zoom controls when
314     * using the built-in zoom mechanisms. See {@link #setBuiltInZoomControls}.
315     * The default is true.
316     *
317     * @param enabled whether the WebView should display on-screen zoom controls
318     */
319    public void setDisplayZoomControls(boolean enabled) {
320        throw new MustOverrideException();
321    }
322
323    /**
324     * Gets whether the WebView displays on-screen zoom controls when using
325     * the built-in zoom mechanisms.
326     *
327     * @return true if the WebView displays on-screen zoom controls when using
328     *         the built-in zoom mechanisms
329     * @see #setDisplayZoomControls
330     */
331    public boolean getDisplayZoomControls() {
332        throw new MustOverrideException();
333    }
334
335    /**
336     * Enables or disables file access within WebView. File access is enabled by
337     * default.  Note that this enables or disables file system access only.
338     * Assets and resources are still accessible using file:///android_asset and
339     * file:///android_res.
340     */
341    public void setAllowFileAccess(boolean allow) {
342        throw new MustOverrideException();
343    }
344
345    /**
346     * Gets whether this WebView supports file access.
347     *
348     * @see #setAllowFileAccess
349     */
350    public boolean getAllowFileAccess() {
351        throw new MustOverrideException();
352    }
353
354    /**
355     * Enables or disables content URL access within WebView.  Content URL
356     * access allows WebView to load content from a content provider installed
357     * in the system. The default is enabled.
358     */
359    public void setAllowContentAccess(boolean allow) {
360        throw new MustOverrideException();
361    }
362
363    /**
364     * Gets whether this WebView supports content URL access.
365     *
366     * @see #setAllowContentAccess
367     */
368    public boolean getAllowContentAccess() {
369        throw new MustOverrideException();
370    }
371
372    /**
373     * Sets whether the WebView loads pages in overview mode, that is,
374     * zooms out the content to fit on screen by width. This setting is
375     * taken into account when the content width is greater than the width
376     * of the WebView control, for example, when {@link #getUseWideViewPort}
377     * is enabled. The default is false.
378     */
379    public void setLoadWithOverviewMode(boolean overview) {
380        throw new MustOverrideException();
381    }
382
383    /**
384     * Gets whether this WebView loads pages in overview mode.
385     *
386     * @return whether this WebView loads pages in overview mode
387     * @see #setLoadWithOverviewMode
388     */
389    public boolean getLoadWithOverviewMode() {
390        throw new MustOverrideException();
391    }
392
393    /**
394     * Sets whether the WebView will enable smooth transition while panning or
395     * zooming or while the window hosting the WebView does not have focus.
396     * If it is true, WebView will choose a solution to maximize the performance.
397     * e.g. the WebView's content may not be updated during the transition.
398     * If it is false, WebView will keep its fidelity. The default value is false.
399     *
400     * @deprecated This method is now obsolete, and will become a no-op in future.
401     */
402    @Deprecated
403    public void setEnableSmoothTransition(boolean enable) {
404        throw new MustOverrideException();
405    }
406
407    /**
408     * Gets whether the WebView enables smooth transition while panning or
409     * zooming.
410     *
411     * @see #setEnableSmoothTransition
412     *
413     * @deprecated This method is now obsolete, and will become a no-op in future.
414     */
415    @Deprecated
416    public boolean enableSmoothTransition() {
417        throw new MustOverrideException();
418    }
419
420    /**
421     * Sets whether the WebView uses its background for over scroll background.
422     * If true, it will use the WebView's background. If false, it will use an
423     * internal pattern. Default is true.
424     *
425     * @deprecated This method is now obsolete.
426     * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
427     */
428    @Deprecated
429    public void setUseWebViewBackgroundForOverscrollBackground(boolean view) {
430        throw new MustOverrideException();
431    }
432
433    /**
434     * Gets whether this WebView uses WebView's background instead of
435     * internal pattern for over scroll background.
436     *
437     * @see #setUseWebViewBackgroundForOverscrollBackground
438     * @deprecated This method is now obsolete.
439     * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
440     */
441    @Deprecated
442    public boolean getUseWebViewBackgroundForOverscrollBackground() {
443        throw new MustOverrideException();
444    }
445
446    /**
447     * Sets whether the WebView should save form data. The default is true.
448     */
449    public void setSaveFormData(boolean save) {
450        throw new MustOverrideException();
451    }
452
453    /**
454     * Gets whether the WebView saves form data.
455     *
456     * @return whether the WebView saves form data
457     * @see #setSaveFormData
458     */
459    public boolean getSaveFormData() {
460        throw new MustOverrideException();
461    }
462
463    /**
464     * Sets whether the WebView should save passwords. The default is true.
465     * @deprecated Saving passwords in WebView will not be supported in future versions.
466     */
467    @Deprecated
468    public void setSavePassword(boolean save) {
469        throw new MustOverrideException();
470    }
471
472    /**
473     * Gets whether the WebView saves passwords.
474     *
475     * @return whether the WebView saves passwords
476     * @see #setSavePassword
477     * @deprecated Saving passwords in WebView will not be supported in future versions.
478     */
479    @Deprecated
480    public boolean getSavePassword() {
481        throw new MustOverrideException();
482    }
483
484    /**
485     * Sets the text zoom of the page in percent. The default is 100.
486     *
487     * @param textZoom the text zoom in percent
488     */
489    public synchronized void setTextZoom(int textZoom) {
490        throw new MustOverrideException();
491    }
492
493    /**
494     * Gets the text zoom of the page in percent.
495     *
496     * @return the text zoom of the page in percent
497     * @see #setTextZoom
498     */
499    public synchronized int getTextZoom() {
500        throw new MustOverrideException();
501    }
502
503    /**
504     * Sets policy for third party cookies.
505     * Developers should access this via {@link CookieManager#setShouldAcceptThirdPartyCookies}.
506     * @hide Internal API.
507     */
508    public void setAcceptThirdPartyCookies(boolean accept) {
509        throw new MustOverrideException();
510    }
511
512    /**
513     * Gets policy for third party cookies.
514     * Developers should access this via {@link CookieManager#getShouldAcceptThirdPartyCookies}.
515     * @hide Internal API
516     */
517    public boolean getAcceptThirdPartyCookies() {
518        throw new MustOverrideException();
519    }
520
521    /**
522     * Sets the text size of the page. The default is {@link TextSize#NORMAL}.
523     *
524     * @param t the text size as a {@link TextSize} value
525     * @deprecated Use {@link #setTextZoom} instead.
526     */
527    public synchronized void setTextSize(TextSize t) {
528        setTextZoom(t.value);
529    }
530
531    /**
532     * Gets the text size of the page. If the text size was previously specified
533     * in percent using {@link #setTextZoom}, this will return the closest
534     * matching {@link TextSize}.
535     *
536     * @return the text size as a {@link TextSize} value
537     * @see #setTextSize
538     * @deprecated Use {@link #getTextZoom} instead.
539     */
540    public synchronized TextSize getTextSize() {
541        TextSize closestSize = null;
542        int smallestDelta = Integer.MAX_VALUE;
543        int textSize = getTextZoom();
544        for (TextSize size : TextSize.values()) {
545            int delta = Math.abs(textSize - size.value);
546            if (delta == 0) {
547                return size;
548            }
549            if (delta < smallestDelta) {
550                smallestDelta = delta;
551                closestSize = size;
552            }
553        }
554        return closestSize != null ? closestSize : TextSize.NORMAL;
555    }
556
557    /**
558     * Sets the default zoom density of the page. This must be called from the UI
559     * thread. The default is {@link ZoomDensity#MEDIUM}.
560     *
561     * This setting is not recommended for use in new applications.  If the WebView
562     * is utilized to display mobile-oriented pages, the desired effect can be achieved by
563     * adjusting 'width' and 'initial-scale' attributes of page's 'meta viewport'
564     * tag. For pages lacking the tag, {@link android.webkit.WebView#setInitialScale}
565     * and {@link #setUseWideViewPort} can be used.
566     *
567     * @param zoom the zoom density
568     * @deprecated This method is no longer supported, see the function documentation for
569     *             recommended alternatives.
570     */
571    @Deprecated
572    public void setDefaultZoom(ZoomDensity zoom) {
573        throw new MustOverrideException();
574    }
575
576    /**
577     * Gets the default zoom density of the page. This should be called from
578     * the UI thread.
579     *
580     * This setting is not recommended for use in new applications.
581     *
582     * @return the zoom density
583     * @see #setDefaultZoom
584     * @deprecated Will only return the default value.
585     */
586    public ZoomDensity getDefaultZoom() {
587        throw new MustOverrideException();
588    }
589
590    /**
591     * Enables using light touches to make a selection and activate mouseovers.
592     * @deprecated From {@link android.os.Build.VERSION_CODES#JELLY_BEAN} this
593     *             setting is obsolete and has no effect.
594     */
595    @Deprecated
596    public void setLightTouchEnabled(boolean enabled) {
597        throw new MustOverrideException();
598    }
599
600    /**
601     * Gets whether light touches are enabled.
602     * @see #setLightTouchEnabled
603     * @deprecated This setting is obsolete.
604     */
605    @Deprecated
606    public boolean getLightTouchEnabled() {
607        throw new MustOverrideException();
608    }
609
610    /**
611     * Controlled a rendering optimization that is no longer present. Setting
612     * it now has no effect.
613     *
614     * @deprecated This setting now has no effect.
615     * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
616     */
617    @Deprecated
618    public synchronized void setUseDoubleTree(boolean use) {
619        // Specified to do nothing, so no need for derived classes to override.
620    }
621
622    /**
623     * Controlled a rendering optimization that is no longer present. Setting
624     * it now has no effect.
625     *
626     * @deprecated This setting now has no effect.
627     * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
628     */
629    @Deprecated
630    public synchronized boolean getUseDoubleTree() {
631        // Returns false unconditionally, so no need for derived classes to override.
632        return false;
633    }
634
635    /**
636     * Sets the user-agent string using an integer code.
637     * <ul>
638     *   <li>0 means the WebView should use an Android user-agent string</li>
639     *   <li>1 means the WebView should use a desktop user-agent string</li>
640     * </ul>
641     * Other values are ignored. The default is an Android user-agent string,
642     * i.e. code value 0.
643     *
644     * @param ua the integer code for the user-agent string
645     * @deprecated Please use {@link #setUserAgentString} instead.
646     * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
647     */
648    @Deprecated
649    public synchronized void setUserAgent(int ua) {
650        throw new MustOverrideException();
651    }
652
653    /**
654     * Gets the user-agent as an integer code.
655     * <ul>
656     *   <li>-1 means the WebView is using a custom user-agent string set with
657     *   {@link #setUserAgentString}</li>
658     *   <li>0 means the WebView should use an Android user-agent string</li>
659     *   <li>1 means the WebView should use a desktop user-agent string</li>
660     * </ul>
661     *
662     * @return the integer code for the user-agent string
663     * @see #setUserAgent
664     * @deprecated Please use {@link #getUserAgentString} instead.
665     * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
666     */
667    @Deprecated
668    public synchronized int getUserAgent() {
669        throw new MustOverrideException();
670    }
671
672    /**
673     * Sets whether the WebView should enable support for the &quot;viewport&quot;
674     * HTML meta tag or should use a wide viewport.
675     * When the value of the setting is false, the layout width is always set to the
676     * width of the WebView control in device-independent (CSS) pixels.
677     * When the value is true and the page contains the viewport meta tag, the value
678     * of the width specified in the tag is used. If the page does not contain the tag or
679     * does not provide a width, then a wide viewport will be used.
680     *
681     * @param use whether to enable support for the viewport meta tag
682     */
683    public synchronized void setUseWideViewPort(boolean use) {
684        throw new MustOverrideException();
685    }
686
687    /**
688     * Gets whether the WebView supports the &quot;viewport&quot;
689     * HTML meta tag or will use a wide viewport.
690     *
691     * @return true if the WebView supports the viewport meta tag
692     * @see #setUseWideViewPort
693     */
694    public synchronized boolean getUseWideViewPort() {
695        throw new MustOverrideException();
696    }
697
698    /**
699     * Sets whether the WebView whether supports multiple windows. If set to
700     * true, {@link WebChromeClient#onCreateWindow} must be implemented by the
701     * host application. The default is false.
702     *
703     * @param support whether to suport multiple windows
704     */
705    public synchronized void setSupportMultipleWindows(boolean support) {
706        throw new MustOverrideException();
707    }
708
709    /**
710     * Gets whether the WebView supports multiple windows.
711     *
712     * @return true if the WebView supports multiple windows
713     * @see #setSupportMultipleWindows
714     */
715    public synchronized boolean supportMultipleWindows() {
716        throw new MustOverrideException();
717    }
718
719    /**
720     * Sets the underlying layout algorithm. This will cause a relayout of the
721     * WebView. The default is {@link LayoutAlgorithm#NARROW_COLUMNS}.
722     *
723     * @param l the layout algorithm to use, as a {@link LayoutAlgorithm} value
724     */
725    public synchronized void setLayoutAlgorithm(LayoutAlgorithm l) {
726        throw new MustOverrideException();
727    }
728
729    /**
730     * Gets the current layout algorithm.
731     *
732     * @return the layout algorithm in use, as a {@link LayoutAlgorithm} value
733     * @see #setLayoutAlgorithm
734     */
735    public synchronized LayoutAlgorithm getLayoutAlgorithm() {
736        throw new MustOverrideException();
737    }
738
739    /**
740     * Sets the standard font family name. The default is "sans-serif".
741     *
742     * @param font a font family name
743     */
744    public synchronized void setStandardFontFamily(String font) {
745        throw new MustOverrideException();
746    }
747
748    /**
749     * Gets the standard font family name.
750     *
751     * @return the standard font family name as a string
752     * @see #setStandardFontFamily
753     */
754    public synchronized String getStandardFontFamily() {
755        throw new MustOverrideException();
756    }
757
758    /**
759     * Sets the fixed font family name. The default is "monospace".
760     *
761     * @param font a font family name
762     */
763    public synchronized void setFixedFontFamily(String font) {
764        throw new MustOverrideException();
765    }
766
767    /**
768     * Gets the fixed font family name.
769     *
770     * @return the fixed font family name as a string
771     * @see #setFixedFontFamily
772     */
773    public synchronized String getFixedFontFamily() {
774        throw new MustOverrideException();
775    }
776
777    /**
778     * Sets the sans-serif font family name. The default is "sans-serif".
779     *
780     * @param font a font family name
781     */
782    public synchronized void setSansSerifFontFamily(String font) {
783        throw new MustOverrideException();
784    }
785
786    /**
787     * Gets the sans-serif font family name.
788     *
789     * @return the sans-serif font family name as a string
790     * @see #setSansSerifFontFamily
791     */
792    public synchronized String getSansSerifFontFamily() {
793        throw new MustOverrideException();
794    }
795
796    /**
797     * Sets the serif font family name. The default is "sans-serif".
798     *
799     * @param font a font family name
800     */
801    public synchronized void setSerifFontFamily(String font) {
802        throw new MustOverrideException();
803    }
804
805    /**
806     * Gets the serif font family name. The default is "serif".
807     *
808     * @return the serif font family name as a string
809     * @see #setSerifFontFamily
810     */
811    public synchronized String getSerifFontFamily() {
812        throw new MustOverrideException();
813    }
814
815    /**
816     * Sets the cursive font family name. The default is "cursive".
817     *
818     * @param font a font family name
819     */
820    public synchronized void setCursiveFontFamily(String font) {
821        throw new MustOverrideException();
822    }
823
824    /**
825     * Gets the cursive font family name.
826     *
827     * @return the cursive font family name as a string
828     * @see #setCursiveFontFamily
829     */
830    public synchronized String getCursiveFontFamily() {
831        throw new MustOverrideException();
832    }
833
834    /**
835     * Sets the fantasy font family name. The default is "fantasy".
836     *
837     * @param font a font family name
838     */
839    public synchronized void setFantasyFontFamily(String font) {
840        throw new MustOverrideException();
841    }
842
843    /**
844     * Gets the fantasy font family name.
845     *
846     * @return the fantasy font family name as a string
847     * @see #setFantasyFontFamily
848     */
849    public synchronized String getFantasyFontFamily() {
850        throw new MustOverrideException();
851    }
852
853    /**
854     * Sets the minimum font size. The default is 8.
855     *
856     * @param size a non-negative integer between 1 and 72. Any number outside
857     *             the specified range will be pinned.
858     */
859    public synchronized void setMinimumFontSize(int size) {
860        throw new MustOverrideException();
861    }
862
863    /**
864     * Gets the minimum font size.
865     *
866     * @return a non-negative integer between 1 and 72
867     * @see #setMinimumFontSize
868     */
869    public synchronized int getMinimumFontSize() {
870        throw new MustOverrideException();
871    }
872
873    /**
874     * Sets the minimum logical font size. The default is 8.
875     *
876     * @param size a non-negative integer between 1 and 72. Any number outside
877     *             the specified range will be pinned.
878     */
879    public synchronized void setMinimumLogicalFontSize(int size) {
880        throw new MustOverrideException();
881    }
882
883    /**
884     * Gets the minimum logical font size.
885     *
886     * @return a non-negative integer between 1 and 72
887     * @see #setMinimumLogicalFontSize
888     */
889    public synchronized int getMinimumLogicalFontSize() {
890        throw new MustOverrideException();
891    }
892
893    /**
894     * Sets the default font size. The default is 16.
895     *
896     * @param size a non-negative integer between 1 and 72. Any number outside
897     *             the specified range will be pinned.
898     */
899    public synchronized void setDefaultFontSize(int size) {
900        throw new MustOverrideException();
901    }
902
903    /**
904     * Gets the default font size.
905     *
906     * @return a non-negative integer between 1 and 72
907     * @see #setDefaultFontSize
908     */
909    public synchronized int getDefaultFontSize() {
910        throw new MustOverrideException();
911    }
912
913    /**
914     * Sets the default fixed font size. The default is 16.
915     *
916     * @param size a non-negative integer between 1 and 72. Any number outside
917     *             the specified range will be pinned.
918     */
919    public synchronized void setDefaultFixedFontSize(int size) {
920        throw new MustOverrideException();
921    }
922
923    /**
924     * Gets the default fixed font size.
925     *
926     * @return a non-negative integer between 1 and 72
927     * @see #setDefaultFixedFontSize
928     */
929    public synchronized int getDefaultFixedFontSize() {
930        throw new MustOverrideException();
931    }
932
933    /**
934     * Sets whether the WebView should load image resources. Note that this method
935     * controls loading of all images, including those embedded using the data
936     * URI scheme. Use {@link #setBlockNetworkImage} to control loading only
937     * of images specified using network URI schemes. Note that if the value of this
938     * setting is changed from false to true, all images resources referenced
939     * by content currently displayed by the WebView are loaded automatically.
940     * The default is true.
941     *
942     * @param flag whether the WebView should load image resources
943     */
944    public synchronized void setLoadsImagesAutomatically(boolean flag) {
945        throw new MustOverrideException();
946    }
947
948    /**
949     * Gets whether the WebView loads image resources. This includes
950     * images embedded using the data URI scheme.
951     *
952     * @return true if the WebView loads image resources
953     * @see #setLoadsImagesAutomatically
954     */
955    public synchronized boolean getLoadsImagesAutomatically() {
956        throw new MustOverrideException();
957    }
958
959    /**
960     * Sets whether the WebView should not load image resources from the
961     * network (resources accessed via http and https URI schemes).  Note
962     * that this method has no effect unless
963     * {@link #getLoadsImagesAutomatically} returns true. Also note that
964     * disabling all network loads using {@link #setBlockNetworkLoads}
965     * will also prevent network images from loading, even if this flag is set
966     * to false. When the value of this setting is changed from true to false,
967     * network images resources referenced by content currently displayed by
968     * the WebView are fetched automatically. The default is false.
969     *
970     * @param flag whether the WebView should not load image resources from the
971     *             network
972     * @see #setBlockNetworkLoads
973     */
974    public synchronized void setBlockNetworkImage(boolean flag) {
975        throw new MustOverrideException();
976    }
977
978    /**
979     * Gets whether the WebView does not load image resources from the network.
980     *
981     * @return true if the WebView does not load image resources from the network
982     * @see #setBlockNetworkImage
983     */
984    public synchronized boolean getBlockNetworkImage() {
985        throw new MustOverrideException();
986    }
987
988    /**
989     * Sets whether the WebView should not load resources from the network.
990     * Use {@link #setBlockNetworkImage} to only avoid loading
991     * image resources. Note that if the value of this setting is
992     * changed from true to false, network resources referenced by content
993     * currently displayed by the WebView are not fetched until
994     * {@link android.webkit.WebView#reload} is called.
995     * If the application does not have the
996     * {@link android.Manifest.permission#INTERNET} permission, attempts to set
997     * a value of false will cause a {@link java.lang.SecurityException}
998     * to be thrown. The default value is false if the application has the
999     * {@link android.Manifest.permission#INTERNET} permission, otherwise it is
1000     * true.
1001     *
1002     * @param flag whether the WebView should not load any resources from the
1003     *             network
1004     * @see android.webkit.WebView#reload
1005     */
1006    public synchronized void setBlockNetworkLoads(boolean flag) {
1007        throw new MustOverrideException();
1008    }
1009
1010    /**
1011     * Gets whether the WebView does not load any resources from the network.
1012     *
1013     * @return true if the WebView does not load any resources from the network
1014     * @see #setBlockNetworkLoads
1015     */
1016    public synchronized boolean getBlockNetworkLoads() {
1017        throw new MustOverrideException();
1018    }
1019
1020    /**
1021     * Tells the WebView to enable JavaScript execution.
1022     * <b>The default is false.</b>
1023     *
1024     * @param flag true if the WebView should execute JavaScript
1025     */
1026    public synchronized void setJavaScriptEnabled(boolean flag) {
1027        throw new MustOverrideException();
1028    }
1029
1030    /**
1031     * Sets whether JavaScript running in the context of a file scheme URL
1032     * should be allowed to access content from any origin. This includes
1033     * access to content from other file scheme URLs. See
1034     * {@link #setAllowFileAccessFromFileURLs}. To enable the most restrictive,
1035     * and therefore secure policy, this setting should be disabled.
1036     * Note that this setting affects only JavaScript access to file scheme
1037     * resources. Other access to such resources, for example, from image HTML
1038     * elements, is unaffected.
1039     * <p>
1040     * The default value is true for API level
1041     * {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1} and below,
1042     * and false for API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN}
1043     * and above.
1044     *
1045     * @param flag whether JavaScript running in the context of a file scheme
1046     *             URL should be allowed to access content from any origin
1047     */
1048    public abstract void setAllowUniversalAccessFromFileURLs(boolean flag);
1049
1050    /**
1051     * Sets whether JavaScript running in the context of a file scheme URL
1052     * should be allowed to access content from other file scheme URLs. To
1053     * enable the most restrictive, and therefore secure policy, this setting
1054     * should be disabled. Note that the value of this setting is ignored if
1055     * the value of {@link #getAllowUniversalAccessFromFileURLs} is true.
1056     * Note too, that this setting affects only JavaScript access to file scheme
1057     * resources. Other access to such resources, for example, from image HTML
1058     * elements, is unaffected.
1059     * <p>
1060     * The default value is true for API level
1061     * {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1} and below,
1062     * and false for API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN}
1063     * and above.
1064     *
1065     * @param flag whether JavaScript running in the context of a file scheme
1066     *             URL should be allowed to access content from other file
1067     *             scheme URLs
1068     */
1069    public abstract void setAllowFileAccessFromFileURLs(boolean flag);
1070
1071    /**
1072     * Sets whether the WebView should enable plugins. The default is false.
1073     *
1074     * @param flag true if plugins should be enabled
1075     * @deprecated This method has been deprecated in favor of
1076     *             {@link #setPluginState}
1077     * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
1078     */
1079    @Deprecated
1080    public synchronized void setPluginsEnabled(boolean flag) {
1081        throw new MustOverrideException();
1082    }
1083
1084    /**
1085     * Tells the WebView to enable, disable, or have plugins on demand. On
1086     * demand mode means that if a plugin exists that can handle the embedded
1087     * content, a placeholder icon will be shown instead of the plugin. When
1088     * the placeholder is clicked, the plugin will be enabled. The default is
1089     * {@link PluginState#OFF}.
1090     *
1091     * @param state a PluginState value
1092     * @deprecated Plugins will not be supported in future, and should not be used.
1093     */
1094    @Deprecated
1095    public synchronized void setPluginState(PluginState state) {
1096        throw new MustOverrideException();
1097    }
1098
1099    /**
1100     * Sets a custom path to plugins used by the WebView. This method is
1101     * obsolete since each plugin is now loaded from its own package.
1102     *
1103     * @param pluginsPath a String path to the directory containing plugins
1104     * @deprecated This method is no longer used as plugins are loaded from
1105     *             their own APK via the system's package manager.
1106     * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
1107     */
1108    @Deprecated
1109    public synchronized void setPluginsPath(String pluginsPath) {
1110        // Specified to do nothing, so no need for derived classes to override.
1111    }
1112
1113    /**
1114     * Sets the path to where database storage API databases should be saved.
1115     * In order for the database storage API to function correctly, this method
1116     * must be called with a path to which the application can write. This
1117     * method should only be called once: repeated calls are ignored.
1118     *
1119     * @param databasePath a path to the directory where databases should be
1120     *                     saved.
1121     * @deprecated Database paths are managed by the implementation and calling this method
1122     *             will have no effect.
1123     */
1124    // This will update WebCore when the Sync runs in the C++ side.
1125    // Note that the WebCore Database Tracker only allows the path to be set
1126    // once.
1127    @Deprecated
1128    public synchronized void setDatabasePath(String databasePath) {
1129        throw new MustOverrideException();
1130    }
1131
1132    /**
1133     * Sets the path where the Geolocation databases should be saved. In order
1134     * for Geolocation permissions and cached positions to be persisted, this
1135     * method must be called with a path to which the application can write.
1136     *
1137     * @param databasePath a path to the directory where databases should be
1138     *                     saved.
1139     */
1140    // This will update WebCore when the Sync runs in the C++ side.
1141    public synchronized void setGeolocationDatabasePath(String databasePath) {
1142        throw new MustOverrideException();
1143    }
1144
1145    /**
1146     * Sets whether the Application Caches API should be enabled. The default
1147     * is false. Note that in order for the Application Caches API to be
1148     * enabled, a valid database path must also be supplied to
1149     * {@link #setAppCachePath}.
1150     *
1151     * @param flag true if the WebView should enable Application Caches
1152     */
1153    public synchronized void setAppCacheEnabled(boolean flag) {
1154        throw new MustOverrideException();
1155    }
1156
1157    /**
1158     * Sets the path to the Application Caches files. In order for the
1159     * Application Caches API to be enabled, this method must be called with a
1160     * path to which the application can write. This method should only be
1161     * called once: repeated calls are ignored.
1162     *
1163     * @param appCachePath a String path to the directory containing
1164     *                     Application Caches files.
1165     * @see #setAppCacheEnabled
1166     */
1167    public synchronized void setAppCachePath(String appCachePath) {
1168        throw new MustOverrideException();
1169    }
1170
1171    /**
1172     * Sets the maximum size for the Application Cache content. The passed size
1173     * will be rounded to the nearest value that the database can support, so
1174     * this should be viewed as a guide, not a hard limit. Setting the
1175     * size to a value less than current database size does not cause the
1176     * database to be trimmed. The default size is {@link Long#MAX_VALUE}.
1177     * It is recommended to leave the maximum size set to the default value.
1178     *
1179     * @param appCacheMaxSize the maximum size in bytes
1180     * @deprecated In future quota will be managed automatically.
1181     */
1182    @Deprecated
1183    public synchronized void setAppCacheMaxSize(long appCacheMaxSize) {
1184        throw new MustOverrideException();
1185    }
1186
1187    /**
1188     * Sets whether the database storage API is enabled. The default value is
1189     * false. See also {@link #setDatabasePath} for how to correctly set up the
1190     * database storage API.
1191     *
1192     * This setting is global in effect, across all WebView instances in a process.
1193     * Note you should only modify this setting prior to making <b>any</b> WebView
1194     * page load within a given process, as the WebView implementation may ignore
1195     * changes to this setting after that point.
1196     *
1197     * @param flag true if the WebView should use the database storage API
1198     */
1199    public synchronized void setDatabaseEnabled(boolean flag) {
1200        throw new MustOverrideException();
1201    }
1202
1203    /**
1204     * Sets whether the DOM storage API is enabled. The default value is false.
1205     *
1206     * @param flag true if the WebView should use the DOM storage API
1207     */
1208    public synchronized void setDomStorageEnabled(boolean flag) {
1209        throw new MustOverrideException();
1210    }
1211
1212    /**
1213     * Gets whether the DOM Storage APIs are enabled.
1214     *
1215     * @return true if the DOM Storage APIs are enabled
1216     * @see #setDomStorageEnabled
1217     */
1218    public synchronized boolean getDomStorageEnabled() {
1219        throw new MustOverrideException();
1220    }
1221    /**
1222     * Gets the path to where database storage API databases are saved.
1223     *
1224     * @return the String path to the database storage API databases
1225     * @see #setDatabasePath
1226     * @deprecated Database paths are managed by the implementation this method is obsolete.
1227     */
1228    @Deprecated
1229    public synchronized String getDatabasePath() {
1230        throw new MustOverrideException();
1231    }
1232
1233    /**
1234     * Gets whether the database storage API is enabled.
1235     *
1236     * @return true if the database storage API is enabled
1237     * @see #setDatabaseEnabled
1238     */
1239    public synchronized boolean getDatabaseEnabled() {
1240        throw new MustOverrideException();
1241    }
1242
1243    /**
1244     * Sets whether Geolocation is enabled. The default is true.
1245     * <p>
1246     * Please note that in order for the Geolocation API to be usable
1247     * by a page in the WebView, the following requirements must be met:
1248     * <ul>
1249     *   <li>an application must have permission to access the device location,
1250     *   see {@link android.Manifest.permission#ACCESS_COARSE_LOCATION},
1251     *   {@link android.Manifest.permission#ACCESS_FINE_LOCATION};
1252     *   <li>an application must provide an implementation of the
1253     *   {@link WebChromeClient#onGeolocationPermissionsShowPrompt} callback
1254     *   to receive notifications that a page is requesting access to location
1255     *   via the JavaScript Geolocation API.
1256     * </ul>
1257     * <p>
1258     * As an option, it is possible to store previous locations and web origin
1259     * permissions in a database. See {@link #setGeolocationDatabasePath}.
1260     *
1261     * @param flag whether Geolocation should be enabled
1262     */
1263    public synchronized void setGeolocationEnabled(boolean flag) {
1264        throw new MustOverrideException();
1265    }
1266
1267    /**
1268     * Gets whether JavaScript is enabled.
1269     *
1270     * @return true if JavaScript is enabled
1271     * @see #setJavaScriptEnabled
1272     */
1273    public synchronized boolean getJavaScriptEnabled() {
1274        throw new MustOverrideException();
1275    }
1276
1277    /**
1278     * Gets whether JavaScript running in the context of a file scheme URL can
1279     * access content from any origin. This includes access to content from
1280     * other file scheme URLs.
1281     *
1282     * @return whether JavaScript running in the context of a file scheme URL
1283     *         can access content from any origin
1284     * @see #setAllowUniversalAccessFromFileURLs
1285     */
1286    public abstract boolean getAllowUniversalAccessFromFileURLs();
1287
1288    /**
1289     * Gets whether JavaScript running in the context of a file scheme URL can
1290     * access content from other file scheme URLs.
1291     *
1292     * @return whether JavaScript running in the context of a file scheme URL
1293     *         can access content from other file scheme URLs
1294     * @see #setAllowFileAccessFromFileURLs
1295     */
1296    public abstract boolean getAllowFileAccessFromFileURLs();
1297
1298    /**
1299     * Gets whether plugins are enabled.
1300     *
1301     * @return true if plugins are enabled
1302     * @see #setPluginsEnabled
1303     * @deprecated This method has been replaced by {@link #getPluginState}
1304     * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
1305     */
1306    @Deprecated
1307    public synchronized boolean getPluginsEnabled() {
1308        throw new MustOverrideException();
1309    }
1310
1311    /**
1312     * Gets the current state regarding whether plugins are enabled.
1313     *
1314     * @return the plugin state as a {@link PluginState} value
1315     * @see #setPluginState
1316     * @deprecated Plugins will not be supported in future, and should not be used.
1317     */
1318    @Deprecated
1319    public synchronized PluginState getPluginState() {
1320        throw new MustOverrideException();
1321    }
1322
1323    /**
1324     * Gets the directory that contains the plugin libraries. This method is
1325     * obsolete since each plugin is now loaded from its own package.
1326     *
1327     * @return an empty string
1328     * @deprecated This method is no longer used as plugins are loaded from
1329     * their own APK via the system's package manager.
1330     * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
1331     */
1332    @Deprecated
1333    public synchronized String getPluginsPath() {
1334        // Unconditionally returns empty string, so no need for derived classes to override.
1335        return "";
1336    }
1337
1338    /**
1339     * Tells JavaScript to open windows automatically. This applies to the
1340     * JavaScript function window.open(). The default is false.
1341     *
1342     * @param flag true if JavaScript can open windows automatically
1343     */
1344    public synchronized void setJavaScriptCanOpenWindowsAutomatically(boolean flag) {
1345        throw new MustOverrideException();
1346    }
1347
1348    /**
1349     * Gets whether JavaScript can open windows automatically.
1350     *
1351     * @return true if JavaScript can open windows automatically during
1352     *         window.open()
1353     * @see #setJavaScriptCanOpenWindowsAutomatically
1354     */
1355    public synchronized boolean getJavaScriptCanOpenWindowsAutomatically() {
1356        throw new MustOverrideException();
1357    }
1358
1359    /**
1360     * Sets the default text encoding name to use when decoding html pages.
1361     * The default is "UTF-8".
1362     *
1363     * @param encoding the text encoding name
1364     */
1365    public synchronized void setDefaultTextEncodingName(String encoding) {
1366        throw new MustOverrideException();
1367    }
1368
1369    /**
1370     * Gets the default text encoding name.
1371     *
1372     * @return the default text encoding name as a string
1373     * @see #setDefaultTextEncodingName
1374     */
1375    public synchronized String getDefaultTextEncodingName() {
1376        throw new MustOverrideException();
1377    }
1378
1379    /**
1380     * Sets the WebView's user-agent string. If the string is null or empty,
1381     * the system default value will be used.
1382     */
1383    public synchronized void setUserAgentString(String ua) {
1384        throw new MustOverrideException();
1385    }
1386
1387    /**
1388     * Gets the WebView's user-agent string.
1389     *
1390     * @return the WebView's user-agent string
1391     * @see #setUserAgentString
1392     */
1393    public synchronized String getUserAgentString() {
1394        throw new MustOverrideException();
1395    }
1396
1397    /**
1398     * Returns the default User-Agent used by a WebView.
1399     * An instance of WebView could use a different User-Agent if a call
1400     * is made to {@link WebSettings#setUserAgentString(String)}.
1401     *
1402     * @param context a Context object used to access application assets
1403     */
1404    public static String getDefaultUserAgent(Context context) {
1405        return WebViewFactory.getProvider().getStatics().getDefaultUserAgent(context);
1406    }
1407
1408    /**
1409     * Tells the WebView whether it needs to set a node to have focus when
1410     * {@link WebView#requestFocus(int, android.graphics.Rect)} is called. The
1411     * default value is true.
1412     *
1413     * @param flag whether the WebView needs to set a node
1414     */
1415    public void setNeedInitialFocus(boolean flag) {
1416        throw new MustOverrideException();
1417    }
1418
1419    /**
1420     * Sets the priority of the Render thread. Unlike the other settings, this
1421     * one only needs to be called once per process. The default value is
1422     * {@link RenderPriority#NORMAL}.
1423     *
1424     * @param priority the priority
1425     * @deprecated It is not recommended to adjust thread priorities, and this will
1426     *             not be supported in future versions.
1427     */
1428    @Deprecated
1429    public synchronized void setRenderPriority(RenderPriority priority) {
1430        throw new MustOverrideException();
1431    }
1432
1433    /**
1434     * Overrides the way the cache is used. The way the cache is used is based
1435     * on the navigation type. For a normal page load, the cache is checked
1436     * and content is re-validated as needed. When navigating back, content is
1437     * not revalidated, instead the content is just retrieved from the cache.
1438     * This method allows the client to override this behavior by specifying
1439     * one of {@link #LOAD_DEFAULT},
1440     * {@link #LOAD_CACHE_ELSE_NETWORK}, {@link #LOAD_NO_CACHE} or
1441     * {@link #LOAD_CACHE_ONLY}. The default value is {@link #LOAD_DEFAULT}.
1442     *
1443     * @param mode the mode to use
1444     */
1445    public void setCacheMode(int mode) {
1446        throw new MustOverrideException();
1447    }
1448
1449    /**
1450     * Gets the current setting for overriding the cache mode.
1451     *
1452     * @return the current setting for overriding the cache mode
1453     * @see #setCacheMode
1454     */
1455    public int getCacheMode() {
1456        throw new MustOverrideException();
1457    }
1458
1459    /**
1460     * Configures the WebView's behavior when a secure origin attempts to load a resource from an
1461     * insecure origin.
1462     *
1463     * By default, apps that target {@link android.os.Build.VERSION_CODES#KITKAT} or below default
1464     * to {@link #MIXED_CONTENT_ALWAYS_ALLOW}. Apps targeting
1465     * {@link android.os.Build.VERSION_CODES#LOLLIPOP} default to {@link #MIXED_CONTENT_NEVER_ALLOW}.
1466     *
1467     * The preferred and most secure mode of operation for the WebView is
1468     * {@link #MIXED_CONTENT_NEVER_ALLOW} and use of {@link #MIXED_CONTENT_ALWAYS_ALLOW} is
1469     * strongly discouraged.
1470     *
1471     * @param mode The mixed content mode to use. One of {@link #MIXED_CONTENT_NEVER_ALLOW},
1472     *     {@link #MIXED_CONTENT_NEVER_ALLOW} or {@link #MIXED_CONTENT_COMPATIBILITY_MODE}.
1473     */
1474    public abstract void setMixedContentMode(int mode);
1475
1476    /**
1477     * Gets the current behavior of the WebView with regard to loading insecure content from a
1478     * secure origin.
1479     * @return The current setting, one of {@link #MIXED_CONTENT_NEVER_ALLOW},
1480     *     {@link #MIXED_CONTENT_NEVER_ALLOW} or {@link #MIXED_CONTENT_COMPATIBILITY_MODE}.
1481     */
1482    public abstract int getMixedContentMode();
1483
1484    /**
1485     * Sets whether to use a video overlay for embedded encrypted video.
1486     * In API levels prior to {@link android.os.Build.VERSION_CODES#LOLLIPOP}, encrypted video can
1487     * only be rendered directly on a secure video surface, so it had been a hard problem to play
1488     * encrypted video in HTML.  When this flag is on, WebView can play encrypted video (MSE/EME)
1489     * by using a video overlay (aka hole-punching) for videos embedded using HTML &lt;video&gt;
1490     * tag.<br>
1491     * Caution: This setting is intended for use only in a narrow set of circumstances and apps
1492     * should only enable it if they require playback of encrypted video content. It will impose
1493     * the following limitations on the WebView:
1494     * <ul>
1495     * <li> Only one video overlay can be played at a time.
1496     * <li> Changes made to position or dimensions of a video element may be propagated to the
1497     * corresponding video overlay with a noticeable delay.
1498     * <li> The video overlay is not visible to web APIs and as such may not interact with
1499     * script or styling. For example, CSS styles applied to the &lt;video&gt; tag may be ignored.
1500     * </ul>
1501     * This is not an exhaustive set of constraints and it may vary with new versions of the
1502     * WebView.
1503     * @hide
1504     */
1505    @SystemApi
1506    public abstract void setVideoOverlayForEmbeddedEncryptedVideoEnabled(boolean flag);
1507
1508    /**
1509     * Gets whether a video overlay will be used for embedded encrypted video.
1510     *
1511     * @return true if WebView uses a video overlay for embedded encrypted video.
1512     * @see #setVideoOverlayForEmbeddedEncryptedVideoEnabled
1513     * @hide
1514     */
1515    @SystemApi
1516    public abstract boolean getVideoOverlayForEmbeddedEncryptedVideoEnabled();
1517}
1518