diff options
author | Selim Gurun <sgurun@google.com> | 2012-03-29 18:19:01 -0700 |
---|---|---|
committer | Selim Gurun <sgurun@google.com> | 2012-04-19 16:38:18 -0700 |
commit | 0ea6dad65eb77f9347a59704b1f8a019cfc9e01f (patch) | |
tree | 42f80084648ffd22b98fb610d72b19e7d649c928 /core/java/android/webkit/WebSettings.java | |
parent | 3d275af3c3996f80816142628c380f79a9606c51 (diff) | |
download | frameworks_base-0ea6dad65eb77f9347a59704b1f8a019cfc9e01f.zip frameworks_base-0ea6dad65eb77f9347a59704b1f8a019cfc9e01f.tar.gz frameworks_base-0ea6dad65eb77f9347a59704b1f8a019cfc9e01f.tar.bz2 |
Add websettings API for file origin policy.
Bug: 6212665
Add the API and change the default behavior for Jelly Bean+.
Change-Id: I9a83f510675023c36e2e72c4a69ad082d8124a23
Diffstat (limited to 'core/java/android/webkit/WebSettings.java')
-rw-r--r-- | core/java/android/webkit/WebSettings.java | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java index cddd7ab..7ce29aaf 100644 --- a/core/java/android/webkit/WebSettings.java +++ b/core/java/android/webkit/WebSettings.java @@ -17,6 +17,7 @@ package android.webkit; import android.os.Message; +import android.os.Build; /** * Manages settings state for a WebView. When a WebView is first created, it @@ -29,7 +30,7 @@ import android.os.Message; // This is (effectively) an abstract base class; concrete WebViewProviders must // create a class derived from this, and return an instance of it in the // WebViewProvider.getWebSettingsProvider() method implementation. -public class WebSettings { +public abstract class WebSettings { // TODO: Remove MustOverrideException and make all methods throwing it abstract instead; // needs API file update. private static class MustOverrideException extends RuntimeException { @@ -750,6 +751,29 @@ public class WebSettings { } /** + * Configure scripting (such as XmlHttpRequest) access from file scheme URLs + * to any origin. Note, calling this method with a true argument value also + * implies calling setAllowFileAccessFromFileURLs with a true. The default + * value is false for API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN} + * and higher and true otherwise. + * + . * @param flag True if the WebView should allow scripting access from file + * scheme URLs to any origin + */ + public abstract void setAllowUniversalAccessFromFileURLs(boolean flag); + + /** + * Configure scripting (such as XmlHttpRequest) access from file scheme URLs + * to file origin. The default value is false for API level + * {@link android.os.Build.VERSION_CODES#JELLY_BEAN} and higher and true + * otherwise. + * + * @param flag True if the WebView should allow scripting access from file + * scheme URLs to file origin + */ + public abstract void setAllowFileAccessFromFileURLs(boolean flag); + + /** * Tell the WebView to enable plugins. * @param flag True if the WebView should load plugins. * @deprecated This method has been deprecated in favor of @@ -891,6 +915,26 @@ public class WebSettings { } /** + * Return true if scripting access {see @setAllowUniversalAccessFromFileURLs} from + * file URLs to any origin is enabled. The default value is false for API level + * {@link android.os.Build.VERSION_CODES#JELLY_BEAN} and higher and true otherwise. + * + * @return True if the WebView allows scripting access from file scheme requests + * to any origin + */ + public abstract boolean getAllowUniversalAccessFromFileURLs(); + + /** + * Return true if scripting access {see @setAllowFileAccessFromFileURLs} from file + * URLs to file origin is enabled. The default value is false for API level + * {@link android.os.Build.VERSION_CODES#JELLY_BEAN} and higher, and true otherwise. + * + * @return True if the WebView allows scripting access from file scheme requests + * to file origin + */ + public abstract boolean getAllowFileAccessFromFileURLs(); + + /** * Return true if plugins are enabled. * @return True if plugins are enabled. * @deprecated This method has been replaced by {@link #getPluginState} |