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

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

Issue 2172933002: Open the notification URL (not the web app start_url) when deep-linking into standalone mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 5 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 | « chrome/android/java/src/org/chromium/chrome/browser/ChromeServiceTabLauncher.java ('k') | 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/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 c25ccaebbc11b28233f726ba673aa941fe847384..0b7ed276effc4fbe17defa62b5994fb3f5d858ef 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
@@ -17,6 +17,7 @@ import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
import org.chromium.chrome.browser.IntentHandler;
import org.chromium.chrome.browser.ShortcutHelper;
+import org.chromium.chrome.browser.ShortcutSource;
import org.chromium.chrome.browser.document.ChromeLauncherActivity;
import org.chromium.chrome.browser.metrics.LaunchMetrics;
import org.chromium.chrome.browser.tab.Tab;
@@ -87,6 +88,17 @@ public class WebappLauncherActivity extends Activity {
// Activity.
launchIntent.setAction(Intent.ACTION_VIEW);
launchIntent.setData(Uri.parse(WebappActivity.WEBAPP_SCHEME + "://" + webappId));
+
+ // 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 (webappSource == ShortcutSource.NOTIFICATION) {
+ launchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ }
} else {
Log.e(TAG, "Shortcut (%s) opened in Chrome.", webappUrl);
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/ChromeServiceTabLauncher.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698