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

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

Issue 2502213002: Make WebappDelegateFactory#activateContents() take in account WebAPKs (Closed)
Patch Set: Merge branch 'master' into activate_contents Created 4 years, 1 month 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/WebappDelegateFactory.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java
index b3ad5e2f3f6f6c7c849d96c470a260af04573baa..87f2d3edd4550c0e88d2733f04906bd675f9f06d 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java
@@ -15,8 +15,10 @@ import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabDelegateFactory;
import org.chromium.chrome.browser.tab.TabStateBrowserControlsVisibilityDelegate;
import org.chromium.chrome.browser.tab.TabWebContentsDelegateAndroid;
+import org.chromium.chrome.browser.util.IntentUtils;
import org.chromium.chrome.browser.util.UrlUtilities;
import org.chromium.components.security_state.ConnectionSecurityLevel;
+import org.chromium.webapk.lib.client.WebApkNavigationClient;
/**
* A {@link TabDelegateFactory} class to be used in all {@link Tab} instances owned by a
@@ -33,12 +35,19 @@ public class WebappDelegateFactory extends FullScreenDelegateFactory {
@Override
public void activateContents() {
+ // Create an Intent that will be fired toward the WebappLauncherActivity, which in turn
+ // will fire an Intent to launch the correct WebappActivity or WebApkActivity. On L+
+ // this could probably be changed to call AppTask.moveToFront(), but for backwards
+ // compatibility we relaunch it the hard way.
String startUrl = mActivity.getWebappInfo().uri().toString();
- // Create an Intent that will be fired toward the WebappLauncherActivity, which in turn
- // will fire an Intent to launch the correct WebappActivity. On L+ this could probably
- // be changed to call AppTask.moveToFront(), but for backwards compatibility we relaunch
- // it the hard way.
+ if (!TextUtils.isEmpty(mActivity.getWebappInfo().webApkPackageName())) {
+ Intent intent = WebApkNavigationClient.createLaunchWebApkIntent(
+ mActivity.getWebappInfo().webApkPackageName(), startUrl);
+ IntentUtils.safeStartActivity(ContextUtils.getApplicationContext(), intent);
+ return;
+ }
+
Intent intent = new Intent();
intent.setAction(WebappLauncherActivity.ACTION_START_WEBAPP);
intent.setPackage(mActivity.getPackageName());
@@ -47,7 +56,7 @@ public class WebappDelegateFactory extends FullScreenDelegateFactory {
intent.putExtra(
ShortcutHelper.EXTRA_MAC, ShortcutHelper.getEncodedMac(mActivity, startUrl));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- ContextUtils.getApplicationContext().startActivity(intent);
+ IntentUtils.safeStartActivity(ContextUtils.getApplicationContext(), intent);
}
}
« 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