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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentSettings.java

Issue 11759023: [Android WebView] Implement WebSettings.{get|set}UseWideViewport (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and fix tests that were expecting UseWideViewPort=true Created 7 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
Index: content/public/android/java/src/org/chromium/content/browser/ContentSettings.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentSettings.java b/content/public/android/java/src/org/chromium/content/browser/ContentSettings.java
index 7569758a650f63aa78363fa0dfcbc44e579d3dc8..ceb2f88420555f684831594eaa32f84a928096f2 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentSettings.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentSettings.java
@@ -90,6 +90,7 @@ public class ContentSettings {
private PluginState mPluginState = PluginState.OFF;
private boolean mAppCacheEnabled = false;
private boolean mDomStorageEnabled = false;
+ private boolean mUseWideViewport = false;
// Not accessed by the native side.
private boolean mSupportZoom = true;
@@ -995,6 +996,40 @@ public class ContentSettings {
}
/**
+ * Sets whether the WebView should enable support for the "viewport"
+ * HTML meta tag or should use a wide viewport.
+ * When the value of the setting is false, the layout width is always set to the
+ * width of the WebView control in device-independent (CSS) pixels.
+ * When the value is true and the page contains the viewport meta tag, the value
+ * of the width specified in the tag is used. If the page does not contain the tag or
+ * does not provide a width, then a wide viewport will be used.
+ *
+ * @param use whether to enable support for the viewport meta tag
+ */
+ public void setUseWideViewPort(boolean use) {
+ assert mCanModifySettings;
+ synchronized (mContentSettingsLock) {
+ if (mUseWideViewport != use) {
+ mUseWideViewport = use;
+ mEventHandler.syncSettingsLocked();
+ }
+ }
+ }
+
+ /**
+ * Gets whether the WebView supports the "viewport"
+ * HTML meta tag or will use a wide viewport.
+ *
+ * @return true if the WebView supports the viewport meta tag
+ * @see #setUseWideViewPort
+ */
+ public boolean getUseWideViewPort() {
+ synchronized (mContentSettingsLock) {
+ return mUseWideViewport;
+ }
+ }
+
+ /**
* Sets whether the Application Caches API should be enabled. The default
* is false. Note that in order for the Application Caches API to be
* enabled, a non-empty database path must also be supplied to

Powered by Google App Engine
This is Rietveld 408576698