Methods Summary |
---|
synchronized java.lang.String | getAcceptLanguage()
synchronized(sLockForLocaleSettings) {
Locale currentLocale = Locale.getDefault();
if (!sLocale.equals(currentLocale)) {
sLocale = currentLocale;
mAcceptLanguage = getCurrentAcceptLanguage();
}
}
return mAcceptLanguage;
|
public boolean | getAllowFileAccess()Returns true if this WebView supports file access.
return mAllowFileAccess;
|
public synchronized boolean | getBlockNetworkImage()Return true if the WebView will block network image.
return mBlockNetworkImage;
|
public synchronized boolean | getBlockNetworkLoads()
return mBlockNetworkLoads;
|
public boolean | getBuiltInZoomControls()Returns true if the zoom mechanism built into WebView is being used.
return mBuiltInZoomControls;
|
public int | getCacheMode()Return the current setting for overriding the cache mode. For a full
description, see the {@link #setCacheMode(int)} function.
return mOverrideCacheMode;
|
private java.lang.String | getCurrentAcceptLanguage()Looks at sLocale and returns current AcceptLanguage String.
Locale locale;
synchronized(sLockForLocaleSettings) {
locale = sLocale;
}
StringBuffer buffer = new StringBuffer();
final String language = locale.getLanguage();
if (language != null) {
buffer.append(language);
final String country = locale.getCountry();
if (country != null) {
buffer.append("-");
buffer.append(country);
}
}
if (!locale.equals(Locale.US)) {
buffer.append(", ");
java.util.Locale us = Locale.US;
if (us.getLanguage() != null) {
buffer.append(us.getLanguage());
final String country = us.getCountry();
if (country != null) {
buffer.append("-");
buffer.append(country);
}
}
}
return buffer.toString();
|
private synchronized java.lang.String | getCurrentUserAgent()Looks at sLocale and mContext and returns current UserAgent String.
Locale locale;
synchronized(sLockForLocaleSettings) {
locale = sLocale;
}
StringBuffer buffer = new StringBuffer();
// Add version
final String version = Build.VERSION.RELEASE;
if (version.length() > 0) {
buffer.append(version);
} else {
// default to "1.0"
buffer.append("1.0");
}
buffer.append("; ");
final String language = locale.getLanguage();
if (language != null) {
buffer.append(language.toLowerCase());
final String country = locale.getCountry();
if (country != null) {
buffer.append("-");
buffer.append(country.toLowerCase());
}
} else {
// default to "en"
buffer.append("en");
}
final String model = Build.MODEL;
if (model.length() > 0) {
buffer.append("; ");
buffer.append(model);
}
final String id = Build.ID;
if (id.length() > 0) {
buffer.append(" Build/");
buffer.append(id);
}
final String base = mContext.getResources().getText(
com.android.internal.R.string.web_user_agent).toString();
return String.format(base, buffer);
|
public synchronized java.lang.String | getCursiveFontFamily()Get the cursive font family name.
return mCursiveFontFamily;
|
public synchronized int | getDefaultFixedFontSize()Get the default fixed font size.
return mDefaultFixedFontSize;
|
public synchronized int | getDefaultFontSize()Get the default font size.
return mDefaultFontSize;
|
public synchronized java.lang.String | getDefaultTextEncodingName()Get the default text encoding name.
return mDefaultTextEncoding;
|
public synchronized java.lang.String | getFantasyFontFamily()Get the fantasy font family name.
return mFantasyFontFamily;
|
public synchronized java.lang.String | getFixedFontFamily()Get the fixed font family name.
return mFixedFontFamily;
|
public synchronized boolean | getJavaScriptCanOpenWindowsAutomatically()Return true if javascript can open windows automatically.
return mJavaScriptCanOpenWindowsAutomatically;
|
public synchronized boolean | getJavaScriptEnabled()Return true if javascript is enabled.
return mJavaScriptEnabled;
|
public synchronized android.webkit.WebSettings$LayoutAlgorithm | getLayoutAlgorithm()Return the current layout algorithm.
return mLayoutAlgorithm;
|
public boolean | getLightTouchEnabled()Returns true if light touches are enabled.
return mLightTouchEnabled;
|
public synchronized boolean | getLoadsImagesAutomatically()Return true if the WebView will load image resources automatically.
return mLoadsImagesAutomatically;
|
public synchronized int | getMinimumFontSize()Get the minimum font size.
return mMinimumFontSize;
|
public synchronized int | getMinimumLogicalFontSize()Get the minimum logical font size.
return mMinimumLogicalFontSize;
|
public boolean | getNavDump()Returns true if dumping the navigation cache is enabled.
return mNavDump;
|
boolean | getNeedInitialFocus()
return mNeedInitialFocus;
|
public synchronized boolean | getPluginsEnabled()Return true if plugins are enabled.
return mPluginsEnabled;
|
public synchronized java.lang.String | getPluginsPath()Return the current path used for plugins in the WebView.
return mPluginsPath;
|
public synchronized java.lang.String | getSansSerifFontFamily()Get the sans-serif font family name.
return mSansSerifFontFamily;
|
public boolean | getSaveFormData()Return whether the WebView is saving form data.
return mSaveFormData;
|
public boolean | getSavePassword()Return whether the WebView is saving password.
return mSavePassword;
|
public synchronized java.lang.String | getSerifFontFamily()Get the serif font family name.
return mSerifFontFamily;
|
public synchronized java.lang.String | getStandardFontFamily()Get the standard font family name.
return mStandardFontFamily;
|
public synchronized android.webkit.WebSettings$TextSize | getTextSize()Get the text size of the page.
return mTextSize;
|
public synchronized boolean | getUseDoubleTree()Return true if the WebView is using the double tree rendering algorithm.
return mUseDoubleTree;
|
public synchronized boolean | getUseWideViewPort()
return mUseWideViewport;
|
public synchronized int | getUserAgent()Return user-agent as int
if (DESKTOP_USERAGENT.equals(mUserAgent)) {
return 1;
} else if (IPHONE_USERAGENT.equals(mUserAgent)) {
return 2;
} else if (mUseDefaultUserAgent) {
return 0;
}
return -1;
|
public synchronized java.lang.String | getUserAgentString()Return the WebView's user-agent string.
if (DESKTOP_USERAGENT.equals(mUserAgent) ||
IPHONE_USERAGENT.equals(mUserAgent) ||
!mUseDefaultUserAgent) {
return mUserAgent;
}
boolean doPostSync = false;
synchronized(sLockForLocaleSettings) {
Locale currentLocale = Locale.getDefault();
if (!sLocale.equals(currentLocale)) {
sLocale = currentLocale;
mUserAgent = getCurrentUserAgent();
mAcceptLanguage = getCurrentAcceptLanguage();
doPostSync = true;
}
}
if (doPostSync) {
postSync();
}
return mUserAgent;
|
private native void | nativeSync(int nativeFrame)
|
private int | pin(int size)
// FIXME: 72 is just an arbitrary max text size value.
if (size < 1) {
return 1;
} else if (size > 72) {
return 72;
}
return size;
|
private synchronized void | postSync()
// Only post if a sync is not pending
if (!mSyncPending) {
mSyncPending = mEventHandler.sendMessage(
Message.obtain(null, EventHandler.SYNC));
}
|
public void | setAllowFileAccess(boolean allow)Enable or disable file access within WebView. File access is enabled by
default.
mAllowFileAccess = allow;
|
public synchronized void | setBlockNetworkImage(boolean flag)Tell the WebView to block network image. This is only checked when
getLoadsImagesAutomatically() is true.
if (mBlockNetworkImage != flag) {
mBlockNetworkImage = flag;
postSync();
}
|
public synchronized void | setBlockNetworkLoads(boolean flag)
if (mBlockNetworkLoads != flag) {
mBlockNetworkLoads = flag;
verifyNetworkAccess();
}
|
public void | setBuiltInZoomControls(boolean enabled)Sets whether the zoom mechanism built into WebView is used.
mBuiltInZoomControls = enabled;
|
public void | setCacheMode(int mode)Override the way the cache is used. The way the cache is used is based
on the navigation option. For a normal page load, the cache is checked
and content is re-validated as needed. When navigating back, content is
not revalidated, instead the content is just pulled from the cache.
This function allows the client to override this behavior.
if (mode != mOverrideCacheMode) {
mOverrideCacheMode = mode;
}
|
public synchronized void | setCursiveFontFamily(java.lang.String font)Set the cursive font family name.
if (font != null && !font.equals(mCursiveFontFamily)) {
mCursiveFontFamily = font;
postSync();
}
|
public synchronized void | setDefaultFixedFontSize(int size)Set the default fixed font size.
size = pin(size);
if (mDefaultFixedFontSize != size) {
mDefaultFixedFontSize = size;
postSync();
}
|
public synchronized void | setDefaultFontSize(int size)Set the default font size.
size = pin(size);
if (mDefaultFontSize != size) {
mDefaultFontSize = size;
postSync();
}
|
public synchronized void | setDefaultTextEncodingName(java.lang.String encoding)Set the default text encoding name to use when decoding html pages.
if (encoding != null && !encoding.equals(mDefaultTextEncoding)) {
mDefaultTextEncoding = encoding;
postSync();
}
|
public synchronized void | setFantasyFontFamily(java.lang.String font)Set the fantasy font family name.
if (font != null && !font.equals(mFantasyFontFamily)) {
mFantasyFontFamily = font;
postSync();
}
|
public synchronized void | setFixedFontFamily(java.lang.String font)Set the fixed font family name.
if (font != null && !font.equals(mFixedFontFamily)) {
mFixedFontFamily = font;
postSync();
}
|
public synchronized void | setJavaScriptCanOpenWindowsAutomatically(boolean flag)Tell javascript to open windows automatically. This applies to the
javascript function window.open().
if (mJavaScriptCanOpenWindowsAutomatically != flag) {
mJavaScriptCanOpenWindowsAutomatically = flag;
postSync();
}
|
public synchronized void | setJavaScriptEnabled(boolean flag)Tell the WebView to enable javascript execution.
if (mJavaScriptEnabled != flag) {
mJavaScriptEnabled = flag;
postSync();
}
|
public synchronized void | setLayoutAlgorithm(android.webkit.WebSettings$LayoutAlgorithm l)Set the underlying layout algorithm. This will cause a relayout of the
WebView.
// XXX: This will only be affective if libwebcore was built with
// ANDROID_LAYOUT defined.
if (mLayoutAlgorithm != l) {
mLayoutAlgorithm = l;
postSync();
}
|
public void | setLightTouchEnabled(boolean enabled)Enables using light touches to make a selection and activate mouseovers.
mLightTouchEnabled = enabled;
|
public synchronized void | setLoadsImagesAutomatically(boolean flag)Tell the WebView to load image resources automatically.
if (mLoadsImagesAutomatically != flag) {
mLoadsImagesAutomatically = flag;
postSync();
}
|
public synchronized void | setMinimumFontSize(int size)Set the minimum font size.
size = pin(size);
if (mMinimumFontSize != size) {
mMinimumFontSize = size;
postSync();
}
|
public synchronized void | setMinimumLogicalFontSize(int size)Set the minimum logical font size.
size = pin(size);
if (mMinimumLogicalFontSize != size) {
mMinimumLogicalFontSize = size;
postSync();
}
|
public void | setNavDump(boolean enabled)Enables dumping the pages navigation cache to a text file.
mNavDump = enabled;
|
public void | setNeedInitialFocus(boolean flag)Tell the WebView whether it needs to set a node to have focus when
{@link WebView#requestFocus(int, android.graphics.Rect)} is called.
if (mNeedInitialFocus != flag) {
mNeedInitialFocus = flag;
}
|
public synchronized void | setPluginsEnabled(boolean flag)Tell the WebView to enable plugins.
if (mPluginsEnabled != flag) {
mPluginsEnabled = flag;
postSync();
}
|
public synchronized void | setPluginsPath(java.lang.String pluginsPath)Set a custom path to plugins used by the WebView. The client
must ensure it exists before this call.
if (pluginsPath != null && !pluginsPath.equals(mPluginsPath)) {
mPluginsPath = pluginsPath;
postSync();
}
|
public synchronized void | setRenderPriority(android.webkit.WebSettings$RenderPriority priority)Set the priority of the Render thread. Unlike the other settings, this
one only needs to be called once per process.
if (mRenderPriority != priority) {
mRenderPriority = priority;
mEventHandler.sendMessage(Message.obtain(null,
EventHandler.PRIORITY));
}
|
public synchronized void | setSansSerifFontFamily(java.lang.String font)Set the sans-serif font family name.
if (font != null && !font.equals(mSansSerifFontFamily)) {
mSansSerifFontFamily = font;
postSync();
}
|
public void | setSaveFormData(boolean save)Store whether the WebView is saving form data.
mSaveFormData = save;
|
public void | setSavePassword(boolean save)Store whether the WebView is saving password.
mSavePassword = save;
|
public synchronized void | setSerifFontFamily(java.lang.String font)Set the serif font family name.
if (font != null && !font.equals(mSerifFontFamily)) {
mSerifFontFamily = font;
postSync();
}
|
public void | setShrinksStandaloneImagesToFit(boolean shrink)If set, webkit alternately shrinks and expands images viewed outside
of an HTML page to fit the screen. This conflicts with attempts by
the UI to zoom in and out of an image, so it is set false by default.
if (mShrinksStandaloneImagesToFit != shrink) {
mShrinksStandaloneImagesToFit = shrink;
postSync();
}
|
public synchronized void | setStandardFontFamily(java.lang.String font)Set the standard font family name.
if (font != null && !font.equals(mStandardFontFamily)) {
mStandardFontFamily = font;
postSync();
}
|
public synchronized void | setSupportMultipleWindows(boolean support)Tell the WebView whether it supports multiple windows. TRUE means
that {@link WebChromeClient#onCreateWindow(WebView, boolean,
boolean, Message)} is implemented by the host application.
if (mSupportMultipleWindows != support) {
mSupportMultipleWindows = support;
postSync();
}
|
public void | setSupportZoom(boolean support)Set whether the WebView supports zoom
mSupportZoom = support;
|
public synchronized void | setTextSize(android.webkit.WebSettings$TextSize t)Set the text size of the page.
if (WebView.mLogEvent && mTextSize != t ) {
Checkin.updateStats(mContext.getContentResolver(),
Checkin.Stats.Tag.BROWSER_TEXT_SIZE_CHANGE, 1, 0.0);
}
mTextSize = t;
postSync();
|
public synchronized void | setUseDoubleTree(boolean use)Tell the WebView to use the double tree rendering algorithm.
if (mUseDoubleTree != use) {
mUseDoubleTree = use;
postSync();
}
|
public synchronized void | setUseWideViewPort(boolean use)Tell the WebView to use the wide viewport
if (mUseWideViewport != use) {
mUseWideViewport = use;
postSync();
}
|
public synchronized void | setUserAgent(int ua)Tell the WebView about user-agent string.
String uaString = null;
if (ua == 1) {
if (DESKTOP_USERAGENT.equals(mUserAgent)) {
return; // do nothing
} else {
uaString = DESKTOP_USERAGENT;
}
} else if (ua == 2) {
if (IPHONE_USERAGENT.equals(mUserAgent)) {
return; // do nothing
} else {
uaString = IPHONE_USERAGENT;
}
} else if (ua != 0) {
return; // do nothing
}
setUserAgentString(uaString);
|
public synchronized void | setUserAgentString(java.lang.String ua)Set the WebView's user-agent string. If the string "ua" is null or empty,
it will use the system default user-agent string.
if (ua == null || ua.length() == 0) {
synchronized(sLockForLocaleSettings) {
Locale currentLocale = Locale.getDefault();
if (!sLocale.equals(currentLocale)) {
sLocale = currentLocale;
mAcceptLanguage = getCurrentAcceptLanguage();
}
}
ua = getCurrentUserAgent();
mUseDefaultUserAgent = true;
} else {
mUseDefaultUserAgent = false;
}
if (!ua.equals(mUserAgent)) {
mUserAgent = ua;
postSync();
}
|
public synchronized boolean | supportMultipleWindows()
return mSupportMultipleWindows;
|
public boolean | supportZoom()Returns whether the WebView supports zoom
return mSupportZoom;
|
synchronized void | syncSettingsAndCreateHandler(BrowserFrame frame)Transfer messages from the queue to the new WebCoreThread. Called from
WebCore thread.
mBrowserFrame = frame;
if (android.util.Config.DEBUG) {
junit.framework.Assert.assertTrue(frame.mNativeFrame != 0);
}
nativeSync(frame.mNativeFrame);
mSyncPending = false;
mEventHandler.createHandler();
|
private void | verifyNetworkAccess()
if (!mBlockNetworkLoads) {
if (mContext.checkPermission("android.permission.INTERNET",
android.os.Process.myPid(), android.os.Process.myUid()) !=
PackageManager.PERMISSION_GRANTED) {
throw new SecurityException
("Permission denied - " +
"application missing INTERNET permission");
}
}
|