diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-20 23:13:08 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-20 23:13:08 +0000 |
commit | 7516da7ed78fab9987d9c782c0beb6d36a9565ff (patch) | |
tree | de4cedc37ae6c0abafa2d5d65fc425e119a80839 /chrome/plugin | |
parent | 89ef2e4ef9117683a4e22da5976bfbc08b9bd1b1 (diff) | |
download | chromium_src-7516da7ed78fab9987d9c782c0beb6d36a9565ff.zip chromium_src-7516da7ed78fab9987d9c782c0beb6d36a9565ff.tar.gz chromium_src-7516da7ed78fab9987d9c782c0beb6d36a9565ff.tar.bz2 |
Make Mac plugin _setWindowNumber: interception more focused
We interpose _setWindowNumber: because at the point where we intercept modal dialogs the window ID (which we need to pass to the browser process) hasn't been set yet. However, it also causes some false-positives. This narrows our _setWindowNumber: handling so that it only happens for the next call after we've caught an explicit window-showing call too early to get a window number.
BUG=41936
TEST=Plugin-opened windows (Flash full-screen, Gmail attachments, etc.) should continue to change focus correctly.
Review URL: http://codereview.chromium.org/1727001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45105 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin')
-rw-r--r-- | chrome/plugin/plugin_interpose_util_mac.mm | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/chrome/plugin/plugin_interpose_util_mac.mm b/chrome/plugin/plugin_interpose_util_mac.mm index e410ec1..10f1639 100644 --- a/chrome/plugin/plugin_interpose_util_mac.mm +++ b/chrome/plugin/plugin_interpose_util_mac.mm @@ -115,16 +115,20 @@ static void OnPluginWindowClosed(const WindowInfo& window_info) { window_info.bounds); } +static BOOL g_waiting_for_window_number = NO; + static void OnPluginWindowShown(const WindowInfo& window_info, BOOL is_modal) { // The window id is 0 if it has never been shown (including while it is the // process of being shown for the first time); when that happens, we'll catch // it in _setWindowNumber instead. static BOOL s_pending_display_is_modal = NO; if (window_info.window_id == 0) { + g_waiting_for_window_number = YES; if (is_modal) s_pending_display_is_modal = YES; return; } + g_waiting_for_window_number = NO; if (s_pending_display_is_modal) { is_modal = YES; s_pending_display_is_modal = NO; @@ -193,11 +197,14 @@ static void OnPluginWindowShown(const WindowInfo& window_info, BOOL is_modal) { } - (void)chromePlugin_setWindowNumber:(NSInteger)num { - if (num > 0 && ![self chromePlugin_isPopupMenuWindow]) + if (!g_waiting_for_window_number || num <= 0) { + [self chromePlugin_setWindowNumber:num]; + return; + } + if (![self chromePlugin_isPopupMenuWindow]) mac_plugin_interposing::SwitchToPluginProcess(); [self chromePlugin_setWindowNumber:num]; - if (num > 0) - OnPluginWindowShown(WindowInfo(self), NO); + OnPluginWindowShown(WindowInfo(self), NO); } @end |