OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.webapps; |
| 6 |
| 7 import android.content.Intent; |
| 8 |
| 9 import org.chromium.chrome.browser.ShortcutHelper; |
| 10 import org.chromium.content_public.browser.LoadUrlParams; |
| 11 import org.chromium.ui.base.PageTransition; |
| 12 |
| 13 /** |
| 14 * An Activity is designed for WebAPKs (native Android apps) and displays a weba
pp in a nearly |
| 15 * UI-less Chrome. |
| 16 */ |
| 17 public class WebApkActivity extends WebappActivity { |
| 18 @Override |
| 19 protected void onNewIntent(Intent intent) { |
| 20 super.onNewIntent(intent); |
| 21 // We could bring a WebAPK hosted WebappActivity to foreground and navig
ate it to a |
| 22 // different URL. For example, WebAPK "foo" is launched and navigates to |
| 23 // "www.foo.com/foo". In Chrome, user clicks a link "www.foo.com/bar" in
Google search |
| 24 // results. After clicking the link, WebAPK "foo" is brought to foregrou
nd, and |
| 25 // loads the page of "www.foo.com/bar" at the same time. |
| 26 // The extra {@link ShortcutHelper.EXTRA_URL} provides the URL that the
WebAPK will |
| 27 // navigate to. |
| 28 String overrideUrl = intent.getStringExtra(ShortcutHelper.EXTRA_URL); |
| 29 if (overrideUrl != null && isInitialized() |
| 30 && !overrideUrl.equals(getActivityTab().getUrl())) { |
| 31 getActivityTab().loadUrl( |
| 32 new LoadUrlParams(overrideUrl, PageTransition.AUTO_TOPLEVEL)
); |
| 33 } |
| 34 } |
| 35 |
| 36 @Override |
| 37 protected void initializeSplashScreenWidgets(final int backgroundColor) { |
| 38 // TODO(hanxi): Removes this function and use {@link WebApkActivity}'s i
mplementation |
| 39 // when WebAPKs are registered in WebappRegistry. |
| 40 initializeSplashScreenWidgets(backgroundColor, null); |
| 41 } |
| 42 } |
OLD | NEW |