Skip to content

Commit

Permalink
[Tab Group Parity] Change flags to use cached flags in some instances
Browse files Browse the repository at this point in the history
Change the TabGroupParity flag to use cached flags in some use cases.

Bug: 335691911, 41490324
Change-Id: Ic728178978f7951e0a242ec001e831678d6a53b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5462491
Commit-Queue: Brandon Fong <bjfong@google.com>
Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1289553}
  • Loading branch information
Brandon Fong authored and Chromium LUCI CQ committed Apr 18, 2024
1 parent d0c3d58 commit b4e62fe
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ RecyclerViewPosition getRecyclerViewPosition() {
}

private View.OnClickListener getColorIconClickListener() {
if (ChromeFeatureList.isEnabled(ChromeFeatureList.TAB_GROUP_PARITY_ANDROID)) {
if (ChromeFeatureList.sTabGroupParityAndroid.isEnabled()) {
return (view) -> {
showColorPickerPopup(view);
TabUiMetricsHelper.recordTabGroupColorChangeActionMetrics(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private ModelList buildMenuItems(boolean isIncognito) {
R.style.TextAppearance_TextLarge_Primary_Baseline_Light,
isIncognito,
true));
if (ChromeFeatureList.isEnabled(ChromeFeatureList.TAB_GROUP_PARITY_ANDROID)) {
if (ChromeFeatureList.sTabGroupParityAndroid.isEnabled()) {
itemList.add(
BrowserUiListMenuUtils.buildMenuListItemWithIncognitoText(
R.string.tab_grid_dialog_toolbar_edit_group_color,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private void restoreTabGroup(

// Ensure that the color is set before merging the tabs into a group on restore, to indicate
// that this is not going to be a new group creation.
if (ChromeFeatureList.isEnabled(ChromeFeatureList.TAB_GROUP_PARITY_ANDROID)) {
if (ChromeFeatureList.sTabGroupParityAndroid.isEnabled()) {
groupFilter.setTabGroupColor(rootId, color);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private void buildGroupsAndCreateClosure(List<Tab> tabs) {
String title = TabGroupTitleUtils.getTabGroupTitle(rootId);
// Give a tab group the first color in the color list as a placeholder.
@TabGroupColorId int color = TabGroupColorId.GREY;
if (ChromeFeatureList.isEnabled(ChromeFeatureList.TAB_GROUP_PARITY_ANDROID)) {
if (ChromeFeatureList.sTabGroupParityAndroid.isEnabled()) {
color = TabGroupColorUtils.getOrCreateTabGroupColor(rootId, mTabGroupModelFilter);
}
List<Tab> groupTabs = new ArrayList<Tab>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ public boolean onInterceptTouchEvent(MotionEvent e) {
.addTouchEventObserver(mDragDropTouchObserver);
}

if (ChromeFeatureList.isEnabled(ChromeFeatureList.TAB_GROUP_PARITY_ANDROID)) {
if (ChromeFeatureList.sTabGroupParityAndroid.isEnabled()) {
Runnable onDialogAcceptedRunnable =
() -> {
if (!mTabModelSelectorSupplier.get().isIncognitoSelected()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void createSingleTabGroup(Tab tab, boolean notify) {
mActualGroupCount++;
boolean didCreateNewGroup = true;

if (ChromeFeatureList.isEnabled(ChromeFeatureList.TAB_GROUP_PARITY_ANDROID)) {
if (ChromeFeatureList.sTabGroupParityAndroid.isEnabled()) {
// If the destination group already has an assigned color, then this action is not
// for a new tab group creation. Currently, the only case where this would be called
// and it is not a new tab group creation is when a tab group is restored from the
Expand Down Expand Up @@ -242,7 +242,7 @@ public void mergeTabsToGroup(
boolean didCreateNewGroup =
!isTabInTabGroup(sourceTab) && !isTabInTabGroup(destinationTab);

if (ChromeFeatureList.isEnabled(ChromeFeatureList.TAB_GROUP_PARITY_ANDROID)) {
if (ChromeFeatureList.sTabGroupParityAndroid.isEnabled()) {
destinationGroupColorId = TabGroupColorUtils.getTabGroupColor(destinationRootId);
// If the destination group already has an assigned color, then this action is not
// for a new tab group creation. Currently, the only case where this would be called
Expand Down Expand Up @@ -370,7 +370,7 @@ public void mergeListOfTabsToGroup(
int destinationIndexInTabModel = getTabModelDestinationIndex(destinationTab);
String destinationGroupTitle = TabGroupTitleUtils.getTabGroupTitle(destinationRootId);
int destinationGroupColorId = INVALID_COLOR_ID;
if (ChromeFeatureList.isEnabled(ChromeFeatureList.TAB_GROUP_PARITY_ANDROID)) {
if (ChromeFeatureList.sTabGroupParityAndroid.isEnabled()) {
destinationGroupColorId = TabGroupColorUtils.getTabGroupColor(destinationRootId);
}

Expand Down

0 comments on commit b4e62fe

Please sign in to comment.