Skip to content

Commit 0777d2d

Browse files
Steve BlockAndroid (Google) Code Review
authored andcommitted
Merge "Clarify comments for WebSettings."
2 parents fe07b9a + 605a491 commit 0777d2d

File tree

1 file changed

+41
-21
lines changed

1 file changed

+41
-21
lines changed

core/java/android/webkit/WebSettings.java

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,8 +1156,13 @@ public synchronized void setPageCacheCapacity(int size) {
11561156
}
11571157

11581158
/**
1159-
* Tell the WebView to load image resources automatically.
1160-
* @param flag True if the WebView should load images automatically.
1159+
* Sets whether the WebView should load image resources. Note that this method
1160+
* controls loading of all images, including those embedded using the data
1161+
* URI scheme. Use {@link #setBlockNetworkImage} to control loading only
1162+
* of images specified using network URI schemes. Note that if the value of this
1163+
* setting is changed from false to true, all images resources referenced
1164+
* by content currently displayed by the WebView are loaded automatically.
1165+
* @param flag Whether the WebView should load image resources.
11611166
*/
11621167
public synchronized void setLoadsImagesAutomatically(boolean flag) {
11631168
if (mLoadsImagesAutomatically != flag) {
@@ -1167,20 +1172,26 @@ public synchronized void setLoadsImagesAutomatically(boolean flag) {
11671172
}
11681173

11691174
/**
1170-
* Return true if the WebView will load image resources automatically.
1171-
* The default is true.
1172-
* @return True if the WebView loads images automatically.
1175+
* Returns true if the WebView loads image resources. This includes
1176+
* images embedded using the data URI scheme. The default is true.
1177+
* @return True if the WebView loads image resources.
11731178
*/
11741179
public synchronized boolean getLoadsImagesAutomatically() {
11751180
return mLoadsImagesAutomatically;
11761181
}
11771182

11781183
/**
1179-
* Tell the WebView to block network images. This is only checked when
1180-
* {@link #getLoadsImagesAutomatically} is true. If you set the value to
1181-
* false, images will automatically be loaded. Use this api to reduce
1182-
* bandwidth only. Use {@link #setBlockNetworkLoads} if possible.
1183-
* @param flag True if the WebView should block network images.
1184+
* Sets whether the WebView should not load image resources from the
1185+
* network (resources accessed via http and https URI schemes). Note
1186+
* that this method has no effect unless
1187+
* {@link #getLoadsImagesAutomatically} returns true. Also note that
1188+
* disabling all network loads using {@link #setBlockNetworkLoads}
1189+
* will also prevent network images from loading, even if this flag is set
1190+
* to false. When the value of this setting is changed from true to false,
1191+
* network images resources referenced by content currently displayed by
1192+
* the WebView are fetched automatically.
1193+
* @param flag Whether the WebView should not load image resources from
1194+
* the network.
11841195
* @see #setBlockNetworkLoads
11851196
*/
11861197
public synchronized void setBlockNetworkImage(boolean flag) {
@@ -1191,20 +1202,27 @@ public synchronized void setBlockNetworkImage(boolean flag) {
11911202
}
11921203

11931204
/**
1194-
* Return true if the WebView will block network images. The default is
1195-
* false.
1196-
* @return True if the WebView blocks network images.
1205+
* Returns true if the WebView does not load image resources from the network.
1206+
* The default is false.
1207+
* @return True if the WebView does not load image resources from the network.
11971208
*/
11981209
public synchronized boolean getBlockNetworkImage() {
11991210
return mBlockNetworkImage;
12001211
}
12011212

12021213
/**
1203-
* Tell the WebView to block all network load requests. If you set the
1204-
* value to false, you must call {@link android.webkit.WebView#reload} to
1205-
* fetch remote resources. This flag supercedes the value passed to
1206-
* {@link #setBlockNetworkImage}.
1207-
* @param flag True if the WebView should block all network loads.
1214+
* Sets whether the WebView should not load resources from the network.
1215+
* Use {@link #setBlockNetworkImage} to only avoid loading
1216+
* image resources. Note that if the value of this setting is
1217+
* changed from true to false, network resources referenced by content
1218+
* currently displayed by the WebView are not fetched until
1219+
* {@link android.webkit.WebView#reload} is called.
1220+
* If the application does not have the
1221+
* {@link android.Manifest.permission#INTERNET} permission, attempts to set
1222+
* a value of false will cause a {@link java.lang.SecurityException}
1223+
* to be thrown.
1224+
* @param flag Whether the WebView should not load any resources
1225+
* from the network.
12081226
* @see android.webkit.WebView#reload
12091227
*/
12101228
public synchronized void setBlockNetworkLoads(boolean flag) {
@@ -1216,9 +1234,11 @@ public synchronized void setBlockNetworkLoads(boolean flag) {
12161234
}
12171235

12181236
/**
1219-
* Return true if the WebView will block all network loads. The default is
1220-
* false.
1221-
* @return True if the WebView blocks all network loads.
1237+
* Returns true if the WebView does not load any resources from the network.
1238+
* The default value is false if the application has the
1239+
* {@link android.Manifest.permission#INTERNET} permission, otherwise it is
1240+
* true.
1241+
* @return True if the WebView does not load any resources from the network.
12221242
*/
12231243
public synchronized boolean getBlockNetworkLoads() {
12241244
return mBlockNetworkLoads;

0 commit comments

Comments
 (0)