diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-08 23:49:37 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-08 23:49:37 +0000 |
commit | ce154da766f16bc59390de94726587645c5fed2b (patch) | |
tree | 41bfaea4689fbbbb6801bf85ce52ff2430456f8f /chrome | |
parent | 446b42d218dfb6ba77b88c3d6ebde73a51fbf423 (diff) | |
download | chromium_src-ce154da766f16bc59390de94726587645c5fed2b.zip chromium_src-ce154da766f16bc59390de94726587645c5fed2b.tar.gz chromium_src-ce154da766f16bc59390de94726587645c5fed2b.tar.bz2 |
Improve handling of plugin context menus on Leopard.
Don't switch to the plugin process when bringing up the dummy window that holds context menus on 10.5. This improves key handling in the menu, as well as preventing the browser window from dimming.
BUG=40058
TEST=Right-click on a Flash instance on 10.5 using Flash 10.1. The window should appear to stay focused, and the menu should respond to keys (up, down, esc).
Review URL: http://codereview.chromium.org/1631004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/plugin/plugin_interpose_util_mac.mm | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/chrome/plugin/plugin_interpose_util_mac.mm b/chrome/plugin/plugin_interpose_util_mac.mm index 8980eb4..e410ec1 100644 --- a/chrome/plugin/plugin_interpose_util_mac.mm +++ b/chrome/plugin/plugin_interpose_util_mac.mm @@ -134,7 +134,12 @@ static void OnPluginWindowShown(const WindowInfo& window_info, BOOL is_modal) { } @interface NSWindow (ChromePluginUtilities) +// Returns YES if the window is visible and actually on the screen. - (BOOL)chromePlugin_isWindowOnScreen; +// Returns YES if the window is the dummy window we use for popup menus; +// see PluginInstance::PopUpContextMenu. +// This can be removed once 10.5 is no longer supported. +- (BOOL)chromePlugin_isPopupMenuWindow; @end @implementation NSWindow (ChromePluginUtilities) @@ -150,6 +155,10 @@ static void OnPluginWindowShown(const WindowInfo& window_info, BOOL is_modal) { return NO; } +- (BOOL)chromePlugin_isPopupMenuWindow { + return [[self title] isEqualToString:@"PopupMenuDummy"]; +} + @end @interface NSWindow (ChromePluginInterposing) @@ -169,20 +178,22 @@ static void OnPluginWindowShown(const WindowInfo& window_info, BOOL is_modal) { - (void)chromePlugin_orderFront:(id)sender { [self chromePlugin_orderFront:sender]; - if ([self chromePlugin_isWindowOnScreen]) + if ([self chromePlugin_isWindowOnScreen] && + ![self chromePlugin_isPopupMenuWindow]) mac_plugin_interposing::SwitchToPluginProcess(); OnPluginWindowShown(WindowInfo(self), NO); } - (void)chromePlugin_makeKeyAndOrderFront:(id)sender { [self chromePlugin_makeKeyAndOrderFront:sender]; - if ([self chromePlugin_isWindowOnScreen]) + if ([self chromePlugin_isWindowOnScreen] && + ![self chromePlugin_isPopupMenuWindow]) mac_plugin_interposing::SwitchToPluginProcess(); OnPluginWindowShown(WindowInfo(self), NO); } - (void)chromePlugin_setWindowNumber:(NSInteger)num { - if (num > 0) + if (num > 0 && ![self chromePlugin_isPopupMenuWindow]) mac_plugin_interposing::SwitchToPluginProcess(); [self chromePlugin_setWindowNumber:num]; if (num > 0) |