summaryrefslogtreecommitdiffstats
path: root/core/java/android/webkit/WebSettings.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/webkit/WebSettings.java')
-rw-r--r--core/java/android/webkit/WebSettings.java1127
1 files changed, 119 insertions, 1008 deletions
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index c463b40..cddd7ab 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -16,16 +16,7 @@
package android.webkit;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.content.pm.PackageManager;
-import android.os.Build;
-import android.os.Handler;
import android.os.Message;
-import android.util.DisplayMetrics;
-import android.util.EventLog;
-
-import java.util.Locale;
/**
* Manages settings state for a WebView. When a WebView is first created, it
@@ -35,7 +26,18 @@ import java.util.Locale;
* been destroyed, any method call on WebSettings will throw an
* IllegalStateException.
*/
+// 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 {
+ // TODO: Remove MustOverrideException and make all methods throwing it abstract instead;
+ // needs API file update.
+ private static class MustOverrideException extends RuntimeException {
+ MustOverrideException() {
+ super("abstract function called: must be overriden!");
+ }
+ }
+
/**
* Enum for controlling the layout of html.
* NORMAL means no rendering changes.
@@ -141,379 +143,12 @@ public class WebSettings {
OFF
}
- // TODO: Keep this up to date
- private static final String PREVIOUS_VERSION = "4.0.3";
-
- // WebView associated with this WebSettings.
- private WebView mWebView;
- // BrowserFrame used to access the native frame pointer.
- private BrowserFrame mBrowserFrame;
- // Flag to prevent multiple SYNC messages at one time.
- private boolean mSyncPending = false;
- // Custom handler that queues messages until the WebCore thread is active.
- private final EventHandler mEventHandler;
-
- // Private settings so we don't have to go into native code to
- // retrieve the values. After setXXX, postSync() needs to be called.
- //
- // The default values need to match those in WebSettings.cpp
- // If the defaults change, please also update the JavaDocs so developers
- // know what they are.
- private LayoutAlgorithm mLayoutAlgorithm = LayoutAlgorithm.NARROW_COLUMNS;
- private Context mContext;
- private int mTextSize = 100;
- private String mStandardFontFamily = "sans-serif";
- private String mFixedFontFamily = "monospace";
- private String mSansSerifFontFamily = "sans-serif";
- private String mSerifFontFamily = "serif";
- private String mCursiveFontFamily = "cursive";
- private String mFantasyFontFamily = "fantasy";
- private String mDefaultTextEncoding;
- private String mUserAgent;
- private boolean mUseDefaultUserAgent;
- private String mAcceptLanguage;
- private int mMinimumFontSize = 8;
- private int mMinimumLogicalFontSize = 8;
- private int mDefaultFontSize = 16;
- private int mDefaultFixedFontSize = 13;
- private int mPageCacheCapacity = 0;
- private boolean mLoadsImagesAutomatically = true;
- private boolean mBlockNetworkImage = false;
- private boolean mBlockNetworkLoads;
- private boolean mJavaScriptEnabled = false;
- private boolean mHardwareAccelSkia = false;
- private boolean mShowVisualIndicator = false;
- private PluginState mPluginState = PluginState.OFF;
- private boolean mJavaScriptCanOpenWindowsAutomatically = false;
- private boolean mUseDoubleTree = false;
- private boolean mUseWideViewport = false;
- private boolean mSupportMultipleWindows = false;
- private boolean mShrinksStandaloneImagesToFit = false;
- private long mMaximumDecodedImageSize = 0; // 0 means default
- private boolean mPrivateBrowsingEnabled = false;
- private boolean mSyntheticLinksEnabled = true;
- // HTML5 API flags
- private boolean mAppCacheEnabled = false;
- private boolean mDatabaseEnabled = false;
- private boolean mDomStorageEnabled = false;
- private boolean mWorkersEnabled = false; // only affects V8.
- private boolean mGeolocationEnabled = true;
- private boolean mXSSAuditorEnabled = false;
- // HTML5 configuration parameters
- private long mAppCacheMaxSize = Long.MAX_VALUE;
- private String mAppCachePath = null;
- private String mDatabasePath = "";
- // The WebCore DatabaseTracker only allows the database path to be set
- // once. Keep track of when the path has been set.
- private boolean mDatabasePathHasBeenSet = false;
- private String mGeolocationDatabasePath = "";
- // Don't need to synchronize the get/set methods as they
- // are basic types, also none of these values are used in
- // native WebCore code.
- private ZoomDensity mDefaultZoom = ZoomDensity.MEDIUM;
- private RenderPriority mRenderPriority = RenderPriority.NORMAL;
- private int mOverrideCacheMode = LOAD_DEFAULT;
- private int mDoubleTapZoom = 100;
- private boolean mSaveFormData = true;
- private boolean mAutoFillEnabled = false;
- private boolean mSavePassword = true;
- private boolean mLightTouchEnabled = false;
- private boolean mNeedInitialFocus = true;
- private boolean mNavDump = false;
- private boolean mSupportZoom = true;
- private boolean mBuiltInZoomControls = false;
- private boolean mDisplayZoomControls = true;
- private boolean mAllowFileAccess = true;
- private boolean mAllowContentAccess = true;
- private boolean mLoadWithOverviewMode = false;
- private boolean mEnableSmoothTransition = false;
- private boolean mForceUserScalable = false;
-
- // AutoFill Profile data
- /**
- * @hide for now, pending API council approval.
- */
- public static class AutoFillProfile {
- private int mUniqueId;
- private String mFullName;
- private String mEmailAddress;
- private String mCompanyName;
- private String mAddressLine1;
- private String mAddressLine2;
- private String mCity;
- private String mState;
- private String mZipCode;
- private String mCountry;
- private String mPhoneNumber;
-
- public AutoFillProfile(int uniqueId, String fullName, String email,
- String companyName, String addressLine1, String addressLine2,
- String city, String state, String zipCode, String country,
- String phoneNumber) {
- mUniqueId = uniqueId;
- mFullName = fullName;
- mEmailAddress = email;
- mCompanyName = companyName;
- mAddressLine1 = addressLine1;
- mAddressLine2 = addressLine2;
- mCity = city;
- mState = state;
- mZipCode = zipCode;
- mCountry = country;
- mPhoneNumber = phoneNumber;
- }
-
- public int getUniqueId() { return mUniqueId; }
- public String getFullName() { return mFullName; }
- public String getEmailAddress() { return mEmailAddress; }
- public String getCompanyName() { return mCompanyName; }
- public String getAddressLine1() { return mAddressLine1; }
- public String getAddressLine2() { return mAddressLine2; }
- public String getCity() { return mCity; }
- public String getState() { return mState; }
- public String getZipCode() { return mZipCode; }
- public String getCountry() { return mCountry; }
- public String getPhoneNumber() { return mPhoneNumber; }
- }
-
-
- private AutoFillProfile mAutoFillProfile;
-
- private boolean mUseWebViewBackgroundForOverscroll = true;
-
- // private WebSettings, not accessible by the host activity
- static private int mDoubleTapToastCount = 3;
-
- private static final String PREF_FILE = "WebViewSettings";
- private static final String DOUBLE_TAP_TOAST_COUNT = "double_tap_toast_count";
-
- // Class to handle messages before WebCore is ready.
- private class EventHandler {
- // Message id for syncing
- static final int SYNC = 0;
- // Message id for setting priority
- static final int PRIORITY = 1;
- // Message id for writing double-tap toast count
- static final int SET_DOUBLE_TAP_TOAST_COUNT = 2;
- // Actual WebCore thread handler
- private Handler mHandler;
-
- private synchronized void createHandler() {
- // as mRenderPriority can be set before thread is running, sync up
- setRenderPriority();
-
- // create a new handler
- mHandler = new Handler() {
- @Override
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case SYNC:
- synchronized (WebSettings.this) {
- if (mBrowserFrame.mNativeFrame != 0) {
- nativeSync(mBrowserFrame.mNativeFrame);
- }
- mSyncPending = false;
- }
- break;
-
- case PRIORITY: {
- setRenderPriority();
- break;
- }
-
- case SET_DOUBLE_TAP_TOAST_COUNT: {
- SharedPreferences.Editor editor = mContext
- .getSharedPreferences(PREF_FILE,
- Context.MODE_PRIVATE).edit();
- editor.putInt(DOUBLE_TAP_TOAST_COUNT,
- mDoubleTapToastCount);
- editor.commit();
- break;
- }
- }
- }
- };
- }
-
- private void setRenderPriority() {
- synchronized (WebSettings.this) {
- if (mRenderPriority == RenderPriority.NORMAL) {
- android.os.Process.setThreadPriority(
- android.os.Process.THREAD_PRIORITY_DEFAULT);
- } else if (mRenderPriority == RenderPriority.HIGH) {
- android.os.Process.setThreadPriority(
- android.os.Process.THREAD_PRIORITY_FOREGROUND +
- android.os.Process.THREAD_PRIORITY_LESS_FAVORABLE);
- } else if (mRenderPriority == RenderPriority.LOW) {
- android.os.Process.setThreadPriority(
- android.os.Process.THREAD_PRIORITY_BACKGROUND);
- }
- }
- }
-
- /**
- * Send a message to the private queue or handler.
- */
- private synchronized boolean sendMessage(Message msg) {
- if (mHandler != null) {
- mHandler.sendMessage(msg);
- return true;
- } else {
- return false;
- }
- }
- }
-
- // User agent strings.
- private static final String DESKTOP_USERAGENT = "Mozilla/5.0 (X11; " +
- "Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) " +
- "Chrome/11.0.696.34 Safari/534.24";
- private static final String IPHONE_USERAGENT =
- "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us)"
- + " AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0"
- + " Mobile/7A341 Safari/528.16";
- private static Locale sLocale;
- private static Object sLockForLocaleSettings;
-
- /**
- * Package constructor to prevent clients from creating a new settings
- * instance.
- */
- WebSettings(Context context, WebView webview) {
- mEventHandler = new EventHandler();
- mContext = context;
- mWebView = webview;
- mDefaultTextEncoding = context.getString(com.android.internal.
- R.string.default_text_encoding);
-
- if (sLockForLocaleSettings == null) {
- sLockForLocaleSettings = new Object();
- sLocale = Locale.getDefault();
- }
- mAcceptLanguage = getCurrentAcceptLanguage();
- mUserAgent = getCurrentUserAgent();
- mUseDefaultUserAgent = true;
-
- mBlockNetworkLoads = mContext.checkPermission(
- "android.permission.INTERNET", android.os.Process.myPid(),
- android.os.Process.myUid()) != PackageManager.PERMISSION_GRANTED;
- }
-
- private static final String ACCEPT_LANG_FOR_US_LOCALE = "en-US";
-
- /**
- * Looks at sLocale and returns current AcceptLanguage String.
- * @return Current AcceptLanguage String.
- */
- private String getCurrentAcceptLanguage() {
- Locale locale;
- synchronized(sLockForLocaleSettings) {
- locale = sLocale;
- }
- StringBuilder buffer = new StringBuilder();
- addLocaleToHttpAcceptLanguage(buffer, locale);
-
- if (!Locale.US.equals(locale)) {
- if (buffer.length() > 0) {
- buffer.append(", ");
- }
- buffer.append(ACCEPT_LANG_FOR_US_LOCALE);
- }
-
- return buffer.toString();
- }
-
/**
- * Convert obsolete language codes, including Hebrew/Indonesian/Yiddish,
- * to new standard.
+ * Hidden constructor to prevent clients from creating a new settings
+ * instance or deriving the class.
+ * @hide
*/
- private static String convertObsoleteLanguageCodeToNew(String langCode) {
- if (langCode == null) {
- return null;
- }
- if ("iw".equals(langCode)) {
- // Hebrew
- return "he";
- } else if ("in".equals(langCode)) {
- // Indonesian
- return "id";
- } else if ("ji".equals(langCode)) {
- // Yiddish
- return "yi";
- }
- return langCode;
- }
-
- private static void addLocaleToHttpAcceptLanguage(StringBuilder builder,
- Locale locale) {
- String language = convertObsoleteLanguageCodeToNew(locale.getLanguage());
- if (language != null) {
- builder.append(language);
- String country = locale.getCountry();
- if (country != null) {
- builder.append("-");
- builder.append(country);
- }
- }
- }
-
- /**
- * Looks at sLocale and mContext and returns current UserAgent String.
- * @return Current UserAgent String.
- */
- private synchronized String getCurrentUserAgent() {
- Locale locale;
- synchronized(sLockForLocaleSettings) {
- locale = sLocale;
- }
- StringBuffer buffer = new StringBuffer();
- // Add version
- final String version = Build.VERSION.RELEASE;
- if (version.length() > 0) {
- if (Character.isDigit(version.charAt(0))) {
- // Release is a version, eg "3.1"
- buffer.append(version);
- } else {
- // Release is a codename, eg "Honeycomb"
- // In this case, use the previous release's version
- buffer.append(PREVIOUS_VERSION);
- }
- } else {
- // default to "1.0"
- buffer.append("1.0");
- }
- buffer.append("; ");
- final String language = locale.getLanguage();
- if (language != null) {
- buffer.append(convertObsoleteLanguageCodeToNew(language));
- final String country = locale.getCountry();
- if (country != null) {
- buffer.append("-");
- buffer.append(country.toLowerCase());
- }
- } else {
- // default to "en"
- buffer.append("en");
- }
- buffer.append(";");
- // add the model for the release build
- if ("REL".equals(Build.VERSION.CODENAME)) {
- 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);
- }
- String mobile = mContext.getResources().getText(
- com.android.internal.R.string.web_user_agent_target_content).toString();
- final String base = mContext.getResources().getText(
- com.android.internal.R.string.web_user_agent).toString();
- return String.format(base, buffer, mobile);
+ protected WebSettings() {
}
/**
@@ -522,7 +157,7 @@ public class WebSettings {
*/
@Deprecated
public void setNavDump(boolean enabled) {
- mNavDump = enabled;
+ throw new MustOverrideException();
}
/**
@@ -531,37 +166,35 @@ public class WebSettings {
*/
@Deprecated
public boolean getNavDump() {
- return mNavDump;
+ throw new MustOverrideException();
}
/**
* Set whether the WebView supports zoom
*/
public void setSupportZoom(boolean support) {
- mSupportZoom = support;
- mWebView.updateMultiTouchSupport(mContext);
+ throw new MustOverrideException();
}
/**
* Returns whether the WebView supports zoom
*/
public boolean supportZoom() {
- return mSupportZoom;
+ throw new MustOverrideException();
}
/**
* Sets whether the zoom mechanism built into WebView is used.
*/
public void setBuiltInZoomControls(boolean enabled) {
- mBuiltInZoomControls = enabled;
- mWebView.updateMultiTouchSupport(mContext);
+ throw new MustOverrideException();
}
/**
* Returns true if the zoom mechanism built into WebView is being used.
*/
public boolean getBuiltInZoomControls() {
- return mBuiltInZoomControls;
+ throw new MustOverrideException();
}
/**
@@ -571,15 +204,14 @@ public class WebSettings {
* to work without the on screen controls
*/
public void setDisplayZoomControls(boolean enabled) {
- mDisplayZoomControls = enabled;
- mWebView.updateMultiTouchSupport(mContext);
+ throw new MustOverrideException();
}
/**
* Returns true if the on screen zoom buttons are being used.
*/
public boolean getDisplayZoomControls() {
- return mDisplayZoomControls;
+ throw new MustOverrideException();
}
/**
@@ -589,14 +221,14 @@ public class WebSettings {
* file:///android_res.
*/
public void setAllowFileAccess(boolean allow) {
- mAllowFileAccess = allow;
+ throw new MustOverrideException();
}
/**
* Returns true if this WebView supports file access.
*/
public boolean getAllowFileAccess() {
- return mAllowFileAccess;
+ throw new MustOverrideException();
}
/**
@@ -605,28 +237,28 @@ public class WebSettings {
* system. The default is enabled.
*/
public void setAllowContentAccess(boolean allow) {
- mAllowContentAccess = allow;
+ throw new MustOverrideException();
}
/**
* Returns true if this WebView supports content url access.
*/
public boolean getAllowContentAccess() {
- return mAllowContentAccess;
+ throw new MustOverrideException();
}
/**
* Set whether the WebView loads a page with overview mode.
*/
public void setLoadWithOverviewMode(boolean overview) {
- mLoadWithOverviewMode = overview;
+ throw new MustOverrideException();
}
/**
* Returns true if this WebView loads page with overview mode
*/
public boolean getLoadWithOverviewMode() {
- return mLoadWithOverviewMode;
+ throw new MustOverrideException();
}
/**
@@ -637,15 +269,14 @@ public class WebSettings {
* If it is false, WebView will keep its fidelity. The default value is false.
*/
public void setEnableSmoothTransition(boolean enable) {
- mEnableSmoothTransition = enable;
+ throw new MustOverrideException();
}
-
/**
* Returns true if the WebView enables smooth transition while panning or
* zooming.
*/
public boolean enableSmoothTransition() {
- return mEnableSmoothTransition;
+ throw new MustOverrideException();
}
/**
@@ -656,7 +287,7 @@ public class WebSettings {
*/
@Deprecated
public void setUseWebViewBackgroundForOverscrollBackground(boolean view) {
- mUseWebViewBackgroundForOverscroll = view;
+ throw new MustOverrideException();
}
/**
@@ -666,14 +297,14 @@ public class WebSettings {
*/
@Deprecated
public boolean getUseWebViewBackgroundForOverscrollBackground() {
- return mUseWebViewBackgroundForOverscroll;
+ throw new MustOverrideException();
}
/**
* Store whether the WebView is saving form data.
*/
public void setSaveFormData(boolean save) {
- mSaveFormData = save;
+ throw new MustOverrideException();
}
/**
@@ -681,21 +312,21 @@ public class WebSettings {
* entries/autofill++. Always false in private browsing mode.
*/
public boolean getSaveFormData() {
- return mSaveFormData && !mPrivateBrowsingEnabled;
+ throw new MustOverrideException();
}
/**
* Store whether the WebView is saving password.
*/
public void setSavePassword(boolean save) {
- mSavePassword = save;
+ throw new MustOverrideException();
}
/**
* Return whether the WebView is saving password.
*/
public boolean getSavePassword() {
- return mSavePassword;
+ throw new MustOverrideException();
}
/**
@@ -703,14 +334,7 @@ public class WebSettings {
* @param textZoom A percent value for increasing or decreasing the text.
*/
public synchronized void setTextZoom(int textZoom) {
- if (mTextSize != textZoom) {
- if (WebView.mLogEvent) {
- EventLog.writeEvent(EventLogTags.BROWSER_TEXT_SIZE_CHANGE,
- mTextSize, textZoom);
- }
- mTextSize = textZoom;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -719,7 +343,7 @@ public class WebSettings {
* @see setTextSizeZoom
*/
public synchronized int getTextZoom() {
- return mTextSize;
+ throw new MustOverrideException();
}
/**
@@ -729,7 +353,7 @@ public class WebSettings {
* @deprecated Use {@link #setTextZoom(int)} instead
*/
public synchronized void setTextSize(TextSize t) {
- setTextZoom(t.value);
+ throw new MustOverrideException();
}
/**
@@ -741,40 +365,7 @@ public class WebSettings {
* @deprecated Use {@link #getTextZoom()} instead
*/
public synchronized TextSize getTextSize() {
- TextSize closestSize = null;
- int smallestDelta = Integer.MAX_VALUE;
- for (TextSize size : TextSize.values()) {
- int delta = Math.abs(mTextSize - size.value);
- if (delta == 0) {
- return size;
- }
- if (delta < smallestDelta) {
- smallestDelta = delta;
- closestSize = size;
- }
- }
- return closestSize != null ? closestSize : TextSize.NORMAL;
- }
-
- /**
- * Set the double-tap zoom of the page in percent. Default is 100.
- * @param doubleTapZoom A percent value for increasing or decreasing the double-tap zoom.
- * @hide
- */
- public void setDoubleTapZoom(int doubleTapZoom) {
- if (mDoubleTapZoom != doubleTapZoom) {
- mDoubleTapZoom = doubleTapZoom;
- mWebView.updateDoubleTapZoom(doubleTapZoom);
- }
- }
-
- /**
- * Get the double-tap zoom of the page in percent.
- * @return A percent value describing the double-tap zoom.
- * @hide
- */
- public int getDoubleTapZoom() {
- return mDoubleTapZoom;
+ throw new MustOverrideException();
}
/**
@@ -784,10 +375,7 @@ public class WebSettings {
* @see WebSettings.ZoomDensity
*/
public void setDefaultZoom(ZoomDensity zoom) {
- if (mDefaultZoom != zoom) {
- mDefaultZoom = zoom;
- mWebView.adjustDefaultZoomDensity(zoom.value);
- }
+ throw new MustOverrideException();
}
/**
@@ -797,21 +385,21 @@ public class WebSettings {
* @see WebSettings.ZoomDensity
*/
public ZoomDensity getDefaultZoom() {
- return mDefaultZoom;
+ throw new MustOverrideException();
}
/**
* Enables using light touches to make a selection and activate mouseovers.
*/
public void setLightTouchEnabled(boolean enabled) {
- mLightTouchEnabled = enabled;
+ throw new MustOverrideException();
}
/**
* Returns true if light touches are enabled.
*/
public boolean getLightTouchEnabled() {
- return mLightTouchEnabled;
+ throw new MustOverrideException();
}
/**
@@ -820,7 +408,7 @@ public class WebSettings {
*/
@Deprecated
public synchronized void setUseDoubleTree(boolean use) {
- return;
+ // Specified to do nothing, so no need for derived classes to override.
}
/**
@@ -829,6 +417,7 @@ public class WebSettings {
*/
@Deprecated
public synchronized boolean getUseDoubleTree() {
+ // Returns false unconditionally, so no need for derived classes to override.
return false;
}
@@ -841,23 +430,7 @@ public class WebSettings {
*/
@Deprecated
public synchronized void setUserAgent(int ua) {
- 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);
+ throw new MustOverrideException();
}
/**
@@ -870,31 +443,21 @@ public class WebSettings {
*/
@Deprecated
public synchronized int getUserAgent() {
- if (DESKTOP_USERAGENT.equals(mUserAgent)) {
- return 1;
- } else if (IPHONE_USERAGENT.equals(mUserAgent)) {
- return 2;
- } else if (mUseDefaultUserAgent) {
- return 0;
- }
- return -1;
+ throw new MustOverrideException();
}
/**
* Tell the WebView to use the wide viewport
*/
public synchronized void setUseWideViewPort(boolean use) {
- if (mUseWideViewport != use) {
- mUseWideViewport = use;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
* @return True if the WebView is using a wide viewport
*/
public synchronized boolean getUseWideViewPort() {
- return mUseWideViewport;
+ throw new MustOverrideException();
}
/**
@@ -903,10 +466,7 @@ public class WebSettings {
* boolean, Message)} is implemented by the host application.
*/
public synchronized void setSupportMultipleWindows(boolean support) {
- if (mSupportMultipleWindows != support) {
- mSupportMultipleWindows = support;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -915,7 +475,7 @@ public class WebSettings {
* boolean, Message)} is implemented by the host application.
*/
public synchronized boolean supportMultipleWindows() {
- return mSupportMultipleWindows;
+ throw new MustOverrideException();
}
/**
@@ -925,12 +485,7 @@ public class WebSettings {
* @see WebSettings.LayoutAlgorithm
*/
public synchronized void setLayoutAlgorithm(LayoutAlgorithm l) {
- // XXX: This will only be affective if libwebcore was built with
- // ANDROID_LAYOUT defined.
- if (mLayoutAlgorithm != l) {
- mLayoutAlgorithm = l;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -940,7 +495,7 @@ public class WebSettings {
* @see WebSettings.LayoutAlgorithm
*/
public synchronized LayoutAlgorithm getLayoutAlgorithm() {
- return mLayoutAlgorithm;
+ throw new MustOverrideException();
}
/**
@@ -948,10 +503,7 @@ public class WebSettings {
* @param font A font family name.
*/
public synchronized void setStandardFontFamily(String font) {
- if (font != null && !font.equals(mStandardFontFamily)) {
- mStandardFontFamily = font;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -959,7 +511,7 @@ public class WebSettings {
* @return The standard font family name as a string.
*/
public synchronized String getStandardFontFamily() {
- return mStandardFontFamily;
+ throw new MustOverrideException();
}
/**
@@ -967,10 +519,7 @@ public class WebSettings {
* @param font A font family name.
*/
public synchronized void setFixedFontFamily(String font) {
- if (font != null && !font.equals(mFixedFontFamily)) {
- mFixedFontFamily = font;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -978,7 +527,7 @@ public class WebSettings {
* @return The fixed font family name as a string.
*/
public synchronized String getFixedFontFamily() {
- return mFixedFontFamily;
+ throw new MustOverrideException();
}
/**
@@ -986,10 +535,7 @@ public class WebSettings {
* @param font A font family name.
*/
public synchronized void setSansSerifFontFamily(String font) {
- if (font != null && !font.equals(mSansSerifFontFamily)) {
- mSansSerifFontFamily = font;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -997,7 +543,7 @@ public class WebSettings {
* @return The sans-serif font family name as a string.
*/
public synchronized String getSansSerifFontFamily() {
- return mSansSerifFontFamily;
+ throw new MustOverrideException();
}
/**
@@ -1005,10 +551,7 @@ public class WebSettings {
* @param font A font family name.
*/
public synchronized void setSerifFontFamily(String font) {
- if (font != null && !font.equals(mSerifFontFamily)) {
- mSerifFontFamily = font;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1016,7 +559,7 @@ public class WebSettings {
* @return The serif font family name as a string.
*/
public synchronized String getSerifFontFamily() {
- return mSerifFontFamily;
+ throw new MustOverrideException();
}
/**
@@ -1024,10 +567,7 @@ public class WebSettings {
* @param font A font family name.
*/
public synchronized void setCursiveFontFamily(String font) {
- if (font != null && !font.equals(mCursiveFontFamily)) {
- mCursiveFontFamily = font;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1035,7 +575,7 @@ public class WebSettings {
* @return The cursive font family name as a string.
*/
public synchronized String getCursiveFontFamily() {
- return mCursiveFontFamily;
+ throw new MustOverrideException();
}
/**
@@ -1043,10 +583,7 @@ public class WebSettings {
* @param font A font family name.
*/
public synchronized void setFantasyFontFamily(String font) {
- if (font != null && !font.equals(mFantasyFontFamily)) {
- mFantasyFontFamily = font;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1054,7 +591,7 @@ public class WebSettings {
* @return The fantasy font family name as a string.
*/
public synchronized String getFantasyFontFamily() {
- return mFantasyFontFamily;
+ throw new MustOverrideException();
}
/**
@@ -1063,11 +600,7 @@ public class WebSettings {
* Any number outside the specified range will be pinned.
*/
public synchronized void setMinimumFontSize(int size) {
- size = pin(size);
- if (mMinimumFontSize != size) {
- mMinimumFontSize = size;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1075,7 +608,7 @@ public class WebSettings {
* @return A non-negative integer between 1 and 72.
*/
public synchronized int getMinimumFontSize() {
- return mMinimumFontSize;
+ throw new MustOverrideException();
}
/**
@@ -1084,11 +617,7 @@ public class WebSettings {
* Any number outside the specified range will be pinned.
*/
public synchronized void setMinimumLogicalFontSize(int size) {
- size = pin(size);
- if (mMinimumLogicalFontSize != size) {
- mMinimumLogicalFontSize = size;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1096,7 +625,7 @@ public class WebSettings {
* @return A non-negative integer between 1 and 72.
*/
public synchronized int getMinimumLogicalFontSize() {
- return mMinimumLogicalFontSize;
+ throw new MustOverrideException();
}
/**
@@ -1105,11 +634,7 @@ public class WebSettings {
* Any number outside the specified range will be pinned.
*/
public synchronized void setDefaultFontSize(int size) {
- size = pin(size);
- if (mDefaultFontSize != size) {
- mDefaultFontSize = size;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1117,7 +642,7 @@ public class WebSettings {
* @return A non-negative integer between 1 and 72.
*/
public synchronized int getDefaultFontSize() {
- return mDefaultFontSize;
+ throw new MustOverrideException();
}
/**
@@ -1126,11 +651,7 @@ public class WebSettings {
* Any number outside the specified range will be pinned.
*/
public synchronized void setDefaultFixedFontSize(int size) {
- size = pin(size);
- if (mDefaultFixedFontSize != size) {
- mDefaultFixedFontSize = size;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1138,21 +659,7 @@ public class WebSettings {
* @return A non-negative integer between 1 and 72.
*/
public synchronized int getDefaultFixedFontSize() {
- return mDefaultFixedFontSize;
- }
-
- /**
- * Set the number of pages cached by the WebKit for the history navigation.
- * @param size A non-negative integer between 0 (no cache) and 20 (max).
- * @hide
- */
- public synchronized void setPageCacheCapacity(int size) {
- if (size < 0) size = 0;
- if (size > 20) size = 20;
- if (mPageCacheCapacity != size) {
- mPageCacheCapacity = size;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1165,10 +672,7 @@ public class WebSettings {
* @param flag Whether the WebView should load image resources.
*/
public synchronized void setLoadsImagesAutomatically(boolean flag) {
- if (mLoadsImagesAutomatically != flag) {
- mLoadsImagesAutomatically = flag;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1177,7 +681,7 @@ public class WebSettings {
* @return True if the WebView loads image resources.
*/
public synchronized boolean getLoadsImagesAutomatically() {
- return mLoadsImagesAutomatically;
+ throw new MustOverrideException();
}
/**
@@ -1195,10 +699,7 @@ public class WebSettings {
* @see #setBlockNetworkLoads
*/
public synchronized void setBlockNetworkImage(boolean flag) {
- if (mBlockNetworkImage != flag) {
- mBlockNetworkImage = flag;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1207,7 +708,7 @@ public class WebSettings {
* @return True if the WebView does not load image resources from the network.
*/
public synchronized boolean getBlockNetworkImage() {
- return mBlockNetworkImage;
+ throw new MustOverrideException();
}
/**
@@ -1226,11 +727,7 @@ public class WebSettings {
* @see android.webkit.WebView#reload
*/
public synchronized void setBlockNetworkLoads(boolean flag) {
- if (mBlockNetworkLoads != flag) {
- mBlockNetworkLoads = flag;
- verifyNetworkAccess();
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1241,20 +738,7 @@ public class WebSettings {
* @return True if the WebView does not load any resources from the network.
*/
public synchronized boolean getBlockNetworkLoads() {
- return mBlockNetworkLoads;
- }
-
-
- 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");
- }
- }
+ throw new MustOverrideException();
}
/**
@@ -1262,50 +746,7 @@ public class WebSettings {
* @param flag True if the WebView should execute javascript.
*/
public synchronized void setJavaScriptEnabled(boolean flag) {
- if (mJavaScriptEnabled != flag) {
- mJavaScriptEnabled = flag;
- postSync();
- }
- }
-
- /**
- * Tell the WebView to use Skia's hardware accelerated rendering path
- * @param flag True if the WebView should use Skia's hw-accel path
- * @hide
- */
- public synchronized void setHardwareAccelSkiaEnabled(boolean flag) {
- if (mHardwareAccelSkia != flag) {
- mHardwareAccelSkia = flag;
- postSync();
- }
- }
-
- /**
- * @return True if the WebView is using hardware accelerated skia
- * @hide
- */
- public synchronized boolean getHardwareAccelSkiaEnabled() {
- return mHardwareAccelSkia;
- }
-
- /**
- * Tell the WebView to show the visual indicator
- * @param flag True if the WebView should show the visual indicator
- * @hide
- */
- public synchronized void setShowVisualIndicator(boolean flag) {
- if (mShowVisualIndicator != flag) {
- mShowVisualIndicator = flag;
- postSync();
- }
- }
-
- /**
- * @return True if the WebView is showing the visual indicator
- * @hide
- */
- public synchronized boolean getShowVisualIndicator() {
- return mShowVisualIndicator;
+ throw new MustOverrideException();
}
/**
@@ -1316,7 +757,7 @@ public class WebSettings {
*/
@Deprecated
public synchronized void setPluginsEnabled(boolean flag) {
- setPluginState(flag ? PluginState.ON : PluginState.OFF);
+ throw new MustOverrideException();
}
/**
@@ -1327,10 +768,7 @@ public class WebSettings {
* @param state One of the PluginState values.
*/
public synchronized void setPluginState(PluginState state) {
- if (mPluginState != state) {
- mPluginState = state;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1342,6 +780,7 @@ public class WebSettings {
*/
@Deprecated
public synchronized void setPluginsPath(String pluginsPath) {
+ // Specified to do nothing, so no need for derived classes to override.
}
/**
@@ -1352,11 +791,7 @@ public class WebSettings {
* be saved. May be the empty string but should never be null.
*/
public synchronized void setDatabasePath(String databasePath) {
- if (databasePath != null && !mDatabasePathHasBeenSet) {
- mDatabasePath = databasePath;
- mDatabasePathHasBeenSet = true;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1367,40 +802,26 @@ public class WebSettings {
* should never be null.
*/
public synchronized void setGeolocationDatabasePath(String databasePath) {
- if (databasePath != null
- && !databasePath.equals(mGeolocationDatabasePath)) {
- mGeolocationDatabasePath = databasePath;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
- * Enable or disable the Application Cache API.
- * @param flag Whether to enable the Application Cache API.
+ * Tell the WebView to enable Application Caches API.
+ * @param flag True if the WebView should enable Application Caches.
*/
public synchronized void setAppCacheEnabled(boolean flag) {
- if (mAppCacheEnabled != flag) {
- mAppCacheEnabled = flag;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
- * Set the path used by the Application Cache API to store files. This
- * setting is applied to all WebViews in the application. In order for the
- * Application Cache API to function, this method must be called with a
- * path which exists and is writable by the application. This method may
- * only be called once: repeated calls are ignored.
- * @param path Path to the directory that should be used to store Application
- * Cache files.
+ * Set a custom path to the Application Caches files. The client
+ * must ensure it exists before this call.
+ * @param appCachePath String path to the directory containing Application
+ * Caches files. The appCache path can be the empty string but should not
+ * be null. Passing null for this parameter will result in a no-op.
*/
- public synchronized void setAppCachePath(String path) {
- // We test for a valid path and for repeated setting on the native
- // side, but we can avoid syncing in some simple cases.
- if (mAppCachePath == null && path != null && !path.isEmpty()) {
- mAppCachePath = path;
- postSync();
- }
+ public synchronized void setAppCachePath(String appCachePath) {
+ throw new MustOverrideException();
}
/**
@@ -1408,10 +829,7 @@ public class WebSettings {
* @param appCacheMaxSize the maximum size in bytes.
*/
public synchronized void setAppCacheMaxSize(long appCacheMaxSize) {
- if (appCacheMaxSize != mAppCacheMaxSize) {
- mAppCacheMaxSize = appCacheMaxSize;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1420,10 +838,7 @@ public class WebSettings {
* API.
*/
public synchronized void setDatabaseEnabled(boolean flag) {
- if (mDatabaseEnabled != flag) {
- mDatabaseEnabled = flag;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1432,10 +847,7 @@ public class WebSettings {
* API.
*/
public synchronized void setDomStorageEnabled(boolean flag) {
- if (mDomStorageEnabled != flag) {
- mDomStorageEnabled = flag;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1443,16 +855,15 @@ public class WebSettings {
* @return True if the DOM Storage API's are enabled.
*/
public synchronized boolean getDomStorageEnabled() {
- return mDomStorageEnabled;
+ throw new MustOverrideException();
}
-
/**
* Return the path to where database storage API databases are saved for
* the current WebView.
* @return the String path to the database storage API databases.
*/
public synchronized String getDatabasePath() {
- return mDatabasePath;
+ throw new MustOverrideException();
}
/**
@@ -1460,21 +871,7 @@ public class WebSettings {
* @return True if the database storage API is enabled.
*/
public synchronized boolean getDatabaseEnabled() {
- return mDatabaseEnabled;
- }
-
- /**
- * Tell the WebView to enable WebWorkers API.
- * @param flag True if the WebView should enable WebWorkers.
- * Note that this flag only affects V8. JSC does not have
- * an equivalent setting.
- * @hide
- */
- public synchronized void setWorkersEnabled(boolean flag) {
- if (mWorkersEnabled != flag) {
- mWorkersEnabled = flag;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1482,22 +879,7 @@ public class WebSettings {
* @param flag Whether Geolocation should be enabled.
*/
public synchronized void setGeolocationEnabled(boolean flag) {
- if (mGeolocationEnabled != flag) {
- mGeolocationEnabled = flag;
- postSync();
- }
- }
-
- /**
- * Sets whether XSS Auditor is enabled.
- * @param flag Whether XSS Auditor should be enabled.
- * @hide Only used by LayoutTestController.
- */
- public synchronized void setXSSAuditorEnabled(boolean flag) {
- if (mXSSAuditorEnabled != flag) {
- mXSSAuditorEnabled = flag;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1505,7 +887,7 @@ public class WebSettings {
* @return True if javascript is enabled.
*/
public synchronized boolean getJavaScriptEnabled() {
- return mJavaScriptEnabled;
+ throw new MustOverrideException();
}
/**
@@ -1515,7 +897,7 @@ public class WebSettings {
*/
@Deprecated
public synchronized boolean getPluginsEnabled() {
- return mPluginState == PluginState.ON;
+ throw new MustOverrideException();
}
/**
@@ -1523,7 +905,7 @@ public class WebSettings {
* @return A value corresponding to the enum PluginState.
*/
public synchronized PluginState getPluginState() {
- return mPluginState;
+ throw new MustOverrideException();
}
/**
@@ -1535,6 +917,7 @@ public class WebSettings {
*/
@Deprecated
public synchronized String getPluginsPath() {
+ // Unconditionally returns empty string, so no need for derived classes to override.
return "";
}
@@ -1543,12 +926,8 @@ public class WebSettings {
* javascript function window.open().
* @param flag True if javascript can open windows automatically.
*/
- public synchronized void setJavaScriptCanOpenWindowsAutomatically(
- boolean flag) {
- if (mJavaScriptCanOpenWindowsAutomatically != flag) {
- mJavaScriptCanOpenWindowsAutomatically = flag;
- postSync();
- }
+ public synchronized void setJavaScriptCanOpenWindowsAutomatically(boolean flag) {
+ throw new MustOverrideException();
}
/**
@@ -1558,18 +937,14 @@ public class WebSettings {
* window.open().
*/
public synchronized boolean getJavaScriptCanOpenWindowsAutomatically() {
- return mJavaScriptCanOpenWindowsAutomatically;
+ throw new MustOverrideException();
}
-
/**
* Set the default text encoding name to use when decoding html pages.
* @param encoding The text encoding name.
*/
public synchronized void setDefaultTextEncodingName(String encoding) {
- if (encoding != null && !encoding.equals(mDefaultTextEncoding)) {
- mDefaultTextEncoding = encoding;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1577,7 +952,7 @@ public class WebSettings {
* @return The default text encoding name as a string.
*/
public synchronized String getDefaultTextEncodingName() {
- return mDefaultTextEncoding;
+ throw new MustOverrideException();
}
/**
@@ -1585,66 +960,14 @@ public class WebSettings {
* it will use the system default user-agent string.
*/
public synchronized void setUserAgentString(String ua) {
- 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();
- }
+ throw new MustOverrideException();
}
/**
* Return the WebView's user-agent string.
*/
public synchronized String getUserAgentString() {
- 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;
- }
-
- /* package api to grab the Accept Language string. */
- /*package*/ synchronized String getAcceptLanguage() {
- synchronized(sLockForLocaleSettings) {
- Locale currentLocale = Locale.getDefault();
- if (!sLocale.equals(currentLocale)) {
- sLocale = currentLocale;
- mAcceptLanguage = getCurrentAcceptLanguage();
- }
- }
- return mAcceptLanguage;
- }
-
- /* package */ boolean isNarrowColumnLayout() {
- return getLayoutAlgorithm() == LayoutAlgorithm.NARROW_COLUMNS;
+ throw new MustOverrideException();
}
/**
@@ -1654,14 +977,7 @@ public class WebSettings {
* @param flag
*/
public void setNeedInitialFocus(boolean flag) {
- if (mNeedInitialFocus != flag) {
- mNeedInitialFocus = flag;
- }
- }
-
- /* Package api to get the choice whether it needs to set initial focus. */
- /* package */ boolean getNeedInitialFocus() {
- return mNeedInitialFocus;
+ throw new MustOverrideException();
}
/**
@@ -1671,11 +987,7 @@ public class WebSettings {
* @param priority RenderPriority, can be normal, high or low.
*/
public synchronized void setRenderPriority(RenderPriority priority) {
- if (mRenderPriority != priority) {
- mRenderPriority = priority;
- mEventHandler.sendMessage(Message.obtain(null,
- EventHandler.PRIORITY));
- }
+ throw new MustOverrideException();
}
/**
@@ -1687,10 +999,7 @@ public class WebSettings {
* @param mode One of the LOAD_ values.
*/
public void setCacheMode(int mode) {
- if (mode != mOverrideCacheMode) {
- mOverrideCacheMode = mode;
- postSync();
- }
+ throw new MustOverrideException();
}
/**
@@ -1698,204 +1007,6 @@ public class WebSettings {
* description, see the {@link #setCacheMode(int)} function.
*/
public int getCacheMode() {
- return mOverrideCacheMode;
+ throw new MustOverrideException();
}
-
- /**
- * 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.
- * @param shrink Set true to let webkit shrink the standalone image to fit.
- * {@hide}
- */
- public void setShrinksStandaloneImagesToFit(boolean shrink) {
- if (mShrinksStandaloneImagesToFit != shrink) {
- mShrinksStandaloneImagesToFit = shrink;
- postSync();
- }
- }
-
- /**
- * Specify the maximum decoded image size. The default is
- * 2 megs for small memory devices and 8 megs for large memory devices.
- * @param size The maximum decoded size, or zero to set to the default.
- * @hide
- */
- public void setMaximumDecodedImageSize(long size) {
- if (mMaximumDecodedImageSize != size) {
- mMaximumDecodedImageSize = size;
- postSync();
- }
- }
-
- /**
- * Returns whether to use fixed viewport. Use fixed viewport
- * whenever wide viewport is on.
- */
- /* package */ boolean getUseFixedViewport() {
- return getUseWideViewPort();
- }
-
- /**
- * Returns whether private browsing is enabled.
- */
- /* package */ boolean isPrivateBrowsingEnabled() {
- return mPrivateBrowsingEnabled;
- }
-
- /**
- * Sets whether private browsing is enabled.
- * @param flag Whether private browsing should be enabled.
- */
- /* package */ synchronized void setPrivateBrowsingEnabled(boolean flag) {
- if (mPrivateBrowsingEnabled != flag) {
- mPrivateBrowsingEnabled = flag;
-
- // AutoFill is dependant on private browsing being enabled so
- // reset it to take account of the new value of mPrivateBrowsingEnabled.
- setAutoFillEnabled(mAutoFillEnabled);
-
- postSync();
- }
- }
-
- /**
- * Returns whether the viewport metatag can disable zooming
- * @hide
- */
- public boolean forceUserScalable() {
- return mForceUserScalable;
- }
-
- /**
- * Sets whether viewport metatag can disable zooming.
- * @param flag Whether or not to forceably enable user scalable.
- * @hide
- */
- public synchronized void setForceUserScalable(boolean flag) {
- mForceUserScalable = flag;
- }
-
- synchronized void setSyntheticLinksEnabled(boolean flag) {
- if (mSyntheticLinksEnabled != flag) {
- mSyntheticLinksEnabled = flag;
- postSync();
- }
- }
-
- /**
- * @hide
- */
- public synchronized void setAutoFillEnabled(boolean enabled) {
- // AutoFill is always disabled in private browsing mode.
- boolean autoFillEnabled = enabled && !mPrivateBrowsingEnabled;
- if (mAutoFillEnabled != autoFillEnabled) {
- mAutoFillEnabled = autoFillEnabled;
- postSync();
- }
- }
-
- /**
- * @hide
- */
- public synchronized boolean getAutoFillEnabled() {
- return mAutoFillEnabled;
- }
-
- /**
- * @hide
- */
- public synchronized void setAutoFillProfile(AutoFillProfile profile) {
- if (mAutoFillProfile != profile) {
- mAutoFillProfile = profile;
- postSync();
- }
- }
-
- /**
- * @hide
- */
- public synchronized AutoFillProfile getAutoFillProfile() {
- return mAutoFillProfile;
- }
-
- int getDoubleTapToastCount() {
- return mDoubleTapToastCount;
- }
-
- void setDoubleTapToastCount(int count) {
- if (mDoubleTapToastCount != count) {
- mDoubleTapToastCount = count;
- // write the settings in the non-UI thread
- mEventHandler.sendMessage(Message.obtain(null,
- EventHandler.SET_DOUBLE_TAP_TOAST_COUNT));
- }
- }
-
- /**
- * @hide
- */
- public void setProperty(String key, String value) {
- if (mWebView.nativeSetProperty(key, value)) {
- mWebView.contentInvalidateAll();
- }
- }
-
- /**
- * @hide
- */
- public String getProperty(String key) {
- return mWebView.nativeGetProperty(key);
- }
-
- /**
- * Transfer messages from the queue to the new WebCoreThread. Called from
- * WebCore thread.
- */
- /*package*/
- synchronized void syncSettingsAndCreateHandler(BrowserFrame frame) {
- mBrowserFrame = frame;
- if (DebugFlags.WEB_SETTINGS) {
- junit.framework.Assert.assertTrue(frame.mNativeFrame != 0);
- }
-
- SharedPreferences sp = mContext.getSharedPreferences(PREF_FILE,
- Context.MODE_PRIVATE);
- if (mDoubleTapToastCount > 0) {
- mDoubleTapToastCount = sp.getInt(DOUBLE_TAP_TOAST_COUNT,
- mDoubleTapToastCount);
- }
- nativeSync(frame.mNativeFrame);
- mSyncPending = false;
- mEventHandler.createHandler();
- }
-
- /**
- * Let the Settings object know that our owner is being destroyed.
- */
- /*package*/
- synchronized void onDestroyed() {
- }
-
- 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;
- }
-
- /* Post a SYNC message to handle syncing the native settings. */
- private synchronized void postSync() {
- // Only post if a sync is not pending
- if (!mSyncPending) {
- mSyncPending = mEventHandler.sendMessage(
- Message.obtain(null, EventHandler.SYNC));
- }
- }
-
- // Synchronize the native and java settings.
- private native void nativeSync(int nativeFrame);
}