| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.content.Intent; | 7 import android.content.Intent; |
| 8 import android.os.AsyncTask; | 8 import android.os.AsyncTask; |
| 9 | 9 |
| 10 import org.chromium.base.ContextUtils; | 10 import org.chromium.base.ContextUtils; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 public static void launchTab(final int requestId, final boolean incognito, f
inal String url, | 52 public static void launchTab(final int requestId, final boolean incognito, f
inal String url, |
| 53 final int disposition, final String referrerUrl, final int referrerP
olicy, | 53 final int disposition, final String referrerUrl, final int referrerP
olicy, |
| 54 final String extraHeaders, final ResourceRequestBody postData) { | 54 final String extraHeaders, final ResourceRequestBody postData) { |
| 55 final TabDelegate tabDelegate = new TabDelegate(incognito); | 55 final TabDelegate tabDelegate = new TabDelegate(incognito); |
| 56 | 56 |
| 57 // 1. Launch WebAPK if one matches the target URL. | 57 // 1. Launch WebAPK if one matches the target URL. |
| 58 if (ChromeWebApkHost.isEnabled()) { | 58 if (ChromeWebApkHost.isEnabled()) { |
| 59 String webApkPackageName = | 59 String webApkPackageName = |
| 60 WebApkValidator.queryWebApkPackage(ContextUtils.getApplicati
onContext(), url); | 60 WebApkValidator.queryWebApkPackage(ContextUtils.getApplicati
onContext(), url); |
| 61 if (webApkPackageName != null) { | 61 if (webApkPackageName != null) { |
| 62 Intent intent = | 62 Intent intent = WebApkNavigationClient.createLaunchWebApkIntent( |
| 63 WebApkNavigationClient.createLaunchWebApkIntent(webApkPa
ckageName, url); | 63 webApkPackageName, url, true /* forceNavigation */); |
| 64 if (intent != null) { | 64 if (intent != null) { |
| 65 intent.putExtra(ShortcutHelper.EXTRA_SOURCE, ShortcutSource.
NOTIFICATION); | 65 intent.putExtra(ShortcutHelper.EXTRA_SOURCE, ShortcutSource.
NOTIFICATION); |
| 66 ContextUtils.getApplicationContext().startActivity(intent); | 66 ContextUtils.getApplicationContext().startActivity(intent); |
| 67 return; | 67 return; |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 // 2. Launch WebappActivity if one matches the target URL and was opened
recently. | 72 // 2. Launch WebappActivity if one matches the target URL and was opened
recently. |
| 73 // Otherwise, open the URL in a tab. | 73 // Otherwise, open the URL in a tab. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 * @param requestId Id of the tab launching request which has been fulfilled
. | 126 * @param requestId Id of the tab launching request which has been fulfilled
. |
| 127 * @param webContents The WebContents instance associated with this request. | 127 * @param webContents The WebContents instance associated with this request. |
| 128 */ | 128 */ |
| 129 public static void onWebContentsForRequestAvailable(int requestId, WebConten
ts webContents) { | 129 public static void onWebContentsForRequestAvailable(int requestId, WebConten
ts webContents) { |
| 130 nativeOnWebContentsForRequestAvailable(requestId, webContents); | 130 nativeOnWebContentsForRequestAvailable(requestId, webContents); |
| 131 } | 131 } |
| 132 | 132 |
| 133 private static native void nativeOnWebContentsForRequestAvailable( | 133 private static native void nativeOnWebContentsForRequestAvailable( |
| 134 int requestId, WebContents webContents); | 134 int requestId, WebContents webContents); |
| 135 } | 135 } |
| OLD | NEW |