Index: android_webview/java/src/org/chromium/android_webview/AwSettings.java |
diff --git a/android_webview/java/src/org/chromium/android_webview/AwSettings.java b/android_webview/java/src/org/chromium/android_webview/AwSettings.java |
index 6cc8e532ef99d5912feb9acabd0788e3eb1ebefc..42bcca832257c40af8b572f8f3c6af994c2d07b5 100644 |
--- a/android_webview/java/src/org/chromium/android_webview/AwSettings.java |
+++ b/android_webview/java/src/org/chromium/android_webview/AwSettings.java |
@@ -10,6 +10,7 @@ import android.os.Handler; |
import android.os.Message; |
import android.os.Process; |
import android.provider.Settings; |
+import android.util.Log; |
import android.webkit.WebSettings; |
import android.webkit.WebSettings.PluginState; |
@@ -26,8 +27,8 @@ import org.chromium.base.ThreadUtils; |
*/ |
@JNINamespace("android_webview") |
public class AwSettings { |
- // This enum corresponds to WebSettings.LayoutAlgorithm. We use our own to be |
- // able to extend it. |
+ // Do not use! Will be removed soon. See crbug.com/332089. |
+ // Use android.webkit.WebSettings.LayoutAlgorithm instead. |
public enum LayoutAlgorithm { |
NORMAL, |
SINGLE_COLUMN, |
@@ -50,7 +51,8 @@ public class AwSettings { |
// Lock to protect all settings. |
private final Object mAwSettingsLock = new Object(); |
- private LayoutAlgorithm mLayoutAlgorithm = LayoutAlgorithm.NARROW_COLUMNS; |
+ private WebSettings.LayoutAlgorithm mLayoutAlgorithm = |
+ WebSettings.LayoutAlgorithm.NARROW_COLUMNS; |
private int mTextSizePercent = 100; |
private String mStandardFontFamily = "sans-serif"; |
private String mFixedFontFamily = "monospace"; |
@@ -181,7 +183,9 @@ public class AwSettings { |
while (mIsUpdateWebkitPrefsMessagePending) { |
mAwSettingsLock.wait(); |
} |
- } catch (InterruptedException e) {} |
+ } catch (InterruptedException e) { |
+ Log.w(TAG, "updateWebkitPreferencesLocked interrupted", e); |
+ } |
} |
} |
} |
@@ -1026,10 +1030,21 @@ public class AwSettings { |
return mJavaScriptCanOpenWindowsAutomatically; |
} |
+ // A temporary adapter to avoid breaking code from Android frameworks/webview. crbug.com/332089 |
+ public void setLayoutAlgorithm(AwSettings.LayoutAlgorithm l) { |
+ final WebSettings.LayoutAlgorithm[] webViewValues = { |
+ WebSettings.LayoutAlgorithm.NORMAL, |
+ WebSettings.LayoutAlgorithm.SINGLE_COLUMN, |
+ WebSettings.LayoutAlgorithm.NARROW_COLUMNS, |
+ WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING |
+ }; |
+ setLayoutAlgorithm(webViewValues[l.ordinal()]); |
+ } |
+ |
/** |
* See {@link android.webkit.WebSettings#setLayoutAlgorithm}. |
*/ |
- public void setLayoutAlgorithm(LayoutAlgorithm l) { |
+ public void setLayoutAlgorithm(WebSettings.LayoutAlgorithm l) { |
synchronized (mAwSettingsLock) { |
if (mLayoutAlgorithm != l) { |
mLayoutAlgorithm = l; |
@@ -1041,7 +1056,7 @@ public class AwSettings { |
/** |
* See {@link android.webkit.WebSettings#getLayoutAlgorithm}. |
*/ |
- public LayoutAlgorithm getLayoutAlgorithm() { |
+ public WebSettings.LayoutAlgorithm getLayoutAlgorithm() { |
synchronized (mAwSettingsLock) { |
return mLayoutAlgorithm; |
} |
@@ -1055,7 +1070,7 @@ public class AwSettings { |
*/ |
@CalledByNative |
private boolean getTextAutosizingEnabledLocked() { |
- return mLayoutAlgorithm == LayoutAlgorithm.TEXT_AUTOSIZING; |
+ return mLayoutAlgorithm == WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING; |
} |
/** |