Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1596)

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwSettings.java

Issue 115253004: [Android WebView] Prepare to remove AwSettings.LayoutAlgorithm (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
/**
« no previous file with comments | « no previous file | android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698