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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappTabDelegate.java

Issue 2969143002: Fixes redirects to external apps when navigating from PWA. (Closed)
Patch Set: Created 3 years, 5 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
Index: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappTabDelegate.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappTabDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappTabDelegate.java
index e3e1e9e9a2c74c14e48d61cf70a12c6cf87e00c1..e2831bcf967c1ea558d30f5d184bf7229a1406c8 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappTabDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappTabDelegate.java
@@ -3,9 +3,12 @@
// found in the LICENSE file.
package org.chromium.chrome.browser.webapps;
+import android.content.Intent;
import android.net.Uri;
import android.support.customtabs.CustomTabsIntent;
+import org.chromium.chrome.browser.IntentHandler;
+import org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabIdManager;
import org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager;
@@ -20,11 +23,8 @@ import org.chromium.chrome.browser.tabmodel.document.TabDelegate;
* {@code _blank} links and {@code window.open(url)} calls instead of creating a new tab in Chrome.
*/
public class WebappTabDelegate extends TabDelegate {
- private final WebappActivity mActivity;
-
- public WebappTabDelegate(WebappActivity activity, boolean incognito) {
+ public WebappTabDelegate(boolean incognito) {
super(incognito);
- this.mActivity = activity;
}
@Override
@@ -32,11 +32,12 @@ public class WebappTabDelegate extends TabDelegate {
int assignedTabId = TabIdManager.getInstance().generateValidId(Tab.INVALID_TAB_ID);
AsyncTabParamsManager.add(assignedTabId, asyncParams);
- CustomTabsIntent customTabIntent =
- new CustomTabsIntent.Builder().setShowTitle(true).build();
+ Intent intent = new CustomTabsIntent.Builder().setShowTitle(true).build().intent;
+ intent.setData(Uri.parse(asyncParams.getLoadUrlParams().getUrl()));
+ intent.putExtra(CustomTabIntentDataProvider.EXTRA_SEND_TO_EXTERNAL_DEFAULT_HANDLER, true);
Yusuf 2017/07/07 20:50:02 Good investigation finding out about this! I am s
piotrs 2017/07/09 23:43:38 My patch description wasn't clear enough, I update
+ intent.putExtra(CustomTabIntentDataProvider.EXTRA_IS_OPENED_BY_CHROME, true);
+ addAsyncTabExtras(asyncParams, parentId, false /* isChromeUI */, assignedTabId, intent);
- customTabIntent.intent.setPackage(mActivity.getPackageName());
- addAsyncTabExtras(asyncParams, parentId, true, assignedTabId, customTabIntent.intent);
- customTabIntent.launchUrl(mActivity, Uri.parse(asyncParams.getLoadUrlParams().getUrl()));
+ IntentHandler.startActivityForTrustedIntent(intent);
}
}

Powered by Google App Engine
This is Rietveld 408576698