Commit a9ef3160 authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Allow a Frame Background Context Menu on Mac

This brings the frame context menu available on other platforms to Mac
and allows users to restore the previously closed tab within the
tabstrip.

BUG=997637

Change-Id: Iaff4cbb6066e52a6ffc969d030b9351051a7a1f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1779019
Commit-Queue: Robert Liao <robliao@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693229}
parent c851534f
...@@ -372,7 +372,7 @@ bool BrowserFrameMac::UseCustomFrame() const { ...@@ -372,7 +372,7 @@ bool BrowserFrameMac::UseCustomFrame() const {
} }
bool BrowserFrameMac::UsesNativeSystemMenu() const { bool BrowserFrameMac::UsesNativeSystemMenu() const {
return true; return false;
} }
bool BrowserFrameMac::ShouldSaveWindowPlacement() const { bool BrowserFrameMac::ShouldSaveWindowPlacement() const {
......
...@@ -230,17 +230,30 @@ ...@@ -230,17 +230,30 @@
return; return;
NSEventType type = [event type]; NSEventType type = [event type];
if ((type != NSKeyDown && type != NSKeyUp) || ![self hasViewsMenuActive]) {
[super sendEvent:event]; // Draggable regions only respond to left-click dragging, but the system will
// still suppress right-clicks in a draggable region. Forwarding right-clicks
// allows the underlying views to respond to right-click to potentially bring
// up a frame context menu.
if (type == NSRightMouseDown) {
[[self contentView] rightMouseDown:event];
return;
} else if (type == NSRightMouseUp) {
[[self contentView] rightMouseUp:event];
return; return;
} else if ([self hasViewsMenuActive]) {
// Send to the menu, after converting the event into an action message using
// the content view.
if (type == NSKeyDown) {
[[self contentView] keyDown:event];
return;
} else if (type == NSKeyUp) {
[[self contentView] keyUp:event];
return;
}
} }
// Send to the menu, after converting the event into an action message using [super sendEvent:event];
// the content view.
if (type == NSKeyDown)
[[self contentView] keyDown:event];
else
[[self contentView] keyUp:event];
} }
// Override window order functions to intercept other visibility changes. This // Override window order functions to intercept other visibility changes. This
......
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