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

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

Issue 2829943002: Redirecting off-origin navigations in PWAs to CCT. (Closed)
Patch Set: Merge Created 3 years, 7 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: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java
index 34d2e1a287fcae91d144532e2cf5483e90d6ae74..3c76b2e59eb8b63f5a38a3053bc284fd8e8ade77 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java
@@ -166,19 +166,19 @@ public class WebappLauncherActivity extends Activity {
launchIntent.setData(Uri.parse(WebappActivity.WEBAPP_SCHEME + "://" + info.id()));
launchIntent.setFlags(
Intent.FLAG_ACTIVITY_NEW_TASK | ApiCompatibilityUtils.getActivityNewDocumentFlag());
-
- if (!isWebApk) {
- // If this is launching from a notification, we want to ensure that the URL being
- // launched is the URL in the intent. If a paused WebappActivity exists for this id,
- // then by default it will be focused and we have no way of sending the desired URL to
- // it (the intent is swallowed). As a workaround, set the CLEAR_TOP flag to ensure that
- // the existing Activity is cleared and relaunched with this intent.
- // TODO(dominickn): ideally, we want be able to route an intent to
- // WebappActivity.onNewIntent instead of restarting the Activity.
- if (source == ShortcutSource.NOTIFICATION) {
- launchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- }
- }
+ // Setting FLAG_ACTIVITY_CLEAR_TOP handles 2 edge cases:
+ // - If a plain PWA is launching from a notification, we want to ensure that the URL being
dominickn 2017/05/23 03:20:13 Nit: "legacy" PWA, not "plain" PWA.
piotrs 2017/05/23 04:11:11 Done.
+ // launched is the URL in the intent. If a paused WebappActivity exists for this id,
+ // then by default it will be focused and we have no way of sending the desired URL to
+ // it (the intent is swallowed). As a workaround, set the CLEAR_TOP flag to ensure that
+ // the existing Activity is cleared and relaunched with this intent.
+ // - If a WebAPK is having a CustomTabActivity on top of it in the same Task, and user
+ // clicks a link to takes them back to the scope of a WebAPK, we want to destroy the
+ // CustomTabActivity activity and go back to the WebAPK activity. It is intentional that
+ // Custom Tab will not be reachable with a back button.
+ // TODO(dominickn): ideally, we want be able to route an intent to onNewIntent() instead of
+ // restarting the Activity.
+ launchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
return launchIntent;
}

Powered by Google App Engine
This is Rietveld 408576698