Commit dc1214b3 authored by Clark DuVall's avatar Clark DuVall Committed by Chromium LUCI CQ

[WebLayer] Remove WebLayer.initializeWebViewCompatibilityMode()

WebView compatibility is on by default, so this is no longer needed.

Bug: 1051358
Change-Id: I88740862ad035d91271974417512bcd4da42c3d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2628231
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Auto-Submit: Clark DuVall <cduvall@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843199}
parent cc76379d
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
package org.chromium.weblayer.test; package org.chromium.weblayer.test;
import android.support.test.InstrumentationRegistry;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
...@@ -17,7 +16,6 @@ import org.junit.runner.RunWith; ...@@ -17,7 +16,6 @@ import org.junit.runner.RunWith;
import org.chromium.base.StrictModeContext; import org.chromium.base.StrictModeContext;
import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CallbackHelper;
import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.content_public.browser.test.util.TestThreadUtils;
import org.chromium.weblayer.WebLayer;
/** /**
* Tests for compatibility with running WebView and WebLayer in the same process. These tests only * Tests for compatibility with running WebView and WebLayer in the same process. These tests only
...@@ -32,10 +30,6 @@ public class WebViewCompatibilityTest { ...@@ -32,10 +30,6 @@ public class WebViewCompatibilityTest {
@Test @Test
@SmallTest @SmallTest
public void testBothLoadPage() throws Exception { public void testBothLoadPage() throws Exception {
TestThreadUtils.runOnUiThreadBlocking(() -> {
WebLayer.initializeWebViewCompatibilityMode(
InstrumentationRegistry.getTargetContext().getApplicationContext());
});
mActivityTestRule.launchShellWithUrl(mActivityTestRule.getTestDataURL("simple_page.html")); mActivityTestRule.launchShellWithUrl(mActivityTestRule.getTestDataURL("simple_page.html"));
WebView webView = TestThreadUtils.runOnUiThreadBlocking(() -> { WebView webView = TestThreadUtils.runOnUiThreadBlocking(() -> {
// Loading WebView triggers loading from disk. // Loading WebView triggers loading from disk.
......
...@@ -78,18 +78,6 @@ public class WebLayer { ...@@ -78,18 +78,6 @@ public class WebLayer {
private static long sContextCreationTime; private static long sContextCreationTime;
private static long sWebLayerLoaderCreationTime; private static long sWebLayerLoaderCreationTime;
/** The result of calling {@link #initializeWebViewCompatibilityMode}. */
public enum WebViewCompatibilityResult {
/** Compatibility mode has been successfully set up. */
SUCCESS,
/** This version of the WebLayer implementation does not support WebView compatibility. */
FAILURE_UNSUPPORTED_VERSION,
/** An uncategorized failure happened. */
FAILURE_OTHER,
}
/** /**
* Returns true if WebLayer is available. This tries to load WebLayer, but does no * Returns true if WebLayer is available. This tries to load WebLayer, but does no
* initialization. This function may be called by code that uses WebView. * initialization. This function may be called by code that uses WebView.
...@@ -110,16 +98,6 @@ public class WebLayer { ...@@ -110,16 +98,6 @@ public class WebLayer {
} }
} }
/**
* Deprecated. This is no longer necessary since WebView compatibility mode is now enabled by
* default. This will be removed once the client app is updated.
*/
public static WebViewCompatibilityResult initializeWebViewCompatibilityMode(
@NonNull Context appContext) {
ThreadCheck.ensureOnUiThread();
return WebViewCompatibilityResult.SUCCESS;
}
/** /**
* Asynchronously creates and initializes WebLayer. Calling this more than once returns the same * Asynchronously creates and initializes WebLayer. Calling this more than once returns the same
* object. Both this method and {@link #loadSync} yield the same instance of {@link WebLayer}. * object. Both this method and {@link #loadSync} yield the same instance of {@link WebLayer}.
......
...@@ -18,10 +18,6 @@ ...@@ -18,10 +18,6 @@
android:title="Translate" /> android:title="Translate" />
<item android:id="@+id/clear_browsing_data_menu_id" <item android:id="@+id/clear_browsing_data_menu_id"
android:title="Clear all browsing data" /> android:title="Clear all browsing data" />
<item android:id="@+id/webview_compat_menu_id"
android:title="Restart with WebView compat mode" />
<item android:id="@+id/no_webview_compat_menu_id"
android:title="Restart without WebView compat mode" />
<item android:id="@+id/set_translate_target_lang_menu_id" <item android:id="@+id/set_translate_target_lang_menu_id"
android:title="Set translate target language to German" /> android:title="Set translate target language to German" />
<item android:id="@+id/clear_translate_target_lang_menu_id" <item android:id="@+id/clear_translate_target_lang_menu_id"
......
...@@ -92,7 +92,6 @@ public class WebLayerShellActivity extends AppCompatActivity { ...@@ -92,7 +92,6 @@ public class WebLayerShellActivity extends AppCompatActivity {
} }
private static final String NON_INCOGNITO_PROFILE_NAME = "DefaultProfile"; private static final String NON_INCOGNITO_PROFILE_NAME = "DefaultProfile";
private static final String EXTRA_WEBVIEW_COMPAT = "EXTRA_WEBVIEW_COMPAT";
private static class ContextMenuCreator private static class ContextMenuCreator
implements View.OnCreateContextMenuListener, MenuItem.OnMenuItemClickListener { implements View.OnCreateContextMenuListener, MenuItem.OnMenuItemClickListener {
...@@ -257,7 +256,6 @@ public class WebLayerShellActivity extends AppCompatActivity { ...@@ -257,7 +256,6 @@ public class WebLayerShellActivity extends AppCompatActivity {
private boolean mAnimateControlsChanges; private boolean mAnimateControlsChanges;
private boolean mSetDarkMode; private boolean mSetDarkMode;
private boolean mInIncognitoMode; private boolean mInIncognitoMode;
private boolean mEnableWebViewCompat;
private boolean mEnableAltTopView; private boolean mEnableAltTopView;
@Override @Override
...@@ -265,10 +263,6 @@ public class WebLayerShellActivity extends AppCompatActivity { ...@@ -265,10 +263,6 @@ public class WebLayerShellActivity extends AppCompatActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
mSetDarkMode = AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES; mSetDarkMode = AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES;
mEnableWebViewCompat = getIntent().getBooleanExtra(EXTRA_WEBVIEW_COMPAT, false);
if (mEnableWebViewCompat) {
WebLayer.initializeWebViewCompatibilityMode(getApplicationContext());
}
setContentView(R.layout.main); setContentView(R.layout.main);
TextView versionText = (TextView) findViewById(R.id.version_text); TextView versionText = (TextView) findViewById(R.id.version_text);
versionText.setText(getString( versionText.setText(getString(
...@@ -313,8 +307,6 @@ public class WebLayerShellActivity extends AppCompatActivity { ...@@ -313,8 +307,6 @@ public class WebLayerShellActivity extends AppCompatActivity {
popup.getMenu() popup.getMenu()
.findItem(R.id.translate_menu_id) .findItem(R.id.translate_menu_id)
.setVisible(mBrowser.getActiveTab().canTranslate()); .setVisible(mBrowser.getActiveTab().canTranslate());
popup.getMenu().findItem(R.id.webview_compat_menu_id).setVisible(!mEnableWebViewCompat);
popup.getMenu().findItem(R.id.no_webview_compat_menu_id).setVisible(mEnableWebViewCompat);
boolean isDesktopUserAgent = mBrowser.getActiveTab().isDesktopUserAgentEnabled(); boolean isDesktopUserAgent = mBrowser.getActiveTab().isDesktopUserAgentEnabled();
popup.getMenu().findItem(R.id.desktop_site_menu_id).setVisible(!isDesktopUserAgent); popup.getMenu().findItem(R.id.desktop_site_menu_id).setVisible(!isDesktopUserAgent);
popup.getMenu().findItem(R.id.no_desktop_site_menu_id).setVisible(isDesktopUserAgent); popup.getMenu().findItem(R.id.no_desktop_site_menu_id).setVisible(isDesktopUserAgent);
...@@ -365,14 +357,6 @@ public class WebLayerShellActivity extends AppCompatActivity { ...@@ -365,14 +357,6 @@ public class WebLayerShellActivity extends AppCompatActivity {
}); });
} }
if (item.getItemId() == R.id.webview_compat_menu_id) {
restartShell(true);
}
if (item.getItemId() == R.id.no_webview_compat_menu_id) {
restartShell(false);
}
if (item.getItemId() == R.id.desktop_site_menu_id) { if (item.getItemId() == R.id.desktop_site_menu_id) {
mBrowser.getActiveTab().setDesktopUserAgentEnabled(true); mBrowser.getActiveTab().setDesktopUserAgentEnabled(true);
} }
...@@ -821,18 +805,6 @@ public class WebLayerShellActivity extends AppCompatActivity { ...@@ -821,18 +805,6 @@ public class WebLayerShellActivity extends AppCompatActivity {
super.onBackPressed(); super.onBackPressed();
} }
@SuppressWarnings("checkstyle:SystemExitCheck") // Allowed since this shouldn't be a crash.
private void restartShell(boolean enableWebViewCompat) {
finish();
Intent intent = new Intent();
intent.setClassName(getPackageName(), getClass().getName());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(EXTRA_WEBVIEW_COMPAT, enableWebViewCompat);
startActivity(intent);
System.exit(0);
}
private void updateFavicon(@NonNull Tab tab) { private void updateFavicon(@NonNull Tab tab) {
if (tab == mBrowser.getActiveTab()) { if (tab == mBrowser.getActiveTab()) {
assert mTabToPerTabState.containsKey(tab); assert mTabToPerTabState.containsKey(tab);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment