Commit d521671f 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
TEST=Right clicking at frame and contents boundaries in tabbed Chrome.

Change-Id: I3c4129641d398e38786cfa7d501edc32f2e92252
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1786935
Auto-Submit: Robert Liao <robliao@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Robert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694319}
parent 35d52688
...@@ -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,34 @@ ...@@ -230,17 +230,34 @@
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
return; // 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) {
if ([[self contentView] hitTest:event.locationInWindow] == nil) {
[[self contentView] rightMouseDown:event];
return;
}
} else if (type == NSRightMouseUp) {
if ([[self contentView] hitTest:event.locationInWindow] == nil) {
[[self contentView] rightMouseUp:event];
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