Commit abbf99f1 authored by Side Yilmaz's avatar Side Yilmaz Committed by Chromium LUCI CQ

Pass the correct profile to the tab_management classes.

This CL gets profile from the current tab model instead of always using
regular profile.

Bug: 1048632
Change-Id: I61458edce798ff205cdd4b2915bbebb58df504ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2567921Reviewed-by: default avatarYue Zhang <yuezhanggg@chromium.org>
Commit-Queue: Side YILMAZ <sideyilmaz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833363}
parent 09b01647
......@@ -310,9 +310,7 @@ public class MultiThumbnailCardProvider implements TabListMediator.ThumbnailProv
}
public void initWithNative() {
// TODO (https://crbug.com/1048632): Use the current profile (i.e., regular profile or
// incognito profile) instead of always using regular profile. It works correctly now, but
// it is not safe.
Profile profile = mTabModelSelector.getCurrentModel().getProfile();
mTabListFaviconProvider.initWithNative(Profile.getLastUsedRegularProfile());
}
......
......@@ -77,6 +77,7 @@ public class TabListCoordinator implements Destroyable {
private final Context mContext;
private final TabListModel mModel;
private final @UiType int mItemType;
private final TabModelSelector mTabModelSelector;
private boolean mIsInitialized;
private ViewTreeObserver.OnGlobalLayoutListener mGlobalLayoutListener;
......@@ -116,6 +117,7 @@ public class TabListCoordinator implements Destroyable {
mContext = context;
mModel = new TabListModel();
mAdapter = new SimpleRecyclerViewAdapter(mModel);
mTabModelSelector = tabModelSelector;
RecyclerView.RecyclerListener recyclerListener = null;
if (mMode == TabListMode.GRID || mMode == TabListMode.CAROUSEL) {
mAdapter.registerType(UiType.SELECTABLE, parent -> {
......@@ -231,9 +233,6 @@ public class TabListCoordinator implements Destroyable {
mRecyclerView.setHasFixedSize(true);
if (recyclerListener != null) mRecyclerView.setRecyclerListener(recyclerListener);
// TODO (https://crbug.com/1048632): Use the current profile (i.e., regular profile or
// incognito profile) instead of always using regular profile. It works correctly now, but
// it is not safe.
TabListFaviconProvider tabListFaviconProvider =
new TabListFaviconProvider(mContext, mMode == TabListMode.STRIP);
......@@ -292,7 +291,7 @@ public class TabListCoordinator implements Destroyable {
mIsInitialized = true;
Profile profile = Profile.getLastUsedRegularProfile();
Profile profile = mTabModelSelector.getCurrentModel().getProfile();
mMediator.initWithNative(profile);
if (dynamicResourceLoader != null) {
mRecyclerView.createDynamicView(dynamicResourceLoader);
......
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