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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java

Issue 2752133002: [WebAPKs] Don't crash if WebAPK starts on page which displays interstitial (Closed)
Patch Set: Created 3 years, 9 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
index 3f7d2328c09bd720297c13cc8d35fb699e07beef..5cfd7fa8b11b54a1daf7a956e381743589ae4c39 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
@@ -30,6 +30,7 @@ import org.chromium.base.VisibleForTesting;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.blink_public.platform.WebDisplayMode;
import org.chromium.chrome.R;
+import org.chromium.chrome.browser.IntentHandler;
import org.chromium.chrome.browser.TabState;
import org.chromium.chrome.browser.document.DocumentUtils;
import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager;
@@ -543,18 +544,22 @@ public class WebappActivity extends FullScreenActivity {
}
// Kick the interstitial navigation to Chrome.
- Intent intent = new Intent(
- Intent.ACTION_VIEW, Uri.parse(getActivityTab().getUrl()));
+ Intent intent =
+ new Intent(Intent.ACTION_VIEW, Uri.parse(getActivityTab().getUrl()));
intent.setPackage(getPackageName());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- startActivity(intent);
+ IntentHandler.startChromeLauncherActivityForTrustedIntent(intent);
// Pretend like the navigation never happened. We delay so that this happens while
// the Activity is in the background.
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
- getActivityTab().goBack();
+ if (getActivityTab().canGoBack()) {
+ getActivityTab().goBack();
+ } else {
+ ApiCompatibilityUtils.finishAndRemoveTask(WebappActivity.this);
+ }
}
}, MS_BEFORE_NAVIGATING_BACK_FROM_INTERSTITIAL);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698