| Index: chrome/browser/ui/cocoa/extensions/browser_action_button.mm
|
| diff --git a/chrome/browser/ui/cocoa/extensions/browser_action_button.mm b/chrome/browser/ui/cocoa/extensions/browser_action_button.mm
|
| index 57854f6ce35fb6a0842a357f2a6241677ae5b54f..ca9620b2fa0b1418f85195ea70b013457870918c 100644
|
| --- a/chrome/browser/ui/cocoa/extensions/browser_action_button.mm
|
| +++ b/chrome/browser/ui/cocoa/extensions/browser_action_button.mm
|
| @@ -111,10 +111,15 @@ ToolbarActionViewDelegateBridge::~ToolbarActionViewDelegateBridge() {
|
| }
|
|
|
| void ToolbarActionViewDelegateBridge::ShowContextMenu() {
|
| - // We should only be showing the context menu in this way if we're doing so
|
| - // for an overflowed action.
|
| - DCHECK(![owner_ superview]);
|
| + DCHECK(![controller_ toolbarActionsBar]->in_overflow_mode());
|
| + if ([owner_ superview]) {
|
| + // If the button is already visible on the toolbar, we can skip ahead to
|
| + // just showing the menu.
|
| + DoShowContextMenu();
|
| + return;
|
| + }
|
|
|
| + // Otherwise, we have to slide the button out.
|
| contextMenuRunning_ = true;
|
| AppMenuController* appMenuController =
|
| [[[BrowserWindowController browserWindowControllerForWindow:
|
| @@ -331,21 +336,7 @@ void ToolbarActionViewDelegateBridge::DoShowContextMenu() {
|
| fromView:nil];
|
| // Only perform the click if we didn't drag the button.
|
| if (NSPointInRect(location, [self bounds]) && !isBeingDragged_) {
|
| - // There's also a chance that the action is disabled, and the left click
|
| - // should show the context menu.
|
| - if (!viewController_->IsEnabled(
|
| - [browserActionsController_ currentWebContents]) &&
|
| - viewController_->DisabledClickOpensMenu()) {
|
| - // No menus-in-menus; see comment in -rightMouseDown:.
|
| - if ([browserActionsController_ isOverflow]) {
|
| - [browserActionsController_ mainButtonForId:viewController_->GetId()]->
|
| - viewControllerDelegate_->ShowContextMenu();
|
| - } else {
|
| - [NSMenu popUpContextMenu:[self menu] withEvent:theEvent forView:self];
|
| - }
|
| - } else {
|
| - [self performClick:self];
|
| - }
|
| + [self performClick:self];
|
| } else {
|
| // Make sure an ESC to end a drag doesn't trigger 2 endDrags.
|
| if (isBeingDragged_) {
|
| @@ -489,6 +480,10 @@ void ToolbarActionViewDelegateBridge::DoShowContextMenu() {
|
| return image;
|
| }
|
|
|
| +- (void)showContextMenu {
|
| + viewControllerDelegate_->ShowContextMenu();
|
| +}
|
| +
|
| - (NSMenu*)menu {
|
| // Hack: Since Cocoa doesn't support menus-running-in-menus (see also comment
|
| // in -rightMouseDown:), it doesn't launch the menu for an overflowed action
|
|
|