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

Unified Diff: chrome/android/webapk/libs/client/src/org/chromium/webapk/lib/client/NavigationClient.java

Issue 2010633004: Launch WebAPK if notification opens URL within WebAPK scope (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/webapk/libs/client/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ }
+}
« no previous file with comments | « chrome/android/webapk/libs/client/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698