summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Scott <phanna@android.com>2011-01-12 09:44:59 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-01-12 09:44:59 -0800
commit92a9a3c5ef9774863b4cee93d43b67582a02c2f0 (patch)
treeabd694a5afd7b8704b11a5b06fb3d4b5b5d4a2c9
parente5cf7f2bc51913d87bf97c8a1885f736edc5f0bc (diff)
parentd1737edc13864b2304763167720b27b68791e25a (diff)
downloadframeworks_base-92a9a3c5ef9774863b4cee93d43b67582a02c2f0.zip
frameworks_base-92a9a3c5ef9774863b4cee93d43b67582a02c2f0.tar.gz
frameworks_base-92a9a3c5ef9774863b4cee93d43b67582a02c2f0.tar.bz2
Merge "Do not merge." into honeycomb
-rw-r--r--api/current.xml24
-rw-r--r--core/java/android/webkit/BrowserFrame.java3
-rw-r--r--core/java/android/webkit/FrameLoader.java3
-rw-r--r--core/java/android/webkit/WebSettings.java21
4 files changed, 48 insertions, 3 deletions
diff --git a/api/current.xml b/api/current.xml
index 6371a32..38ee9f6 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -232537,6 +232537,17 @@
visibility="public"
>
</method>
+<method name="getAllowContentAccess"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getAllowFileAccess"
return="boolean"
abstract="false"
@@ -232955,6 +232966,19 @@
visibility="public"
>
</method>
+<method name="setAllowContentAccess"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="allow" type="boolean">
+</parameter>
+</method>
<method name="setAllowFileAccess"
return="void"
abstract="false"
diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java
index de1faa2..e246717 100644
--- a/core/java/android/webkit/BrowserFrame.java
+++ b/core/java/android/webkit/BrowserFrame.java
@@ -738,7 +738,8 @@ class BrowserFrame extends Handler {
}
// content://
- } else if (url.startsWith(ANDROID_CONTENT)) {
+ } else if (mSettings.getAllowContentAccess() &&
+ url.startsWith(ANDROID_CONTENT)) {
try {
// Strip off mimetype, for compatibility with ContentLoader.java
// If we don't do this, we can fail to load Gmail attachments,
diff --git a/core/java/android/webkit/FrameLoader.java b/core/java/android/webkit/FrameLoader.java
index 2b44775..0d80302 100644
--- a/core/java/android/webkit/FrameLoader.java
+++ b/core/java/android/webkit/FrameLoader.java
@@ -203,7 +203,8 @@ class FrameLoader {
settings.getAllowFileAccess())).sendToTarget();
}
return true;
- } else if (URLUtil.isContentUrl(url)) {
+ } else if (settings.getAllowContentAccess() &&
+ URLUtil.isContentUrl(url)) {
// Send the raw url to the ContentLoader because it will do a
// permission check and the url has to match.
if (loadListener.isSynchronous()) {
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index 6750422..0670c4e 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -215,6 +215,7 @@ public class WebSettings {
private boolean mBuiltInZoomControls = false;
private boolean mDisplayZoomControls = true;
private boolean mAllowFileAccess = true;
+ private boolean mAllowContentAccess = true;
private boolean mLoadWithOverviewMode = false;
private boolean mEnableSmoothTransition = false;
@@ -587,7 +588,9 @@ public class WebSettings {
/**
* Enable or disable file access within WebView. File access is enabled by
- * default.
+ * default. Note that this enables or disables file system access only.
+ * Assets and resources are still accessible using file:///android_asset and
+ * file:///android_res.
*/
public void setAllowFileAccess(boolean allow) {
mAllowFileAccess = allow;
@@ -601,6 +604,22 @@ public class WebSettings {
}
/**
+ * Enable or disable content url access within WebView. Content url access
+ * allows WebView to load content from a content provider installed in the
+ * system. The default is enabled.
+ */
+ public void setAllowContentAccess(boolean allow) {
+ mAllowContentAccess = allow;
+ }
+
+ /**
+ * Returns true if this WebView supports content url access.
+ */
+ public boolean getAllowContentAccess() {
+ return mAllowContentAccess;
+ }
+
+ /**
* Set whether the WebView loads a page with overview mode.
*/
public void setLoadWithOverviewMode(boolean overview) {