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

Unified Diff: web_apks/minting_example/libs/client/org/chromium/minting/lib/client/NavigationClient.java

Issue 1888773004: 🙅 Bind a WebAPK to its "host" browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add template apk Created 4 years, 8 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: 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..2bb2baa4bdb24e4917083abd20476b97f234b422 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,10 +5,12 @@
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.
@@ -40,12 +42,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));

Powered by Google App Engine
This is Rietveld 408576698