Index: web_apks/minting_example/libs/client/org/chromium/minting/lib/client/NavigationClient.java |
diff --git a/web_apks/minting_example/libs/client/org/chromium/minting/lib/client/NavigationClient.java b/web_apks/minting_example/libs/client/org/chromium/minting/lib/client/NavigationClient.java |
index c01028ef13341b6464ee04781c182020944c0365..7e9704ea68f194baa4c7c65b91c48b28fa29761f 100644 |
--- a/web_apks/minting_example/libs/client/org/chromium/minting/lib/client/NavigationClient.java |
+++ b/web_apks/minting_example/libs/client/org/chromium/minting/lib/client/NavigationClient.java |
@@ -5,17 +5,17 @@ |
package org.chromium.minting.lib.client; |
import android.content.ComponentName; |
+import android.content.Context; |
import android.content.Intent; |
import android.net.Uri; |
import org.chromium.minting.lib.common.WebAPKConstants; |
+import org.chromium.minting.lib.common.WebAPKUtils; |
/** |
* NavigationClient provides APIs that A WebAPK host can delegate a WebAPK to load URL. |
*/ |
public class NavigationClient { |
- private static final String EXTRA_CALLER_PACKAGE_NAME = "EXTRA_CALLER_PACKAGE_NAME"; |
- |
/** |
* Create an Intent to launch a WebAPK and return the Intent to the host. |
* @param webAPKPackageName the package name of the WebAPK to launch. |
@@ -32,7 +32,6 @@ public class NavigationClient { |
} |
intent.setComponent(new ComponentName(webAPKPackageName, |
WebAPKConstants.WEBAPK_MAIN_ACTIVITY)); |
- intent.putExtra(EXTRA_CALLER_PACKAGE_NAME, callerPackageName); |
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
return intent; |
} |
@@ -40,12 +39,13 @@ public class NavigationClient { |
/** |
* When navigation is out of the scope of a WebAPK, the Activity hosted in the WebAPK can call |
* this function to create an Intent to ask its host to complete the navigation. |
- * @param hostPackageName the package name of the WebAPK host. |
+ * @param context a context instance. |
* @param urlToNavigate the URL for the navigation. |
* @param hostLauchActivity the Activity of the host that this Intent is sent to. |
*/ |
- public static Intent createIntentToNavigateBackToHost(String hostPackageName, |
+ public static Intent createIntentToNavigateBackToHost(Context context, |
String urlToNavigate, String hostLauchActivity) { |
+ String hostPackageName = WebAPKUtils.getHostBrowserPackageName(context); |
Intent intent = new Intent(Intent.ACTION_VIEW); |
intent.setComponent(new ComponentName(hostPackageName, hostLauchActivity)); |
intent.setData(Uri.parse(urlToNavigate)); |