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

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

Issue 2898373002: Redirects _blank and window.open() off-origin navigation from PWA to CCT. (Closed)
Patch Set: Merge Created 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 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 package org.chromium.chrome.browser.webapps;
5
6 import android.net.Uri;
7 import android.support.customtabs.CustomTabsIntent;
8
9 import org.chromium.chrome.browser.tab.Tab;
10 import org.chromium.chrome.browser.tab.TabIdManager;
11 import org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager;
12 import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType;
13 import org.chromium.chrome.browser.tabmodel.document.AsyncTabCreationParams;
14 import org.chromium.chrome.browser.tabmodel.document.TabDelegate;
15
16 /**
17 * Asynchronously creates Tabs for navigation originating from an installed PWA.
18 *
19 * This is the same as the parent class with exception of opening a Custom Tab f or
20 * {@code _blank} links and {@code window.open(url)} calls instead of creating a new tab in Chrome.
21 */
22 public class WebappTabDelegate extends TabDelegate {
23 private final WebappActivity mActivity;
24
25 public WebappTabDelegate(WebappActivity activity, boolean incognito) {
26 super(incognito);
27 this.mActivity = activity;
28 }
29
30 @Override
31 public void createNewTab(AsyncTabCreationParams asyncParams, TabLaunchType t ype, int parentId) {
32 int assignedTabId = TabIdManager.getInstance().generateValidId(Tab.INVAL ID_TAB_ID);
33 AsyncTabParamsManager.add(assignedTabId, asyncParams);
34
35 CustomTabsIntent customTabIntent =
36 new CustomTabsIntent.Builder().setShowTitle(true).build();
37
38 customTabIntent.intent.setPackage(mActivity.getPackageName());
39 addAsyncTabExtras(asyncParams, parentId, true, assignedTabId, customTabI ntent.intent);
40 customTabIntent.launchUrl(mActivity, Uri.parse(asyncParams.getLoadUrlPar ams().getUrl()));
41 }
42 }
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java ('k') | chrome/android/java_sources.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698