Index: chrome/android/webapk/libs/client/src/org/chromium/webapk/lib/client/NavigationClient.java |
diff --git a/chrome/android/webapk/libs/client/src/org/chromium/webapk/lib/client/NavigationClient.java b/chrome/android/webapk/libs/client/src/org/chromium/webapk/lib/client/NavigationClient.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..734bbe172c1432ca14b1d4501f8b380c373d330f |
--- /dev/null |
+++ b/chrome/android/webapk/libs/client/src/org/chromium/webapk/lib/client/NavigationClient.java |
@@ -0,0 +1,32 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.webapk.lib.client; |
+ |
+import android.content.Context; |
+import android.content.Intent; |
+ |
+/** |
+ * NavigationClient provides an API to launch a WebAPK. |
+ */ |
+public class NavigationClient { |
+ /** |
+ * Launches a WebAPK. |
+ * @param context Application context. |
+ * @param webApkPackageName Package name of the WebAPK to launch. |
+ * @param url URL to navigate WebAPK to. |
+ */ |
+ public static void launchWebApk(Context context, String webApkPackageName, String url) { |
+ Intent intent; |
+ try { |
+ intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME); |
+ } catch (Exception e) { |
+ return; |
+ } |
+ |
+ intent.setPackage(webApkPackageName); |
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
+ context.startActivity(intent); |
+ } |
+} |