Commit 26f6a124 authored by Michael Thiessen's avatar Michael Thiessen Committed by Commit Bot

Re-use ChromeTabCreator for NoTouchActivity

Turns out we don't really want to use the TabDelegate that
WebAppActivity uses, as it does asynchronous tab loading, and fires an
intent in order to launch the NTP, instead of just opening it in a tab.

This is slightly complicated by some weird initialization ordering
issues (why does CTA initialize the TabModels in initializeCompositor??)
and that we still want new tab link clicks to open in CCT (to avoid
breaking things that need multiple tabs alive at once, like oauth).

Bug: 984019
Change-Id: Iea98cdc0936b374eb985643af8dbb040feeef946
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1742927Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Reviewed-by: default avatarYusuf Ozuysal <yusufo@chromium.org>
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686457}
parent a0fb7719
......@@ -1556,6 +1556,7 @@ chrome_java_sources = [
"java/src/org/chromium/chrome/browser/tabmodel/TabModelObserver.java",
"java/src/org/chromium/chrome/browser/tabmodel/TabModelObserverJniBridge.java",
"java/src/org/chromium/chrome/browser/tabmodel/TabModelOrderController.java",
"java/src/org/chromium/chrome/browser/tabmodel/TabModelOrderControllerImpl.java",
"java/src/org/chromium/chrome/browser/tabmodel/TabModelSelector.java",
"java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorBase.java",
"java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorImpl.java",
......
......@@ -50,12 +50,12 @@ public abstract class SingleTabActivity extends ChromeActivity {
}
@Override
protected Pair<TabDelegate, TabDelegate> createTabCreators() {
return Pair.create(createTabDelegate(false), createTabDelegate(true));
protected Pair<? extends TabCreator, ? extends TabCreator> createTabCreators() {
return Pair.create(createTabCreator(false), createTabCreator(true));
}
/** Creates TabDelegates for opening new Tabs. */
protected TabDelegate createTabDelegate(boolean incognito) {
protected TabCreator createTabCreator(boolean incognito) {
return new TabDelegate(incognito);
}
......
......@@ -77,6 +77,7 @@ public class SingleTabModel implements TabModel {
@Override
public int indexOf(Tab tab) {
if (tab == null) return INVALID_TAB_INDEX;
return mTab != null && mTab.getId() == tab.getId() ? 0 : INVALID_TAB_INDEX;
}
......@@ -190,7 +191,9 @@ public class SingleTabModel implements TabModel {
}
@Override
public void addTab(Tab tab, int index, @TabLaunchType int type) {}
public void addTab(Tab tab, int index, @TabLaunchType int type) {
setTab(tab);
}
@Override
public void removeTab(Tab tab) {
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Copyright 2019 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.tabmodel;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabAttributeKeys;
import org.chromium.chrome.browser.tab.TabAttributes;
/**
* This class acts as a controller for determining where tabs should be inserted
* into a tab strip model. See tab_strip_model_order_controller.cc and
* tab_strip_model.cc
* into a tab strip model.
*/
public class TabModelOrderController {
private static final int NO_TAB = -1;
private final TabModelSelector mTabModelSelector;
public TabModelOrderController(TabModelSelector modelSelector) {
mTabModelSelector = modelSelector;
}
public interface TabModelOrderController {
/**
* Determine the insertion index of the next tab. If it's not the result of
* a link being pressed, the provided index will be returned.
......@@ -29,20 +18,7 @@ public class TabModelOrderController {
* @param position The provided position.
* @return Where to insert the tab.
*/
public int determineInsertionIndex(@TabLaunchType int type, int position, Tab newTab) {
if (type == TabLaunchType.FROM_BROWSER_ACTIONS) return -1;
if (linkClicked(type)) {
position = determineInsertionIndex(type, newTab);
}
if (willOpenInForeground(type, newTab.isIncognito())) {
// Forget any existing relationships, we don't want to make things
// too confusing by having multiple groups active at the same time.
forgetAllOpeners();
}
return position;
}
int determineInsertionIndex(@TabLaunchType int type, int position, Tab newTab);
/**
* Determine the insertion index of the next tab.
......@@ -50,88 +26,7 @@ public class TabModelOrderController {
* @param type The launch type of the new tab.
* @return Where to insert the tab.
*/
public int determineInsertionIndex(@TabLaunchType int type, Tab newTab) {
TabModel currentModel = mTabModelSelector.getCurrentModel();
if (sameModelType(currentModel, newTab)) {
Tab currentTab = TabModelUtils.getCurrentTab(currentModel);
if (currentTab == null) {
assert (currentModel.getCount() == 0);
return 0;
}
int currentId = currentTab.getId();
int currentIndex = TabModelUtils.getTabIndexById(currentModel, currentId);
if (willOpenInForeground(type, newTab.isIncognito())) {
// If the tab was opened in the foreground, insert it adjacent to its parent tab if
// that exists and that tab is not the current selected tab, else insert the tab
// adjacent to the current tab that opened that link.
Tab parentTab = TabModelUtils.getTabById(currentModel, newTab.getParentId());
if (parentTab != null && currentTab != parentTab) {
int parentTabIndex =
TabModelUtils.getTabIndexById(currentModel, parentTab.getId());
return parentTabIndex + 1;
}
return currentIndex + 1;
} else {
// If the tab was opened in the background, position at the end of
// it's 'group'.
int index = getIndexOfLastTabOpenedBy(currentId, currentIndex);
if (index != NO_TAB) {
return index + 1;
} else {
return currentIndex + 1;
}
}
} else {
// If the tab is opening in the other model type, just put it at the end.
return mTabModelSelector.getModel(newTab.isIncognito()).getCount();
}
}
/**
* Returns the index of the last tab in the model opened by the specified
* opener, starting at startIndex. To clarify, the tabs are traversed in the
* descending order of their position in the model. This means that the tab
* furthest in the stack with the given opener id will be returned.
*
* @param openerId The opener of interest.
* @param startIndex The start point of the search.
* @return The last tab if found, NO_TAB otherwise.
*/
private int getIndexOfLastTabOpenedBy(int openerId, int startIndex) {
TabModel currentModel = mTabModelSelector.getCurrentModel();
int count = currentModel.getCount();
for (int i = count - 1; i >= startIndex; i--) {
Tab tab = currentModel.getTabAt(i);
if (tab.getParentId() == openerId
&& TabAttributes.from(tab).get(TabAttributeKeys.GROUPED_WITH_PARENT, true)) {
return i;
}
}
return NO_TAB;
}
/**
* Clear the opener attribute on all tabs in the model.
*/
void forgetAllOpeners() {
TabModel currentModel = mTabModelSelector.getCurrentModel();
int count = currentModel.getCount();
for (int i = 0; i < count; i++) {
TabAttributes.from(currentModel.getTabAt(i))
.set(TabAttributeKeys.GROUPED_WITH_PARENT, false);
}
}
/**
* Determine if a launch type is the result of linked being clicked.
*/
static boolean linkClicked(@TabLaunchType int type) {
return type == TabLaunchType.FROM_LINK
|| type == TabLaunchType.FROM_LONGPRESS_FOREGROUND
|| type == TabLaunchType.FROM_LONGPRESS_BACKGROUND;
}
int determineInsertionIndex(@TabLaunchType int type, Tab newTab);
/**
* Determine if a launch type will result in the tab being opened in the
......@@ -140,19 +35,5 @@ public class TabModelOrderController {
* @param isNewTabIncognito True if the new opened tab is incognito.
* @return True if the tab will be in the foreground
*/
public boolean willOpenInForeground(@TabLaunchType int type, boolean isNewTabIncognito) {
// Restore is handling the active index by itself.
if (type == TabLaunchType.FROM_RESTORE || type == TabLaunchType.FROM_BROWSER_ACTIONS) {
return false;
}
return type != TabLaunchType.FROM_LONGPRESS_BACKGROUND
|| (!mTabModelSelector.isIncognitoSelected() && isNewTabIncognito);
}
/**
* @return {@code true} If both tabs have the same model type, {@code false} otherwise.
*/
static boolean sameModelType(TabModel model, Tab tab) {
return model.isIncognito() == tab.isIncognito();
}
boolean willOpenInForeground(@TabLaunchType int type, boolean isNewTabIncognito);
}
// Copyright 2014 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.tabmodel;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabAttributeKeys;
import org.chromium.chrome.browser.tab.TabAttributes;
/**
* Implementation of the TabModelOrderController based off of tab_strip_model_order_controller.cc
* and tab_strip_model.cc
*/
public class TabModelOrderControllerImpl implements TabModelOrderController {
private static final int NO_TAB = -1;
private final TabModelSelector mTabModelSelector;
public TabModelOrderControllerImpl(TabModelSelector modelSelector) {
mTabModelSelector = modelSelector;
}
@Override
public int determineInsertionIndex(@TabLaunchType int type, int position, Tab newTab) {
if (type == TabLaunchType.FROM_BROWSER_ACTIONS) return -1;
if (linkClicked(type)) {
position = determineInsertionIndex(type, newTab);
}
if (willOpenInForeground(type, newTab.isIncognito())) {
// Forget any existing relationships, we don't want to make things
// too confusing by having multiple groups active at the same time.
forgetAllOpeners();
}
return position;
}
@Override
public int determineInsertionIndex(@TabLaunchType int type, Tab newTab) {
TabModel currentModel = mTabModelSelector.getCurrentModel();
if (sameModelType(currentModel, newTab)) {
Tab currentTab = TabModelUtils.getCurrentTab(currentModel);
if (currentTab == null) {
assert (currentModel.getCount() == 0);
return 0;
}
int currentId = currentTab.getId();
int currentIndex = TabModelUtils.getTabIndexById(currentModel, currentId);
if (willOpenInForeground(type, newTab.isIncognito())) {
// If the tab was opened in the foreground, insert it adjacent to its parent tab if
// that exists and that tab is not the current selected tab, else insert the tab
// adjacent to the current tab that opened that link.
Tab parentTab = TabModelUtils.getTabById(currentModel, newTab.getParentId());
if (parentTab != null && currentTab != parentTab) {
int parentTabIndex =
TabModelUtils.getTabIndexById(currentModel, parentTab.getId());
return parentTabIndex + 1;
}
return currentIndex + 1;
} else {
// If the tab was opened in the background, position at the end of
// it's 'group'.
int index = getIndexOfLastTabOpenedBy(currentId, currentIndex);
if (index != NO_TAB) {
return index + 1;
} else {
return currentIndex + 1;
}
}
} else {
// If the tab is opening in the other model type, just put it at the end.
return mTabModelSelector.getModel(newTab.isIncognito()).getCount();
}
}
/**
* Returns the index of the last tab in the model opened by the specified
* opener, starting at startIndex. To clarify, the tabs are traversed in the
* descending order of their position in the model. This means that the tab
* furthest in the stack with the given opener id will be returned.
*
* @param openerId The opener of interest.
* @param startIndex The start point of the search.
* @return The last tab if found, NO_TAB otherwise.
*/
private int getIndexOfLastTabOpenedBy(int openerId, int startIndex) {
TabModel currentModel = mTabModelSelector.getCurrentModel();
int count = currentModel.getCount();
for (int i = count - 1; i >= startIndex; i--) {
Tab tab = currentModel.getTabAt(i);
if (tab.getParentId() == openerId
&& TabAttributes.from(tab).get(TabAttributeKeys.GROUPED_WITH_PARENT, true)) {
return i;
}
}
return NO_TAB;
}
/**
* Clear the opener attribute on all tabs in the model.
*/
void forgetAllOpeners() {
TabModel currentModel = mTabModelSelector.getCurrentModel();
int count = currentModel.getCount();
for (int i = 0; i < count; i++) {
TabAttributes.from(currentModel.getTabAt(i))
.set(TabAttributeKeys.GROUPED_WITH_PARENT, false);
}
}
/**
* Determine if a launch type is the result of linked being clicked.
*/
static boolean linkClicked(@TabLaunchType int type) {
return type == TabLaunchType.FROM_LINK || type == TabLaunchType.FROM_LONGPRESS_FOREGROUND
|| type == TabLaunchType.FROM_LONGPRESS_BACKGROUND;
}
@Override
public boolean willOpenInForeground(@TabLaunchType int type, boolean isNewTabIncognito) {
// Restore is handling the active index by itself.
if (type == TabLaunchType.FROM_RESTORE || type == TabLaunchType.FROM_BROWSER_ACTIONS) {
return false;
}
return type != TabLaunchType.FROM_LONGPRESS_BACKGROUND
|| (!mTabModelSelector.isIncognitoSelected() && isNewTabIncognito);
}
/**
* @return {@code true} If both tabs have the same model type, {@code false} otherwise.
*/
static boolean sameModelType(TabModel model, Tab tab) {
return model.isIncognito() == tab.isIncognito();
}
}
......@@ -79,7 +79,7 @@ public class TabModelSelectorImpl extends TabModelSelectorBase implements TabMod
mIsTabbedActivityForSync = isTabbedActivity;
mTabSaver = new TabPersistentStore(
persistencePolicy, this, mTabCreatorManager, persistentStoreObserver);
mOrderController = new TabModelOrderController(this);
mOrderController = new TabModelOrderControllerImpl(this);
}
@Override
......
......@@ -49,7 +49,6 @@ import org.chromium.chrome.browser.tab.TabDelegateFactory;
import org.chromium.chrome.browser.tab.TabObserver;
import org.chromium.chrome.browser.tab.TabObserverRegistrar;
import org.chromium.chrome.browser.tab.TabState;
import org.chromium.chrome.browser.tabmodel.document.TabDelegate;
import org.chromium.chrome.browser.toolbar.top.ToolbarControlContainer;
import org.chromium.chrome.browser.util.ColorUtils;
import org.chromium.chrome.browser.widget.TintedDrawable;
......@@ -834,7 +833,7 @@ public class WebappActivity extends SingleTabActivity {
}
@Override
protected TabDelegate createTabDelegate(boolean incognito) {
protected TabCreator createTabCreator(boolean incognito) {
return new WebappTabDelegate(incognito, mWebappInfo);
}
......
......@@ -75,7 +75,7 @@ public class TabModelSelectorObserverTestRule extends ChromeBrowserTestRule {
}
};
TabModelOrderController orderController = new TabModelOrderController(mSelector);
TabModelOrderController orderController = new TabModelOrderControllerImpl(mSelector);
TabContentManager tabContentManager =
new TabContentManager(InstrumentationRegistry.getTargetContext(), null, false);
TabPersistencePolicy persistencePolicy = new TabbedModeTabPersistencePolicy(0, false);
......
......@@ -179,7 +179,7 @@ public class TabPersistentStoreTest {
mTabCreatorManager, mTabPersistentStoreObserver);
}
});
mTabModelOrderController = new TabModelOrderController(this);
mTabModelOrderController = new TabModelOrderControllerImpl(this);
Callable<TabModelImpl> callable = new Callable<TabModelImpl>() {
@Override
......
......@@ -30,7 +30,6 @@ import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabDelegateFactory;
import org.chromium.chrome.browser.tab.TabRedirectHandler;
import org.chromium.chrome.browser.tab.TabState;
import org.chromium.chrome.browser.tabmodel.document.TabDelegate;
import org.chromium.chrome.browser.util.UrlConstants;
import org.chromium.content_public.browser.LoadUrlParams;
import org.chromium.content_public.common.Referrer;
......@@ -145,6 +144,12 @@ public class NoTouchActivity extends SingleTabActivity {
// we need to clear it due to inactivity, we should do it before calling
// super#initializeState.
if (launchNtpDueToInactivity) resetSavedInstanceState();
((TouchlessTabCreator) getTabCreator(false))
.setTabModel(getTabModelSelector().getModel(false));
((TouchlessTabCreator) getTabCreator(true))
.setTabModel(getTabModelSelector().getModel(true));
super.initializeState();
// By this point if we were going to restore a URL from savedInstanceState we would already
......@@ -284,7 +289,7 @@ public class NoTouchActivity extends SingleTabActivity {
}
@Override
protected TabDelegate createTabDelegate(boolean incognito) {
return new TouchlessTabDelegate(incognito);
protected TabCreator createTabCreator(boolean incognito) {
return new TouchlessTabCreator(this, getWindowAndroid(), incognito);
}
}
// Copyright 2019 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.touchless;
import android.content.Intent;
import android.net.Uri;
import android.provider.Browser;
import androidx.browser.customtabs.CustomTabsIntent;
import org.chromium.base.ContextUtils;
import org.chromium.chrome.browser.IntentHandler;
import org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider;
import org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider.LaunchSourceType;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabIdManager;
import org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager;
import org.chromium.chrome.browser.tabmodel.ChromeTabCreator;
import org.chromium.chrome.browser.tabmodel.TabLaunchType;
import org.chromium.chrome.browser.tabmodel.TabModel;
import org.chromium.chrome.browser.tabmodel.TabModelOrderController;
import org.chromium.chrome.browser.tabmodel.document.AsyncTabCreationParams;
import org.chromium.chrome.browser.tabmodel.document.TabDelegate;
import org.chromium.chrome.browser.util.UrlUtilities;
import org.chromium.content_public.browser.LoadUrlParams;
import org.chromium.content_public.browser.WebContents;
import org.chromium.ui.base.WindowAndroid;
/**
* Creates Tabs for navigation originating from {@link NoTouchActivity}.
*
* This is the same as the parent class with exception of opening a Custom Tab instead of creating a
* new tab in Chrome for links that open in new tabs.
*/
public class TouchlessTabCreator extends ChromeTabCreator {
private final TabDelegate mAsyncTabDelegate;
private final TabModelOrderController mOrderController;
public TouchlessTabCreator(NoTouchActivity activity, WindowAndroid window, boolean incognito) {
super(activity, window, incognito);
mAsyncTabDelegate = new TabDelegate(incognito) {
@Override
public void createNewTab(
AsyncTabCreationParams asyncParams, @TabLaunchType int type, int parentId) {
String url = asyncParams.getLoadUrlParams().getUrl();
int assignedTabId = TabIdManager.getInstance().generateValidId(Tab.INVALID_TAB_ID);
AsyncTabParamsManager.add(assignedTabId, asyncParams);
Intent intent = new CustomTabsIntent.Builder().setShowTitle(true).build().intent;
intent.setData(Uri.parse(url));
intent.putExtra(
CustomTabIntentDataProvider.EXTRA_SEND_TO_EXTERNAL_DEFAULT_HANDLER, true);
intent.putExtra(CustomTabIntentDataProvider.EXTRA_IS_OPENED_BY_CHROME, true);
intent.putExtra(CustomTabIntentDataProvider.EXTRA_IS_OPENED_BY_WEBAPK, false);
intent.putExtra(CustomTabIntentDataProvider.EXTRA_BROWSER_LAUNCH_SOURCE,
LaunchSourceType.OTHER);
intent.putExtra(Browser.EXTRA_APPLICATION_ID,
ContextUtils.getApplicationContext().getPackageName());
addAsyncTabExtras(
asyncParams, parentId, false /* isChromeUI */, assignedTabId, intent);
IntentHandler.startActivityForTrustedIntent(intent);
}
};
mOrderController = new TabModelOrderController() {
@Override
public int determineInsertionIndex(int type, int position, Tab newTab) {
return 0;
}
@Override
public int determineInsertionIndex(int type, Tab newTab) {
return 0;
}
@Override
public boolean willOpenInForeground(int type, boolean isNewTabIncognito) {
return true;
}
};
}
@Override
public boolean createTabWithWebContents(
Tab parent, WebContents webContents, @TabLaunchType int type, String url) {
if (shouldRedirectToCCT(type, url)) {
return mAsyncTabDelegate.createTabWithWebContents(parent, webContents, type, url);
}
return super.createTabWithWebContents(parent, webContents, type, url);
}
@Override
public Tab createNewTab(
LoadUrlParams loadUrlParams, @TabLaunchType int type, Tab parent, Intent intent) {
if (shouldRedirectToCCT(type, loadUrlParams.getUrl())) {
return mAsyncTabDelegate.createNewTab(loadUrlParams, type, parent);
}
return super.createNewTab(loadUrlParams, type, parent, intent);
}
private boolean shouldRedirectToCCT(@TabLaunchType int type, String url) {
// Only link clicks should open in CCT, if the browser opens a tab for, say, intent
// handling, we should continue to open in NoTouchActivity.
// However, we should also handle intent URLs as normal, even if they open in a new window.
return isLinkClickLaunchType(type) && !UrlUtilities.validateIntentUrl(url);
}
private boolean isLinkClickLaunchType(@TabLaunchType int type) {
return type == TabLaunchType.FROM_LINK || type == TabLaunchType.FROM_LONGPRESS_FOREGROUND
|| type == TabLaunchType.FROM_LONGPRESS_BACKGROUND;
}
/* package */ void setTabModel(TabModel model) {
setTabModel(model, mOrderController);
}
}
// Copyright 2019 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.touchless;
import android.content.Intent;
import android.net.Uri;
import android.provider.Browser;
import org.chromium.base.ContextUtils;
import org.chromium.chrome.browser.IntentHandler;
import org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider;
import org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider.LaunchSourceType;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabIdManager;
import org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager;
import org.chromium.chrome.browser.tabmodel.TabLaunchType;
import org.chromium.chrome.browser.tabmodel.document.AsyncTabCreationParams;
import org.chromium.chrome.browser.tabmodel.document.TabDelegate;
import org.chromium.chrome.browser.util.UrlUtilities;
import androidx.browser.customtabs.CustomTabsIntent;
/**
* Asynchronously creates Tabs for navigation originating from {@link NoTouchActivity}.
*
* This is the same as the parent class with exception of opening a Custom Tab instead of creating a
* new tab in Chrome.
*/
public class TouchlessTabDelegate extends TabDelegate {
public TouchlessTabDelegate(boolean incognito) {
super(incognito);
}
@Override
public void createNewTab(
AsyncTabCreationParams asyncParams, @TabLaunchType int type, int parentId) {
if (!isLinkClickLaunchType(type)) {
// Only link clicks should open in CCT, if the browser opens a tab for, say, intent
// handling, we should continue to open in NoTouchActivity.
super.createNewTab(asyncParams, type, parentId);
return;
}
if (UrlUtilities.validateIntentUrl(asyncParams.getLoadUrlParams().getUrl())) {
// Handle intent URLs as normal.
super.createNewTab(asyncParams, type, parentId);
return;
}
String url = asyncParams.getLoadUrlParams().getUrl();
int assignedTabId = TabIdManager.getInstance().generateValidId(Tab.INVALID_TAB_ID);
AsyncTabParamsManager.add(assignedTabId, asyncParams);
Intent intent = new CustomTabsIntent.Builder().setShowTitle(true).build().intent;
intent.setData(Uri.parse(url));
intent.putExtra(CustomTabIntentDataProvider.EXTRA_SEND_TO_EXTERNAL_DEFAULT_HANDLER, true);
intent.putExtra(CustomTabIntentDataProvider.EXTRA_IS_OPENED_BY_CHROME, true);
intent.putExtra(CustomTabIntentDataProvider.EXTRA_IS_OPENED_BY_WEBAPK, false);
intent.putExtra(
CustomTabIntentDataProvider.EXTRA_BROWSER_LAUNCH_SOURCE, LaunchSourceType.OTHER);
intent.putExtra(Browser.EXTRA_APPLICATION_ID,
ContextUtils.getApplicationContext().getPackageName());
addAsyncTabExtras(asyncParams, parentId, false /* isChromeUI */, assignedTabId, intent);
IntentHandler.startActivityForTrustedIntent(intent);
}
private boolean isLinkClickLaunchType(@TabLaunchType int type) {
return type == TabLaunchType.FROM_LINK || type == TabLaunchType.FROM_LONGPRESS_FOREGROUND
|| type == TabLaunchType.FROM_LONGPRESS_BACKGROUND;
}
}
......@@ -44,7 +44,7 @@ touchless_java_sources = [
"touchless/java/src/org/chromium/chrome/browser/touchless/TouchlessPreferences.java",
"touchless/java/src/org/chromium/chrome/browser/touchless/TouchlessRecyclerView.java",
"touchless/java/src/org/chromium/chrome/browser/touchless/TouchlessSuggestionsBinder.java",
"touchless/java/src/org/chromium/chrome/browser/touchless/TouchlessTabDelegate.java",
"touchless/java/src/org/chromium/chrome/browser/touchless/TouchlessTabCreator.java",
"touchless/java/src/org/chromium/chrome/browser/touchless/TouchlessTabObserver.java",
"touchless/java/src/org/chromium/chrome/browser/touchless/TouchlessUiCoordinator.java",
"touchless/java/src/org/chromium/chrome/browser/touchless/TouchlessUiCoordinatorImpl.java",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment