Commit 103d54a8 authored by Peter Kotwicz's avatar Peter Kotwicz Committed by Commit Bot

[Android WebAPK] Do not hide splash screen when network error dialog is up

This CL changes the splash screen hiding logic to not hide the splash screen
while the network error dialog is up.

BUG=920729

Change-Id: Ifa4659b2e97c70b5d4dde83ba52b3bd41a80ea29
Reviewed-on: https://chromium-review.googlesource.com/c/1405985
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#622103}
parent 2723aeaa
...@@ -19,6 +19,11 @@ import org.chromium.net.NetError; ...@@ -19,6 +19,11 @@ import org.chromium.net.NetError;
public class WebappOfflineDialog { public class WebappOfflineDialog {
private Dialog mDialog; private Dialog mDialog;
/** Returns whether the dialog is showing. */
public boolean isShowing() {
return mDialog != null && mDialog.isShowing();
}
/** /**
* Shows the dialog that notifies users that the WebAPK or TWA is offline. * Shows the dialog that notifies users that the WebAPK or TWA is offline.
* @param activity Activity that will be used for {@link Dialog#show()}. * @param activity Activity that will be used for {@link Dialog#show()}.
......
...@@ -49,9 +49,6 @@ class WebappSplashScreenController extends EmptyTabObserver { ...@@ -49,9 +49,6 @@ class WebappSplashScreenController extends EmptyTabObserver {
private ViewGroup mSplashScreen; private ViewGroup mSplashScreen;
private WebappUma mWebappUma; private WebappUma mWebappUma;
/** The error code of the navigation. */
private int mErrorCode;
private WebappOfflineDialog mOfflineDialog; private WebappOfflineDialog mOfflineDialog;
/** Indicates whether reloading is allowed. */ /** Indicates whether reloading is allowed. */
...@@ -167,8 +164,7 @@ class WebappSplashScreenController extends EmptyTabObserver { ...@@ -167,8 +164,7 @@ class WebappSplashScreenController extends EmptyTabObserver {
int httpStatusCode) { int httpStatusCode) {
if (!mIsForWebApk || !isInMainFrame) return; if (!mIsForWebApk || !isInMainFrame) return;
mErrorCode = errorCode; switch (errorCode) {
switch (mErrorCode) {
case ERROR_OK: case ERROR_OK:
if (mOfflineDialog != null) { if (mOfflineDialog != null) {
mOfflineDialog.cancel(); mOfflineDialog.cancel();
...@@ -186,9 +182,11 @@ class WebappSplashScreenController extends EmptyTabObserver { ...@@ -186,9 +182,11 @@ class WebappSplashScreenController extends EmptyTabObserver {
} }
protected boolean canHideSplashScreen() { protected boolean canHideSplashScreen() {
if (!mIsForWebApk) return true; if (mOfflineDialog == null) return true;
return mErrorCode != NetError.ERR_INTERNET_DISCONNECTED
&& mErrorCode != NetError.ERR_NETWORK_CHANGED; // {@link mOfflineDialog} is not nulled out when the user closes the network error dialog
// via the <Back> key.
return !mOfflineDialog.isShowing();
} }
private void onNetworkChanged(Tab tab) { private void onNetworkChanged(Tab 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