Commit ac630813 authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Disable menu button for disabled extensions

This removes the confusing behavior where a user clicks a button,
expecting an action to happen, but there is no associated action so we
would instead spawn a context menu.

This now does not look like a clickable button (no hover state) and the
three-dot menu is used to access the context menu for extensions without
actions.

Bug: chromium:943702
Change-Id: I9ae6fe7d549dd2dac2d003fb6f1fecdab66e9c83
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1575859Reviewed-by: default avatarCollin Baker <collinbaker@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652618}
parent fa675414
......@@ -91,6 +91,7 @@ void ExtensionsMenuButton::UpdateState() {
SetTitleTextWithHintRange(controller_->GetActionName(),
gfx::Range::InvalidRange());
SetTooltipText(controller_->GetTooltip(GetCurrentWebContents()));
SetEnabled(controller_->IsEnabled(GetCurrentWebContents()));
}
bool ExtensionsMenuButton::IsMenuRunning() const {
......
......@@ -94,3 +94,11 @@ TEST_F(ExtensionsMenuButtonTest, UpdatesToDisplayTooltip) {
EXPECT_EQ(button_->GetTooltipText(gfx::Point()), tooltip);
}
TEST_F(ExtensionsMenuButtonTest, ButtonMatchesEnabledStateOfExtension) {
EXPECT_TRUE(button_->enabled());
controller_->SetEnabled(false);
EXPECT_FALSE(button_->enabled());
controller_->SetEnabled(true);
EXPECT_TRUE(button_->enabled());
}
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