diff options
author | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-23 13:43:45 +0000 |
---|---|---|
committer | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-23 13:43:45 +0000 |
commit | 95ec47b88785193e14114dce45351ee73a832f7c (patch) | |
tree | d7e48d0fe6fdd28ce4b41b941d216a57d4efe0ad /android_webview | |
parent | 2f629acda1c3205a72ede4567fddfa6519b30e5a (diff) | |
download | chromium_src-95ec47b88785193e14114dce45351ee73a832f7c.zip chromium_src-95ec47b88785193e14114dce45351ee73a832f7c.tar.gz chromium_src-95ec47b88785193e14114dce45351ee73a832f7c.tar.bz2 |
[Android WebView] Parametrize targetDensityDpi support
It is now possible to control targetDensityDpi and other quirks support when constructing AwContents
BUG=277369
R=benm@chromium.org
Review URL: https://codereview.chromium.org/22909031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219274 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
4 files changed, 20 insertions, 6 deletions
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java index 5ead1f7..df560c4 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java @@ -449,6 +449,13 @@ public class AwContents { isAccessFromFileURLsGrantedByDefault, new AwLayoutSizer()); } + public AwContents(AwBrowserContext browserContext, ViewGroup containerView, + InternalAccessDelegate internalAccessAdapter, AwContentsClient contentsClient, + boolean isAccessFromFileURLsGrantedByDefault, AwLayoutSizer layoutSizer) { + this(browserContext, containerView, internalAccessAdapter, contentsClient, + isAccessFromFileURLsGrantedByDefault, layoutSizer, false); + } + private static ContentViewCore createAndInitializeContentViewCore(ViewGroup containerView, InternalAccessDelegate internalDispatcher, int nativeWebContents, ContentViewCore.GestureStateListener pinchGestureStateListener, @@ -473,7 +480,8 @@ public class AwContents { */ public AwContents(AwBrowserContext browserContext, ViewGroup containerView, InternalAccessDelegate internalAccessAdapter, AwContentsClient contentsClient, - boolean isAccessFromFileURLsGrantedByDefault, AwLayoutSizer layoutSizer) { + boolean isAccessFromFileURLsGrantedByDefault, AwLayoutSizer layoutSizer, + boolean supportsLegacyQuirks) { mBrowserContext = browserContext; mContainerView = containerView; mInternalAccessAdapter = internalAccessAdapter; @@ -503,7 +511,7 @@ public class AwContents { }; mSettings = new AwSettings(mContainerView.getContext(), hasInternetPermission, zoomListener, - isAccessFromFileURLsGrantedByDefault, mDIPScale); + isAccessFromFileURLsGrantedByDefault, mDIPScale, supportsLegacyQuirks); mDefaultVideoPosterRequestHandler = new DefaultVideoPosterRequestHandler(mContentsClient); mSettings.setDefaultVideoPosterURL( mDefaultVideoPosterRequestHandler.getDefaultVideoPosterURL()); 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 eea2898..0247ed4 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwSettings.java +++ b/android_webview/java/src/org/chromium/android_webview/AwSettings.java @@ -82,7 +82,7 @@ public class AwSettings { private String mDefaultVideoPosterURL; private float mInitialPageScalePercent = 0; - private final boolean mSupportDeprecatedTargetDensityDPI = true; + private final boolean mSupportDeprecatedTargetDensityDPI; private final boolean mPasswordEchoEnabled; @@ -175,7 +175,8 @@ public class AwSettings { public AwSettings(Context context, boolean hasInternetPermission, ZoomSupportChangeListener zoomChangeListener, boolean isAccessFromFileURLsGrantedByDefault, - double dipScale) { + double dipScale, + boolean supportsLegacyQuirks) { ThreadUtils.assertOnUiThread(); synchronized (mAwSettingsLock) { mHasInternetPermission = hasInternetPermission; @@ -195,6 +196,8 @@ public class AwSettings { // Respect the system setting for password echoing. mPasswordEchoEnabled = Settings.System.getInt(context.getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD, 1) == 1; + + mSupportDeprecatedTargetDensityDPI = supportsLegacyQuirks; } // Defer initializing the native side until a native WebContents instance is set. } diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java index 0bb148e..29906b5 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java @@ -226,9 +226,11 @@ public class AwTestBase final TestDependencyFactory testDependencyFactory = createTestDependencyFactory(); final AwTestContainerView testContainerView = testDependencyFactory.createAwTestContainerView(getActivity()); + // TODO(mnaganov): Should also have tests for the "pure Chromium" mode. + // See http://crbug.com/278106 testContainerView.initialize(new AwContents( mBrowserContext, testContainerView, testContainerView.getInternalAccessDelegate(), - awContentsClient, false, testDependencyFactory.createLayoutSizer())); + awContentsClient, false, testDependencyFactory.createLayoutSizer(), true)); return testContainerView; } diff --git a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java index a252627..1e1a3eb 100644 --- a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java +++ b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java @@ -29,6 +29,7 @@ import org.chromium.android_webview.AwBrowserProcess; import org.chromium.android_webview.AwBrowserContext; import org.chromium.android_webview.AwContents; import org.chromium.android_webview.AwContentsClient; +import org.chromium.android_webview.AwLayoutSizer; import org.chromium.android_webview.test.AwTestContainerView; import org.chromium.android_webview.test.NullContentsClient; import org.chromium.content.browser.LoadUrlParams; @@ -89,7 +90,7 @@ public class AwShellActivity extends Activity { } testContainerView.initialize(new AwContents(mBrowserContext, testContainerView, testContainerView.getInternalAccessDelegate(), - awContentsClient, false)); + awContentsClient, false, new AwLayoutSizer(), true)); testContainerView.getAwContents().getSettings().setJavaScriptEnabled(true); return testContainerView; } |