Commit 12c465ec authored by Connie Wan's avatar Connie Wan Committed by Chromium LUCI CQ

Separate AddToNewGroup and OpenTabGroupEditor invocations

This is a no-op for every non-test instance of AddToNewGroup except for here: https://source.chromium.org/chromium/chromium/src/+/master:chrome/browser/extensions/api/tabs/tabs_api.cc;l=1844

So the editor bubble is still auto-opened in almost every case of creating a new group, except when it happens via an extension.

Bug: 1106846
Change-Id: Ide379350893a5a5bc31e2ee653ceacac6c42560e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2613786Reviewed-by: default avatarCharlene Yan <cyan@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Connie Wan <connily@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841107}
parent 909901eb
......@@ -124,6 +124,7 @@ void ConfigureTabGroupForNavigation(NavigateParams* nav_params) {
if (ShouldAutoCreateGroupForNavigation(nav_params)) {
nav_params->group =
model->AddToNewGroup({source_index, source_index + 1});
model->OpenTabGroupEditor(nav_params->group.value());
}
}
}
......
......@@ -1058,7 +1058,6 @@ tab_groups::TabGroupId TabStripModel::AddToNewGroup(
const tab_groups::TabGroupId new_group =
tab_groups::TabGroupId::GenerateNew();
AddToNewGroupImpl(indices, new_group);
OpenTabGroupEditor(new_group);
return new_group;
}
......@@ -1387,10 +1386,12 @@ void TabStripModel::ExecuteContextMenuCommand(int context_index,
case CommandToggleGrouped: {
std::vector<int> indices = GetIndicesForCommand(context_index);
bool group = WillContextMenuGroup(context_index);
if (group)
AddToNewGroup(indices);
else
if (group) {
tab_groups::TabGroupId new_group = AddToNewGroup(indices);
OpenTabGroupEditor(new_group);
} else {
RemoveFromGroup(indices);
}
break;
}
......@@ -1424,7 +1425,9 @@ void TabStripModel::ExecuteContextMenuCommand(int context_index,
case CommandAddToNewGroup: {
base::RecordAction(UserMetricsAction("TabContextMenu_AddToNewGroup"));
AddToNewGroup(GetIndicesForCommand(context_index));
tab_groups::TabGroupId new_group =
AddToNewGroup(GetIndicesForCommand(context_index));
OpenTabGroupEditor(new_group);
break;
}
......
......@@ -25,6 +25,7 @@ class TabGroupEditorBubbleViewDialogBrowserTest : public DialogBrowserTest {
void ShowUi(const std::string& name) override {
tab_groups::TabGroupId group =
browser()->tab_strip_model()->AddToNewGroup({0});
browser()->tab_strip_model()->OpenTabGroupEditor(group);
BrowserView* browser_view = static_cast<BrowserView*>(browser()->window());
TabGroupHeader* header = browser_view->tabstrip()->group_header(group);
......
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