Index: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkActivity.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkActivity.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2cd5ea50d829ef8efec3498d910f8cdb120fc8a4 |
--- /dev/null |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkActivity.java |
@@ -0,0 +1,42 @@ |
+// 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.chrome.browser.webapps; |
+ |
+import android.content.Intent; |
+ |
+import org.chromium.chrome.browser.ShortcutHelper; |
+import org.chromium.content_public.browser.LoadUrlParams; |
+import org.chromium.ui.base.PageTransition; |
+ |
+/** |
+ * An Activity is designed for WebAPKs (native Android apps) and displays a webapp in a nearly |
+ * UI-less Chrome. |
+ */ |
+public class WebApkActivity extends WebappActivity { |
+ @Override |
+ protected void onNewIntent(Intent intent) { |
+ super.onNewIntent(intent); |
+ // We could bring a WebAPK hosted WebappActivity to foreground and navigate it to a |
+ // different URL. For example, WebAPK "foo" is launched and navigates to |
+ // "www.foo.com/foo". In Chrome, user clicks a link "www.foo.com/bar" in Google search |
+ // results. After clicking the link, WebAPK "foo" is brought to foreground, and |
+ // loads the page of "www.foo.com/bar" at the same time. |
+ // The extra {@link ShortcutHelper.EXTRA_URL} provides the URL that the WebAPK will |
+ // navigate to. |
+ String overrideUrl = intent.getStringExtra(ShortcutHelper.EXTRA_URL); |
+ if (overrideUrl != null && isInitialized() |
+ && !overrideUrl.equals(getActivityTab().getUrl())) { |
+ getActivityTab().loadUrl( |
+ new LoadUrlParams(overrideUrl, PageTransition.AUTO_TOPLEVEL)); |
+ } |
+ } |
+ |
+ @Override |
+ protected void initializeSplashScreenWidgets(final int backgroundColor) { |
+ // TODO(hanxi): Removes this function and use {@link WebApkActivity}'s implementation |
+ // when WebAPKs are registered in WebappRegistry. |
+ initializeSplashScreenWidgets(backgroundColor, null); |
+ } |
+} |