Commit 9d60fcef authored by spqchan's avatar spqchan Committed by Commit bot

Added the "Show as Tab" option for popups on OSX

Added the "Show as Tab" option under the Window menu.
The option only appears if the current window is not tabbed.

BUG=43953

Review URL: https://codereview.chromium.org/1681863005

Cr-Commit-Position: refs/heads/master@{#374690}
parent 651fa124
......@@ -492,6 +492,11 @@ CA
<action selector="commandDispatch:" target="-1" id="530"/>
</connections>
</menuItem>
<menuItem title="^IDS_SHOW_AS_TAB" tag="34029" id="470">
<connections>
<action selector="commandDispatch:" target="-1" id="559"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="551"/>
<menuItem title="^IDS_SHOW_DOWNLOADS_MAC" tag="40012" keyEquivalent="J" id="550">
<connections>
......
......@@ -982,6 +982,16 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
![self keyWindowIsModal] : NO;
}
}
// "Show as tab" should only appear when the current window is a popup.
// Since |validateUserInterfaceItem:| is called only when there are no
// key windows, we should just hide this.
// This is handled outside of the switch statement because we want to hide
// this regardless if the command is supported or not.
if (tag == IDC_SHOW_AS_TAB) {
NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item);
[menuItem setHidden:YES];
}
} else if (action == @selector(terminate:)) {
enable = YES;
} else if (action == @selector(showPreferences:)) {
......
......@@ -219,6 +219,13 @@ Browser* FindBrowserForSender(id sender, NSWindow* window) {
[menuItem setHidden:YES];
enable = NO;
}
break;
}
case IDC_SHOW_AS_TAB: {
// Hide this menu option if the window is tabbed.
NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item);
[menuItem setHidden:browser->is_type_tabbed()];
break;
}
default:
// Special handling for the contents of the Text Encoding submenu. On
......
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