diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-23 22:16:39 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-23 22:16:39 +0000 |
commit | 89822a58b483a88a4ac730b3e83cd86bea05a326 (patch) | |
tree | 6943a3b888034ee6e21ed6c8447c2cc1ede6824b /chrome/browser/plugin_carbon_interpose_mac.cc | |
parent | 66c91634736257ee272c8010e275b96cac7a4261 (diff) | |
download | chromium_src-89822a58b483a88a4ac730b3e83cd86bea05a326.zip chromium_src-89822a58b483a88a4ac730b3e83cd86bea05a326.tar.gz chromium_src-89822a58b483a88a4ac730b3e83cd86bea05a326.tar.bz2 |
Switch from plugin to browser process only when all windows close (Mac)
Whenever a plugin-opened window is closed, check for other visible windows and only reactive the browser process if there aren't any.
BUG=23566
TEST=Press command-shift-G on a plugin-opened open dialog, then dismiss the sheet. The open dialog should stay visible and active.
Review URL: http://codereview.chromium.org/328013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29957 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugin_carbon_interpose_mac.cc')
-rw-r--r-- | chrome/browser/plugin_carbon_interpose_mac.cc | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/chrome/browser/plugin_carbon_interpose_mac.cc b/chrome/browser/plugin_carbon_interpose_mac.cc index 99d2e0f..a7beff7 100644 --- a/chrome/browser/plugin_carbon_interpose_mac.cc +++ b/chrome/browser/plugin_carbon_interpose_mac.cc @@ -33,9 +33,6 @@ static void SwitchToPluginProcess() { if (SameProcess(&this_process, &front_process, &matched) != noErr) return; if (!matched) { - // TODO: We may need to keep a stack, or at least check the total window - // count, since this won't work if a plugin opens more than one window at - // a time. g_saved_front_process = front_process; SetFrontProcess(&this_process); } @@ -60,6 +57,24 @@ static void SwitchToSavedProcess() { } } +// Checks to see if there are any plugin-opened windows still showing, and if +// not reactivates the saved process. +// Should be called after any window has been closed. +static void MaybeReactivateSavedProcess() { + bool window_is_visible = false; + WindowRef window = GetWindowList(); + while (window != NULL) { + if (IsWindowVisible(window)) { + window_is_visible = true; + break; + } + window = GetNextWindow(window); + } + + if (!window_is_visible) + SwitchToSavedProcess(); +} + #pragma mark - static Boolean ChromePluginIsWindowHilited(WindowRef window) { @@ -96,14 +111,14 @@ static void ChromePluginShowWindow(WindowRef window) { } static void ChromePluginDisposeWindow(WindowRef window) { - SwitchToSavedProcess(); + MaybeReactivateSavedProcess(); webkit_glue::NotifyBrowserOfPluginDisposeWindow(HIWindowGetCGWindowID(window), CGRectForWindow(window)); DisposeWindow(window); } static void ChromePluginHideWindow(WindowRef window) { - SwitchToSavedProcess(); + MaybeReactivateSavedProcess(); webkit_glue::NotifyBrowserOfPluginHideWindow(HIWindowGetCGWindowID(window), CGRectForWindow(window)); HideWindow(window); |