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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java

Issue 2984453002: Add Browser Actions tab model selector and open a tab through it if ChromeTabbedActivity is not ava…
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/tab/Tab.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
index 2609171edc35962f998b7e0a8ae23b9c7b1031f8..f4395d6167d66b0821983d2e4a7f68027f054316 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
@@ -351,6 +351,12 @@ public class Tab
*/
private boolean mIsDetached;
+ /**
+ * Indicates whether the history of this tab should be separated from Chrome history.
+ * This is true only for startSpeculation in CCT.
+ */
+ private boolean mIsHistoryDetached;
+
/**
* The UMA object used to report stats for this tab. Note that this may be null under certain
* conditions, such as incognito mode.
@@ -492,7 +498,11 @@ public class Tab
context.getApplicationContext(), ChromeActivity.getThemeId()) : null;
mWindowAndroid = window;
mLaunchType = type;
- if (mLaunchType == TabLaunchType.FROM_DETACHED) mIsDetached = true;
+ if (mLaunchType == TabLaunchType.FROM_DETACHED_SPECULATE
+ || mLaunchType == TabLaunchType.FROM_DETACHED_USER_ACTION) {
+ mIsDetached = true;
+ }
+ if (mLaunchType == TabLaunchType.FROM_DETACHED_SPECULATE) mIsHistoryDetached = true;
if (mThemedApplicationContext != null) {
Resources resources = mThemedApplicationContext.getResources();
mIdealFaviconSize = resources.getDimensionPixelSize(R.dimen.default_favicon_size);
@@ -1294,7 +1304,6 @@ public class Tab
} else {
setContentViewCore(contentViewCore);
}
-
mContentViewCore.addImeEventObserver(new ImeEventObserver() {
@Override
public void onImeEvent() {
@@ -1314,7 +1323,6 @@ public class Tab
if (!creatingWebContents && webContents.isLoadingToDifferentDocument()) {
didStartPageLoad(webContents.getUrl(), false);
}
-
getAppBannerManager().setIsEnabledForTab(mDelegateFactory.canShowAppBanners(this));
} finally {
if (mTimestampMillis == INVALID_TIMESTAMP) {
@@ -1427,6 +1435,7 @@ public class Tab
reparentingParams.finalizeTabReparenting();
mIsDetached = false;
+ mIsHistoryDetached = false;
nativeAttachDetachedTab(mNativeTabAndroid);
// Reload the NativePage (if any), since the old NativePage has a reference to the old
@@ -1670,7 +1679,7 @@ public class Tab
mDownloadDelegate = new ChromeDownloadDelegate(mThemedApplicationContext, this);
assert mNativeTabAndroid != 0;
- nativeInitWebContents(mNativeTabAndroid, mIncognito, mIsDetached,
+ nativeInitWebContents(mNativeTabAndroid, mIncognito, mIsHistoryDetached,
Yusuf 2017/07/18 22:59:47 This param is for isBackgroundTab, right? Is that
ltian 2017/08/07 23:24:12 New design will open all tabs in lazy load mode so
mContentViewCore.getWebContents(), mWebContentsDelegate,
new TabContextMenuPopulator(
mDelegateFactory.createContextMenuPopulator(this), this));
@@ -2954,11 +2963,13 @@ public class Tab
*
* @return The newly created and initialized tab.
*/
- public static Tab createDetached(TabDelegateFactory delegateFactory) {
+ public static Tab createDetached(TabDelegateFactory delegateFactory, boolean byUserAction) {
Context context = ContextUtils.getApplicationContext();
WindowAndroid windowAndroid = new WindowAndroid(context);
- Tab tab = new Tab(INVALID_TAB_ID, INVALID_TAB_ID, false, context, windowAndroid,
- TabLaunchType.FROM_DETACHED, null, null);
+ TabLaunchType launchType = byUserAction ? TabLaunchType.FROM_DETACHED_USER_ACTION
+ : TabLaunchType.FROM_DETACHED_SPECULATE;
+ Tab tab = new Tab(INVALID_TAB_ID, INVALID_TAB_ID, false, context, windowAndroid, launchType,
+ null, null);
tab.initialize(null, null, delegateFactory, true, false);
// Resize the webContent to avoid expensive post load resize when attaching the tab.

Powered by Google App Engine
This is Rietveld 408576698