|
17 | 17 | package android.webkit; |
18 | 18 |
|
19 | 19 | import android.os.Message; |
| 20 | +import android.os.Build; |
20 | 21 |
|
21 | 22 | /** |
22 | 23 | * Manages settings state for a WebView. When a WebView is first created, it |
|
29 | 30 | // This is (effectively) an abstract base class; concrete WebViewProviders must |
30 | 31 | // create a class derived from this, and return an instance of it in the |
31 | 32 | // WebViewProvider.getWebSettingsProvider() method implementation. |
32 | | -public class WebSettings { |
| 33 | +public abstract class WebSettings { |
33 | 34 | // TODO: Remove MustOverrideException and make all methods throwing it abstract instead; |
34 | 35 | // needs API file update. |
35 | 36 | private static class MustOverrideException extends RuntimeException { |
@@ -770,6 +771,29 @@ public synchronized void setJavaScriptEnabled(boolean flag) { |
770 | 771 | throw new MustOverrideException(); |
771 | 772 | } |
772 | 773 |
|
| 774 | + /** |
| 775 | + * Configure scripting (such as XmlHttpRequest) access from file scheme URLs |
| 776 | + * to any origin. Note, calling this method with a true argument value also |
| 777 | + * implies calling setAllowFileAccessFromFileURLs with a true. The default |
| 778 | + * value is false for API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN} |
| 779 | + * and higher and true otherwise. |
| 780 | + * |
| 781 | + . * @param flag True if the WebView should allow scripting access from file |
| 782 | + * scheme URLs to any origin |
| 783 | + */ |
| 784 | + public abstract void setAllowUniversalAccessFromFileURLs(boolean flag); |
| 785 | + |
| 786 | + /** |
| 787 | + * Configure scripting (such as XmlHttpRequest) access from file scheme URLs |
| 788 | + * to file origin. The default value is false for API level |
| 789 | + * {@link android.os.Build.VERSION_CODES#JELLY_BEAN} and higher and true |
| 790 | + * otherwise. |
| 791 | + * |
| 792 | + * @param flag True if the WebView should allow scripting access from file |
| 793 | + * scheme URLs to file origin |
| 794 | + */ |
| 795 | + public abstract void setAllowFileAccessFromFileURLs(boolean flag); |
| 796 | + |
773 | 797 | /** |
774 | 798 | * Tell the WebView to enable plugins. |
775 | 799 | * @param flag True if the WebView should load plugins. |
@@ -911,6 +935,26 @@ public synchronized boolean getJavaScriptEnabled() { |
911 | 935 | throw new MustOverrideException(); |
912 | 936 | } |
913 | 937 |
|
| 938 | + /** |
| 939 | + * Return true if scripting access {see @setAllowUniversalAccessFromFileURLs} from |
| 940 | + * file URLs to any origin is enabled. The default value is false for API level |
| 941 | + * {@link android.os.Build.VERSION_CODES#JELLY_BEAN} and higher and true otherwise. |
| 942 | + * |
| 943 | + * @return True if the WebView allows scripting access from file scheme requests |
| 944 | + * to any origin |
| 945 | + */ |
| 946 | + public abstract boolean getAllowUniversalAccessFromFileURLs(); |
| 947 | + |
| 948 | + /** |
| 949 | + * Return true if scripting access {see @setAllowFileAccessFromFileURLs} from file |
| 950 | + * URLs to file origin is enabled. The default value is false for API level |
| 951 | + * {@link android.os.Build.VERSION_CODES#JELLY_BEAN} and higher, and true otherwise. |
| 952 | + * |
| 953 | + * @return True if the WebView allows scripting access from file scheme requests |
| 954 | + * to file origin |
| 955 | + */ |
| 956 | + public abstract boolean getAllowFileAccessFromFileURLs(); |
| 957 | + |
914 | 958 | /** |
915 | 959 | * Return true if plugins are enabled. |
916 | 960 | * @return True if plugins are enabled. |
|
0 commit comments