Commit bff8e317 authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Extensions UI] Rename some "overflow" references to "unpinned"

The "overflow" menu referred to the old extensions toolbar UI; now we
use the terminology of "pinned" and "unpinned". Update a few of these
sites - most notably in the ExtensionContextMenuModel.

Note: This deliberately does not update any references in old UI code,
since those still (conceptually) refer to the overflow menu.

Bug: 1100412
Change-Id: I2d3f968f548f43e9aaa1e4d7fa01b99c1ef4f02c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2387137
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803441}
parent 822e5350
......@@ -90,7 +90,7 @@ int GetVisibilityStringId(
const Extension* extension,
ExtensionContextMenuModel::ButtonVisibility button_visibility) {
if (base::FeatureList::IsEnabled(features::kExtensionsToolbarMenu)) {
return button_visibility == ExtensionContextMenuModel::VISIBLE
return button_visibility == ExtensionContextMenuModel::PINNED
? IDS_EXTENSIONS_UNPIN_FROM_TOOLBAR
: IDS_EXTENSIONS_PIN_TO_TOOLBAR;
}
......@@ -100,13 +100,13 @@ int GetVisibilityStringId(
// "transitively shown" buttons that are shown only while the button has a
// popup or menu visible.
switch (button_visibility) {
case (ExtensionContextMenuModel::VISIBLE):
case (ExtensionContextMenuModel::PINNED):
string_id = IDS_EXTENSIONS_HIDE_BUTTON_IN_MENU;
break;
case (ExtensionContextMenuModel::TRANSITIVELY_VISIBLE):
string_id = IDS_EXTENSIONS_KEEP_BUTTON_IN_TOOLBAR;
break;
case (ExtensionContextMenuModel::OVERFLOWED):
case (ExtensionContextMenuModel::UNPINNED):
string_id = IDS_EXTENSIONS_SHOW_BUTTON_IN_TOOLBAR;
break;
}
......@@ -338,7 +338,7 @@ void ExtensionContextMenuModel::ExecuteCommand(int command_id,
ExtensionTabUtil::OpenOptionsPage(extension, browser_);
break;
case TOGGLE_VISIBILITY: {
bool currently_visible = button_visibility_ == VISIBLE;
bool currently_visible = button_visibility_ == PINNED;
ToolbarActionsModel::Get(browser_->profile())
->SetActionVisibility(extension->id(), !currently_visible);
break;
......
......@@ -69,16 +69,18 @@ class ExtensionContextMenuModel : public ui::SimpleMenuModel,
kMaxValue = kPageAccessLearnMore,
};
// The current visibility of the button; this can affect the "hide"/"show"
// The current visibility of the extension; this affects the "pin" / "unpin"
// strings in the menu.
// TODO(devlin): Update these to be more appropriate for the extensions menu.
// TODO(devlin): Rename this "PinState" when we finish removing the old UI
// bits.
enum ButtonVisibility {
// The button is visible on the toolbar.
VISIBLE,
// The button is temporarily visible on the toolbar, as for showign a popup.
// The extension is pinned on the toolbar.
PINNED,
// The extension is temporarily visible on the toolbar, as for showing a
// popup.
TRANSITIVELY_VISIBLE,
// The button is showed in the overflow menu.
OVERFLOWED
// The extension is not pinned (and is shown in the extensions menu).
UNPINNED,
};
// Delegate to handle showing an ExtensionAction popup.
......
......@@ -381,9 +381,9 @@ IN_PROC_BROWSER_TEST_F(CommandsApiTest, InactivePageActionDoesntTrigger) {
"pageAction.onClicked", expect_dispatch);
}
// Tests that a page action that is overflowed will still properly trigger when
// the keybinding is used.
IN_PROC_BROWSER_TEST_F(CommandsApiTest, OverflowedPageActionTriggers) {
// Tests that a page action that is unpinned and only shown within the
// extensions menu will still properly trigger when the keybinding is used.
IN_PROC_BROWSER_TEST_F(CommandsApiTest, UnpinnedPageActionTriggers) {
base::AutoReset<bool> disable_toolbar_animations(
&ToolbarActionsBar::disable_animations_for_testing_, true);
......
......@@ -503,12 +503,12 @@ extensions::ExtensionContextMenuModel::ButtonVisibility
ToolbarActionsBar::GetActionVisibility(
const ToolbarActionViewController* action) const {
extensions::ExtensionContextMenuModel::ButtonVisibility visibility =
extensions::ExtensionContextMenuModel::VISIBLE;
extensions::ExtensionContextMenuModel::PINNED;
if (GetPoppedOutAction() == action) {
visibility = extensions::ExtensionContextMenuModel::TRANSITIVELY_VISIBLE;
} else if (!IsActionVisibleOnToolbar(action)) {
visibility = extensions::ExtensionContextMenuModel::OVERFLOWED;
visibility = extensions::ExtensionContextMenuModel::UNPINNED;
}
return visibility;
}
......
......@@ -91,7 +91,7 @@ class ExtensionsMenuViewBrowserTest : public ExtensionsToolbarBrowserTest {
"ExtensionUninstallDialogDelegateView");
extensions::ExtensionContextMenuModel menu_model(
extensions()[0].get(), browser(),
extensions::ExtensionContextMenuModel::VISIBLE, nullptr,
extensions::ExtensionContextMenuModel::PINNED, nullptr,
false /* can_show_icon_in_toolbar */);
menu_model.ExecuteCommand(
extensions::ExtensionContextMenuModel::UNINSTALL, 0);
......@@ -557,7 +557,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewBrowserTest,
// browser.
extensions::ExtensionContextMenuModel menu(
extensions()[0].get(), incognito_browser(),
extensions::ExtensionContextMenuModel::VISIBLE, nullptr,
extensions::ExtensionContextMenuModel::PINNED, nullptr,
true /* can_show_icon_in_toolbar */);
EXPECT_FALSE(menu.IsCommandIdEnabled(
extensions::ExtensionContextMenuModel::TOGGLE_VISIBILITY));
......
......@@ -276,13 +276,13 @@ extensions::ExtensionContextMenuModel::ButtonVisibility
ExtensionsToolbarContainer::GetActionVisibility(
const ToolbarActionViewController* action) const {
extensions::ExtensionContextMenuModel::ButtonVisibility visibility =
extensions::ExtensionContextMenuModel::VISIBLE;
extensions::ExtensionContextMenuModel::PINNED;
if (ShouldForceVisibility(action->GetId()) &&
!model_->IsActionPinned(action->GetId())) {
visibility = extensions::ExtensionContextMenuModel::TRANSITIVELY_VISIBLE;
} else if (!IsActionVisibleOnToolbar(action)) {
visibility = extensions::ExtensionContextMenuModel::OVERFLOWED;
visibility = extensions::ExtensionContextMenuModel::UNPINNED;
}
return visibility;
}
......
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